This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] i386_stab_reg_to_regnum (4 <-> 5, ebp <-> esp)


Eli, here is a program you can use to see whether DJGPP's GCC and
the current GDB disagree on how to number %ebp and %esp.

One of the reasons people would tend not to notice if %ebp and %esp
are misnumbered in STABS is that they almost never occur.  Dwarf 2
emits explicit location expressions to specify the "frame base" for a
function; these expressions usually refer to %esp or %ebp.  In STABS,
however, stack-based variables are simply marked as "LSYMS" or
"PSYMS", whose locations are given as offsets relative to some
implicit base that the debugger just has to know.

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.

Attachment: frameless.c
Description: test program to get a variable in %ebp


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]