Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@cygnus.com>
To: Matt Hiller <hiller@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch] Translation of mn10300 debugging symbols to gdb's internalregister numbering scheme
Date: Tue, 27 Feb 2001 14:45:00 -0000	[thread overview]
Message-ID: <3A9C2B51.BFC22FD@cygnus.com> (raw)
In-Reply-To: <Pine.LNX.4.21.0102271323490.9144-100000@breve.cygnus.com>

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)


       reply	other threads:[~2001-02-27 14:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.21.0102271323490.9144-100000@breve.cygnus.com>
2001-02-27 14:45 ` Michael Snyder [this message]
2001-02-27 16:03   ` Matt Hiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A9C2B51.BFC22FD@cygnus.com \
    --to=msnyder@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=hiller@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox