This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: gcc HEAD bad stabs (?)
On Fri, Sep 12, 2003 at 04:11:15AM -0400, Michael Elizabeth Chastain wrote:
> I think gcc HEAD is emitting bad stabs again,
> and need some confirmation before I can file a bug report.
>
> The questionable stabs happen when 'main' calls 'factorial',
> but there is no prototype for 'factorial' yet. Here are all
> the stabs after the boilerplate stabs. The full source code
> and assembly code are at the end of the message.
>
> # some stabs for factorial
> .stabs "factorial:F(0,3)",36,0,13,factorial
> .stabs "value:p(0,3)",160,0,12,8
> .stabs "value:r(0,3)",64,0,12,3
> .stabs "",36,0,0,.Lscope0-factorial
> # some stabs for main
> .stabs "main:F(0,3)",36,0,6,main
> .stabs "argc:p(0,3)",160,0,5,8
> .stabs "argv:p(0,21)=*(3,36)",160,0,5,12
> .stabs "envp:p(0,21)",160,0,5,16
> .stabs "/usr/include/stdlib.h",132,0,0,.Ltext1
> .stabs "z0.c",132,0,0,.Ltext2
> # stray stab for factorial!!
> .stabs "factorial:F(0,3)",36,0,13,factorial
> # end of main
> .stabs "",36,0,0,.Lscope1-main
> .stabs "",100,0,0,.Letext
>
> Look at that stray stab for factorial, which occurs just
> before the stab for .Lscope1-main!
>
> This causes a subtle problem in gdb. gdb gets a bogus endaddr
> for the block with main in it, so find_function_start_sal fails
> to adjust for the prologue properly, so the breakpoint at the
> beginning of an instruction happens too early. The bad block
> probably causes more problems, too.
I agree that this is a bug. Factorial is not inside of main, so stabs
with its address shouldn't be either.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer