From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8454 invoked by alias); 15 Feb 2012 19:13:12 -0000 Received: (qmail 8435 invoked by uid 22791); 15 Feb 2012 19:13:09 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Feb 2012 19:12:43 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1FJChFb006891 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 15 Feb 2012 14:12:43 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q1FJCgkr031786; Wed, 15 Feb 2012 14:12:43 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q1FJCfFu002478; Wed, 15 Feb 2012 14:12:42 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Subject: FYI: fix 'info reg' output Date: Wed, 15 Feb 2012 19:30:00 -0000 Message-ID: <87ipj7nc5y.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00309.txt.bz2 I'm checking this in. This fixes PR 12659. The bug is wrong output when multiple names are given to "info register": (gdb) info reg sp fp sp fp: 0x7fffffffe4d0 fp: 0x7fffffffe4d0 Note the name of the first register. The fix is just tweaking a printf a bit. New test case included. Built and regtested on x86-64 Fedora 16. Tom 2012-02-15 Tom Tromey PR gdb/12659: * infcmd.c (registers_info): Print just the current register's name. 2012-02-15 Tom Tromey * gdb.base/pc-fp.exp: Add "info register" tests. diff --git a/gdb/infcmd.c b/gdb/infcmd.c index e9e3e32..7d929df 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2170,7 +2170,7 @@ registers_info (char *addr_exp, int fpregs) struct value_print_options opts; struct value *val = value_of_user_reg (regnum, frame); - printf_filtered ("%s: ", start); + printf_filtered ("%.*s: ", (int) (end - start), start); get_formatted_print_options (&opts, 'x'); val_print_scalar_formatted (check_typedef (value_type (val)), value_contents_for_printing (val), diff --git a/gdb/testsuite/gdb.base/pc-fp.exp b/gdb/testsuite/gdb.base/pc-fp.exp index 9d74eef..f650000 100644 --- a/gdb/testsuite/gdb.base/pc-fp.exp +++ b/gdb/testsuite/gdb.base/pc-fp.exp @@ -60,11 +60,10 @@ set valueof_fp [get_hexadecimal_valueof "\$fp" "0"] gdb_test "display/i \$pc" "1: x/i +\\\$pc( +|\r\n)=> ${valueof_pc}.*" gdb_test "display/w \$fp" "2: x/xw +\\\$fp +${valueof_fp}.*" -# FIXME: cagney/2002-09-04: Should also check that ``info registers -# $pc'' et.al.'' come back with the same value as the above displays -# and a print --- assuming that is that people agree to such behavour. -# Need to re-write default_print_registers_info() for it to work (and -# such a rewrite is on the reggroups branch). +gdb_test "info register \$pc" "${valueof_pc}.*" +gdb_test "info register \$fp" "${valueof_fp}.*" -# gdb_test "info registers \$pc" "${valueof_pc}" -# gdb_test "info registers \$fp" "${valueof_fp}" +# Regression test for +# http://sourceware.org/bugzilla/show_bug.cgi?id=12659 +gdb_test "info register pc fp" \ + "pc: ${valueof_pc}\[\r\n\]+fp: ${valueof_fp}\[\r\n\]+"