From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27794 invoked by alias); 27 Feb 2006 05:59:29 -0000 Received: (qmail 27780 invoked by uid 22791); 27 Feb 2006 05:59:28 -0000 X-Spam-Check-By: sourceware.org Received: from xproxy.gmail.com (HELO xproxy.gmail.com) (66.249.82.200) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 27 Feb 2006 05:59:27 +0000 Received: by xproxy.gmail.com with SMTP id s17so527480wxc for ; Sun, 26 Feb 2006 21:59:25 -0800 (PST) Received: by 10.70.124.12 with SMTP id w12mr4095593wxc; Sun, 26 Feb 2006 21:59:25 -0800 (PST) Received: by 10.70.125.17 with HTTP; Sun, 26 Feb 2006 21:59:25 -0800 (PST) Message-ID: <8f2776cb0602262159o655816a9g95df21d38e0af6da@mail.gmail.com> Date: Mon, 27 Feb 2006 06:16:00 -0000 From: "Jim Blandy" To: "Thomas Richter" Subject: Re: [PATCH] Print references as /x correctly Cc: gdb-patches@sourceware.org In-Reply-To: <200602262248.k1QMmjlB009999@mersenne.math.TU-Berlin.DE> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200602262248.k1QMmjlB009999@mersenne.math.TU-Berlin.DE> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00492.txt.bz2 On 2/26/06, Thomas Richter wrote: > gdb 6.4 does not print references correctly with the type specifier /x. T= o reproduce, create > a reference "a" to an int variable, then try to print its value by > > p /x a > > gdb will now incorrectly print the address of the variable a references, = not its contents. Hi, Thomas. Thanks for the bug report --- it looks right to me. I want to run the regression test suite on it, though, to see if there are tests that need to be updated. We should probably have a regression test for this problem as well. By the way: in the future, you should use the 'diff' program to generate patches that show the change you're suggesting. Use the '-u' or '-c' option, so that your patch shows the context of the change as well as the modified lines themselves. This is less ambiguous, easier for others to try out (since they can use the 'patch' program to apply the patch automatically), and should be less work for you. For example, here's the output from diff -u for your change: Index: printcmd.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/printcmd.c,v retrieving revision 1.97 diff -u -p -r1.97 printcmd.c --- printcmd.c 2 Feb 2006 02:26:48 -0000 1.97 +++ printcmd.c 27 Feb 2006 05:57:49 -0000 @@ -326,7 +326,8 @@ print_formatted (struct value *val, int || TYPE_CODE (type) =3D=3D TYPE_CODE_STRING || TYPE_CODE (type) =3D=3D TYPE_CODE_STRUCT || TYPE_CODE (type) =3D=3D TYPE_CODE_UNION - || TYPE_CODE (type) =3D=3D TYPE_CODE_NAMESPACE) + || TYPE_CODE (type) =3D=3D TYPE_CODE_NAMESPACE + || TYPE_CODE (type) =3D=3D TYPE_CODE_REF) /* If format is 0, use the 'natural' format for * that type of value. If the type is non-scalar, * we have to use language rules to print it as