Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Locate sparc64 arguments correctly
Date: Sat, 20 Apr 2002 02:17:00 -0000	[thread overview]
Message-ID: <20020420.020906.44150275.davem@redhat.com> (raw)


Two problems:

1) Debugging information encodes LOC_ARG/LOC_REF_ARG offsets
   with the Sparc64 stack bias included, we keep track of the
   frame pointer with the stack bias removed on sparc64.

   sparc64_frame_args_address takes care of that.

2) REG_STRUCT_HAS_ADDR was wrong, structs larger than 16 bytes
   are passed by reference.

No regression test changes, likely because these things aren't
hit by the testsuite.

2002-04-20  David S. Miller  <davem@redhat.com>

	* config/sparc/tm-sp64.h (REG_STRUCT_HAS_ADDR): Structs are passed
	by reference when they are greater than 16 bytes in size, not 32.
	* sparc-tdep.c (sparc_reg_struct_has_addr): Likewise.

	* config/sparc/tm-sp64.h (FRAME_ARGS_ADDRESS): Define.
	* sparc-tdep.c (sparc64_frame_args_address): New function.
	(sparc_gdbarch_init): Use it for sparc64, else use
	default_frame_address.

--- config/sparc/tm-sp64.h.~1~	Fri Apr 19 23:02:03 2002
+++ config/sparc/tm-sp64.h	Sat Apr 20 01:55:05 2002
@@ -223,6 +223,9 @@ CORE_ADDR sparc64_push_arguments (int,
 #undef  STACK_ALIGN
 #define STACK_ALIGN(ADDR) (((ADDR) + 15 ) & -16)
 
+#undef FRAME_ARGS_ADDRESS
+#define FRAME_ARGS_ADDRESS(FI)	((FI)->frame - 2047)
+
 /* Initializer for an array of names of registers.
    There should be NUM_REGS strings in this initializer.  */
 /* Some of these registers are only accessible from priviledged mode.
@@ -263,7 +266,7 @@ CORE_ADDR sparc64_push_arguments (int,
 }
 
 #undef REG_STRUCT_HAS_ADDR
-#define REG_STRUCT_HAS_ADDR(gcc_p,type) (TYPE_LENGTH (type) > 32)
+#define REG_STRUCT_HAS_ADDR(gcc_p,type) (TYPE_LENGTH (type) > 16)
 
 extern CORE_ADDR sparc64_read_sp ();
 extern CORE_ADDR sparc64_read_fp ();
--- sparc-tdep.c.~1~	Sat Apr 20 01:46:27 2002
+++ sparc-tdep.c	Sat Apr 20 01:52:38 2002
@@ -2798,6 +2798,16 @@ sparc64_register_byte (int regno)
     return 64 * 8 + (regno - 80) * 8;
 }
 
+/* Debugging information stores LOC_ARG/LOC_REF_ARG offsets with the
+   sparc64 stack bias present, this undoes that so that users of
+   FRAME_ARGS_ADDRESS use the right location.  */
+
+static CORE_ADDR
+sparc64_frame_args_address (struct frame_info *fi)
+{
+  return fi->frame - 2047;
+}
+
 /* Advance PC across any function entry prologue instructions to reach
    some "real" code.  SKIP_PROLOGUE_FRAMELESS_P advances the PC past
    some of the prologue, but stops as soon as it knows that the
@@ -2886,7 +2896,7 @@ int
 sparc_reg_struct_has_addr (int gcc_p, struct type *type)
 {
   if (GDB_TARGET_IS_SPARC64)
-    return (TYPE_LENGTH (type) > 32);
+    return (TYPE_LENGTH (type) > 16);
   else
     return (gcc_p != 1);
 }
@@ -3128,6 +3139,7 @@ sparc_gdbarch_init (struct gdbarch_info 
       set_gdbarch_use_struct_convention (gdbarch, 
 					 sparc64_use_struct_convention);
       set_gdbarch_write_sp (gdbarch, sparc64_write_sp);
+      set_gdbarch_frame_args_address (gdbarch, sparc64_frame_args_address);
       tdep->y_regnum = SPARC64_Y_REGNUM;
       tdep->fp_max_regnum = SPARC_FP0_REGNUM + 48;
       tdep->intreg_size = 8;


             reply	other threads:[~2002-04-20  9:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-20  2:17 David S. Miller [this message]
2002-04-23 12:53 ` Michael Snyder
2002-04-23 21:57   ` David S. Miller
2002-04-23 16:09 ` Kevin Buettner
2002-04-24  8:33   ` David S. Miller
2002-04-24  9:42     ` Kevin Buettner
2002-04-24  9:53       ` David S. Miller

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=20020420.020906.44150275.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=gdb-patches@sources.redhat.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