aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/spu-tdep.c33
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.cp/cp-relocate.exp6
4 files changed, 48 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dba0c35..c991663 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2007-08-27 Markus Deuling <deuling@de.ibm.com>
+
+ * spu-tdep.c (spu_pointer_to_address): New function.
+ (spu_integer_to_address): Likewise.
+ (spu_gdbarch_init): Add spu_pointer_to_address and
+ spu_integer_to_address to gdbarch.
+
2007-08-26 Pedro Alves <pedro_alves@portugalmail.pt>
* arm-wince-tdep.c (ARM_WINCE_JB_PC): Change to 10.
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 933b924..ed676fe 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -322,6 +322,35 @@ spu_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return default_register_reggroup_p (gdbarch, regnum, group);
}
+/* Address conversion. */
+
+static CORE_ADDR
+spu_pointer_to_address (struct type *type, const gdb_byte *buf)
+{
+ ULONGEST addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
+ ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */
+
+ if (target_has_registers && target_has_stack && target_has_memory)
+ lslr = get_frame_register_unsigned (get_selected_frame (NULL),
+ SPU_LSLR_REGNUM);
+
+ return addr & lslr;
+}
+
+static CORE_ADDR
+spu_integer_to_address (struct gdbarch *gdbarch,
+ struct type *type, const gdb_byte *buf)
+{
+ ULONGEST addr = unpack_long (type, buf);
+ ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */
+
+ if (target_has_registers && target_has_stack && target_has_memory)
+ lslr = get_frame_register_unsigned (get_selected_frame (NULL),
+ SPU_LSLR_REGNUM);
+
+ return addr & lslr;
+}
+
/* Decoding SPU instructions. */
@@ -2006,6 +2035,10 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
+ /* Address conversion. */
+ set_gdbarch_pointer_to_address (gdbarch, spu_pointer_to_address);
+ set_gdbarch_integer_to_address (gdbarch, spu_integer_to_address);
+
/* Inferior function calls. */
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
set_gdbarch_frame_align (gdbarch, spu_frame_align);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a90b009..54d4776 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-27 Markus Deuling <deuling@de.ibm.com>
+
+ * gdb.cp/cp-relocate.exp (add-symbol-file): Change addresses
+ to fit into SPU Local Store memory.
+
2007-08-23 Joel Brobecker <brobecker@adacore.com>
* gdb.base/default.exp: Adjust the expected output of "info
diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp
index cde3dd6..3d31ad0 100644
--- a/gdb/testsuite/gdb.cp/cp-relocate.exp
+++ b/gdb/testsuite/gdb.cp/cp-relocate.exp
@@ -123,7 +123,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
-gdb_test "add-symbol-file ${binfile} 0 -s ${func1_sec} 0x40000 -s ${func2_sec} 0x80000" \
+gdb_test "add-symbol-file ${binfile} 0 -s ${func1_sec} 0x10000 -s ${func2_sec} 0x20000" \
"Reading symbols from .*${testfile}\\.o\\.\\.\\.done\\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)" \
"add-symbol-file ${testfile}.o" \
"add symbol table from file \".*${testfile}\\.o\" at.*\\(y or n\\) " \
@@ -131,6 +131,6 @@ gdb_test "add-symbol-file ${binfile} 0 -s ${func1_sec} 0x40000 -s ${func2_sec} 0
# Make sure the function addresses were updated.
gdb_test "break *'$func1_name'" \
- "Breakpoint $decimal at 0x4....: file .*"
+ "Breakpoint $decimal at 0x1....: file .*"
gdb_test "break *'$func2_name'" \
- "Breakpoint $decimal at 0x8....: file .*"
+ "Breakpoint $decimal at 0x2....: file .*"