From: Simon Marchi <simark@simark.ca>
To: Christian Biesinger <cbiesinger@google.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Make symbol_set_names a member function
Date: Fri, 27 Dec 2019 03:02:00 -0000 [thread overview]
Message-ID: <34ef9777-7067-8669-a9a5-40c8cfe8e8d6@simark.ca> (raw)
In-Reply-To: <CAPTJ0XFf=_sGgkuyqM52w3ma0ZwG+nswGy7x34_qwKepBUA-rQ@mail.gmail.com>
On 2019-12-26 8:09 p.m., Christian Biesinger wrote:
> On Thu, Dec 26, 2019 at 6:50 PM Simon Marchi <simark@simark.ca> wrote:
>>
>> On 2019-12-26 2:52 a.m., cbiesinger@chromium.org wrote:
>>> From: Christian Biesinger <cbiesinger@google.com>
>>>
>>> This also renames it to make it clearer that this is not a cheap
>>> functin (to compute_and_set_names). Also renames name to m_name
>>
>> "functin"
>
> Thanks, fixed locally.
>
>>> to make the implementation of the renamed function more readable.
>>>
>>> Most of the places that access sym->m_name directly were also changed
>>> to call linkage_name () instead, to make it clearer which name they
>>> are accessing.
>>
>> I think that all makes sense.
>>
>>> @@ -2110,7 +2109,8 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
>>> if (!sym)
>>> {
>>> printf_filtered ("Static symbol `");
>>> - puts_filtered ((*psym)->ginfo.name);
>>> + /* TODO: Should this be print_name ()? */
>>> + puts_filtered ((*psym)->ginfo.linkage_name ());
>>> printf_filtered ("' only found in ");
>>> puts_filtered (ps->filename);
>>> printf_filtered (" psymtab\n");
>>> @@ -2128,7 +2128,8 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
>>> if (!sym)
>>> {
>>> printf_filtered ("Global symbol `");
>>> - puts_filtered ((*psym)->ginfo.name);
>>> + /* TODO: Should this be print_name ()? */
>>> + puts_filtered ((*psym)->ginfo.linkage_name ());
>>> printf_filtered ("' only found in ");
>>> puts_filtered (ps->filename);
>>> printf_filtered (" psymtab\n");
>>
>> For this patch, I wouldn't change the behavior (which means using linkage_name), but we could
>> consider a separate patch to change it.
>
> I removed the TODO locally. OK to push with withose two changes?
Yes.
>> I hacked the code to always enter these ifs and print both the linkage_name
>> and the natural_name. With a C++ test program containing this function:
>>
>> int hello(int);
>>
>> I get:
>>
>> linkage_name: hello
>> natural_name: hello
>>
>> I would have expected linkage_name to be _Z5helloi and the natural_name to be
>> hello(int). Do you know if it's expected for the partial symbol to contain
>> just "hello" for both?
>
> Huh..
>
> I added a printf in compute_and_set_names and found that there's a
> symbol with the mangled name *and* a symbol with the plain name. I
> guess that's why? But I don't know what that means...
Ok, I see what happens. The first call to compute_and_set_names
is while parsing minimal symbols, by minimal_symbol_reader::install.
This one has a mangled linkage name (_Z5helloi).
The second call is while creating partial symbols, by add_psymbol_to_bcache.
This is the one with the linkage name "hello". I suppose that's expected,
I had never really paid attention to this.
There's also a third call, while creating the full blown symbol, with a
linkage name of "hello(int)".
So the term "linkage_name" in general_symbol_info is perhaps a bit misleading,
it makes sense for minimal symbols, but not really for partial and full symbols.
Simon
next prev parent reply other threads:[~2019-12-27 3:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-26 7:52 cbiesinger
2019-12-26 17:50 ` Simon Marchi
2019-12-27 1:09 ` Christian Biesinger via gdb-patches
2019-12-27 3:02 ` Simon Marchi [this message]
2019-12-27 4:43 ` Christian Biesinger via gdb-patches
2020-01-06 19:26 ` Christian Biesinger via gdb-patches
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=34ef9777-7067-8669-a9a5-40c8cfe8e8d6@simark.ca \
--to=simark@simark.ca \
--cc=cbiesinger@google.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