From: Simon Marchi Date: Thu, 16 May 2024 20:21:23 +0000 (-0400) Subject: gdb: pass program space to clear_current_source_symtab_and_line X-Git-Tag: binutils-2_43~118 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fbee6a57b23782212e1b2ebf46203da926d3dfb3;p=thirdparty%2Fbinutils-gdb.git gdb: pass program space to clear_current_source_symtab_and_line Make the current program space reference bubble up one level. Change-Id: I692554474d17e4f4708fd8ad662bf6c0bb964726 Approved-By: Tom Tromey Reviewed-By: Thiago Jung Bauermann --- diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 3af794cebaf..450009156d4 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1295,7 +1295,7 @@ list_command (const char *arg, int from_tty) { /* The inferior is not running, so reset the current source location to the default (usually the main function). */ - clear_current_source_symtab_and_line (); + clear_current_source_symtab_and_line (current_program_space); try { set_default_source_symtab_and_line (); diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 56add01daa6..f51baab8d2c 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -564,7 +564,7 @@ objfile::~objfile () struct symtab_and_line cursal = get_current_source_symtab_and_line (); if (cursal.symtab && cursal.symtab->compunit ()->objfile () == this) - clear_current_source_symtab_and_line (); + clear_current_source_symtab_and_line (this->pspace ()); } /* Rebuild section map next time we need it. */ diff --git a/gdb/source.c b/gdb/source.c index 9e528d3f705..bced213171a 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -298,9 +298,9 @@ set_current_source_symtab_and_line (const symtab_and_line &sal) /* Reset any information stored about a default file and line to print. */ void -clear_current_source_symtab_and_line (void) +clear_current_source_symtab_and_line (program_space *pspace) { - current_source_location *loc = get_source_location (current_program_space); + current_source_location *loc = get_source_location (pspace); loc->set (nullptr, 0); } diff --git a/gdb/source.h b/gdb/source.h index 144ee48f722..4eb17937899 100644 --- a/gdb/source.h +++ b/gdb/source.h @@ -21,6 +21,7 @@ #include "gdbsupport/scoped_fd.h" +struct program_space; struct symtab; /* See openp function definition for their description. */ @@ -126,7 +127,7 @@ extern symtab_and_line set_current_source_symtab_and_line (const symtab_and_line &sal); /* Reset any information stored about a default file and line to print. */ -extern void clear_current_source_symtab_and_line (void); +extern void clear_current_source_symtab_and_line (program_space *pspace); /* Add a source path substitution rule. */ extern void add_substitute_path_rule (const char *, const char *); diff --git a/gdb/symfile.c b/gdb/symfile.c index 6b722214663..69230482da3 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2884,7 +2884,7 @@ clear_symtab_users (symfile_add_flags add_flags) /* Clear the "current" symtab first, because it is no longer valid. breakpoint_re_set may try to access the current symtab. */ - clear_current_source_symtab_and_line (); + clear_current_source_symtab_and_line (current_program_space); clear_displays (); clear_last_displayed_sal ();