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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
truein the beginning of the function, and set it tofalsejust before the function exits. Then you could set a conditional breakpoint (using theconditioncommand) to stop only when this boolean variable istrue.