mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 07:53:51 +08:00
Add new overload of gdbarch_return_value
The gdbarch "return_value" can't correctly handle variably-sized types. The problem here is that the TYPE_LENGTH of such a type is 0, until the type is resolved, which requires reading memory. However, gdbarch_return_value only accepts a buffer as an out parameter. Fixing this requires letting the implementation of the gdbarch method resolve the type and return a value -- that is, both the contents and the new type. After an attempt at this, I realized I wouldn't be able to correctly update all implementations (there are ~80) of this method. So, instead, this patch adds a new method that falls back to the current method, and it updates gdb to only call the new method. This way it's possible to incrementally convert the architectures that I am able to test.
This commit is contained in:
@ -1098,6 +1098,24 @@ default_get_return_buf_addr (struct type *val_type, frame_info_ptr cur_frame)
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum return_value_convention
|
||||
default_gdbarch_return_value
|
||||
(struct gdbarch *gdbarch, struct value *function, struct type *valtype,
|
||||
struct regcache *regcache, struct value **read_value,
|
||||
const gdb_byte *writebuf)
|
||||
{
|
||||
gdb_byte *readbuf = nullptr;
|
||||
|
||||
if (read_value != nullptr)
|
||||
{
|
||||
*read_value = allocate_value (valtype);
|
||||
readbuf = value_contents_raw (*read_value).data ();
|
||||
}
|
||||
|
||||
return gdbarch_return_value (gdbarch, function, valtype, regcache,
|
||||
readbuf, writebuf);
|
||||
}
|
||||
|
||||
/* Non-zero if we want to trace architecture code. */
|
||||
|
||||
#ifndef GDBARCH_DEBUG
|
||||
|
Reference in New Issue
Block a user