gdb: add program_space parameters to some auto-load functions

Make the current_program_space references bubble up a bit.

Change-Id: Id047a48cc8d8a45504cdbb5960bafe3e7735d652
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Simon Marchi 2023-10-03 22:20:20 -04:00
parent eb0558dee5
commit 74ce4f8ecf
4 changed files with 15 additions and 15 deletions

View file

@ -706,12 +706,9 @@ maybe_add_script_text (struct auto_load_pspace_info *pspace_info,
/* Clear the table of loaded section scripts. */
static void
clear_section_scripts (void)
clear_section_scripts (program_space *pspace)
{
struct program_space *pspace = current_program_space;
struct auto_load_pspace_info *info;
info = auto_load_pspace_data.get (pspace);
auto_load_pspace_info *info = auto_load_pspace_data.get (pspace);
if (info != NULL && info->loaded_script_files != NULL)
auto_load_pspace_data.clear (pspace);
}
@ -1175,7 +1172,7 @@ auto_load_new_objfile (struct objfile *objfile)
if (!objfile)
{
/* OBJFILE is NULL when loading a new "main" symbol-file. */
clear_section_scripts ();
clear_section_scripts (current_program_space);
return;
}
@ -1262,15 +1259,14 @@ print_scripts (const std::vector<loaded_script *> &scripts)
PATTERN. FROM_TTY is the usual GDB boolean for user interactivity. */
void
auto_load_info_scripts (const char *pattern, int from_tty,
const struct extension_language_defn *language)
auto_load_info_scripts (program_space *pspace, const char *pattern,
int from_tty, const extension_language_defn *language)
{
struct ui_out *uiout = current_uiout;
struct auto_load_pspace_info *pspace_info;
dont_repeat ();
pspace_info = get_auto_load_pspace_data (current_program_space);
auto_load_pspace_info *pspace_info = get_auto_load_pspace_data (pspace);
if (pattern && *pattern)
{
@ -1347,7 +1343,8 @@ auto_load_info_scripts (const char *pattern, int from_tty,
static void
info_auto_load_gdb_scripts (const char *pattern, int from_tty)
{
auto_load_info_scripts (pattern, from_tty, &extension_language_gdb);
auto_load_info_scripts (current_program_space, pattern, from_tty,
&extension_language_gdb);
}
/* Implement 'info auto-load local-gdbinit'. */

View file

@ -56,8 +56,9 @@ extern void auto_load_objfile_script (struct objfile *objfile,
const struct extension_language_defn *);
extern void load_auto_scripts_for_objfile (struct objfile *objfile);
extern char auto_load_info_scripts_pattern_nl[];
extern void auto_load_info_scripts (const char *pattern, int from_tty,
const struct extension_language_defn *);
extern void auto_load_info_scripts (program_space *pspace, const char *pattern,
int from_tty,
const extension_language_defn *);
extern struct cmd_list_element **auto_load_set_cmdlist_get (void);
extern struct cmd_list_element **auto_load_show_cmdlist_get (void);

View file

@ -54,7 +54,8 @@ gdbscm_auto_load_enabled (const struct extension_language_defn *extlang)
static void
info_auto_load_guile_scripts (const char *pattern, int from_tty)
{
auto_load_info_scripts (pattern, from_tty, &extension_language_guile);
auto_load_info_scripts (current_program_space, pattern, from_tty,
&extension_language_guile);
}
void

View file

@ -53,7 +53,8 @@ gdbpy_auto_load_enabled (const struct extension_language_defn *extlang)
static void
info_auto_load_python_scripts (const char *pattern, int from_tty)
{
auto_load_info_scripts (pattern, from_tty, &extension_language_python);
auto_load_info_scripts (current_program_space, pattern, from_tty,
&extension_language_python);
}
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION