This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

stack specific breakpoint

Is there a way to set a breakpoint in a function A only when it is
called from function B? In my case, I have

    funcA( funcD(), funcE())

    funcA(funcD(), funcE())

where funcA is called by both funcB and funcC. funcC is called a lot
of times (the exact number is not known either at run time or compile
time) and funcB is called only a handful of times. The additional
twist is that the arguments passed to funcA are the return values from
other functions - funcD and funcE.

I am interested in stepping into funcA only when it is called from
funcB. Is there a way to specify the function hierarchy when setting a
break point?

I tried setting a break point where funcB calls funcA and then use the
"step" command. But this steps into funcD() instead of funcA().

Currently, my work around is to first set a breakpoint where funcB
calls funcA and when the code hits that set another break point in
funcA. Once code finishes funcA, I will disable it (since it could be
called by funcC afterwards). I will reenable it when it hits the funcA
line in funcB definition. But doing this enable/disable dance is
tiresome. Is there a better way to achiever this?

If this is feature is not supported, could you please add this to the wishlist?

Kamaraju S Kusumanchi

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]