【发布时间】:2019-06-26 21:51:46
【问题描述】:
在 gdb 中调试一个简单的程序时,我想在遇到断点后自动继续执行。据我所知,有两种方法可以实现:
1) 使用hook-stop。
define hook-stop
continue
end
但似乎hook-stop 只被触发一次。下次遇到另一个断点时,执行仍然停止。
2) 使用gdb.events.stop.connect()。
def handle_stop_event(event):
if isinstance(event, gdb.BreakpointEvent):
gdb.execute('continue')
gdb.events.stop.connect(handle_stop_event)
这种方法效果很好。但是如果命中的断点太多,就会出现错误"Fatal Python error: Cannot recover from stack overflow."。
似乎是因为递归调用。我想知道为什么gdb.execute('continue') 会导致这个问题。
我在网上搜索了仍然没有找到解决方案。
PS:Ubuntu 16.04 上的 gdb 版本 7.11.1
任何建议将不胜感激!提前致谢。
【问题讨论】:
标签: gdb