From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12473 invoked by alias); 4 Nov 2011 07:46:10 -0000 Received: (qmail 12459 invoked by uid 22791); 4 Nov 2011 07:46:08 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS 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; Fri, 04 Nov 2011 07:45:48 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pA47jlw9014770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 4 Nov 2011 03:45:48 -0400 Received: from host1.jankratochvil.net (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pA47jjtf026696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 4 Nov 2011 03:45:47 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id pA47jidZ024281; Fri, 4 Nov 2011 08:45:44 +0100 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id pA47jhxu024280; Fri, 4 Nov 2011 08:45:43 +0100 Date: Fri, 04 Nov 2011 07:46:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: RFA: implement ambiguous linespec proposal Message-ID: <20111104074543.GA13839@host1.jankratochvil.net> References: <20111028221459.GA28467@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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: 2011-11/txt/msg00107.txt.bz2 On Thu, 03 Nov 2011 21:48:56 +0100, Tom Tromey wrote: [...] > namespace N1 { > int m() { return 23; } > }; > > namespace N2 { > int m() { return 23; } > }; > > int main() > { > using namespace N1; > using namespace N2; > return 0; > } > > I think this is valid (g++ accepts it). > > What should gdb do if we are stopped in 'main' and the user types 'break m'? > > > Doing namespace searches is a problem if they yield an ambiguous result > because either: > > 1. There is no canonical name that can be put into the breakpoint for > resetting, or > > 2. The breakpoint would have to also capture the current block for > re-setting, which opens a whole new set of problems. > > > I understand that the rationale here is for gdb to work like the > compiler does. Compiler says: .C:13:6: error: call of overloaded ‘m()’ is ambiguous .C:13:6: note: candidates are: .C:6:7: note: int N2::m() .C:2:7: note: int N1::m() and I think GDB should also say the same output as error. It is questionable what it should do on re-set if it becomes ambigous. One can store the available namespaces as strings with the breakpoint (instead of storing pointer to the block - where the block may disappear). I understand it is not feasible to throw an error if ambiguity happens later on a breakpoint re-set, so a multi-location breakpoint is probably OK. Which brings a question whether the multi-location breakpoint should not be placed there already when creating the breakpoint (instead of the suggested error). As GDB already ignores `static' for variables in other files and already ignores even C++ access specifiers it cannot work exactly like the compiler anyway. > I would rather just require the user to type what they mean. It breaks that GDB should be able to parse what the source says. Thanks, Jan