diff options
author | Joel Brobecker <brobecker@gnat.com> | 2005-10-10 01:08:07 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2005-10-10 01:08:07 +0000 |
commit | 0e4377e151dc56be7e941e52ebfda65f78da581c (patch) | |
tree | 6f711e2c1783aeb00234b4d692cf0d8a0a280d96 | |
parent | fd1b946ec5e5c17bf7554d7d0edc9ac37f8dc72e (diff) | |
download | gdb-0e4377e151dc56be7e941e52ebfda65f78da581c.zip gdb-0e4377e151dc56be7e941e52ebfda65f78da581c.tar.gz gdb-0e4377e151dc56be7e941e52ebfda65f78da581c.tar.bz2 |
* i386-tdep.c (i386_reg_struct_return_p): Allow array types as well.
(i386_return_value): Add handling for functions that return array
types.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 20 |
2 files changed, 21 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 666fd79..13a0717 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2005-10-09 Joel Brobecker <brobecker@adacore.com> + * i386-tdep.c (i386_reg_struct_return_p): Allow array types as well. + (i386_return_value): Add handling for functions that return array + types. + +2005-10-09 Joel Brobecker <brobecker@adacore.com> + * ada-valprint.c (print_optional_low_bound): Handle properly cases where the array index type is a TYPE_CODE_RANGE. diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index b060a22..c4016a8 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1424,9 +1424,9 @@ static const char *valid_conventions[] = }; static const char *struct_convention = default_struct_convention; -/* Return non-zero if TYPE, which is assumed to be a structure or - union type, should be returned in registers for architecture - GDBARCH. */ +/* Return non-zero if TYPE, which is assumed to be a structure, + a union type, or an array type, should be returned in registers + for architecture GDBARCH. */ static int i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) @@ -1435,7 +1435,9 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) enum type_code code = TYPE_CODE (type); int len = TYPE_LENGTH (type); - gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION); + gdb_assert (code == TYPE_CODE_STRUCT + || code == TYPE_CODE_UNION + || code == TYPE_CODE_ARRAY); if (struct_convention == pcc_struct_convention || (struct_convention == default_struct_convention @@ -1467,7 +1469,9 @@ i386_return_value (struct gdbarch *gdbarch, struct type *type, { enum type_code code = TYPE_CODE (type); - if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION) + if ((code == TYPE_CODE_STRUCT + || code == TYPE_CODE_UNION + || code == TYPE_CODE_ARRAY) && !i386_reg_struct_return_p (gdbarch, type)) { /* The System V ABI says that: @@ -1481,6 +1485,12 @@ i386_return_value (struct gdbarch *gdbarch, struct type *type, So the ABI guarantees that we can always find the return value just after the function has returned. */ + /* Note that the ABI doesn't mention functions returning arrays, + which is something possible in certain languages such as Ada. + In this case, the value is returned as if it was wrapped in + a record, so the convention applied to records also applies + to arrays. */ + if (readbuf) { ULONGEST addr; |