Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: mark.kettenis@xs4all.nl
Cc: gdb-patches@sourceware.org
Subject: [RFA/sparc64] internal-error printing return value (Ada array) - take 2
Date: Sun, 24 Dec 2006 09:35:00 -0000	[thread overview]
Message-ID: <20061224093615.GH19684@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 490 bytes --]

Hello Mark,

Following our disccussion that started at:

    http://www.sourceware.org/ml/gdb-patches/2006-11/msg00076.html

I finally found the time to make the change you suggested, and then
test it again.

2006-12-24  Joel Brobecker  <brobecker@adacore.com>

        * sparc64-tdep.c (sparc64_extract_return_value): Add handling
        for array types.
        (sparc64_store_return_value): Likewise.

Tested on sparc64-sun-solaris2.8, no regression. OK to commit?

Thank you,
-- 
Joel

[-- Attachment #2: sparc64.diff --]
[-- Type: text/plain, Size: 1440 bytes --]

Index: sparc64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-tdep.c,v
retrieving revision 1.27
diff -u -p -r1.27 sparc64-tdep.c
--- sparc64-tdep.c	22 Aug 2006 20:57:56 -0000	1.27
+++ sparc64-tdep.c	24 Dec 2006 08:42:30 -0000
@@ -1086,6 +1086,15 @@ sparc64_extract_return_value (struct typ
 	regcache_cooked_read (regcache, SPARC_F0_REGNUM + i, buf + i * 4);
       memcpy (valbuf, buf, len);
     }
+  else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+    {
+      /* Small arrays are returned the same way as small records.  */
+      gdb_assert (len <= 32);
+
+      for (i = 0; i < ((len + 7) / 8); i++)
+	regcache_cooked_read (regcache, SPARC_O0_REGNUM + i, buf + i * 8);
+      memcpy (valbuf, buf, len);
+    }
   else
     {
       /* Integral and pointer return values.  */
@@ -1131,6 +1140,16 @@ sparc64_store_return_value (struct type 
       for (i = 0; i < len / 4; i++)
 	regcache_cooked_write (regcache, SPARC_F0_REGNUM + i, buf + i * 4);
     }
+  else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+    {
+      /* Small arrays are returned the same way as small records.  */
+      gdb_assert (len <= 32);
+
+      memset (buf, 0, sizeof (buf));
+      memcpy (buf, valbuf, len);
+      for (i = 0; i < ((len + 7) / 8); i++)
+	regcache_cooked_write (regcache, SPARC_O0_REGNUM + i, buf + i * 8);
+    }
   else
     {
       /* Integral and pointer return values.  */

             reply	other threads:[~2006-12-24  9:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-24  9:35 Joel Brobecker [this message]
2006-12-24 14:58 ` Mark Kettenis
2006-12-26  5:12   ` Joel Brobecker
2006-12-26 13:44     ` Mark Kettenis

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=20061224093615.GH19684@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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