thinko in serial.c::serial_write debug trace
authorJoel Brobecker <brobecker@adacore.com>
Fri, 6 Jun 2014 15:28:27 +0000 (11:28 -0400)
committerJoel Brobecker <brobecker@adacore.com>
Tue, 10 Jun 2014 09:50:06 +0000 (11:50 +0200)
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.

gdb/ChangeLog
gdb/serial.c

index 3097a31c1efb06faece48b1675bbc5a75e46df55..61464c823923f7e61945b590ee8d5bb750cec2bd 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-10  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-10  Joel Brobecker  <brobecker@adacore.com>
 
        * gdbtypes (resolve_dynamic_range): Add function description.
index e780bbe2b823689d103e7c08c1ebe5603a9e8507..d4435089d1ddcc132fc54e040e09f37ca6cae27c 100644 (file)
@@ -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);
This page took 0.029522 seconds and 4 git commands to generate.