aboutsummaryrefslogtreecommitdiff
path: root/gdb/spu-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-03-10 12:36:08 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-03-10 12:36:08 +0000
commit9971ac47821cb9165226be0c520fc5388cbc97fc (patch)
tree16de0b892767526200eb1a7d2dd612e63600630c /gdb/spu-tdep.c
parentaab9fc6c84444847c82e008e41f831438efd5959 (diff)
downloadgdb-9971ac47821cb9165226be0c520fc5388cbc97fc.zip
gdb-9971ac47821cb9165226be0c520fc5388cbc97fc.tar.gz
gdb-9971ac47821cb9165226be0c520fc5388cbc97fc.tar.bz2
2008-03-10 Hidetaka Takano <hidetaka.takano@glb.toshiba.co.jp>
* spu-tdep.c (info_spu_event_command): Insert a '\0' to the end of the data passing to strtoulst function. (info_spu_signal_command): Likewise.
Diffstat (limited to 'gdb/spu-tdep.c')
-rw-r--r--gdb/spu-tdep.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 9fcb118..882b613 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1505,16 +1505,18 @@ info_spu_event_command (char *args, int from_tty)
xsnprintf (annex, sizeof annex, "%d/event_status", id);
len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
- buf, 0, sizeof buf);
+ buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read event_status."));
+ buf[len] = '\0';
event_status = strtoulst (buf, NULL, 16);
xsnprintf (annex, sizeof annex, "%d/event_mask", id);
len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
- buf, 0, sizeof buf);
+ buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read event_mask."));
+ buf[len] = '\0';
event_mask = strtoulst (buf, NULL, 16);
chain = make_cleanup_ui_out_tuple_begin_end (uiout, "SPUInfoEvent");
@@ -1565,9 +1567,10 @@ info_spu_signal_command (char *args, int from_tty)
xsnprintf (annex, sizeof annex, "%d/signal1_type", id);
len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
- buf, 0, sizeof buf);
+ buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read signal1_type."));
+ buf[len] = '\0';
signal1_type = strtoulst (buf, NULL, 16);
xsnprintf (annex, sizeof annex, "%d/signal2", id);
@@ -1582,9 +1585,10 @@ info_spu_signal_command (char *args, int from_tty)
xsnprintf (annex, sizeof annex, "%d/signal2_type", id);
len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
- buf, 0, sizeof buf);
+ buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read signal2_type."));
+ buf[len] = '\0';
signal2_type = strtoulst (buf, NULL, 16);
chain = make_cleanup_ui_out_tuple_begin_end (uiout, "SPUInfoSignal");