This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PING][PATCH PR gdb/18071] TLS variables can't be resolved on aarch64-linux-gnu
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Weimin Pan <weimin dot pan at oracle dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 17 Jan 2018 08:55:07 +0000
- Subject: Re: [PING][PATCH PR gdb/18071] TLS variables can't be resolved on aarch64-linux-gnu
- Authentication-results: sourceware.org; auth=none
- References: <1509636764-46111-1-git-send-email-weimin.pan@oracle.com> <6eadd01b-098c-ca82-b41a-4303f0f6aa0a@oracle.com> <867eshg231.fsf@gmail.com> <f3829e16-8e92-865d-e277-4794f63f3348@oracle.com>
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".
--
Yao (齐尧)