From: Brian Ford <ford@vss.fsi.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] i386_stab_reg_to_regnum (4 <-> 5, ebp <-> esp)
Date: Thu, 01 Apr 2004 00:11:00 -0000 [thread overview]
Message-ID: <Pine.GSO.4.58.0403311727300.21204@thing1-200> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2195 bytes --]
I noticed this while tracking down another problem with adding DWARF2
support to Cygwin. (Jim Blandy knows which one. Thanks again Jim :^),
and this is not necessarily related to that.)
In gcc/config/i386/i386.c, we have:
/* The "default" register map used in 32bit mode. */
int const dbx_register_map[FIRST_PSEUDO_REGISTER] =
{
0, 2, 1, 3, 6, 7, 4, 5, /* general regs */
12, 13, 14, 15, 16, 17, 18, 19, /* fp regs */
-1, -1, -1, -1, -1, /* arg, flags, fpsr, dir, frame */
21, 22, 23, 24, 25, 26, 27, 28, /* SSE */
29, 30, 31, 32, 33, 34, 35, 36, /* MMX */
-1, -1, -1, -1, -1, -1, -1, -1, /* extended integer registers */
-1, -1, -1, -1, -1, -1, -1, -1, /* extended SSE registers */
};
and:
/* Define the register numbers to be used in Dwarf debugging information. */
int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER] =
{
0, 2, 1, 3, 6, 7, 5, 4, /* general regs */
11, 12, 13, 14, 15, 16, 17, 18, /* fp regs */
-1, 9, -1, -1, -1, /* arg, flags, fpsr, dir, frame */
21, 22, 23, 24, 25, 26, 27, 28, /* SSE registers */
29, 30, 31, 32, 33, 34, 35, 36, /* MMX registers */
-1, -1, -1, -1, -1, -1, -1, -1, /* extended integer registers */
-1, -1, -1, -1, -1, -1, -1, -1, /* extended SSE registers */
};
Notice that gcc regno 6 (ebp) and 7 (esp) map to regno 4 and 5
respectively in the "default" (aka dbx, stabs, sdb) table. But, in
the svr4 (aka dwarf, dwarf2, stabs-in-elf) table, they map to regno 5 and
4 respectively.
I'm not sure if/how this should affect i386_register_names. I also hope
that targets have not already coded around this bug so that fixing it will
break something else :-). Please do have a look at these issues before
applying the patch. I'm afraid they are over my head right now.
Thanks.
2004-03-31 Brian Ford <ford@vss.fsi.com>
* i386-tdep.c (i386_stab_reg_to_regnum): Reverse 4 and 5
(ebp and esp respectively) to match the gdb/DWARF regnums.
--
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax: 314-551-8444
[-- Attachment #2: Type: TEXT/PLAIN, Size: 721 bytes --]
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.181
diff -u -p -r1.181 i386-tdep.c
--- i386-tdep.c 23 Mar 2004 14:47:56 -0000 1.181
+++ i386-tdep.c 31 Mar 2004 23:25:52 -0000
@@ -175,8 +175,10 @@ i386_stab_reg_to_regnum (int reg)
/* This implements what GCC calls the "default" register map. */
if (reg >= 0 && reg <= 7)
{
- /* General-purpose registers. */
- return reg;
+ /* General-purpose registers.
+ ebp and esp (4, 5) are reversed with respect to gdb and DWARF. */
+
+ return (reg & 6) == 4 ? reg ^ 1 : reg;
}
else if (reg >= 12 && reg <= 19)
{
next reply other threads:[~2004-04-01 0:11 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-01 0:11 Brian Ford [this message]
2004-04-01 17:22 ` Jim Blandy
2004-04-01 18:00 ` Brian Ford
2004-04-01 21:29 ` Jim Blandy
2004-04-01 22:54 ` Brian Ford
2004-04-02 7:45 ` Eli Zaretskii
[not found] ` <Pine dot GSO dot 4 dot 58 dot 0404021000390 dot 21204 at thing1-200>
[not found] ` <2719-Fri02Apr2004213907+0300-eliz at gnu dot org>
[not found] ` <Pine dot GSO dot 4 dot 58 dot 0404021648050 dot 21204 at thing1-200>
2004-04-02 17:31 ` Brian Ford
2004-04-02 19:42 ` Eli Zaretskii
2004-04-02 23:15 ` Brian Ford
2004-04-03 9:08 ` Eli Zaretskii
2004-04-05 18:18 ` Jim Blandy
2004-04-05 21:57 ` Brian Ford
2004-04-18 16:33 ` Eli Zaretskii
2004-04-05 18:21 ` Jim Blandy
2004-04-05 22:46 ` Brian Ford
2004-04-18 17:00 ` Eli Zaretskii
2004-04-05 22:46 ` Jim Blandy
2004-04-05 23:19 ` Brian Ford
2004-04-05 23:38 ` Jim Blandy
2004-04-06 14:53 ` Brian Ford
2004-04-15 9:38 ` Eli Zaretskii
2004-04-06 23:24 ` Mark Kettenis
2004-04-07 16:25 ` Brian Ford
2004-04-07 18:02 ` Jim Blandy
2004-04-07 20:06 ` [PATCH] Rename i386_xxx_reg_to_regnum Brian Ford
2004-04-07 20:48 ` Jim Blandy
2004-04-07 21:06 ` Brian Ford
2004-04-07 21:41 ` Jim Blandy
2004-04-09 12:37 ` Mark Kettenis
2004-04-09 17:49 ` Brian Ford
2004-04-06 23:23 ` [PATCH] i386_stab_reg_to_regnum (4 <-> 5, ebp <-> esp) Mark Kettenis
2004-04-07 16:46 ` Jim Blandy
2004-04-18 16:48 ` Eli Zaretskii
2004-04-19 2:06 ` ix86 PE/COFF DWARF register numbering (was Re: [PATCH] i386_stab_reg_to_regnum (4 <-> 5, ebp <-> esp)) Brian Ford
2004-04-19 5:59 ` Eli Zaretskii
2004-04-19 16:34 ` ix86 PE/COFF DWARF register numbering Brian Ford
2004-04-19 12:42 ` [PATCH] i386_stab_reg_to_regnum (4 <-> 5, ebp <-> esp) Jim Blandy
2004-04-19 7:02 ` Eli Zaretskii
2004-04-02 19:33 ` Eli Zaretskii
2004-04-02 22:47 ` Brian Ford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.4.58.0403311727300.21204@thing1-200 \
--to=ford@vss.fsi.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox