7

Im debugging quite a complex program with lots of queues, each having a relatively short timeout period set. I cannot debug reliable in gdb's 'manual' command line mode, because timeouts are triggered when I type commands to slowly.

I don't like the idea of extending all the queue's timeouts, as this would make things really messy. (This sounds like the design itself is arguable, I know...)

I'd really like to use the gdb 'scripting' feature, but I haven't found a good tutorial for this.

Could anyone tell me if this is possible in a gdb "command file" script:

  • init some things (easy)
  • set a breakpoint
  • run programm
  • have the next command in script executed once the breakpoint is hit

So basically my question is: can I wait for a breakpoint inside a gdb command file script?

1 Answer 1

9

Answering my own question: I had success using hooks. My command 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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.