From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13204 invoked by alias); 2 Jun 2011 21:45:10 -0000 Received: (qmail 13184 invoked by uid 22791); 2 Jun 2011 21:45:08 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,TW_YM,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; Thu, 02 Jun 2011 21:44:52 +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.14.4/8.14.4) with ESMTP id p52LiqLe016773 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Jun 2011 17:44:52 -0400 Received: from host1.jankratochvil.net (ovpn-113-38.phx2.redhat.com [10.3.113.38]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p52Lin4R020326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 2 Jun 2011 17:44:51 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p52LinpW007011 for ; Thu, 2 Jun 2011 23:44:49 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p52LimAJ007005 for gdb-patches@sourceware.org; Thu, 2 Jun 2011 23:44:48 +0200 Date: Thu, 02 Jun 2011 21:45:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: Re: [patch] Fix C++ demangling of minsyms with symver Message-ID: <20110602214447.GA1609@host1.jankratochvil.net> References: <20110602153308.GA21368@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110602153308.GA21368@host1.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-06/txt/msg00045.txt.bz2 Hi, just a testcase fixup due to a different patches order. Jan gdb/ 2011-06-02 Jan Kratochvil * symtab.c (symbol_find_demangled_name): New parameter objfile. Always call bfd_demangle, not cplus_demangle. (symbol_set_names): Pass OBJFILE. gdb/testsuite/ 2011-06-02 Jan Kratochvil * gdb.cp/cp-symver.cc: New file. * gdb.cp/cp-symver.exp: New file. --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -478,7 +478,7 @@ create_demangled_names_hash (struct objfile *objfile) static char * symbol_find_demangled_name (struct general_symbol_info *gsymbol, - const char *mangled) + const char *mangled, struct objfile *objfile) { char *demangled = NULL; @@ -499,8 +499,8 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, if (gsymbol->language == language_cplus || gsymbol->language == language_auto) { - demangled = - cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI); + demangled = bfd_demangle (objfile->obfd, mangled, + DMGL_PARAMS | DMGL_ANSI); if (demangled != NULL) { gsymbol->language = language_cplus; @@ -509,9 +509,8 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, } if (gsymbol->language == language_java) { - demangled = - cplus_demangle (mangled, - DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA); + demangled = bfd_demangle (objfile->obfd, mangled, + DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA); if (demangled != NULL) { gsymbol->language = language_java; @@ -651,7 +650,8 @@ symbol_set_names (struct general_symbol_info *gsymbol, if (*slot == NULL) { char *demangled_name = symbol_find_demangled_name (gsymbol, - linkage_name_copy); + linkage_name_copy, + objfile); int demangled_len = demangled_name ? strlen (demangled_name) : 0; /* Suppose we have demangled_name==NULL, copy_name==0, and --- /dev/null +++ b/gdb/testsuite/gdb.cp/cp-symver.cc @@ -0,0 +1,33 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 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 . */ + +void a () {} /* at-func-a */ + +/* Give `a' external name `v()' requiring version `VER_A'. */ +asm (".symver _Z1av, _Z1vv@VER_A"); + +void b () {} /* at-func-b */ + +/* Give `b' external name `v()' with default version `VER_B'. */ +asm (".symver _Z1bv, _Z1vv@@VER_B"); + +int +main () +{ + a (); + b (); +} --- /dev/null +++ b/gdb/testsuite/gdb.cp/cp-symver.exp @@ -0,0 +1,38 @@ +# Copyright 2011 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 . + +# Test C++ demangling of versioned symbols. + +set testfile cp-symver +set srcfile ${testfile}.cc +if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] { + return -1 +} + +if ![runto_main] { + untested ${testfile}.exp + return -1 +} + +gdb_test_no_output "set breakpoint pending off" + +gdb_breakpoint {'v()@VER_A'} +gdb_breakpoint {'v()@@VER_B'} + +# GDB currently does not support the default version assumption. +gdb_test "break v()" {Function "v\(\)" not defined\.} + +gdb_continue_to_breakpoint "a" ".* at-func-a .*" +gdb_continue_to_breakpoint "b" ".* at-func-b .*"