Gdb scripting batch file: wait while a breakpoint is maintained?

Im debugging a rather complicated program with a large number of queues, each of which has a relatively short timeout period. I cannot debug reliability in gdb command line mode manually because timeouts start when I type commands slowly.

I don't like the idea of ​​extending all the timeouts in the queue, as this will make things really dirty. (It seems that the design itself is controversial, I know ...)

I would really like to use the gdb 'scripting' function, but I have not found a good tutorial for this.

Can someone tell me if this is possible in the gdb batch file? script:

  • run some things (easy)
  • set a breakpoint
  • run the program
  • has the following command in a script executed after reaching a breakpoint

So basically my question is: can I wait for breakpoints inside the gdb script batch file?

+3
source share
1 answer

Answering my own question: I had success with interceptors. My batch file looks like this:

[initialization code]

define hook-stop
[commands to be executed at breakpoint]
end

set breakpoint pending on
b my_breakpoint_function
r
+4
source

All Articles