This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] i386_stab_reg_to_regnum (4 <-> 5, ebp <-> esp)
> Date: Mon, 5 Apr 2004 16:57:46 -0500 (CDT)
> From: Brian Ford <ford@vss.fsi.com>
>
> > So the only way to get those register numbers to appear at all is to
> > get a variable allocated to them. You'll never get a variable
> > allocated to %esp. And you'll never get a varable allocated to %ebp
> > unless you compile with -fomit-frame-pointer. So, if I compile the
> > attached program with GCC 3.3 passing -O -fomit-frame-pointer, 'n'
> > gets allocated to %ebp.
>
> FWIW, this does show the problem clearly on Cygwin.
>
> ford@fordpc ~
> $ gcc -g -O -fomit-frame-pointer frameless.c -o frameless_stab.exe
>
> ford@fordpc ~
> $ gdb frameless_stab.exe
> [...]
> (gdb) info address n
> Symbol "n" is a variable in register esp.
> (gdb) p n
> $1 = 2289692
I see a similar bug in frameless.c compiled with the DJGPP port of GCC
using -gstabs+. So indeed the bug uncovered by Brian exists in DJGPP
as well, and the patch for stabs register renumbering will fix it for
DJGPP. Thanks!