From: kettenis Date: Sun, 9 May 2004 19:48:25 +0000 (+0000) Subject: * amd64-tdep.c (amd64_return_value): Implement X-Git-Tag: reparent-point~2595 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6c01c74f290260dd24384b3de8c4d584355dc10f;p=pf3gnuchains%2Fpf3gnuchains4x.git * amd64-tdep.c (amd64_return_value): Implement RETURN_VALUE_ABI_RETURNS_ADDRESS. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 75fa25a396..248c1204b5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ 2004-05-09 Mark Kettenis + * amd64-tdep.c (amd64_return_value): Implement + RETURN_VALUE_ABI_RETURNS_ADDRESS. + * m68k-tdep.c (m68k_convert_register_p, m68k_register_to_value) (m68k_value_to_register): New functions. (m68k_gdbarch_init): Set convert_register_p, register_to_value and diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index d16571411b..2b56776dac 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -422,11 +422,28 @@ amd64_return_value (struct gdbarch *gdbarch, struct type *type, amd64_classify (type, class); /* 2. If the type has class MEMORY, then the caller provides space - for the return value and passes the address of this storage in - %rdi as if it were the first argument to the function. In - effect, this address becomes a hidden first argument. */ + for the return value and passes the address of this storage in + %rdi as if it were the first argument to the function. In effect, + this address becomes a hidden first argument. + + On return %rax will contain the address that has been passed in + by the caller in %rdi. */ if (class[0] == AMD64_MEMORY) - return RETURN_VALUE_STRUCT_CONVENTION; + { + /* As indicated by the comment above, 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, AMD64_RAX_REGNUM, &addr); + read_memory (addr, readbuf, TYPE_LENGTH (type)); + } + + return RETURN_VALUE_ABI_RETURNS_ADDRESS; + } gdb_assert (class[1] != AMD64_MEMORY); gdb_assert (len <= 16);