public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dje at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/17201] New: problems with gdb-generated plt symbols
Date: Fri, 25 Jul 2014 23:01:00 -0000	[thread overview]
Message-ID: <bug-17201-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=17201

            Bug ID: 17201
           Summary: problems with gdb-generated plt symbols
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com

This pr is to document some problems I'm seeing with gdb-generated plt symbols.

The first one is that in a shared library with --export-dynamic, there are two
ELF symbols with the same name:
1) the real function
2) the gdb-generated copy of the @plt symbol

The "bug" is kinda subtle and may not result in any broken behaviour, though I
have another bug to add here that may be related.

symbol_set_names has this:

    /* If this name is not in the hash table, add it.  */
    if (*slot == NULL
        /* A C version of the symbol may have already snuck into the table.     
           This happens to, e.g., main.init (__go_init_main).  Cope.  */
        || (gsymbol->language == language_go
            && (*slot)->demangled[0] == '\0'))
      {
        char *demangled_name = symbol_find_demangled_name (gsymbol,
                                                           linkage_name_copy);

A problem is that symbol_find_demangled_name has side-effects, and if a second
symbol is looked up with the same name, then it won't get its language field
updated from language_auto (which is what prim_record_minimal_symbol_full
initially sets it to, the reason for which can be found in the docs for
install_minimal_symbols).  This then causes build_minimal_symbol_hash_tables
to not install the symbol in the demangled hash table because this test fails:

        if (MSYMBOL_SEARCH_NAME (msym) != MSYMBOL_LINKAGE_NAME (msym))

It fails because while the demangled name got set, the language was left as
"auto".

This is a problem at least because it causes confusion when tracking down other
real bugs: iterate_over_minimal_symbols, called from
linespec.c:search_minsyms_for_name, won't find it, so while this symbol would
get included in the result for the main executable, it's missing in the result
for the shared lib.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


             reply	other threads:[~2014-07-25 23:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 23:01 dje at google dot com [this message]
2014-07-25 23:01 ` [Bug symtab/17201] " dje at google dot com
2014-07-25 23:02 ` dje at google dot com
2014-07-25 23:06 ` dje at google dot com
2014-07-25 23:51 ` dje at google dot com
2014-07-25 23:52 ` dje at google dot com
2014-07-25 23:54 ` dje at google dot com
2014-07-26 19:42 ` dje at google dot com
2023-01-30 10:52 ` aburgess at redhat dot com
2023-02-12  6:21 ` cvs-commit at gcc dot gnu.org
2023-02-12  6:40 ` aburgess at redhat dot com

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=bug-17201-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).