Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/sparc64] internal-error printing return value (Ada array) - take 2
@ 2006-12-24  9:35 Joel Brobecker
  2006-12-24 14:58 ` Mark Kettenis
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2006-12-24  9:35 UTC (permalink / raw)
  To: mark.kettenis; +Cc: gdb-patches

[-- 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.  */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA/sparc64] internal-error printing return value (Ada array) - take 2
  2006-12-24  9:35 [RFA/sparc64] internal-error printing return value (Ada array) - take 2 Joel Brobecker
@ 2006-12-24 14:58 ` Mark Kettenis
  2006-12-26  5:12   ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2006-12-24 14:58 UTC (permalink / raw)
  To: brobecker; +Cc: mark.kettenis, gdb-patches

> Date: Sun, 24 Dec 2006 13:36:15 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> 
> 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?

Could you change the comment from

/* Small arrays are returned the same way as small records.  */

into

/* Small arrays are returned the same way as small structures.  */

?

With that change this is ok.

However, did you check how small arrays of floating-point numbers are returned?
I suspect there might be an issue with those.

Mark


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA/sparc64] internal-error printing return value (Ada array) - take 2
  2006-12-24 14:58 ` Mark Kettenis
@ 2006-12-26  5:12   ` Joel Brobecker
  2006-12-26 13:44     ` Mark Kettenis
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2006-12-26  5:12 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: mark.kettenis, gdb-patches

> > 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?

> With that change this is ok.

Thanks Mark, I made the change you asked, and committed the change.

> However, did you check how small arrays of floating-point numbers are
> returned?  I suspect there might be an issue with those.

I just double-checked, and it seems to be working just fine. 
What I will do is extend our array-return testcase to include
this type of array too.

Thank you,
-- 
Joel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA/sparc64] internal-error printing return value (Ada array) - take 2
  2006-12-26  5:12   ` Joel Brobecker
@ 2006-12-26 13:44     ` Mark Kettenis
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Kettenis @ 2006-12-26 13:44 UTC (permalink / raw)
  To: brobecker; +Cc: gdb-patches

> Date: Tue, 26 Dec 2006 09:13:03 +0400
> From: Joel Brobecker <brobecker@adacore.com>

> > However, did you check how small arrays of floating-point numbers are
> > returned?  I suspect there might be an issue with those.
> 
> I just double-checked, and it seems to be working just fine. 
> What I will do is extend our array-return testcase to include
> this type of array too.

Good!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-26 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-24  9:35 [RFA/sparc64] internal-error printing return value (Ada array) - take 2 Joel Brobecker
2006-12-24 14:58 ` Mark Kettenis
2006-12-26  5:12   ` Joel Brobecker
2006-12-26 13:44     ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox