diff options
author | Andrew Cagney <cagney@redhat.com> | 2001-10-15 18:18:30 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2001-10-15 18:18:30 +0000 |
commit | fc0c74b114ec869ce89d12a282a1cbcb6ab7e6e8 (patch) | |
tree | 3525d393b503a2dff090010f9290aa3e36d17557 /gdb/d10v-tdep.c | |
parent | cf5c0c5bc6c2f7810ed42bb930a32ed703a473f6 (diff) | |
download | gdb-fc0c74b114ec869ce89d12a282a1cbcb6ab7e6e8.zip gdb-fc0c74b114ec869ce89d12a282a1cbcb6ab7e6e8.tar.gz gdb-fc0c74b114ec869ce89d12a282a1cbcb6ab7e6e8.tar.bz2 |
Add INTEGER_TO_ADDRESS to hadle nasty harvard architectures that do
funnies to integer to address conversions.
Diffstat (limited to 'gdb/d10v-tdep.c')
-rw-r--r-- | gdb/d10v-tdep.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index b0dd3bc..e9c9269 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -419,6 +419,21 @@ d10v_pointer_to_address (struct type *type, void *buf) return d10v_make_daddr (addr); } +static CORE_ADDR +d10v_integer_to_address (struct type *type, void *buf) +{ + LONGEST val; + val = unpack_long (type, buf); + if (TYPE_CODE (type) == TYPE_CODE_INT + && TYPE_LENGTH (type) <= TYPE_LENGTH (builtin_type_void_data_ptr)) + /* Convert small integers that would would be directly copied into + a pointer variable into an address pointing into data space. */ + return d10v_make_daddr (val & 0xffff); + else + /* The value is too large to fit in a pointer. Assume this was + intentional and that the user in fact specified a raw address. */ + return val; +} /* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. @@ -1478,6 +1493,7 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 32); set_gdbarch_address_to_pointer (gdbarch, d10v_address_to_pointer); set_gdbarch_pointer_to_address (gdbarch, d10v_pointer_to_address); + set_gdbarch_integer_to_address (gdbarch, d10v_integer_to_address); set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); |