@@ -8825,8 +8825,6 @@ static void
parse_breakpoint_sals (location_spec *locspec,
struct linespec_result *canonical)
{
- struct symtab_and_line cursal;
-
if (locspec->type () == LINESPEC_LOCATION_SPEC)
{
const char *spec
@@ -8875,7 +8873,8 @@ parse_breakpoint_sals (location_spec *locspec,
ObjC: However, don't match an Objective-C method name which
may have a '+' or '-' succeeded by a '['. */
- cursal = get_current_source_symtab_and_line ();
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
if (last_displayed_sal_is_valid ())
{
const char *spec = NULL;
@@ -984,7 +984,7 @@ edit_command (const char *arg, int from_tty)
if (arg == 0)
{
set_default_source_symtab_and_line ();
- sal = get_current_source_symtab_and_line ();
+ sal = get_current_source_symtab_and_line (current_program_space);
}
/* Bare "edit" edits file with present line. */
@@ -1240,7 +1240,8 @@ list_command (const char *arg, int from_tty)
if (get_first_line_listed () == 0 && (arg == nullptr || arg[0] != '.'))
{
set_default_source_symtab_and_line ();
- list_around_line (arg, get_current_source_symtab_and_line ());
+ list_around_line
+ (arg, get_current_source_symtab_and_line (current_program_space));
}
/* "l" and "l +" lists the next few lines, unless we're listing past
@@ -1248,7 +1249,8 @@ list_command (const char *arg, int from_tty)
else if (arg == nullptr || arg[0] == '+')
{
set_default_source_symtab_and_line ();
- const symtab_and_line cursal = get_current_source_symtab_and_line ();
+ const symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
if (last_symtab_line (cursal.symtab) >= cursal.line)
print_source_lines (cursal.symtab,
source_lines_range (cursal.line), 0);
@@ -1262,7 +1264,8 @@ list_command (const char *arg, int from_tty)
else if (arg[0] == '-')
{
set_default_source_symtab_and_line ();
- const symtab_and_line cursal = get_current_source_symtab_and_line ();
+ const symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
if (get_first_line_listed () == 1)
error (_("Already at the start of %s."),
@@ -1305,7 +1308,8 @@ list_command (const char *arg, int from_tty)
error (_("Insufficient debug info for showing source "
"lines at default location"));
}
- cursal = get_current_source_symtab_and_line ();
+ cursal
+ = get_current_source_symtab_and_line (current_program_space);
gdb_assert (cursal.symtab != nullptr);
}
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "progspace.h"
#include "ui.h"
#include "ui-out.h"
#include "command.h"
@@ -487,7 +488,8 @@ get_expr_block_and_pc (CORE_ADDR *pc)
if (block == NULL)
{
- struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
if (cursal.symtab)
block = cursal.symtab->compunit ()->blockvector ()->static_block ();
@@ -1078,7 +1078,8 @@ jump_command (const char *arg, int from_tty)
{
/* If multiple sal-objects were found, try dropping those that aren't
from the current symtab. */
- struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
sals.erase (std::remove_if (sals.begin (), sals.end (),
[&] (const symtab_and_line &sal)
{
@@ -3205,7 +3205,8 @@ decode_line_with_current_source (const char *string, int flags)
/* We use whatever is set as the current source line. We do not try
and get a default source symtab+line or it will recursively call us! */
- symtab_and_line cursal = get_current_source_symtab_and_line ();
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
location_spec_up locspec = string_to_location_spec (&string,
current_language);
@@ -3255,9 +3256,9 @@ initialize_defaults (struct symtab **default_symtab, int *default_line)
/* Use whatever we have for the default source line. We don't use
get_current_or_default_symtab_and_line as it can recurse and call
us back! */
- struct symtab_and_line cursal =
- get_current_source_symtab_and_line ();
-
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
+
*default_symtab = cursal.symtab;
*default_line = cursal.line;
}
@@ -121,9 +121,9 @@ default_macro_scope (void)
symbol files loaded, then get_current_or_default would raise an
error. But `set width' shouldn't raise an error just because
it can't decide which scope to macro-expand its argument in. */
- struct symtab_and_line cursal
- = get_current_source_symtab_and_line ();
-
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
+
sal.symtab = cursal.symtab;
sal.line = cursal.line;
}
@@ -35,7 +35,6 @@ void
mi_cmd_file_list_exec_source_file (const char *command,
const char *const *argv, int argc)
{
- struct symtab_and_line st;
struct ui_out *uiout = current_uiout;
if (!mi_valid_noargs ("-file-list-exec-source-file", argc, argv))
@@ -43,7 +42,8 @@ mi_cmd_file_list_exec_source_file (const char *command,
/* Set the default file and line, also get them. */
set_default_source_symtab_and_line ();
- st = get_current_source_symtab_and_line ();
+ symtab_and_line st
+ = get_current_source_symtab_and_line (current_program_space);
/* We should always get a symtab. Apparently, filename does not
need to be tested for NULL. The documentation in symtab.h
@@ -561,7 +561,8 @@ objfile::~objfile ()
and if so, call clear_current_source_symtab_and_line. */
{
- struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
if (cursal.symtab && cursal.symtab->compunit ()->objfile () == this)
clear_current_source_symtab_and_line (current_program_space);
@@ -375,8 +375,8 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
if (!expression_context_block)
{
- struct symtab_and_line cursal
- = get_current_source_symtab_and_line ();
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
if (cursal.symtab)
expression_context_block
@@ -963,7 +963,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
else
{
set_default_source_symtab_and_line ();
- def_sal = get_current_source_symtab_and_line ();
+ def_sal = get_current_source_symtab_and_line (current_program_space);
sals = def_sal;
}
}
@@ -231,16 +231,15 @@ get_source_location (program_space *pspace)
return loc;
}
-/* Return the current source file for listing and next line to list.
- NOTE: The returned sal pc and end fields are not valid. */
+/* See source.h. */
-struct symtab_and_line
-get_current_source_symtab_and_line (void)
+symtab_and_line
+get_current_source_symtab_and_line (program_space *pspace)
{
symtab_and_line cursal;
- current_source_location *loc = get_source_location (current_program_space);
+ current_source_location *loc = get_source_location (pspace);
- cursal.pspace = current_program_space;
+ cursal.pspace = pspace;
cursal.symtab = loc->symtab ();
cursal.line = loc->line ();
cursal.pc = 0;
@@ -23,6 +23,7 @@
struct program_space;
struct symtab;
+struct symtab_and_line;
/* See openp function definition for their description. */
@@ -108,7 +109,8 @@ extern int get_lines_to_list (void);
/* Return the current source file for listing and next line to list.
NOTE: The returned sal pc and end fields are not valid. */
-extern struct symtab_and_line get_current_source_symtab_and_line (void);
+extern symtab_and_line get_current_source_symtab_and_line
+ (program_space *pspace);
/* If the current source file for listing is not set, try and get a default.
Usually called before get_current_source_symtab_and_line() is called.
@@ -393,7 +393,8 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
|| have_partial_symbols (current_program_space))
{
set_default_source_symtab_and_line ();
- struct symtab_and_line sal = get_current_source_symtab_and_line ();
+ symtab_and_line sal
+ = get_current_source_symtab_and_line (current_program_space);
if (sal.symtab != nullptr)
find_line_pc (sal.symtab, sal.line, &addr);
@@ -127,7 +127,8 @@ tui_refresh_frame_and_register_information ()
/* Make sure that the source window is displayed. */
tui_add_win_to_layout (SRC_WIN);
- struct symtab_and_line sal = get_current_source_symtab_and_line ();
+ symtab_and_line sal
+ = get_current_source_symtab_and_line (current_program_space);
tui_update_source_windows_with_line (sal);
}
}
@@ -136,7 +136,8 @@ tui_source_window::do_scroll_vertical (int num_to_scroll)
if (!m_content.empty ())
{
struct symtab *s;
- struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
struct gdbarch *arch = m_gdbarch;
if (cursal.symtab == NULL)
@@ -220,7 +221,7 @@ void
tui_source_window::display_start_addr (struct gdbarch **gdbarch_p,
CORE_ADDR *addr_p)
{
- struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+ symtab_and_line cursal = get_current_source_symtab_and_line (current_program_space);
*gdbarch_p = m_gdbarch;
find_line_pc (cursal.symtab, m_start_line_or_addr.u.line_no, addr_p);
@@ -440,8 +440,8 @@ tui_source_window_base::rerender ()
if (!m_content.empty ())
{
- struct symtab_and_line cursal
- = get_current_source_symtab_and_line ();
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
if (m_start_line_or_addr.loa == LOA_LINE)
cursal.line = m_start_line_or_addr.u.line_no;
@@ -451,8 +451,8 @@ tui_source_window_base::rerender ()
}
else if (deprecated_safe_get_selected_frame () != NULL)
{
- struct symtab_and_line cursal
- = get_current_source_symtab_and_line ();
+ symtab_and_line cursal
+ = get_current_source_symtab_and_line (current_program_space);
frame_info_ptr frame = deprecated_safe_get_selected_frame ();
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -492,7 +492,7 @@ tui_source_window_base::refill ()
if (this == tui_src_win ())
{
- sal = get_current_source_symtab_and_line ();
+ sal = get_current_source_symtab_and_line (current_program_space);
if (sal.symtab == NULL)
{
frame_info_ptr fi = deprecated_safe_get_selected_frame ();