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


> Date: Sun, 18 Apr 2004 20:38:38 +0200 (CEST)
> From: Mark Kettenis <kettenis@chello.nl>
> 
> +  /* 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:

> +  /* 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?

> +  /* NOTE: kettenis/20040418: GCC does have two possible register
> +     numbering schemes on the i386: dbx and SVR4.  These schemes
> +     differ in how they number %ebp, %esp, %eflags, and the
> +     floating-point registers, and are implemented by the attays
                                                             ^^^^^^
A typo.

> +     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])

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/].

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).

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.


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