[PATCH 08/14] gdb: pass program space to have_{full,partial}_symbols

Thiago Jung Bauermann thiago.bauermann@linaro.org
Sat Jul 13 05:09:51 GMT 2024


Simon Marchi <simon.marchi@polymtl.ca> writes:

> diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
> index 0126db5f2bee..dfcbb2bebd98 100644
> --- a/gdb/ada-exp.y
> +++ b/gdb/ada-exp.y
> @@ -1857,7 +1857,9 @@ write_var_or_type (struct parser_state *par_state,
>  	    }
>  	}
>  
> -      if (!have_full_symbols () && !have_partial_symbols () && block == NULL)
> +      if (!have_full_symbols (current_program_space)
> +	  && !have_partial_symbols (current_program_space)
> +	  && block == NULL)

If block != nullptr, does it make sense to use block->objfile ()->pspace
here?

>  	error (_("No symbol table is loaded.  Use the \"file\" command."));
>        if (block == par_state->expression_context_block)
>  	error (_("No definition of \"%s\" in current context."), name0.ptr);
> diff --git a/gdb/linespec.c b/gdb/linespec.c
> index 7a1fbc2ebec5..7a6b21e1b741 100644
> --- a/gdb/linespec.c
> +++ b/gdb/linespec.c
> @@ -3716,7 +3716,8 @@ symtabs_from_filename (const char *filename,
>  
>    if (result.empty ())
>      {
> -      if (!have_full_symbols () && !have_partial_symbols ())
> +      if (!have_full_symbols (current_program_space)
> +	  && !have_partial_symbols (current_program_space))

If search_pspace != nullptr, does it make sense to use it here?

>  	throw_error (NOT_FOUND_ERROR,
>  		     _("No symbol table is loaded.  "
>  		       "Use the \"file\" command."));
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 0bdec9af1987..b9a576f24c9c 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -1053,9 +1053,10 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
>  
>    if (from_tty
>        && (always_confirm
> -	  || ((have_full_symbols () || have_partial_symbols ())
> +	  || ((have_full_symbols (current_program_space)
> +	       || have_partial_symbols (current_program_space))

If parent != nullptr, does it make sense to use parent->pspace here?

>  	      && mainline))
> -      && !query (_("Load new symbol table from \"%s\"? "), name))
> +      && !query (_ ("Load new symbol table from \"%s\"? "), name))
>      error (_("Not confirmed."));
>  
>    if (mainline)

-- 
Thiago


More information about the Gdb-patches mailing list