aboutsummaryrefslogtreecommitdiff
path: root/gdb/m68k-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-05-16 23:04:15 +0000
committerMark Kettenis <kettenis@gnu.org>2004-05-16 23:04:15 +0000
commit51da707ac6f9602d6a34e46e8602c93f80bf6ef6 (patch)
treee88e32502aa42d2805f8051e4d9e45ae99232890 /gdb/m68k-tdep.c
parent8d027a043bf5ad6a1334feeff6144dca7b769076 (diff)
downloadgdb-51da707ac6f9602d6a34e46e8602c93f80bf6ef6.zip
gdb-51da707ac6f9602d6a34e46e8602c93f80bf6ef6.tar.gz
gdb-51da707ac6f9602d6a34e46e8602c93f80bf6ef6.tar.bz2
* m68k-tdep.c (m68k_svr4_return_value): Implement
RETURN_VALUE_ABI_RETURNS_ADDRESS.
Diffstat (limited to 'gdb/m68k-tdep.c')
-rw-r--r--gdb/m68k-tdep.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index b254005..5973f0b 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -360,7 +360,27 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct type *type,
if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION)
&& !m68k_reg_struct_return_p (gdbarch, type))
- return RETURN_VALUE_STRUCT_CONVENTION;
+ {
+ /* The System V ABI says that:
+
+ "A function returning a structure or union also sets %a0 to
+ the value it finds in %a0. Thus when the caller receives
+ control again, the address of the returned object resides in
+ register %a0."
+
+ So the ABI guarantees that we can always find the return
+ value just after the function has returned. */
+
+ if (readbuf)
+ {
+ ULONGEST addr;
+
+ regcache_raw_read_unsigned (regcache, M68K_A0_REGNUM, &addr);
+ read_memory (addr, readbuf, TYPE_LENGTH (type));
+ }
+
+ return RETURN_VALUE_ABI_RETURNS_ADDRESS;
+ }
/* This special case is for structures consisting of a single
`float' or `double' member. These structures are returned in