[PATCH v2 2/2] gdb: Simplify psymbol_functions::require_partial_symbols

Simon Marchi simark@simark.ca
Fri May 20 16:07:19 GMT 2022


On 2022-05-19 14:45, Lancelot SIX via Gdb-patches wrote:
> The previous patch ensured that partial symbols are read before calling
> most of the quick_function's methods.
>
> The psymbol_functions class has the require_partial_symbols method which
> serves this exact purpose.  This method does not need to try to read partial
> symbols anymore, but it can instead assert that any partial symbol have
> been read at this point.
>
> Regression tested on x86_64-linux.
> ---
>  gdb/psymtab.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/psymtab.c b/gdb/psymtab.c
> index 402d6085fe6..2bf6cbc5848 100644
> --- a/gdb/psymtab.c
> +++ b/gdb/psymtab.c
> @@ -84,7 +84,7 @@ psymtab_storage::install_psymtab (partial_symtab *pst)
>  psymtab_storage::partial_symtab_range
>  psymbol_functions::require_partial_symbols (struct objfile *objfile)
>  {
> -  objfile->require_partial_symbols (true);
> +  gdb_assert ((objfile->flags & OBJF_PSYMTABS_READ) != 0);
>    return m_partial_symtabs->range ();
>  }

It sounds like the method should be renamed then.  The "require" meant
that it would read the psymbols if needed.  Now it's really just a
getter, so it could probably be named just "partial_symbols".

Simon


More information about the Gdb-patches mailing list