Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa?] Fix PPC32 struct return
@ 2003-09-13 23:47 Andrew Cagney
  2003-09-16 20:29 ` Kevin Buettner
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2003-09-13 23:47 UTC (permalink / raw)
  To: Jason R Thorpe, gdb-patches

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

Jason,

This fixes a problem with GDB's struct return code vis:
	struct xxx foo () { return xxx;
for NetBSD/ppc 1.6.  Looking at the history though, It appears that 
NetBSD/ppc changed it's struct return convention between 1.5 and 1.6?

Does any OS implement the SVr4 abi correctly?

still, ok?
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1548 bytes --]

2003-09-13  Andrew Cagney  <cagney@redhat.com>

	* ppcnbsd-tdep.c (ppcnbsd_use_struct_convention): New function.
	(ppcnbsd_init_abi): Set "use_struct_convention" to
	"ppcnbsd_use_struct_convention".

Index: ppcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcnbsd-tdep.c,v
retrieving revision 1.7
diff -u -r1.7 ppcnbsd-tdep.c
--- ppcnbsd-tdep.c	5 Jan 2003 01:39:55 -0000	1.7
+++ ppcnbsd-tdep.c	13 Sep 2003 23:22:34 -0000
@@ -204,12 +204,30 @@
   return (nbsd_pc_in_sigtramp (pc, func_name));
 }
 
+/* NetBSD is confused.  It appears that 1.5 was using the correct SVr4
+   convention but, 1.6 switched to the below broken convention.  For
+   the moment use the broken convention.  Ulgh!.  */
+
+static int     
+ppcnbsd_use_struct_convention (int gcc_p, struct type *value_type)
+{  
+  if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8)
+      && TYPE_VECTOR (value_type))
+    return 0;                            
+
+  return !(TYPE_LENGTH (value_type) == 1
+	   || TYPE_LENGTH (value_type) == 2
+	   || TYPE_LENGTH (value_type) == 4
+	   || TYPE_LENGTH (value_type) == 8);
+}
+
 static void
 ppcnbsd_init_abi (struct gdbarch_info info,
                   struct gdbarch *gdbarch)
 {
   set_gdbarch_pc_in_sigtramp (gdbarch, ppcnbsd_pc_in_sigtramp);
 
+  set_gdbarch_use_struct_convention (gdbarch, ppcnbsd_use_struct_convention);
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
                                 nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
 }

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

* Re: [rfa?] Fix PPC32 struct return
  2003-09-13 23:47 [rfa?] Fix PPC32 struct return Andrew Cagney
@ 2003-09-16 20:29 ` Kevin Buettner
  2003-09-17 17:21   ` Jason Thorpe
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Buettner @ 2003-09-16 20:29 UTC (permalink / raw)
  To: Andrew Cagney, Jason R Thorpe, gdb-patches

On Sep 13,  7:45pm, Andrew Cagney wrote:

> 	* ppcnbsd-tdep.c (ppcnbsd_use_struct_convention): New function.
> 	(ppcnbsd_init_abi): Set "use_struct_convention" to
> 	"ppcnbsd_use_struct_convention".

This change is okay with me.  I want Jason to give his okay first
though before you commit it...

Kevin


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

* Re: [rfa?] Fix PPC32 struct return
  2003-09-16 20:29 ` Kevin Buettner
@ 2003-09-17 17:21   ` Jason Thorpe
  2003-09-17 18:22     ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Thorpe @ 2003-09-17 17:21 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: Andrew Cagney, gdb-patches


On Tuesday, September 16, 2003, at 01:28  PM, Kevin Buettner wrote:

>> 	* ppcnbsd-tdep.c (ppcnbsd_use_struct_convention): New function.
>> 	(ppcnbsd_init_abi): Set "use_struct_convention" to
>> 	"ppcnbsd_use_struct_convention".
>
> This change is okay with me.  I want Jason to give his okay first
> though before you commit it...

Yah, I think this is okay.  Sorry, I have been so busy I have not had 
much time to look into this (once Intel Developer Forum is over, things 
will calm down enough that I can take a peek).

I seem to recall looking at this issue once before... But I don't 
remember whether I resolved it or not.  Apparently I didn't.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>


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

* Re: [rfa?] Fix PPC32 struct return
  2003-09-17 17:21   ` Jason Thorpe
@ 2003-09-17 18:22     ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2003-09-17 18:22 UTC (permalink / raw)
  To: Jason Thorpe; +Cc: Kevin Buettner, gdb-patches

> 
> On Tuesday, September 16, 2003, at 01:28  PM, Kevin Buettner wrote:
> 
>     * ppcnbsd-tdep.c (ppcnbsd_use_struct_convention): New function.
>     (ppcnbsd_init_abi): Set "use_struct_convention" to
>     "ppcnbsd_use_struct_convention".
> 
> This change is okay with me.  I want Jason to give his okay first
> though before you commit it...
> 
> Yah, I think this is okay.  Sorry, I have been so busy I have not had much time to look into this (once Intel Developer Forum is over, things will calm down enough that I can take a peek).
> 
> I seem to recall looking at this issue once before... But I don't remember whether I resolved it or not.  Apparently I didn't.

I think it was.  It appears, though, that since then (1.5->1.6) NetBSD 
changed the ABI?

anyway, committed,
Andrew



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

end of thread, other threads:[~2003-09-17 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-13 23:47 [rfa?] Fix PPC32 struct return Andrew Cagney
2003-09-16 20:29 ` Kevin Buettner
2003-09-17 17:21   ` Jason Thorpe
2003-09-17 18:22     ` Andrew Cagney

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