Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Jim Blandy" <jimb@red-bean.com>
To: "Thomas Richter" <thor@mail.math.tu-berlin.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Print references as /x correctly
Date: Mon, 27 Feb 2006 06:16:00 -0000	[thread overview]
Message-ID: <8f2776cb0602262159o655816a9g95df21d38e0af6da@mail.gmail.com> (raw)
In-Reply-To: <200602262248.k1QMmjlB009999@mersenne.math.TU-Berlin.DE>

On 2/26/06, Thomas Richter <thor@mail.math.tu-berlin.de> wrote:
> gdb 6.4 does not print references correctly with the type specifier /x. To 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
===================================================================
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) == TYPE_CODE_STRING
 	  || TYPE_CODE (type) == TYPE_CODE_STRUCT
 	  || TYPE_CODE (type) == TYPE_CODE_UNION
-	  || TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
+	  || TYPE_CODE (type) == TYPE_CODE_NAMESPACE
+          || TYPE_CODE (type) == 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


      reply	other threads:[~2006-02-27  5:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-26 23:42 Thomas Richter
2006-02-27  6:16 ` Jim Blandy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f2776cb0602262159o655816a9g95df21d38e0af6da@mail.gmail.com \
    --to=jimb@red-bean.com \
    --cc=gdb-patches@sourceware.org \
    --cc=thor@mail.math.tu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox