From 74ce4f8ecf8b9b3a41821eec73b8952447e84eef Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 3 Oct 2023 22:20:20 -0400 Subject: [PATCH] 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 --- gdb/auto-load.c | 19 ++++++++----------- gdb/auto-load.h | 5 +++-- gdb/guile/scm-auto-load.c | 3 ++- gdb/python/py-auto-load.c | 3 ++- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gdb/auto-load.c b/gdb/auto-load.c index c6744ca2555..37a44cc2eaa 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -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 &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'. */ diff --git a/gdb/auto-load.h b/gdb/auto-load.h index 8db904e9098..1a7753e2d99 100644 --- a/gdb/auto-load.h +++ b/gdb/auto-load.h @@ -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); diff --git a/gdb/guile/scm-auto-load.c b/gdb/guile/scm-auto-load.c index fc98d99bc0a..d9430089385 100644 --- a/gdb/guile/scm-auto-load.c +++ b/gdb/guile/scm-auto-load.c @@ -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 diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c index 76ae3af39a0..34d5386d6c9 100644 --- a/gdb/python/py-auto-load.c +++ b/gdb/python/py-auto-load.c @@ -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 -- 2.30.2