From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3366 invoked by alias); 18 Oct 2007 11:16:52 -0000 Received: (qmail 3358 invoked by uid 22791); 18 Oct 2007 11:16:51 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 18 Oct 2007 11:16:48 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id DF657982CA; Thu, 18 Oct 2007 11:16:45 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id BFE3D981F1; Thu, 18 Oct 2007 11:16:45 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1IiTMq-00006I-8h; Thu, 18 Oct 2007 07:16:44 -0400 Date: Thu, 18 Oct 2007 11:16:00 -0000 From: Daniel Jacobowitz To: Paul Hilfinger Cc: gdb@sourceware.org Subject: Re: print/x on references Message-ID: <20071018111644.GA32574@caradoc.them.org> Mail-Followup-To: Paul Hilfinger , gdb@sourceware.org References: <20071018093736.8076A48CB9C@nile.gnat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071018093736.8076A48CB9C@nile.gnat.com> User-Agent: Mutt/1.5.15 (2007-04-09) 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/msg00134.txt.bz2 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. -- Daniel Jacobowitz CodeSourcery