This is the mail archive of the
mailing list for the GDB project.
Re: breakpoint commands and finish
On Thu, Apr 17, 2003 at 01:42:58PM -0700, Doug Evans wrote:
> 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").
The macro facility isn't, but a command could be added to do this
without much trouble. I would rather us discuss the semantics of
commands lists containing commands which resume the inferior. There
must be a more user-useful way to approach it than we do now.
MontaVista Software Debian GNU/Linux Developer