From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [patch] Fix C++ demangling of minsyms with symver
Date: Thu, 02 Jun 2011 21:45:00 -0000 [thread overview]
Message-ID: <20110602214447.GA1609@host1.jankratochvil.net> (raw)
In-Reply-To: <20110602153308.GA21368@host1.jankratochvil.net>
Hi,
just a testcase fixup due to a different patches order.
Jan
gdb/
2011-06-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* 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 <jan.kratochvil@redhat.com>
* 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 <http://www.gnu.org/licenses/>. */
+
+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 <http://www.gnu.org/licenses/>.
+
+# 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 .*"
prev parent reply other threads:[~2011-06-02 21:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 15:33 Jan Kratochvil
2011-06-02 18:04 ` Tom Tromey
2011-06-02 18:24 ` Jan Kratochvil
2011-06-02 21:45 ` Jan Kratochvil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110602214447.GA1609@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox