I want to set a condition on a gdb breakpoint to only break if a certain function name appears in the backtrace. What's the best way to do this?
I am not sure how to do exactly what you ask for, but a possible workaround, if you have access to the source code of the relevant function, is to set some global boolean variable to true
in the beginning of the function, and set it to false
just before the function exits. Then you could set a conditional breakpoint (using the condition
command) to stop only when this boolean variable is true
.