This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC] breakpoints and function prologues...
- From: Michael Snyder <msnyder at redhat dot com>
- To: Jim Blandy <jimb at redhat dot com>
- Cc: Joel Brobecker <brobecker at gnat dot com>, gdb-patches at sources dot redhat dot com
- Date: Thu, 01 Aug 2002 15:25:55 -0700
- Subject: Re: [RFC] breakpoints and function prologues...
- Organization: Red Hat, Inc.
- References: <20020722231957.GE4999@gnat.com> <npr8hu6m7e.fsf@zwingli.cygnus.com> <20020726053320.GB10000@gnat.com> <np1y9lwvv9.fsf@zwingli.cygnus.com> <20020731013453.GX13411@gnat.com> <np3ctztyjd.fsf@zwingli.cygnus.com>
Jim Blandy wrote:
>
> For as long as I can remember, GDB has treated setting a breakpoint on
> the line containing the opening curly brace of a function's block as
> meaning `set a breakpoint before the prologue'. I've always assumed
> that was deliberate behavior.
Semi. It follows from the line symbols. GCC emits a line symbol
for that line which spans the address range of the prologue. So
you could say it's deliberate -- but on GCC's part, rather than
on GDB's.
> But I can't find it documented in the GDB manual.
That's because it's not a special case. It's the same
behavior as for any line -- put the breakpoint where
the compiler says to.
> And it's a lousy
> user interface (`break *main' works just as well, and makes more sense
> to me). Maybe the behavior is just a side effect of the decision to
> attribute the prologue code to the line containing the opening curly
> brace
Exactly --
> --- if the program stops in the prologue, that's as sensible a
> place as any to claim it's at.
>
> So I'd support changing `break LINENO' to always skip the prologue.
I would not. It's changing a behavior that people have
become accustomed to.