From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19468 invoked by alias); 18 Oct 2007 16:05:02 -0000 Received: (qmail 19411 invoked by uid 22791); 18 Oct 2007 16:05:01 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 18 Oct 2007 16:04:57 +0000 Received: from zps19.corp.google.com (zps19.corp.google.com [172.25.146.19]) by smtp-out.google.com with ESMTP id l9IG4nis028642 for ; Thu, 18 Oct 2007 09:04:49 -0700 Received: from ug-out-1314.google.com (ugeu2.prod.google.com [10.66.172.2]) by zps19.corp.google.com with ESMTP id l9IG4hJ7001534 for ; Thu, 18 Oct 2007 09:04:48 -0700 Received: by ug-out-1314.google.com with SMTP id u2so513722uge for ; Thu, 18 Oct 2007 09:04:48 -0700 (PDT) Received: by 10.66.248.5 with SMTP id v5mr2008925ugh.1192723488098; Thu, 18 Oct 2007 09:04:48 -0700 (PDT) Received: by 10.66.242.13 with HTTP; Thu, 18 Oct 2007 09:04:48 -0700 (PDT) Message-ID: Date: Thu, 18 Oct 2007 16:05:00 -0000 From: "Douglas Evans" To: "Paul Hilfinger" , gdb@sourceware.org Subject: Re: print/x on references In-Reply-To: <20071018111644.GA32574@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20071018093736.8076A48CB9C@nile.gnat.com> <20071018111644.GA32574@caradoc.them.org> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00139.txt.bz2 On 10/18/07, Daniel Jacobowitz wrote: > On Thu, Oct 18, 2007 at 05:37:36AM -0400, Paul Hilfinger wrote: > > > > Currently, there is a slight discrepancy in the behavior of formatted print > > commands. Stop the program below in f. At that point, we see the > > following behavior: > > > > (gdb) p x > > $4 = (Glorp &) @0x8049850: {x = 1, y = 2} > > (gdb) p/x x > > $5 = 0x8049850 > > > > Is there any particular reason these two cases shouldn't have the same > > behavior? It seems that printcmd.c:print_formatted is conflating the > > cases of C++ pointers and C++ references, and I don't see the justification > > for doing so. > > Well, what's the right behavior? I'm not thrilled with the current > behavior either, but I don't want to make it too hard to get at the > reference's "value" i.e. pointer. In C++ you never (are supposed to) > need that, but while debugging is in my opinion a different story. (gdb) p/x x -> prints same as $4 but in hex (gdb) p &x -> prints pointer (e.g. "$5 = (Glorp *) 0x8049850") $0.02