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)
On Fri, 2 Apr 2004, Eli Zaretskii wrote:
> > Some time ago I did find a problem in register numbering, and IIRC it
> > was fixed, although I don't recall the details and don't see anything
> > in the logs.
>
> Found it. See the thread started by this message:
>
> http://sources.redhat.com/ml/gdb/2001-07/msg00392.html
>
Thanks. Things sure have changed since then, haven't they ;-).
Some comments:
> (Btw, I don't see any COFF_REG_TO_REGNUM.)
>
Now that is set_gdbarch_sdb_reg_to_regnum, and it uses
i386_stab_reg_to_regnum.
Mark Kettenis wrote:
> With the patch that I just checked in, COFF and stabs should do the
> right thing for DJGPP.
>
Um..., except the ebp <-> esp thing.
> DWARF2 will probably still give you the wrong
> register.
>
Yup. I don't see that you fixed that.
> You might want to consider changing GCC such that it uses
> the standard Dwarf renumbering for DWARF2. I don't think it really
> matters since there aren't any native tools that you need to be
> compatible with. On the other hand, using DWARF2 with a numbering
> scheme that nobody else uses, might trigger some bugs.
>
Precisely my reasoning (what do ya think, Jim?).
> If you don't change GCC you should probably override
> DWARF2_REG_TO_REGNO in config/i386/tm-go32.h.
>
You would now do that by calling set_gdbarch_dwarf2_reg_to_regnum in
i386_go32_init_abi with i386_stab_reg_to_regnum as the argument.
Andrew Cagney wrote:
> Yep.
>
> They map a stab/dwarf/... reg onto a cooked regnum (not to be confused
> with a raw reg found in the register cache). Because the i386
> implements its registers using the old PSUEDO / CONVERT stuff, the
> importance of differentiating between the two may not be obvious.
>
Wish I knew how all this cooked regnum stuff worked. That's why I can't
figure out a testcase for you. If it's internally cooked wrong, but
straightened out by the back end, how do you tell?
> There is something here I don't get either.
>
> At present it is assumed that, for a given ISA/ABI, there is only one
> mapping from a DEBUG reg to a REGNUM. I take it, Mark, that you're
> saying that in reality, the mapping depends on all of:
>
> (compiler, object format, debug format, ISA/ABI) (debug reg) -> REGNUM
>
> True? Ulgh!
>
True, and I think all the hooks are there to accomodate this. They just
aren't all fully used/consistent yet.
--
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax: 314-551-8444