Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hidetaka Takano <hidetaka.takano@glb.toshiba.co.jp>
To: gdb-patches@sourceware.org
Subject: problem with "info spu signal" command on spu-gdb
Date: Fri, 29 Feb 2008 13:48:00 -0000	[thread overview]
Message-ID: <004b01c87abb$54f75ef0$e11e4f9d@MOSTPCMSS20377> (raw)

[-- 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");

             reply	other threads:[~2008-02-29 10:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29 13:48 Hidetaka Takano [this message]
2008-03-03 14:28 ` Ulrich Weigand
2008-03-06 12:17   ` Hidetaka Takano
2008-03-10 12:40     ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='004b01c87abb$54f75ef0$e11e4f9d@MOSTPCMSS20377' \
    --to=hidetaka.takano@glb.toshiba.co.jp \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox