* Re: [patch] Translation of mn10300 debugging symbols to gdb's internalregister numbering scheme [not found] <Pine.LNX.4.21.0102271323490.9144-100000@breve.cygnus.com> @ 2001-02-27 14:45 ` Michael Snyder 2001-02-27 16:03 ` Matt Hiller 0 siblings, 1 reply; 2+ messages in thread From: Michael Snyder @ 2001-02-27 14:45 UTC (permalink / raw) To: Matt Hiller; +Cc: gdb-patches Matt Hiller wrote: > > At http://gcc.gnu.org/ml/gcc-patches/2001-02/msg01491.html , Alex > Oliva describes an inconsistency in the register numbering for mn10300 > between gcc and the other tools. Matushita has developed debugging tools > based on the numbering gcc uses, so we are obliged to alter the behavior > of gdb instead. The following patch has gdb translate debugging register > numbers to gdb REGNUMs. > > I do not have write access to this repository; my patch, if > acceptable, will have to be committed by someone else. Matt, I think you have found the right approach, but not quite the right implementation. The DWARF_REG_TO_REGNUM macro has been multi-arched. That means that instead of defining it as a macro, you should implement it as a function in mn10300-tdep.c, and then set the appropriate gdbarch function vector to point to your function. While you are at it, I would recommend you go ahead and use the same function for dwarf2_reg_to_regnum. Might as well cover all bases. Thanks, Michael > > -- > > Matt Hiller > GCC Engineer, Red Hat, Inc., Sunnyvale office > hiller@redhat.com > > 2001-02-27 Matt Hiller <hiller@redhat.com> > > * config/mn10300/tm-mn10300.h (DWARF_REG_TO_REGNUM): New macro. > (STAB_REG_TO_REGNUM): New macro. > > Index: config/mn10300/tm-mn10300.h > =================================================================== > RCS file: /cvs/src/src/gdb/config/mn10300/tm-mn10300.h,v > retrieving revision 1.4 > diff -u -p -r1.4 tm-mn10300.h > --- config/mn10300/tm-mn10300.h 2000/08/12 03:28:42 1.4 > +++ config/mn10300/tm-mn10300.h 2001/02/27 21:33:46 > @@ -167,3 +167,15 @@ extern use_struct_convention_fn mn10300_ > extern void mn10300_virtual_frame_pointer (CORE_ADDR, long *, long *); > #define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \ > mn10300_virtual_frame_pointer ((PC), (REGP), (OFFP)) > + > +/* Convert a DWARF register number to a gdb REGNUM. */ > +#define DWARF_REG_TO_REGNUM(num) \ > + (((num) <= 7) ? (num) \ > + : (num == 8) ? (-1) /* ap, which won't appear in debugging info. */ \ > + : (num == 9) ? (SP_REGNUM) \ > + : (10 <= num && num <= 17) ? ((num - 10) + E0_REGNUM) \ > + : (-1)) /* program counter, etc., none of which appear in debugging > + info. */ > + > +/* Convert a STAB register number to a gdb REGNUM. */ > +#define STAB_REG_TO_REGNUM(num) DWARF_REG_TO_REGNUM (num) ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Translation of mn10300 debugging symbols to gdb's internalregister numbering scheme 2001-02-27 14:45 ` [patch] Translation of mn10300 debugging symbols to gdb's internalregister numbering scheme Michael Snyder @ 2001-02-27 16:03 ` Matt Hiller 0 siblings, 0 replies; 2+ messages in thread From: Matt Hiller @ 2001-02-27 16:03 UTC (permalink / raw) To: Michael Snyder; +Cc: gdb-patches On Tue, 27 Feb 2001, Michael Snyder wrote: > > Matt, > > I think you have found the right approach, but not quite the right > implementation. The DWARF_REG_TO_REGNUM macro has been multi-arched. > That means that instead of defining it as a macro, you should implement > it as a function in mn10300-tdep.c, and then set the appropriate > gdbarch function vector to point to your function. > > While you are at it, I would recommend you go ahead and use the > same function for dwarf2_reg_to_regnum. Might as well cover > all bases. Okay. Another draft follows: > Matt Hiller wrote: > > > > At http://gcc.gnu.org/ml/gcc-patches/2001-02/msg01491.html , Alex > > Oliva describes an inconsistency in the register numbering for mn10300 > > between gcc and the other tools. Matushita has developed debugging tools > > based on the numbering gcc uses, so we are obliged to alter the behavior > > of gdb instead. The following patch has gdb translate debugging register > > numbers to gdb REGNUMs. > > > > I do not have write access to this repository; my patch, if > > acceptable, will have to be committed by someone else. 2001-02-27 Matt Hiller <hiller@redhat.com> * mn10300-tdep.c (mn10300_stab_reg_to_regnum): New function. (mn10300_gdbarch_init): Set appropriate elements of gdbarch to mn10300_stab_reg_to_regnum. Index: mn10300-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mn10300-tdep.c,v retrieving revision 1.6 diff -u -p -r1.6 mn10300-tdep.c --- mn10300-tdep.c 2001/02/08 06:03:53 1.6 +++ mn10300-tdep.c 2001/02/28 00:01:35 @@ -939,6 +939,25 @@ mn10300_dump_tdep (struct gdbarch *curre tdep->am33_mode); } +/* Convert a dbx stab register number to a gdb REGNUM. Also fine for + dwarf and dwarf2. */ + +static int +mn10300_stab_reg_to_regnum (int num) +{ + if (num <= 7) + return num; + else if (num == 8) + return -1; /* ap, which won't appear in debugging info. */ + else if (num == 9) + return SP_REGNUM; + else if (10 <= num && num <= 17) + return (num - 10) + E0_REGNUM; + else + return -1; /* program counter, etc., none of which appear in debugging + info. */ +} + static struct gdbarch * mn10300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -999,6 +1018,9 @@ mn10300_gdbarch_init (struct gdbarch_inf set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); set_gdbarch_num_regs (gdbarch, num_regs); set_gdbarch_do_registers_info (gdbarch, mn10300_do_registers_info); + set_gdbarch_stab_reg_to_regnum (gdbarch, mn10300_stab_reg_to_regnum); + set_gdbarch_dwarf_reg_to_regnum (gdbarch, mn10300_stab_reg_to_regnum); + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_stab_reg_to_regnum); tdep->am33_mode = am33_mode; ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-02-27 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <Pine.LNX.4.21.0102271323490.9144-100000@breve.cygnus.com>
2001-02-27 14:45 ` [patch] Translation of mn10300 debugging symbols to gdb's internalregister numbering scheme Michael Snyder
2001-02-27 16:03 ` Matt Hiller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox