This is the mail archive of the gdb-patches@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]
Other format: [Raw text]

Re: [PATCH] Proper _to_regnum for DWARF on Cygwin


On Mon, 19 Apr 2004, Eli Zaretskii wrote:

> On Sun, 18 Apr 2004 20:38:38 +0200 (CEST) Mark Kettenis wrote:
>
>> +  /* We typically use DWARF-in-COFF with the dbx register numbering.  */
>> +  set_gdbarch_dwarf_reg_to_regnum (gdbarch, i386_dbx_reg_to_regnum);
>> +  set_gdbarch_dwarf2_reg_to_regnum (gdbarch, i386_dbx_reg_to_regnum);
>
> Mark, doesn't this code above from i386_coff_init_abi contradict the
> code further down (and the register mapping used by GCC), viz:

It does contradict the code further down by design, but not the proposed
DWARF register numbering for Cygwin, which is currently the only target to
call this function.  When this patch was written, it was assumed based on
the vanilla FSF GCC sources, that DJGPP would need the same functionality.
Thus the generic function name, but now we know better.

I'm seriously considering reverting that change.  I believe my original
gut feeling was correct before Jim Blandy convinced me otherwise.
Comments before I post the patch to do so?

> > +  /* Use the SVR4 register numbering scheme for DWARF and DWARF 2.  */
> > +  set_gdbarch_dwarf_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
> > +  set_gdbarch_dwarf2_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
>
> ?  For DJGPP, at least, DWARF2-in-COFF uses i386_svr4_reg_to_regnum
> register mapping, not i386_dbx_reg_to_regnum.  Am I missing something
> here?

Nope, we were missing the DJGPP specific GCC patch you listed below.
Don't worry, nothing has been broken regardless.

[snip typo comment]
> > +     Currently, each GCC i386 target always uses the same register
> > +     numbering scheme across all its supported debugging formats
> > +     i.e. SDB (COFF), stabs and DWARF 2.  This is because
> > +     gcc/sdbout.c, gcc/dbxout.c and gcc/dwarf2out.c all use the
> > +     DBX_REGISTER_NUMBER macro which is defined by each target's
> > +     respective config header in a manner independent of the requested
> > +     output debugging format.
>
> As the following fragment (already posted here yesterday) from
> gcc/config/i386/djgpp.h shows, both of these assertions are not true
> for the DJGPP target:
>
>     #undef DBX_REGISTER_NUMBER
>     #define DBX_REGISTER_NUMBER(n) \
>       ((write_symbols == DWARF2_DEBUG) ? svr4_dbx_register_map[n] : dbx_register_map[n])

But we had no way of knowing that ;-).

> Also, in this old message:
>
>     http://sources.redhat.com/ml/gdb/2001-07/msg00398.html
>
> you pointed out to me that:
>
>     Several GCC targets redefine DBX_REGISTER_NUMBER, see for example
>     linux.h in that same directory [gcc/config/i386/].

Yes, but they all follow:

> > +     DBX_REGISTER_NUMBER macro which is defined by each target's
> > +     respective config header in a manner independent of the requested
> > +     output debugging format.
>
> So gcc/*out.c files are clearly not the whole story here (unless
> things have changed in GCC since then; I cannot check this easily
> where I'm typing this).

True.  They are not the *whole* story, but it was assumed that examining
all those config files mentioned above was the *relevant* part of the
story.

> The upshot of all this is that either (a) I'm still confused by the
> issues involved, or (b) the comments and, possibly, the code need to
> be amended to clarify/fix that.

a, the comment part of b, and I'm now convinced the code part of b should
be reverted for Cygwin.  I'll post a patch soon.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444


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