在GDB中,当程序停止时,如何自动执行命令? (如显示) [英] In GDB, how do I execute a command automatically when program stops? (like display)

查看:389
本文介绍了在GDB中,当程序停止时,如何自动执行命令? (如显示)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要每次程序停止时自动执行一些命令,就像显示与x一样。

I want some commands to be automatically executed each time the program stops, just like what display does with x. How do I do that?

推荐答案

这是我发现的简单方法:

Here's the easy way I found out:

define hook-stop
  ...commands to be executed when execution stops
end

有关详情,请参阅此页: http://sourceware.org/gdb/current/onlinedocs/gdb/Hooks.html#Hooks

Refer to this page for details: http://sourceware.org/gdb/current/onlinedocs/gdb/Hooks.html#Hooks

这篇关于在GDB中,当程序停止时,如何自动执行命令? (如显示)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆