This is the mail archive of the gdb@sources.redhat.com 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]

Re: breakpoint commands and finish


Daniel Jacobowitz writes:
 > > rbreak (or ebreak).  I find I often was to place a breakpoint at the
 > > end of a function; it'd be nice if gdb could do that automaticly.
 > 
 > It's too darned hard :)  Debug info does not represent the exit point
 > of the function.  It's not always at the end; modern gcc's can emit
 > multiple exit edges, too.

And if a tail-call optimization has been done, it gets even harder.

OTOH, if one stops at the first instruction of a function,
presumably it'd then be easy to set a breakpoint at the return address.
I wonder if gdb's macro facility is sufficient to write a macro
that would make this almost user-friendly: it would set a
breakpoint at the start of the function (pre-prologue) then have
commands that first sets a tbreak breakpoint at the return address
and then continues.  You couldn't already be in the function of
course (but if you were presumably you'd use "finish").

?


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