summaryrefslogtreecommitdiff
path: root/gdb/d10v-tdep.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-10-15 18:18:30 +0000
committerAndrew Cagney <cagney@redhat.com>2001-10-15 18:18:30 +0000
commit89f60614a741c7cb4c367ef5b77b1d56b9a0f283 (patch)
tree7349d78c248c475102674588870e31eb67976b34 /gdb/d10v-tdep.c
parentf2943c13d768acd64f9f58de2baa46d94abfed4b (diff)
downloadgdb-89f60614a741c7cb4c367ef5b77b1d56b9a0f283.tar.gz
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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c
index b0dd3bcac18..e9c926995b0 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);