How to redefine a gdb built-in command and call th

2019-09-02 05:54发布

I redefined a built-in command in gdb, for example "run", I want to do printing a message and then call the original "run" command to execute the real function. If I write like this:

define run
   print "running"
   run
end

The gdb will reach the max execute limitation, because it is calling recursively. How can I avoid this problem?

标签: debugging gdb
1条回答
仙女界的扛把子
2楼-- · 2019-09-02 06:14

Use gdb User-defined Command Hooks. For example this hook will print message before run command:

define hook-run
print "running"
end
查看更多
登录 后发表回答