Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: SH patch 2 (was Re: [RFA] SH: Deprecate deprecated functions, use new frame interface)
Date: Wed, 24 Sep 2003 11:28:00 -0000	[thread overview]
Message-ID: <20030924112808.GI9981@cygbert.vinschen.de> (raw)
In-Reply-To: <20030924084311.GF9981@cygbert.vinschen.de>

On Wed, Sep 24, 2003 at 10:43:11AM +0200, Corinna Vinschen wrote:
> On Tue, Sep 23, 2003 at 04:26:15PM -0400, Elena Zannoni wrote:
> > I think so too. But I'd like to see if something can be done for SH
> > similar to the i386_convert_register_p method.
> 
> Is that necessary before the patch gets approval or could that be added
> in a follow up step?

I've tested the below patch and the effect is absolut zero with respect to
the store.exp results.  What am I doing wrong?  It doesn't matter if I
diable the dwarf2 sniffer or not, btw.

Corinna

--- sh-tdep.c.NEW	2003-09-24 12:24:10.000000000 +0200
+++ sh-tdep.c	2003-09-24 13:25:30.000000000 +0200
@@ -2111,6 +2111,58 @@ sh_in_function_epilogue_p (struct gdbarc
   return 0;
 }
 
+/* Return nonzero if a value of type TYPE stored in register REGNUM
+   needs any special handling.  */
+static int
+sh_convert_register_p (int regnum, struct type *type)
+{
+  if (TYPE_CODE (type) == TYPE_CODE_FLT)
+      return TYPE_LENGTH (type) > 4 && regnum < DR0_REGNUM;
+  return TYPE_LENGTH (type) > 4;
+}
+
+/* Read a value of type TYPE from register REGNUM in frame FRAME, and
+   return its contents in TO.  */
+static void
+sh_register_to_value (struct frame_info *frame, int regnum,
+		      struct type *type, void *to)
+{
+  int len = TYPE_LENGTH (type);
+  char *buf = to;
+
+  while (len > 0)
+    {
+      get_frame_register (frame, regnum++, buf);
+      if (regnum == 16)	/* Normal register overflow */
+        break;
+      if (regnum == 41)	/* FP register overflow */
+        break;
+      len -= 4;
+      buf += 4;
+    }
+}
+
+/* Write the contents FROM of a value of type TYPE into register
+   REGNUM in frame FRAME.  */
+static void
+sh_value_to_register (struct frame_info *frame, int regnum,
+		      struct type *type, const void *from)
+{
+  int len = TYPE_LENGTH (type);
+  const char *buf = from;
+
+  while (len > 0)
+    {
+      put_frame_register (frame, regnum, buf);
+      if (regnum == 16)	/* Normal register overflow */
+        break;
+      if (regnum == 41)	/* FP register overflow */
+        break;
+      len -= 4;
+      buf += 4;
+    }
+}
+
 static gdbarch_init_ftype sh_gdbarch_init;
 
 static struct gdbarch *
@@ -2213,6 +2265,10 @@ sh_gdbarch_init (struct gdbarch_info inf
   set_gdbarch_in_function_epilogue_p (gdbarch,
 				      sh_in_function_epilogue_p);
 
+  set_gdbarch_convert_register_p (gdbarch, sh_convert_register_p);
+  set_gdbarch_register_to_value (gdbarch,  sh_register_to_value);
+  set_gdbarch_value_to_register (gdbarch, sh_value_to_register);
+
   switch (info.bfd_arch_info->mach)
     {
     case bfd_mach_sh:

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.


  reply	other threads:[~2003-09-24 11:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-08 16:55 [RFA] SH: Deprecate deprecated functions, use new frame interface Corinna Vinschen
2003-09-12 17:32 ` Elena Zannoni
2003-09-15 15:53   ` SH patch 1 (was Re: [RFA] SH: Deprecate deprecated functions, use new frame interface) Corinna Vinschen
2003-09-16 15:42     ` Elena Zannoni
2003-09-16 15:57       ` Corinna Vinschen
2003-09-15 16:01   ` SH patch 2 " Corinna Vinschen
2003-09-16 17:06     ` Elena Zannoni
2003-09-16 17:26       ` Corinna Vinschen
2003-09-16 17:30         ` Daniel Jacobowitz
2003-09-16 17:58           ` Corinna Vinschen
2003-09-22 14:33           ` Corinna Vinschen
2003-09-22 14:44             ` Daniel Jacobowitz
2003-09-22 15:08               ` Corinna Vinschen
2003-09-23 20:16                 ` Elena Zannoni
2003-09-24  8:43                   ` Corinna Vinschen
2003-09-24 11:28                     ` Corinna Vinschen [this message]
2003-09-25 19:44                       ` Elena Zannoni
2003-09-26 11:32                         ` Corinna Vinschen
2003-09-24 18:12                     ` Elena Zannoni
2003-09-25  8:56                       ` Corinna Vinschen
2003-09-22 16:27               ` Andrew Cagney

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=20030924112808.GI9981@cygbert.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=gdb-patches@sources.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