This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] Wrap addresses in spu-gdb
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>, Daniel Jacobowitz <drow at false dot org>, Jim Blandy <jimb at codesourcery dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Thu, 09 Aug 2007 12:38:03 +0200
- Subject: Re: [rfc] Wrap addresses in spu-gdb
- References: <200708081411.l78EBqII022771@d12av02.megacenter.de.ibm.com>
Hi,
Ulrich Weigand schrieb:
Daniel Jacobowitz wrote:
On Wed, Aug 08, 2007 at 08:44:29AM +0200, Markus Deuling wrote:
+ if (target_has_registers && target_has_stack && target_has_memory
+ /* FIXME: Currently needed for dwarf2_read_address to work. */
+ && type != builtin_type_uint32)
I think that you shouldn't commit a patch with this hack in it.
It looks very fragile.
Agreed. Markus, this is a special hack for the combined PPE/SPE
debugger, it shouldn't be necessary for the SPU-standalone (and
mainline) version.
I'll have to look into fixing the underlying issue cleanly when
merging the combined debugger ...
ok, thank you. I attached a patch with a SPU-only version. This can
later be replaced by the version suitable for the combined debugger.
Tested on spu-elf without regression.
ChangeLog:
* 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.
Is this ok to commit?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urpN src/gdb/spu-tdep.c dev/gdb/spu-tdep.c
--- src/gdb/spu-tdep.c 2007-06-18 05:36:44.000000000 +0200
+++ dev/gdb/spu-tdep.c 2007-08-09 12:13:20.000000000 +0200
@@ -324,6 +324,35 @@ spu_register_reggroup_p (struct gdbarch
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. */
@@ -2008,6 +2037,10 @@ spu_gdbarch_init (struct gdbarch_info in
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);