]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: pass program space to clear_current_source_symtab_and_line
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 16 May 2024 20:21:23 +0000 (16:21 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 15 Jul 2024 18:34:12 +0000 (14:34 -0400)
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>
gdb/cli/cli-cmds.c
gdb/objfiles.c
gdb/source.c
gdb/source.h
gdb/symfile.c

index 3af794cebaf2b7e781662180078b26d9dd94d535..450009156d4bbc67fb9bb83c8c9a0df980c36b3e 100644 (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 ();
index 56add01daa65f7067ca68d887b5fc7b210b8f6eb..f51baab8d2ccedfdc1a34cc03e10c387551f1f77 100644 (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.  */
index 9e528d3f705dc875327a8b4860ee0b2f5a4fb0d3..bced213171a6ca5ae43e68942e8be6f8a947b2e9 100644 (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);
 }
 
index 144ee48f72237ca72db9c8cdaa5d2177a42a2392..4eb1793789931213df8dd4521c8c7a2969dc955c 100644 (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 *);
index 6b722214663b1fadc185e2b8843befc55b878d28..69230482da3cde23cc6d057414fa85b5df8664a9 100644 (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 ();