From: Wei-min 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: Thu, 18 Jan 2018 00:18:00 -0000 [thread overview]
Message-ID: <b635472c-6a26-3be5-20bc-c91a1ed6d3a4@oracle.com> (raw)
In-Reply-To: <CAH=s-PPXK3aDnNqAwBf1=qVVup_CwvYvHUKWRB8CprRM3E7hgA@mail.gmail.com>
On 1/17/2018 12:55 AM, Yao Qi wrote:
> On Wed, Jan 17, 2018 at 1:05 AM, Weimin Pan <weimin.pan@oracle.com> wrote:
>> 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.
>>
> dwarf2_physname is called twice with the parameter NAME is
> "another_thread_local".
> The first is about DW_TAG_member and the second is about DW_TAG_variable.
>
> <2><37>: Abbrev Number: 3 (DW_TAG_member)
> <38> DW_AT_name : (indirect string, offset: 0x6e):
> another_thread_local
> <3c> DW_AT_decl_file : 1
> <3d> DW_AT_decl_line : 3
> <3e> DW_AT_type : <0x44>
> <42> DW_AT_external : 1
> <42> DW_AT_accessibility: 1 (public)
> <43> DW_AT_declaration : 1
> ....
> <1><68>: Abbrev Number: 6 (DW_TAG_variable)
> <69> DW_AT_specification: <0x37>
> <6d> DW_AT_decl_line : 6
> <6e> DW_AT_linkage_name: (indirect string, offset: 0x0):
> _ZN1K20another_thread_localE
>
> The second one matters, not the first one. If I set this breakpoint,
> it will hit twice,
>
> (gdb) b dwarf2_physname if strcmp (name, "another_thread_local") == 0
>
> in the 2nd breakpoint hit, you can see dwarf2_physname is called by
> new_symbol_full,
>
> (gdb) bt 5
> #0 dwarf2_physname (name=0x60d0000096fe "another_thread_local",
> die=0x621000156ce0, cu=0x612000018340)
> at gdb/dwarf2read.c:11183
> #1 0x00000000008f20a9 in new_symbol_full (die=0x621000156ce0,
> type=0x0, cu=0x612000018340, space=0x0)
> at gdb/dwarf2read.c:21416
> #2 0x00000000008c80a6 in read_variable (die=0x621000156ce0,
> cu=0x612000018340) at gdb/dwarf2read.c:14439
>
> it returns "K::another_thread_local", and use it to set symbol name.
> That symbol
> is used in lookup_minimal_symbol_and_objfile (SYMBOL_LINKAGE_NAME (sym))
> later when you type command "info address K::another_thread_local".
Yes, the 2nd breakpoint hit in dwarf2_physname() was to handle
the DW_TAG_variable die for another_thread_local. The function
did fetch the correct mangled name from dw2_linkage_name() and
set it in local variable "mangled". Problem is "mangled" got
demangled with gdb_demangle(), for the purpose of suppressing
C++ template function's return type which I don't quite follow,
and the demangled name gets returned.
next prev parent reply other threads:[~2018-01-18 0:18 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
2018-01-17 8:57 ` Yao Qi
2018-01-18 0:18 ` Wei-min Pan [this message]
[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=b635472c-6a26-3be5-20bc-c91a1ed6d3a4@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).