Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Jason R Thorpe <thorpej@wasabisystems.com>,
	gdb-patches@sources.redhat.com
Subject: [rfa?] Fix PPC32 struct return
Date: Sat, 13 Sep 2003 23:47:00 -0000	[thread overview]
Message-ID: <3F63AC09.4070809@redhat.com> (raw)

[-- 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);
 }

             reply	other threads:[~2003-09-13 23:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-13 23:47 Andrew Cagney [this message]
2003-09-16 20:29 ` Kevin Buettner
2003-09-17 17:21   ` Jason Thorpe
2003-09-17 18:22     ` 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=3F63AC09.4070809@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=thorpej@wasabisystems.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