This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]