From: Weimin Pan <weimin.pan@oracle.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PING 2][PATCH PR gdb/18071] TLS variables can't be resolved on aarch64-linux-gnu
Date: Fri, 12 Jan 2018 23:59:00 -0000 [thread overview]
Message-ID: <a2da6cf7-a14d-2b1c-05b9-f44a2dd67102@oracle.com> (raw)
In-Reply-To: <515b875f-8240-b7e0-f5cc-4a26efb64b89@oracle.com>
On 11/15/2017 5:51 PM, Wei-min Pan wrote:
>
> On 11/2/2017 8:32 AM, Weimin Pan wrote:
>> Running the test case with upstream gdb shows two failures:
>>
>> (1) Receiving different error messages when printing TLS variable before
>> Â Â Â Â program runs - because the ARM compiler does not emit dwarf
>> attribute
>> Â Â Â Â DW_AT_location for TLS, the result is expected and the baseline may
>> Â Â Â Â need to be changed for aarch64.
>>
>> (2) Using "info address" command on C++ static TLS object resulted in
>> Â Â Â Â "symbol unresolved" error - below is a snippet from the test case:
>>
>> class K {
>> Â public:
>> Â Â static __thread int another_thread_local;
>> };
>>
>> __thread int K::another_thread_local;
>>
>> (gdb) info address K::another_thread_local
>> Symbol "K::another_thread_local" is unresolved.
>>
>> This patch contains fix for (2).
>>
>> 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.
>>
>> 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().
>>
>> Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions.
>> ---
>> Â gdb/ChangeLog |Â Â Â 5 +++++
>> Â gdb/minsyms.c |Â Â 17 +++--------------
>> Â 2 files changed, 8 insertions(+), 14 deletions(-)
>>
>> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
>> index 4b292e0..2f630bc 100644
>> --- a/gdb/ChangeLog
>> +++ b/gdb/ChangeLog
>> @@ -1,3 +1,8 @@
>> +2017-11-01 Weimin Pan <weimin.pan@oracle.com>
>> +
>> +Â Â Â * minsyms.c (lookup_minimal_symbol_and_objfile): Use
>> +Â Â Â lookup_minimal_symbol() to find symbol entry.
>> +
>>  2017-10-27 Keith Seitz <keiths@redhat.com>
>> Â Â Â Â Â Â * breakpoint.c (print_breakpoint_location): Use the symbol saved
>> diff --git a/gdb/minsyms.c b/gdb/minsyms.c
>> index 37edbd8..4edd8b1 100644
>> --- a/gdb/minsyms.c
>> +++ b/gdb/minsyms.c
>> @@ -881,23 +881,12 @@ lookup_minimal_symbol_and_objfile (const char
>> *name)
>> Â {
>> Â Â Â struct bound_minimal_symbol result;
>> Â Â Â struct objfile *objfile;
>> -Â unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
>> Â Â Â Â ALL_OBJFILES (objfile)
>> Â Â Â Â Â {
>> -Â Â Â Â Â struct minimal_symbol *msym;
>> -
>> -Â Â Â Â Â for (msym = objfile->per_bfd->msymbol_hash[hash];
>> -Â Â Â Â Â Â msym != NULL;
>> -Â Â Â Â Â Â msym = msym->hash_next)
>> -Â Â Â {
>> -Â Â Â Â Â if (strcmp (MSYMBOL_LINKAGE_NAME (msym), name) == 0)
>> -Â Â Â Â Â Â Â {
>> -Â Â Â Â Â Â Â Â Â result.minsym = msym;
>> -Â Â Â Â Â Â Â Â Â result.objfile = objfile;
>> -Â Â Â Â Â Â Â Â Â return result;
>> -Â Â Â Â Â Â Â }
>> -Â Â Â }
>> +Â Â Â Â Â result = lookup_minimal_symbol (name, NULL, objfile);
>> +Â Â Â Â Â if (result.minsym != NULL)
>> +Â Â Â Â Â Â Â return result;
>> Â Â Â Â Â }
>> Â Â Â Â memset (&result, 0, sizeof (result));
>
next prev parent reply other threads:[~2018-01-12 23:59 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 ` [PING][PATCH " 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
[not found] ` <515b875f-8240-b7e0-f5cc-4a26efb64b89@oracle.com>
2018-01-12 23:59 ` Weimin Pan [this message]
[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=a2da6cf7-a14d-2b1c-05b9-f44a2dd67102@oracle.com \
--to=weimin.pan@oracle.com \
--cc=gdb-patches@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).