From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12501 invoked by alias); 26 Jan 2011 22:35:41 -0000 Received: (qmail 12377 invoked by uid 22791); 26 Jan 2011 22:35:38 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_CP,T_RP_MATCHES_RCVD 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; Wed, 26 Jan 2011 22:35:31 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0QMZTGp016401 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 26 Jan 2011 17:35:29 -0500 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0QMZRfK025478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Jan 2011 17:35:28 -0500 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p0QMZQ0l006850; Wed, 26 Jan 2011 23:35:26 +0100 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id p0QMZQhk006849; Wed, 26 Jan 2011 23:35:26 +0100 Date: Wed, 26 Jan 2011 23:14:00 -0000 From: Jan Kratochvil To: Keith Seitz Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA] c++/11734 revisited Message-ID: <20110126223526.GA24255@host1.dyn.jankratochvil.net> References: <4D002672.5090504@redhat.com> <4D07CD68.5000700@redhat.com> <20110124173745.GA31199@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110124173745.GA31199@host1.dyn.jankratochvil.net> 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-01/txt/msg00515.txt.bz2 On Mon, 24 Jan 2011 18:37:45 +0100, Jan Kratochvil wrote: > > Revised patch attached. > > As a summary: > > "physname" patch I call: > 42284fdf9d8cdb20c8e833bdbdb2b56977fea525 > http://sourceware.org/ml/gdb-cvs/2010-03/msg00082.html > dwarf2_physname patchset: > [RFA] dwarf2_physname FINAL > http://sourceware.org/ml/gdb-patches/2010-03/msg00220.html > > Original pre-physname code for pr11734::foo() did not call decode_compound but > called decode_variable which resolved it from the fully qualified name. > > post-physname code tried to resolve pr11734::foo() via decode_compound which > did not support such case and it fails now on HEAD. > > Alternatively to your patch the current HEAD can be modified to call > decode_variable again as in pre-physname era which resolves it correctly but > for some reason you prefer to resolve pr11734::foo() via decode_compound > instead which makes sense. I have to withdraw my preliminary approval. Together with [RFA] c++/12273 http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html both patches duplicate the decode_variable functionality by the new implementation in decode_compound. But this duplication is still not complete, for example it does not handle properly namespaces. It had only a luck the existing namespace tests (nsusing.exp) do not exploit it. I have attached such testcase on top of your this patch: Re: [RFA] c++/11734 revisited http://sourceware.org/ml/gdb-patches/2010-12/msg00263.html with results: PASS: gdb.cp/pr11734.exp: break func PASS: gdb.cp/pr11734.exp: break 'func' ^^^^ = test like nsusing.exp FAIL: gdb.cp/pr11734.exp: break pr11734::foo() (got interactive prompt) FAIL: gdb.cp/pr11734.exp: break 'pr11734::foo()' (got interactive prompt) FAIL: gdb.cp/pr11734.exp: break pr11734::foo(char*) (got interactive prompt) FAIL: gdb.cp/pr11734.exp: break 'pr11734::foo(char*)' (got interactive prompt) FAIL: gdb.cp/pr11734.exp: break pr11734::foo(int) (got interactive prompt) FAIL: gdb.cp/pr11734.exp: break 'pr11734::foo(int)' (got interactive prompt) ^^^^ = these funcs get called by the C++ inferior but GDB cannot resolve them. decode_compound itself should comply to namespacing, just dropping to decode_variable as before is not enough anyway as decode_variable cannot resolve class fields which have no global symbols/minsym. The new plan of G++ parser/plugin is probably not considerable now as a fix. With the very hacky drop into decode_variable the testcase works but this patch of mine is sure not usable. Thanks, Jan --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -783,7 +783,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, /* Does it look like there actually were two parts? */ - if (p[0] == ':' || p[0] == '.') +if (0) // if (p[0] == ':' || p[0] == '.') { /* Is it a C++ or Java compound data structure? The check on p[1] == ':' is capturing the case of "::", @@ -868,7 +868,22 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, } else { - p = skip_quoted (*argptr); + const char *lang_breakchars; + char *breakchars, *s, *end; + + lang_breakchars = current_language->la_word_break_characters (); + + breakchars = alloca (strlen (lang_breakchars) + 1); + strcpy (breakchars, lang_breakchars); + end = &breakchars[strlen (breakchars)]; + + s = strchr (breakchars, ':'); + if (s != NULL) + { + *s = *--end; + *end = 0; + } + p = skip_quoted_chars (*argptr, NULL, breakchars); } /* Keep any template parameters. */ --- a/gdb/testsuite/gdb.cp/pr11734-1.cc +++ b/gdb/testsuite/gdb.cp/pr11734-1.cc @@ -20,11 +20,21 @@ #include "pr11734.h" +namespace A { void func () {} } + +using namespace A; + int main () { pr11734 *p = new pr11734; p->foo (); + + func (); + + pr11734::foo (); + pr11734::foo ((char *) ""); + pr11734::foo (0); + return 0; } - --- a/gdb/testsuite/gdb.cp/pr11734-2.cc +++ b/gdb/testsuite/gdb.cp/pr11734-2.cc @@ -20,8 +20,11 @@ #include "pr11734.h" +namespace A { + void pr11734::foo(void) { } +} --- a/gdb/testsuite/gdb.cp/pr11734-3.cc +++ b/gdb/testsuite/gdb.cp/pr11734-3.cc @@ -20,8 +20,11 @@ #include "pr11734.h" +namespace A { + void pr11734::foo (int a) { } +} --- a/gdb/testsuite/gdb.cp/pr11734-4.cc +++ b/gdb/testsuite/gdb.cp/pr11734-4.cc @@ -20,8 +20,11 @@ #include "pr11734.h" +namespace A { + void pr11734::foo (char *a) { } +} --- a/gdb/testsuite/gdb.cp/pr11734.exp +++ b/gdb/testsuite/gdb.cp/pr11734.exp @@ -34,6 +34,15 @@ if {![runto_main]} { continue } +if [gdb_breakpoint "func"] { + pass "break func" +} +if [gdb_breakpoint "'func'"] { + pass "break 'func'" +} + +gdb_test "ptype ${class}::l" "type = long" + # An array holding the overload types for the method pr11734::foo. The # first element is the overloaded method parameter. The second element # is the expected source file number, e.g. "pr11734-?.cc". --- a/gdb/testsuite/gdb.cp/pr11734.h +++ b/gdb/testsuite/gdb.cp/pr11734.h @@ -18,11 +18,15 @@ Please email any bugs, comments, and/or additions to this file to: bug-gdb@gnu.org */ +namespace A { + class pr11734 { public: - void foo (); - void foo (int); - void foo (char *); + static void foo (); + static void foo (int); + static void foo (char *); + long l; }; +}