public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <Lancelot.Six@amd.com>
To: Tom Tromey <tom@tromey.com>,
	Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
Cc: lsix@lancelotsix.com
Subject: Re: [PATCH] gdb: cooked_index_functions::expand_symtabs_matching: require psymtab
Date: Thu, 19 May 2022 11:46:01 +0100	[thread overview]
Message-ID: <6ac74449-4cdf-84f1-f184-0f73f3abd2bd@amd.com> (raw)
In-Reply-To: <87ilq2d2lu.fsf@tromey.com>

Hi,

Thanks for the comments.

On 18/05/2022 21:09, Tom Tromey wrote:
> [CAUTION: External Email]
> 
>>>>>> Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
>> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
>> index 37e9587e43e..489b857459b 100644
>> --- a/gdb/dwarf2/read.c
>> +++ b/gdb/dwarf2/read.c
>> @@ -18559,6 +18559,9 @@ cooked_index_functions::expand_symtabs_matching
>>         domain_enum domain,
>>         enum search_domain kind)
>>   {
>> +  /* Make sure that the psymtab have been read for objfile.  */
>> +  objfile->require_partial_symbols (false);
> 
> Why 'false' here, when psymtab.c uses 'true'?

This is because otherwise I see a regression in the testsuite (but this 
is probably not a good enough reason, see below).

> 
> Also, can this bug affect the other methods in cooked_index_functions?

I did not initially find other problems, at least not as clear as this 
one.  However the regression mentioned above is a tell I should have 
picked up.

In the regression, we see:

     set variable $x = 32
     Reading symbols from 
.../gdb/testsuite/outputs/gdb.python/py-events/py-events-shlib.so...
     (gdb) FAIL: gdb.python/py-events.exp: do something

This is because the symbol reading from py-events-shlib.so happens quite 
late.  If I compare with how this was done before the new indexer is 
activated (I used 600f5f702728f66ced24f8497c75c58ff442aeb6 as a 
reference), the psymbols for py-events-shlib.so are read from the 
find_pc_sect_compunit_symtab methad, which happens to be called much 
earlier.

So if I also add a objfile->require_partial_symbols call in 
cooked_index_functions::find_pc_sect_compunit_symtab, everything "looks 
good".

The various methods in psymbol_functions consistently uses 
require_partial_symbols.  This could be what should be done in various 
subclasses of quick_symbol_functions used in the new indexer.

However, I feel that it could be clearer to have this done in objfile 
before it actually calls the quick_symbol_functions. This makes it so 
that only the objfile implementation needs to take care of this (This is 
what was initially done with ALL_OBJFILE_PSYMTABS_REQUIRED when lazy 
loading was introduced).

WDYT?

I'll prepare a patch to do this shortly, including changes to address 
Pedro's comments.

Best,
Lancelot.
> 
> thanks,
> Tom

      reply	other threads:[~2022-05-19 10:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 14:19 Lancelot SIX
2022-04-26 19:28 ` Tom Tromey
2022-04-26 23:44   ` Lancelot SIX
2022-04-27 14:11     ` Lancelot SIX
2022-05-04 17:11   ` Six, Lancelot
2022-05-17 13:54     ` Pedro Alves
2022-05-18 20:09 ` Tom Tromey
2022-05-19 10:46   ` Lancelot SIX [this message]

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=6ac74449-4cdf-84f1-f184-0f73f3abd2bd@amd.com \
    --to=lancelot.six@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    --cc=tom@tromey.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).