From: Frederic RISS <frederic.riss@st.com>
To: gdb@sourceware.org
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Get versioned minsyms from dynamic symtab (Was: Re: How to call operator<< functions?)
Date: Thu, 31 Aug 2006 11:34:00 -0000 [thread overview]
Message-ID: <1157024034.3429.303.camel@crx549.cro.st.com> (raw)
In-Reply-To: <1156944608.3429.275.camel@crx549.cro.st.com>
[-- Attachment #1: Type: text/plain, Size: 1159 bytes --]
On Linux, versioned ELF symbols are stored in the static symtab with an
(@)@VERSION suffix. We store such symbols with the suffix and thus fail
to find them when looking up the real name.
This causes failures such as the one described here:
http://www.sourceware.org/ml/gdb/2006-08/msg00244.html
In the general case, GDB doesn't use the dynamic symtab because it
contains usually only a subset of the static table information. The
attached patch make GDB store dynamic versioned symbols.
Maybe this is harvests too much symbols, and we should limit it to the
dynamic symbols of the main executable. It's easy enough to do, we just
need to pass the 'mainline' flag to elf_symfile_read from
elf_symtab_read.
I've no idea if this could break something on non-Linux platforms, I've
just tested on x86-linux.
I'm also attaching a little testsuite patch that fails for me on current
GDB and works with the patch.
Opinions?
2006-08-31 Frederic Riss <frederic.riss@st.com>
* elfread.c (elf_symtab_read): Read versioned symbols from
the dynamic symtab.
2006-08-31 Frederic Riss <frederic.riss@st.com>
* gdb.cp/userdef.exp: Test use of std::cout.
[-- Attachment #2: versioned-symbols.patch --]
[-- Type: text/x-patch, Size: 993 bytes --]
Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.55
diff -u -p -r1.55 elfread.c
--- elfread.c 21 Feb 2006 20:38:48 -0000 1.55
+++ elfread.c 31 Aug 2006 10:50:17 -0000
@@ -211,9 +211,14 @@ elf_symtab_read (struct objfile *objfile
/* If it is a nonstripped executable, do not enter dynamic
symbols, as the dynamic symbol table is usually a subset
- of the main symbol table. */
- if (dynamic && !stripped)
+ of the main symbol table.
+ The Linux ELF symbol versionning requires that the versioned
+ static symbols are suffixed with (@)@VERSION, thus the
+ entries we got from the static symtab for these symbols have
+ suffixed names. The entries in the dynamic symtab don't have
+ the suffix (version info is stored in .gnu_version section). */
+ if (dynamic && !stripped && !((elf_symbol_type *) sym)->version)
continue;
if (sym->flags & BSF_FILE)
{
[-- Attachment #3: testsuite-cout.patch --]
[-- Type: text/x-patch, Size: 719 bytes --]
? testsuite-cout.patch
Index: gdb.cp/userdef.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/userdef.exp,v
retrieving revision 1.6
diff -u -p -r1.6 userdef.exp
--- gdb.cp/userdef.exp 10 Aug 2006 05:27:20 -0000 1.6
+++ gdb.cp/userdef.exp 31 Aug 2006 10:58:01 -0000
@@ -151,5 +151,8 @@ gdb_test "print *c" "\\\$\[0-9\]* = \\(M
gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex"
gdb_test "ptype &*c" "type = struct Member {\[\r\n \]+int z;\[\r\n\]+} &\\*"
+# Check that we're able to use std::cout
+gdb_test "print 'operator<<'(std::cout, one)" "\[\r\n\]+x = 9\[\r\n\]+y = 10\[\r\n\]+-------\[\r\n\]+\\\$\[0-9\]* = .*"
+
gdb_exit
return 0
next prev parent reply other threads:[~2006-08-31 11:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-30 10:11 How to call operator<< functions? Michael Veksler
2006-08-30 11:13 ` Frederic RISS
2006-08-30 13:30 ` Frederic RISS
2006-08-30 13:40 ` Breakpoint Handling in GDB Veenu Verma (AS/EAB)
2006-08-30 13:43 ` Daniel Jacobowitz
2006-08-30 20:30 ` Michael Snyder
2006-08-31 11:34 ` Frederic RISS [this message]
2006-08-31 12:09 ` Get versioned minsyms from dynamic symtab (Was: Re: How to call operator<< functions?) Michael Veksler
2006-08-31 12:26 ` Frederic RISS
2006-08-31 13:02 ` Michael Veksler
2006-08-31 13:23 ` Frederic RISS
2006-08-31 16:48 ` Frederic RISS
2006-08-31 16:57 ` Daniel Jacobowitz
2006-08-31 17:41 ` Frédéric Riss
2006-08-31 17:45 ` Daniel Jacobowitz
2006-08-31 19:48 ` Michael Veksler
2006-08-31 19:52 ` Daniel Jacobowitz
2006-08-30 12:46 ` How to call operator<< functions? Daniel Jacobowitz
2006-08-30 20:05 ` Michael Veksler
2006-08-30 20:24 ` Daniel Jacobowitz
2006-08-30 20:45 ` Michael Veksler
2006-08-30 20:54 ` Daniel Jacobowitz
2006-08-31 12:05 ` Michael Veksler
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=1157024034.3429.303.camel@crx549.cro.st.com \
--to=frederic.riss@st.com \
--cc=gdb-patches@sourceware.org \
--cc=gdb@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