This is the mail archive of the gdb@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]

Re: i386 register numbering


Eli Zaretskii <eliz@delorie.com> 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


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