aboutsummaryrefslogtreecommitdiff
path: root/gdb/mips-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
commitfc0c74b114ec869ce89d12a282a1cbcb6ab7e6e8 (patch)
tree3525d393b503a2dff090010f9290aa3e36d17557 /gdb/mips-tdep.c
parentcf5c0c5bc6c2f7810ed42bb930a32ed703a473f6 (diff)
downloadgdb-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/mips-tdep.c')
-rw-r--r--gdb/mips-tdep.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index a6e06bb..df2bc3b 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -3950,6 +3950,20 @@ mips_ecoff_reg_to_regnum (int num)
return num + FP0_REGNUM - 32;
}
+/* Convert an integer into an address. By first converting the value
+ into a pointer and then extracting it signed, the address is
+ guarenteed to be correctly sign extended. */
+
+static CORE_ADDR
+mips_integer_to_address (struct type *type, void *buf)
+{
+ char *tmp = alloca (TYPE_LENGTH (builtin_type_void_data_ptr));
+ LONGEST val = unpack_long (type, buf);
+ store_signed_integer (tmp, TYPE_LENGTH (builtin_type_void_data_ptr), val);
+ return extract_signed_integer (tmp,
+ TYPE_LENGTH (builtin_type_void_data_ptr));
+}
+
static struct gdbarch *
mips_gdbarch_init (struct gdbarch_info info,
struct gdbarch_list *arches)
@@ -4259,6 +4273,9 @@ mips_gdbarch_init (struct gdbarch_info info,
set_gdbarch_skip_prologue (gdbarch, mips_skip_prologue);
set_gdbarch_saved_pc_after_call (gdbarch, mips_saved_pc_after_call);
+ set_gdbarch_pointer_to_address (gdbarch, signed_pointer_to_address);
+ set_gdbarch_address_to_pointer (gdbarch, address_to_signed_pointer);
+ set_gdbarch_integer_to_address (gdbarch, mips_integer_to_address);
return gdbarch;
}