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

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