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

2019-09-02 05:34发布

问题:

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?

回答1:

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

define hook-run
print "running"
end


标签: debugging gdb