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 <tom@tromey.com>
Reviewed-By: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
This commit is contained in:
Simon Marchi 2024-05-16 16:21:23 -04:00 committed by Simon Marchi
parent 4113c737bd
commit fbee6a57b2
5 changed files with 7 additions and 6 deletions

View file

@ -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 ();

View file

@ -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. */

View file

@ -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);
}

View file

@ -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 *);

View file

@ -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 ();