Is there any way to set a breakpoint in gdb that is conditional on the call stack?
I am debugging C++ in gdb 7.1 on Linux. I have a function a() that is called in many places in the code. I want to set a breakpoint in it, but only if it was called from b() . Is there any way to do it? Is there any way to do it only if b() was called from c() , and so on ad infinitum? Update: There is now a better answer to this question: use GDB _is_caller convenience function. The need you describe comes up quite often, usually in the context of some_utility_fn being called a lot, but you only are interested in the call which comes from some_other_fn . You could probably script this entire