From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30260 invoked by alias); 3 Nov 2011 20:49:14 -0000 Received: (qmail 30109 invoked by uid 22791); 3 Nov 2011 20:49:13 -0000 X-SWARE-Spam-Status: No, hits=-7.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BJ 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; Thu, 03 Nov 2011 20:48:58 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pA3KmwVG018426 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 3 Nov 2011 16:48:58 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pA3KmwjL016501; Thu, 3 Nov 2011 16:48:58 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id pA3Kmu3T024156; Thu, 3 Nov 2011 16:48:57 -0400 From: Tom Tromey To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: RFA: implement ambiguous linespec proposal References: <20111028221459.GA28467@host1.jankratochvil.net> Date: Thu, 03 Nov 2011 20:49:00 -0000 In-Reply-To: (Tom Tromey's message of "Tue, 01 Nov 2011 14:57:47 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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/msg00102.txt.bz2 Jan> -PASS: gdb.cp/ovsrch.exp: break outer::foo if (a == 3) Jan> +FAIL: gdb.cp/ovsrch.exp: break outer::foo if (a == 3) Jan> -PASS: gdb.cp/ovsrch.exp: break inner::foo if (a == 3) Jan> +FAIL: gdb.cp/ovsrch.exp: break inner::foo if (a == 3) Tom> I don't like how this test assumes that gdb will do a namespace search Tom> for a symbol when decoding linespecs. That just seems wrong to me. Tom> But, we've shipped it for a while, so I think we'll have to cope. I am not sure we can make this work sanely. I'm tempted to declare these tests invalid and remove them. Consider this program: 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. And, I still think that makes a lot of sense for expressions. But for linespecs I am not convinced, as I think they are different in nature: they may be re-parsed in many different contexts and they may apply across objfiles and program spaces. Also, for C++ at least, I think "work like the compiler" will have more awful implications: ADL, template stuff, ... I would rather just require the user to type what they mean. Tom