From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5672 invoked by alias); 22 Jun 2010 01:22:14 -0000 Received: (qmail 5664 invoked by uid 22791); 22 Jun 2010 01:22:13 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,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; Tue, 22 Jun 2010 01:22:07 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5M1M6Ko024428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 21 Jun 2010 21:22:06 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5M1M3sQ006265 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 21 Jun 2010 21:22:05 -0400 Message-ID: <4C20103B.1080906@redhat.com> Date: Tue, 22 Jun 2010 01:22:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc12 Lightning/1.0b2pre Thunderbird/3.0.4 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [RFA] c++/11734 Content-Type: multipart/mixed; boundary="------------030702020007030807040308" 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: 2010-06/txt/msg00467.txt.bz2 This is a multi-part message in MIME format. --------------030702020007030807040308 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1118 Hi, c++/11734 involves being unable to set a breakpoint at a method defined in a different CU from the class declaration. This regression occurs because the dwarf2_physname patch removes the use of DW_AT_MIPS_linkage_name. [You might ask why this is. I refer you to c++/11734 for a more detailed explanation of how gdb "appeared" to work prior to the dwarf2_physname patch.] The attached patch fixes this regression. While testing, I also noticed a related issue with overloaded methods defined in multiple CUs, and I've fixed that, too. Questions/comments/concerns? Keith ChangeLog 2010-06-21 Keith Seitz c++/11734 * linespec.c (decode_compound): If saved_arg is surrounded in single quotes, strip them. * psymtab.c (lookup_partial_symbol): If the search name contains overload information, expand any psymtabs that match the un-overoaded name. testsuite/ChangeLog 2010-06-21 Keith Seitz c++/11734 * gdb.cp/pr11734.exp: New test. * gdb.cp/pr11734-1.cc, gdb.cp/pr11734-2.cc, gdb.cp/pr11734-3.cc, gdb.cp/pr11734-4.cc, gdb.cp/pr11734.h: New files. --------------030702020007030807040308 Content-Type: text/plain; name="pr11734.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr11734.patch" Content-length: 10927 Index: linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.103 diff -u -p -r1.103 linespec.c --- linespec.c 14 May 2010 23:41:04 -0000 1.103 +++ linespec.c 22 Jun 2010 01:19:12 -0000 @@ -1217,6 +1217,19 @@ decode_compound (char **argptr, int funf struct type *t; char *saved_java_argptr = NULL; + /* Strip single quotes from SAVED_ARG. This interferes with this function + which might, e.g., later call strcmp_iw with SYMBOL_LINKAGE_NAME + (which never contains quotes). */ + if (*saved_arg == '\'') + { + char *close = strrchr (saved_arg, '\''); + if (close) + { + ++saved_arg; + *close = '\0'; + } + } + /* First check for "global" namespace specification, of the form "::foo". If found, skip over the colons and jump to normal symbol processing. I.e. the whole line specification starts with Index: psymtab.c =================================================================== RCS file: /cvs/src/src/gdb/psymtab.c,v retrieving revision 1.4 diff -u -p -r1.4 psymtab.c --- psymtab.c 16 May 2010 01:27:02 -0000 1.4 +++ psymtab.c 22 Jun 2010 01:19:12 -0000 @@ -476,12 +476,39 @@ lookup_partial_symbol (struct partial_sy if (!(top == bottom)) internal_error (__FILE__, __LINE__, _("failed internal consistency check")); - while (top <= real_top - && SYMBOL_MATCHES_SEARCH_NAME (*top, name)) + while (top <= real_top) { - if (symbol_matches_domain (SYMBOL_LANGUAGE (*top), - SYMBOL_DOMAIN (*top), domain)) - return (*top); + if (SYMBOL_MATCHES_SEARCH_NAME (*top, name)) + { + if (symbol_matches_domain (SYMBOL_LANGUAGE (*top), + SYMBOL_DOMAIN (*top), domain)) + return (*top); + } + else + { + char *paren = strchr (name, '('); + + if (paren) + { + char *new; + + /* NAME has overload information. Partial symbols, however, + do not. This is a case of mistaken identity. + + Although hacky, this is fixed by expanding this psymtab, + which will allow any subsequent symtab search to succeed. + + For more details/test case, please refer to c++/11734. */ + + new = alloca (strlen (name)); + memcpy (new, name, paren - name); + new[name - paren] = '\0'; + if (SYMBOL_MATCHES_SEARCH_NAME (*top, new)) + PSYMTAB_TO_SYMTAB (pst); + } + else + break; + } top++; } } Index: testsuite/gdb.cp/pr11734-1.cc =================================================================== RCS file: testsuite/gdb.cp/pr11734-1.cc diff -N testsuite/gdb.cp/pr11734-1.cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.cp/pr11734-1.cc 22 Jun 2010 01:19:14 -0000 @@ -0,0 +1,30 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@gnu.org */ + +#include "pr11734.h" + +int +main () +{ + pr11734 *p = new pr11734; + p->foo (); + return 0; +} + Index: testsuite/gdb.cp/pr11734-2.cc =================================================================== RCS file: testsuite/gdb.cp/pr11734-2.cc diff -N testsuite/gdb.cp/pr11734-2.cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.cp/pr11734-2.cc 22 Jun 2010 01:19:14 -0000 @@ -0,0 +1,27 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@gnu.org */ + +#include "pr11734.h" + +void +pr11734::foo(void) +{ +} + Index: testsuite/gdb.cp/pr11734-3.cc =================================================================== RCS file: testsuite/gdb.cp/pr11734-3.cc diff -N testsuite/gdb.cp/pr11734-3.cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.cp/pr11734-3.cc 22 Jun 2010 01:19:14 -0000 @@ -0,0 +1,27 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@gnu.org */ + +#include "pr11734.h" + +void +pr11734::foo (int a) +{ +} + Index: testsuite/gdb.cp/pr11734-4.cc =================================================================== RCS file: testsuite/gdb.cp/pr11734-4.cc diff -N testsuite/gdb.cp/pr11734-4.cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.cp/pr11734-4.cc 22 Jun 2010 01:19:14 -0000 @@ -0,0 +1,27 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@gnu.org */ + +#include "pr11734.h" + +void +pr11734::foo (char *a) +{ +} + Index: testsuite/gdb.cp/pr11734.exp =================================================================== RCS file: testsuite/gdb.cp/pr11734.exp diff -N testsuite/gdb.cp/pr11734.exp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.cp/pr11734.exp 22 Jun 2010 01:19:14 -0000 @@ -0,0 +1,67 @@ +# Copyright 2010 Free Software Foundation, Inc. +# +# Contributed by Red Hat, originally written by Keith Seitz. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This file is part of the gdb testsuite. + +if { [skip_cplus_tests] } { continue } + +set testfile "pr11734" +set class $testfile +set binfile [file join $objdir $subdir $testfile] + +set srcfiles {} +for {set i 1} {$i < 5} {incr i} { + lappend srcfiles [file join $srcdir $subdir $testfile-$i.cc] +} +if {[gdb_compile $srcfiles $binfile executable {debug c++}] != "" } { + untested pr11734.exp + return -1 +} + +if {[get_compiler_info $binfile "c++"]} { + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load $binfile + +if {![runto_main]} { + perror "couldn't run to breakpoint" + continue +} + +# 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". +array set tests { + "char*" 4 + "int" 3 + "" 2 +} + +# Test each overload instance twice: once quoted, once unquoted +foreach ovld [array names tests] { + set method "${class}::foo\($ovld\)" + set result "Breakpoint (\[0-9\]).*file .*/$class-$tests($ovld).*" + gdb_test "break $method" $result + gdb_test "break '$method'" $result +} + +gdb_exit +return 0 Index: testsuite/gdb.cp/pr11734.h =================================================================== RCS file: testsuite/gdb.cp/pr11734.h diff -N testsuite/gdb.cp/pr11734.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.cp/pr11734.h 22 Jun 2010 01:19:14 -0000 @@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@gnu.org */ + +class pr11734 +{ + public: + void foo (); + void foo (int); + void foo (char *); +}; + --------------030702020007030807040308--