This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pushed/obv] thinko in serial.c::serial_write debug trace


Hello,

I noticed that, when using 'set debug serial 1', the "write" traces
would always be NUL characters:

    [
    w \x00][\x00][\x00][\x00][\x00][etc]

This is due to a small thinko in the loop that output each character,
where we accidently used the loop boundary instead of the loop index
to index the character to be printed.

After this patch is applied, the output now becomes:

    [
    w $][v][C][o][n][t][?][#][4][9]

gdb/ChangeLog:

	* serial.c (serial_write): Fix index of character to be printed
	in call to serial_logchar when serial debug traces are enabled.

Tested on x86_64-windows. Pushed.

Thanks,
-- 
Joel
---
 gdb/ChangeLog | 5 +++++
 gdb/serial.c  | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4a72665..d691556 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-06  Joel Brobecker  <brobecker@adacore.com>
+
+	* serial.c (serial_write): Fix index of character to be printed
+	in call to serial_logchar when serial debug traces are enabled.
+
 2014-06-06  Mingjie Xing  <mingjie.xing@gmail.com>
 
 	* main.c (print_gdb_help): Add -q and --silent.
diff --git a/gdb/serial.c b/gdb/serial.c
index e780bbe..d443508 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -423,7 +423,7 @@ serial_write (struct serial *scb, const void *buf, size_t count)
       for (c = 0; c < count; c++)
 	{
 	  fprintf_unfiltered (gdb_stdlog, "[");
-	  serial_logchar (gdb_stdlog, 'w', str[count] & 0xff, 0);
+	  serial_logchar (gdb_stdlog, 'w', str[c] & 0xff, 0);
 	  fprintf_unfiltered (gdb_stdlog, "]");
 	}
       gdb_flush (gdb_stdlog);
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]