Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* problem with "info spu signal" command on spu-gdb
@ 2008-02-29 13:48 Hidetaka Takano
  2008-03-03 14:28 ` Ulrich Weigand
  0 siblings, 1 reply; 4+ messages in thread
From: Hidetaka Takano @ 2008-02-29 13:48 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

Hello GDB maintainer,

I am working on Linux running on Cell/B.E. system.

I found a bugs in spu-gdb command "info spu signal".

Would you fix this bug?
I made a patch for it and I've attached it.

Details are as follows:

The "info spu signal" command displays wrong type.
It almost always returns "Override".
Especially, by collaborating Cell IDE Eclipse, the value is quite strange.

This problem is caused by what the GDB's internal function "strtoulst()" expects
 the entry of SPUFS should have the LF code (0x0a) and null (0x00) in its end.
The only signal_type doesn't have it.
 (event_status and event_mask are OK)

In order to fix this problem, of course, it is possible to modify the SPUFS.
Tentatively I would like GDB to work around it.

I will also post this problem report to SPUFS maintainer.

Best regard.
---
Hidetaka Takano

[-- Attachment #2: fix-info-spu-signal.diff --]
[-- Type: application/octet-stream, Size: 1913 bytes --]

diff -urpN src-org/gdb/spu-tdep.c src/gdb/spu-tdep.c
--- src-org/gdb/spu-tdep.c	2008-01-11 22:20:02.000000000 +0900
+++ src/gdb/spu-tdep.c	2008-02-15 10:24:20.000000000 +0900
@@ -1505,16 +1505,18 @@ info_spu_event_command (char *args, int 
 
   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
     
   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
     
   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");

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-03-10 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-29 13:48 problem with "info spu signal" command on spu-gdb Hidetaka Takano
2008-03-03 14:28 ` Ulrich Weigand
2008-03-06 12:17   ` Hidetaka Takano
2008-03-10 12:40     ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox