aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2024-05-16 16:37:06 -0400
committerSimon Marchi <simon.marchi@efficios.com>2024-07-15 14:34:12 -0400
commit9c067e28448f0314d1b0440945e16382a226fd7b (patch)
tree5260c8605c6335170ce5a35da2e7f416277017ae /gdb
parentcc7541ce5e1c317c7b185b005f0c048c997b2b58 (diff)
downloadgdb-9c067e28448f0314d1b0440945e16382a226fd7b.zip
gdb-9c067e28448f0314d1b0440945e16382a226fd7b.tar.gz
gdb-9c067e28448f0314d1b0440945e16382a226fd7b.tar.bz2
gdb: pass program space to have_{full,partial}_symbols
Make the current program space reference bubble up one level. Change-Id: I19c4fc2ca955f9c828ef426a077b43983865697b Approved-By: Tom Tromey <tom@tromey.com> Reviewed-By: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ada-exp.y4
-rw-r--r--gdb/c-exp.y3
-rw-r--r--gdb/cli/cli-cmds.c3
-rw-r--r--gdb/d-exp.y3
-rw-r--r--gdb/go-exp.y4
-rw-r--r--gdb/infcmd.c2
-rw-r--r--gdb/linespec.c9
-rw-r--r--gdb/objfiles.c12
-rw-r--r--gdb/objfiles.h14
-rw-r--r--gdb/p-exp.y4
-rw-r--r--gdb/parse.c3
-rw-r--r--gdb/source.c5
-rw-r--r--gdb/symfile.c8
-rw-r--r--gdb/symtab.c8
-rw-r--r--gdb/tui/tui-disasm.c3
15 files changed, 48 insertions, 37 deletions
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 0126db5..dfcbb2b 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)
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/c-exp.y b/gdb/c-exp.y
index 6022317..a1a74a9 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1213,7 +1213,8 @@ variable: name_not_typename
= lookup_bound_minimal_symbol (arg.c_str ());
if (msymbol.minsym == NULL)
{
- if (!have_full_symbols () && !have_partial_symbols ())
+ if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space))
error (_("No symbol table is loaded. Use the \"file\" command."));
else
error (_("No symbol \"%s\" in current context."),
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 4500091..9d3a90b 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1327,7 +1327,8 @@ list_command (const char *arg, int from_tty)
and clear NO_END; however, if one of the arguments is blank,
set DUMMY_BEG or DUMMY_END to record that fact. */
- if (!have_full_symbols () && !have_partial_symbols ())
+ if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space))
error (_("No symbol table is loaded. Use the \"file\" command."));
std::vector<symtab_and_line> sals;
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index 13d2cfa..6feacd8 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -466,7 +466,8 @@ PrimaryExpression:
msymbol = lookup_bound_minimal_symbol (copy.c_str ());
if (msymbol.minsym != NULL)
pstate->push_new<var_msym_value_operation> (msymbol);
- else if (!have_full_symbols () && !have_partial_symbols ())
+ else if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space))
error (_("No symbol table is loaded. Use the \"file\" command"));
else
error (_("No symbol \"%s\" in current context."),
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 1a6ebbe..115c71b 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -577,8 +577,8 @@ variable: name_not_typename
if (msymbol.minsym != NULL)
pstate->push_new<var_msym_value_operation>
(msymbol);
- else if (!have_full_symbols ()
- && !have_partial_symbols ())
+ else if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space))
error (_("No symbol table is loaded. "
"Use the \"file\" command."));
else
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 4ed55f1..4ce11b5 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -519,7 +519,7 @@ start_command (const char *args, int from_tty)
/* Some languages such as Ada need to search inside the program
minimal symbols for the location where to put the temporary
breakpoint before starting. */
- if (!have_minimal_symbols ())
+ if (!have_minimal_symbols (current_program_space))
error (_("No symbol table loaded. Use the \"file\" command."));
/* Run the program until reaching the main procedure... */
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 9769f01..8670e0a 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1550,9 +1550,9 @@ symbol_not_found_error (const char *symbol, const char *filename)
if (symbol == NULL)
symbol = "";
- if (!have_full_symbols ()
- && !have_partial_symbols ()
- && !have_minimal_symbols ())
+ if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space)
+ && !have_minimal_symbols (current_program_space))
throw_error (NOT_FOUND_ERROR,
_("No symbol table is loaded. Use the \"file\" command."));
@@ -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))
throw_error (NOT_FOUND_ERROR,
_("No symbol table is loaded. "
"Use the \"file\" command."));
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 25129b2..ffa7301 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -755,9 +755,9 @@ objfile_has_symbols (objfile *objfile)
/* See objfiles.h. */
bool
-have_partial_symbols ()
+have_partial_symbols (program_space *pspace)
{
- for (objfile *ofp : current_program_space->objfiles ())
+ for (objfile *ofp : pspace->objfiles ())
if (ofp->has_partial_symbols ())
return true;
@@ -767,9 +767,9 @@ have_partial_symbols ()
/* See objfiles.h. */
bool
-have_full_symbols ()
+have_full_symbols (program_space *pspace)
{
- for (objfile *ofp : current_program_space->objfiles ())
+ for (objfile *ofp : pspace->objfiles ())
if (objfile_has_full_symbols (ofp))
return true;
@@ -795,9 +795,9 @@ objfile_purge_solibs (program_space *pspace)
/* See objfiles.h. */
bool
-have_minimal_symbols ()
+have_minimal_symbols (program_space *pspace)
{
- for (objfile *ofp : current_program_space->objfiles ())
+ for (objfile *ofp : pspace->objfiles ())
if (ofp->per_bfd->minimal_symbol_count > 0)
return true;
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 5cf7331..252b52e 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -932,14 +932,13 @@ extern bool objfile_has_full_symbols (objfile *objfile);
extern bool objfile_has_symbols (objfile *objfile);
-/* Return true if any objfile of the current program space has partial
- symbols. */
+/* Return true if any objfile of PSPACE has partial symbols. */
-extern bool have_partial_symbols ();
+extern bool have_partial_symbols (program_space *pspace);
-/* Return true if any objfile of the current program space has full symbols. */
+/* Return true if any objfile of PSPACE has full symbols. */
-extern bool have_full_symbols ();
+extern bool have_full_symbols (program_space *pspace);
extern void objfile_set_sym_fns (struct objfile *objfile,
const struct sym_fns *sf);
@@ -966,10 +965,9 @@ extern void objfile_purge_solibs (program_space *pspace);
/* Functions for dealing with the minimal symbol table, really a misc
address<->symbol mapping for things we don't have debug symbols for. */
-/* Return true if any objfile of the current program space has minimal
- symbols. */
+/* Return true if any objfile of PSPACE has minimal symbols. */
-extern bool have_minimal_symbols ();
+extern bool have_minimal_symbols (program_space *pspace);
extern struct obj_section *find_pc_section (CORE_ADDR pc);
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index f334db6..0a0fa95 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -725,8 +725,8 @@ variable: name_not_typename
if (msymbol.minsym != NULL)
pstate->push_new<var_msym_value_operation>
(msymbol);
- else if (!have_full_symbols ()
- && !have_partial_symbols ())
+ else if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space))
error (_("No symbol table is loaded. "
"Use the \"file\" command."));
else
diff --git a/gdb/parse.c b/gdb/parse.c
index 0a2b2a5..c10b09a 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -148,7 +148,8 @@ parser_state::push_symbol (const char *name, block_symbol sym)
struct bound_minimal_symbol msymbol = lookup_bound_minimal_symbol (name);
if (msymbol.minsym != NULL)
push_new<expr::var_msym_value_operation> (msymbol);
- else if (!have_full_symbols () && !have_partial_symbols ())
+ else if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space))
error (_("No symbol table is loaded. Use the \"file\" command."));
else
error (_("No symbol \"%s\" in current context."), name);
diff --git a/gdb/source.c b/gdb/source.c
index bced213..bdbe67d 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -260,8 +260,9 @@ get_current_source_symtab_and_line (void)
void
set_default_source_symtab_and_line (void)
{
- if (!have_full_symbols () && !have_partial_symbols ())
- error (_("No symbol table is loaded. Use the \"file\" command."));
+ if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space))
+ error (_ ("No symbol table is loaded. Use the \"file\" command."));
/* Pull in a current source symtab if necessary. */
current_source_location *loc = get_source_location (current_program_space);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 6923048..a4f964a 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))
&& mainline))
- && !query (_("Load new symbol table from \"%s\"? "), name))
+ && !query (_ ("Load new symbol table from \"%s\"? "), name))
error (_("Not confirmed."));
if (mainline)
@@ -1199,7 +1200,8 @@ symbol_file_add_main_1 (const char *args, symfile_add_flags add_flags,
void
symbol_file_clear (int from_tty)
{
- if ((have_full_symbols () || have_partial_symbols ())
+ if ((have_full_symbols (current_program_space)
+ || have_partial_symbols (current_program_space))
&& from_tty
&& (current_program_space->symfile_object_file
? !query (_("Discard symbol table from `%s'? "),
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 9ffc1e0..bb2fc04 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4764,8 +4764,9 @@ info_sources_worker (struct ui_out *uiout,
static void
info_sources_command (const char *args, int from_tty)
{
- if (!have_full_symbols () && !have_partial_symbols ())
- error (_("No symbol table is loaded. Use the \"file\" command."));
+ if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space))
+ error (_ ("No symbol table is loaded. Use the \"file\" command."));
filename_partial_match_opts match_opts;
auto group = make_info_sources_options_def_group (&match_opts);
@@ -6381,7 +6382,8 @@ make_source_files_completion_list (const char *text, const char *word)
const char *base_name;
struct add_partial_filename_data datum;
- if (!have_full_symbols () && !have_partial_symbols ())
+ if (!have_full_symbols (current_program_space)
+ && !have_partial_symbols (current_program_space))
return list;
filename_seen_cache filenames_seen;
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 0727d3a..2f25fed 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -389,7 +389,8 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
if (tui_location.addr () == 0)
{
- if (have_full_symbols () || have_partial_symbols ())
+ if (have_full_symbols (current_program_space)
+ || have_partial_symbols (current_program_space))
{
set_default_source_symtab_and_line ();
struct symtab_and_line sal = get_current_source_symtab_and_line ();