From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: Eli Zaretskii Cc: gdb@sources.redhat.com Subject: Re: i386 register numbering Date: Sat, 28 Jul 2001 04:56:00 -0000 Message-id: References: <200107281012.GAA02314@delorie.com> X-SW-Source: 2001-07/msg00393.html Eli Zaretskii writes: > This happens because the numbering of registers used by GCC differs > from the one used by GDB, see gcc/config/i386/i386.h in the GCC > distribution. Since i386.h seems to be common for all i386 targets, > I'd expect this problem to pop up on other x86 targets as well (the > above was tested with DJGPP native debugging). > > Do others indeed see this bug? If so, what would be the best way of > fixing it? The same problem surfaces on i586-pc-linux-gnu, except that GDB thinks the variable is in %ss. That illustrates a problem: there are two register numbering schemes that are in wide use: the "default" register map (dbx_register_map), and the Dwarf register map (svr4_dbx_register_map). In GDB we have STAB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, etc. We have to provide a suitable definition for those in tm-i386.h. However, the problem mentioned above makes it a bit tricky, since GCC always uses the same register numbering scheme, regardless of the actual debugging format. Most ELF targets use the Dwarf scheme, even if the debugging format is stabs. And it seems that DJGPP uses the "default" scheme, even if you ask for Dwarf 2 debugging info. I'm working on a patch, and I'll try to provide some reasonable defaults. But most targets will have to override some of these defaults. Mark