public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Weimin Pan <weimin.pan@oracle.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PING][PATCH PR gdb/18071] TLS variables can't be resolved on aarch64-linux-gnu
Date: Wed, 17 Jan 2018 01:05:00 -0000	[thread overview]
Message-ID: <f3829e16-8e92-865d-e277-4794f63f3348@oracle.com> (raw)
In-Reply-To: <867eshg231.fsf@gmail.com>


On 1/16/2018 9:12 AM, Yao Qi wrote:
> Wei-min Pan <weimin.pan@oracle.com> writes:
>
>>> Function info_address_command() handles the "info address" command and
>>> calls lookup_minimal_symbol_and_objfile() to find sym's symbol entry in
>>> mininal symbol table if SYMBOL_COMPUTED_OPS (sym) is false. Problem is
>>> that function lookup_minimal_symbol_and_objfile() only looked up an
>>> objfile's minsym ordinary hash table, not its demangled hash table, which
>>> was the reason why the C++ name was not found.
> lookup_minimal_symbol_and_objfile is documented as "only checks the
> linkage name" in minsyms.h,
>
> /* Find the minimal symbol named NAME, and return both the minsym
>     struct and its objfile.  This only checks the linkage name.  */
>
> struct bound_minimal_symbol lookup_minimal_symbol_and_objfile (const char *);
>
>>> The fix is to call lookup_minimal_symbol(), which already looks up entries
>>> in both minsym's hash tables, to find names when traversing the object file
>>> list in lookup_minimal_symbol_and_objfile().
> so, it is incorrect to extend it to search demangled name.  If I set a
> breakpoint on lookup_minimal_symbol_and_objfile,
>
> (gdb) info address K::another_thread_local
>
> Breakpoint 1, lookup_minimal_symbol_and_objfile (name=0x621000136e40 "K::another_thread_local") at gdb/minsyms.c:1012
> 1012	  unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
> (gdb) up
> #1  0x0000000000af7690 in info_address_command (exp=0x604000023f5d "K::another_thread_local", from_tty=1)
>      at gdb/printcmd.c:1567
> 1567		msym = lookup_minimal_symbol_and_objfile (SYMBOL_LINKAGE_NAME (sym));
>
> The problem to me is that why SYMBOL_LINKAGE_NAME (sym) is
> "K::another_thread_local", which is a demangled one.  The symbol's name
> is set in dwarf2read.c:new_symbol_full,
>
>        /* Cache this symbol's name and the name's demangled form (if any).  */
>        SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack);
>        linkagename = dwarf2_physname (name, die, cu);
>        SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
>
> however, dwarf2_physname doesn't return the linkage name, so the
> symbol's linkagename is set incorrectly.  I think the right fix would be
> call other function to get linkagename, maybe, dw2_linkage_name?  I
> don't know.
dwarf2_physname() does call dw2_linkage_name(). But since the class member,
i.e.  another_thread_local, does not contain either DW_AT_linkage_name or
DW_AT_MIPS_linkage_name attribute, its canonicalized name gets returned.

  reply	other threads:[~2018-01-17  1:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1509636764-46111-1-git-send-email-weimin.pan@oracle.com>
2017-11-16  1:53 ` Wei-min Pan
2018-01-16 17:12   ` Yao Qi
2018-01-17  1:05     ` Weimin Pan [this message]
2018-01-17  8:57       ` Yao Qi
2018-01-18  0:18         ` Wei-min Pan
     [not found] ` <515b875f-8240-b7e0-f5cc-4a26efb64b89@oracle.com>
2018-01-12 23:59   ` [PING 2][PATCH " Weimin Pan
     [not found]   ` <64a638db-13e1-e692-f775-9afc19677a2a@oracle.com>
2018-01-24  1:11     ` [PING 3][PATCH " Weimin Pan
2018-02-06  1:21       ` [PING 4][PATCH " Weimin Pan
2018-03-06  1:21         ` [PING 5][PATCH " Weimin Pan
2018-03-13 18:56           ` [PING 6][PATCH " Weimin Pan
2018-03-14 21:06             ` Simon Marchi
2018-03-14 21:34               ` Wei-min Pan

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=f3829e16-8e92-865d-e277-4794f63f3348@oracle.com \
    --to=weimin.pan@oracle.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /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).