From patchwork Fri Jun 6 15:53:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 1356 Received: (qmail 3467 invoked by alias); 6 Jun 2014 15:53:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3366 invoked by uid 89); 6 Jun 2014 15:53:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 06 Jun 2014 15:53:37 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id CDC0D116206 for ; Fri, 6 Jun 2014 11:53:35 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id WD8vAEIOnhUR for ; Fri, 6 Jun 2014 11:53:35 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 9D49E116117 for ; Fri, 6 Jun 2014 11:53:35 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 0658C40F00; Fri, 6 Jun 2014 08:53:39 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [pushed/obv] thinko in serial.c::serial_write debug trace Date: Fri, 6 Jun 2014 08:53:37 -0700 Message-Id: <1402070017-13513-1-git-send-email-brobecker@adacore.com> 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, 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 + + * 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 * 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);