aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-09-09 06:39:56 -0600
committerTom Tromey <tromey@adacore.com>2023-01-03 08:45:01 -0700
commit5cb0f2d5b67ce2b4f60d5ad0b0a26ef918e8244f (patch)
tree301730b1a22abe06aeab97c275dbd27ff69a15a6 /gdb/i386-tdep.c
parent12bb802fab16b5bf8edc027c247741bd75db1257 (diff)
downloadgdb-5cb0f2d5b67ce2b4f60d5ad0b0a26ef918e8244f.zip
gdb-5cb0f2d5b67ce2b4f60d5ad0b0a26ef918e8244f.tar.gz
gdb-5cb0f2d5b67ce2b4f60d5ad0b0a26ef918e8244f.tar.bz2
Convert selected architectures to gdbarch_return_value_as_value
This converts a few selected architectures to use gdbarch_return_value_as_value rather than gdbarch_return_value. The architectures are just the ones that I am able to test. This patch should not introduce any behavior changes.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 88daca4..cc41dd8 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -3030,10 +3030,17 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
static enum return_value_convention
i386_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
- gdb_byte *readbuf, const gdb_byte *writebuf)
+ struct value **read_value, const gdb_byte *writebuf)
{
enum type_code code = type->code ();
+ gdb_byte *readbuf = nullptr;
+ if (read_value != nullptr)
+ {
+ *read_value = allocate_value (type);
+ readbuf = value_contents_raw (*read_value).data ();
+ }
+
if (((code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION
|| code == TYPE_CODE_ARRAY)
@@ -3081,9 +3088,13 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
here. */
if (code == TYPE_CODE_STRUCT && type->num_fields () == 1)
{
- type = check_typedef (type->field (0).type ());
- return i386_return_value (gdbarch, function, type, regcache,
- readbuf, writebuf);
+ struct type *inner_type = check_typedef (type->field (0).type ());
+ enum return_value_convention result
+ = i386_return_value (gdbarch, function, inner_type, regcache,
+ read_value, writebuf);
+ if (read_value != nullptr)
+ deprecated_set_value_type (*read_value, type);
+ return result;
}
if (readbuf)
@@ -8572,7 +8583,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_to_value (gdbarch, i386_register_to_value);
set_gdbarch_value_to_register (gdbarch, i386_value_to_register);
- set_gdbarch_return_value (gdbarch, i386_return_value);
+ set_gdbarch_return_value_as_value (gdbarch, i386_return_value);
set_gdbarch_skip_prologue (gdbarch, i386_skip_prologue);