This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix minor issues with spu as secondary target
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 22 Aug 2008 17:34:09 +0200 (CEST)
- Subject: [commit] Fix minor issues with spu as secondary target
Hello,
another minor issue: when building GDB with SPU as secondary target, the
"info spu" commands will always be installed. However, they are only
functional when actually working on an SPU target. The patch adds an
error message when attempting to use any of those commands while working
with a non-SPU target.
Likewise, when not on the SPU, the spu_overlay_new_objfile hook should
not be attempting to instrument non-SPU object files.
Tested on spu-elf. Committed to mainline.
Bye,
Ulrich
ChangeLog:
* spu-tdep.c (spu_overlay_new_objfile): Only consider SPU objfiles.
(info_spu_event_command): Command only supported on SPU architecture.
(info_spu_signal_command): Likewise.
(info_spu_mailbox_command): Likewise.
(info_spu_dma_command): Likewise.
(info_spu_proxydma_command): Likewise.
diff -urNp src-orig/gdb/spu-tdep.c src/gdb/spu-tdep.c
--- src-orig/gdb/spu-tdep.c 2008-08-22 01:53:05.920265012 +0200
+++ src/gdb/spu-tdep.c 2008-08-22 01:58:55.231241945 +0200
@@ -1463,6 +1508,10 @@ spu_overlay_new_objfile (struct objfile
if (!objfile || objfile_data (objfile, spu_overlay_data) != NULL)
return;
+ /* Consider only SPU objfiles. */
+ if (bfd_get_arch (objfile->obfd) != bfd_arch_spu)
+ return;
+
/* Check if this objfile has overlays. */
ovly_table = spu_get_overlay_table (objfile);
if (!ovly_table)
@@ -1497,6 +1612,9 @@ info_spu_event_command (char *args, int
LONGEST len;
int rc, id;
+ if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu)
+ error (_("\"info spu\" is only supported on the SPU architecture."));
+
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/event_status", id);
@@ -1549,6 +1667,9 @@ info_spu_signal_command (char *args, int
LONGEST len;
int rc, id;
+ if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu)
+ error (_("\"info spu\" is only supported on the SPU architecture."));
+
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/signal1", id);
@@ -1665,6 +1786,9 @@ info_spu_mailbox_command (char *args, in
LONGEST len;
int i, id;
+ if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu)
+ error (_("\"info spu\" is only supported on the SPU architecture."));
+
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
chain = make_cleanup_ui_out_tuple_begin_end (uiout, "SPUInfoMailbox");
@@ -1894,6 +2018,9 @@ info_spu_dma_command (char *args, int fr
LONGEST len;
int i, id;
+ if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu)
+ error (_("\"info spu\" is only supported on the SPU architecture."));
+
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/dma_info", id);
@@ -1963,6 +2090,9 @@ info_spu_proxydma_command (char *args, i
LONGEST len;
int i, id;
+ if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu)
+ error (_("\"info spu\" is only supported on the SPU architecture."));
+
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/proxydma_info", id);
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com