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)
- From: Mark Kettenis <kettenis at chello dot nl>
- To: jimb at redhat dot com
- Cc: ford at vss dot fsi dot com, eliz at gnu dot org, gdb-patches at sources dot redhat dot com
- Date: Wed, 7 Apr 2004 01:22:52 +0200 (CEST)
- Subject: Re: [PATCH] i386_stab_reg_to_regnum (4 <-> 5, ebp <-> esp)
- References: <8011-Fri02Apr2004094123+0300-eliz@gnu.org><Pine dot GSO dot 4 dot 58 dot 0404021000390 dot 21204 at thing1-200><2719-Fri02Apr2004213907+0300-eliz at gnu dot org><Pine dot GSO dot 4 dot 58 dot 0404021648050 dot 21204 at thing1-200> <vt2ptam2gg1.fsf@zenia.home>
From: Jim Blandy <jimb@redhat.com>
Date: 05 Apr 2004 17:44:14 -0500
I'm getting a bit lost, so let me try to sum up the discussion, for my
own sake. There are two distinct questions at hand:
- Should GDB's i386_stab_reg_to_regnum be changed?
For the first question: I think your original patch is correct.
Yup. I agree. I wonder whether I introduced the bug or that it has
always been wrong...
The bit-twiddling is correct, but I'd rather see something more
direct, like:
Index: gdb/i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.182
diff -c -c -F'^(' -r1.182 i386-tdep.c
*** gdb/i386-tdep.c 1 Apr 2004 18:14:03 -0000 1.182
--- gdb/i386-tdep.c 5 Apr 2004 22:15:01 -0000
***************
*** 211,218 ****
/* This implements what GCC calls the "default" register map. */
if (reg >= 0 && reg <= 7)
{
! /* General-purpose registers. */
! return reg;
}
else if (reg >= 12 && reg <= 19)
{
--- 211,223 ----
/* This implements what GCC calls the "default" register map. */
if (reg >= 0 && reg <= 7)
{
! /* General-purpose registers. The debug info calls %ebp
! register 4, and %esp register 5. */
! if (reg == 4)
! return 5;
! else if (reg == 5)
! return 4;
! else return reg;
}
else if (reg >= 12 && reg <= 19)
{
Jim, please apply this patch, with the proper ChangeLog of course.
Mark