public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* stack specific breakpoint
@ 2015-02-23  5:15 kamaraju kusumanchi
  2015-02-23  5:44 ` Doug Evans
  0 siblings, 1 reply; 4+ messages in thread
From: kamaraju kusumanchi @ 2015-02-23  5:15 UTC (permalink / raw)
  To: gdb

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

funcB()
{
    ....
    funcA( funcD(), funcE())
    ....
}

funcC()
{
    ....
    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?

thanks
raju
-- 
Kamaraju S Kusumanchi
http://malayamaarutham.blogspot.com/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-27  2:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-23  5:15 stack specific breakpoint kamaraju kusumanchi
2015-02-23  5:44 ` Doug Evans
2015-02-24  6:08   ` kamaraju kusumanchi
2015-02-27 18:38     ` kamaraju kusumanchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).