This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Tweak sparc_extract_struct_value_address()
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 5 Jan 2004 21:39:05 +0100 (CET)
- Subject: [PATCH] Tweak sparc_extract_struct_value_address()
I looked a bit closer at the ABI and decided that getting the address
from [sp + 64] would be more robust than getting it from %o2.
Hmm, looks like we can reliably return structures that use the "return
value struct convention" on SPARC.
Committed,
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* sparc-tdep.c (sparc_extract_struct_value_address): Get the
address from [sp + 64] instead of %o2.
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.136
diff -u -p -r1.136 sparc-tdep.c
--- sparc-tdep.c 3 Jan 2004 17:59:04 -0000 1.136
+++ sparc-tdep.c 5 Jan 2004 20:35:56 -0000
@@ -839,10 +839,10 @@ sparc32_return_value (struct gdbarch *gd
static CORE_ADDR
sparc_extract_struct_value_address (struct regcache *regcache)
{
- ULONGEST addr;
+ ULONGEST sp;
- regcache_cooked_read_unsigned (regcache, SPARC_O0_REGNUM, &addr);
- return addr;
+ regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp);
+ return read_memory_unsigned_integer (sp + 64, 4);
}
static int