From patchwork Fri Dec 12 19:04:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 4223 Received: (qmail 371 invoked by alias); 12 Dec 2014 19:04:32 -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 361 invoked by uid 89); 12 Dec 2014 19:04:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp13.uk.ibm.com Received: from e06smtp13.uk.ibm.com (HELO e06smtp13.uk.ibm.com) (195.75.94.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 12 Dec 2014 19:04:30 +0000 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Dec 2014 19:04:27 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 12 Dec 2014 19:04:25 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 7963E1B08049 for ; Fri, 12 Dec 2014 19:04:46 +0000 (GMT) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBCJ4ORc58654830 for ; Fri, 12 Dec 2014 19:04:24 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBCJ4Ou2003989 for ; Fri, 12 Dec 2014 14:04:24 -0500 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-196.boeblingen.de.ibm.com [9.152.212.196]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id sBCJ4Nln003986; Fri, 12 Dec 2014 14:04:23 -0500 From: Andreas Arnez To: Doug Evans Cc: Pedro Alves , gdb-patches Subject: Re: [PATCH v4 2/2] Provide completer for "info registers" References: <1418298589-23120-1-git-send-email-arnez@linux.vnet.ibm.com> <1418298589-23120-3-git-send-email-arnez@linux.vnet.ibm.com> <548AEB86.60809@redhat.com> <877fxwnbd6.fsf@br87z6lw.de.ibm.com> Date: Fri, 12 Dec 2014 20:04:22 +0100 In-Reply-To: (Doug Evans's message of "Fri, 12 Dec 2014 09:45:55 -0800") Message-ID: <87388kn0zt.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14121219-0013-0000-0000-00000232CC8A X-IsSubscribed: yes On Fri, Dec 12 2014, Doug Evans wrote: > I'm seeing the following new failure on amd64-linux: > > (gdb) complete info registers ^M > info registers ah^M > info registers al^M > ... > info registers ymm9^M > info registers ymm9h^M > (gdb) FAIL: gdb.base/completion.exp: complete 'info registers ' Oops. This is because the user registers have 3-digit numbers and thus occupy the first column in the output of "maint print user-registers". This doesn't match the latest version of the regexp in completion.exp. In fact, this is a useful finding, because the output of "maint print user-registers" should actually be indented. Here's a suggested fix. -- >8 -- Subject: [PATCH] Fix indentation of "maint print user-registers" This fixes a failure of the test case "complete 'info registers '" in completion.exp on architectures where the user registers have numbers above 99. In that case the output of "maint print user-registers" was no longer indented, and the regexp in the test case failed to add them to the list of expected completion results. The fix also swaps the columns "Name" and "Nr", such that the indentation is always the same, and to be consistent with the output of "maint print registers". gdb/ChangeLog: * user-regs.c (maintenance_print_user_registers): Swap "Nr" and "Name" columns. Assure that the output is always indented. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Adjust to format changes of "maint print user-registers". diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 08e1a52..9c79a29 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -145,17 +145,14 @@ set regs_output [capture_command_output "mt print registers" \ append regs_output "\n" append regs_output [capture_command_output "mt print reggroups" \ ".*Group.*Type\[^\n]*\n"] +append regs_output "\n" +append regs_output [capture_command_output "mt print user-registers" \ + ".*Name.*Nr\[^\n]*\n"] set all_regs {} foreach {- reg} [regexp -all -inline -line {^\s+(\w+)} $regs_output] { lappend all_regs $reg } -set regs_output [capture_command_output "mt print user-registers" \ - ".*Nr.*Name\[^\n]*\n"] -foreach {- reg} [regexp -all -inline -line {^\s+\d+\s+(\w+)} $regs_output] { - lappend all_regs $reg -} - set all_regs [join [lsort -unique $all_regs]] # ... and then compare them to the completion of "info registers". diff --git a/gdb/user-regs.c b/gdb/user-regs.c index adaa959..6cdea16 100644 --- a/gdb/user-regs.c +++ b/gdb/user-regs.c @@ -229,9 +229,9 @@ maintenance_print_user_registers (char *args, int from_tty) regs = gdbarch_data (gdbarch, user_regs_data); regnum = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); - fprintf_unfiltered (gdb_stdout, " Nr Name\n"); + fprintf_unfiltered (gdb_stdout, " %-11s %3s\n", "Name", "Nr"); for (reg = regs->first; reg != NULL; reg = reg->next, ++regnum) - fprintf_unfiltered (gdb_stdout, "%3d %s\n", regnum, reg->name); + fprintf_unfiltered (gdb_stdout, " %-11s %3d\n", reg->name, regnum); } extern initialize_file_ftype _initialize_user_regs; /* -Wmissing-prototypes */