Re: [RFC] breakpoints and function prologues...

Michael Snyder
2002-08-01T22:44:26Z

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.