aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2024-05-16 16:21:23 -0400
committerSimon Marchi <simon.marchi@efficios.com>2024-07-15 14:34:12 -0400
commitfbee6a57b23782212e1b2ebf46203da926d3dfb3 (patch)
tree2436b1cddded3df474df0a5db635f6ffa39d0c55
parent4113c737bda3aa1ac6ae1c418288a11e810c995e (diff)
downloadgdb-fbee6a57b23782212e1b2ebf46203da926d3dfb3.zip
gdb-fbee6a57b23782212e1b2ebf46203da926d3dfb3.tar.gz
gdb-fbee6a57b23782212e1b2ebf46203da926d3dfb3.tar.bz2
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>
-rw-r--r--gdb/cli/cli-cmds.c2
-rw-r--r--gdb/objfiles.c2
-rw-r--r--gdb/source.c4
-rw-r--r--gdb/source.h3
-rw-r--r--gdb/symfile.c2
5 files changed, 7 insertions, 6 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 3af794c..4500091 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 56add01..f51baab 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 9e528d3..bced213 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 144ee48..4eb1793 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 6b72221..6923048 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 ();