diff options
-rw-r--r-- | gdb/breakpoint.c | 5 | ||||
-rw-r--r-- | gdb/cli/cli-cmds.c | 14 | ||||
-rw-r--r-- | gdb/compile/compile.c | 4 | ||||
-rw-r--r-- | gdb/infcmd.c | 3 | ||||
-rw-r--r-- | gdb/linespec.c | 9 | ||||
-rw-r--r-- | gdb/macroscope.c | 6 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-file.c | 4 | ||||
-rw-r--r-- | gdb/objfiles.c | 3 | ||||
-rw-r--r-- | gdb/parse.c | 4 | ||||
-rw-r--r-- | gdb/python/python.c | 2 | ||||
-rw-r--r-- | gdb/source.c | 11 | ||||
-rw-r--r-- | gdb/source.h | 4 | ||||
-rw-r--r-- | gdb/tui/tui-disasm.c | 3 | ||||
-rw-r--r-- | gdb/tui/tui-hooks.c | 3 | ||||
-rw-r--r-- | gdb/tui/tui-source.c | 5 | ||||
-rw-r--r-- | gdb/tui/tui-winsource.c | 10 |
16 files changed, 51 insertions, 39 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 84b18ec..a819517 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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; diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 9d3a90b..92bb8fc 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -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); } diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index 88531a2..8896b44 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -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 (); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 4ce11b5..a030788 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -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) { diff --git a/gdb/linespec.c b/gdb/linespec.c index 8670e0a..eae4f9f 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -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; } diff --git a/gdb/macroscope.c b/gdb/macroscope.c index 4c1304f..c1b2238 100644 --- a/gdb/macroscope.c +++ b/gdb/macroscope.c @@ -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; } diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index 3e2702e..f2fe435 100644 --- a/gdb/mi/mi-cmd-file.c +++ b/gdb/mi/mi-cmd-file.c @@ -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 diff --git a/gdb/objfiles.c b/gdb/objfiles.c index ffa7301..6702158 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -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 (this->pspace ()); if (cursal.symtab && cursal.symtab->compunit ()->objfile () == this) clear_current_source_symtab_and_line (this->pspace ()); diff --git a/gdb/parse.c b/gdb/parse.c index c10b09a..2541a2e 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -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 diff --git a/gdb/python/python.c b/gdb/python/python.c index e9092b4..d86a031 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -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; } } diff --git a/gdb/source.c b/gdb/source.c index bdbe67d..25d6e71 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -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; diff --git a/gdb/source.h b/gdb/source.h index 4eb1793..541ee3b 100644 --- a/gdb/source.h +++ b/gdb/source.h @@ -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. diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 2f25fed..53be866 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -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); diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index e6673ab..25358d0 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -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); } } diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 444c0f7..ee64e41 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -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); diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 80297e5..b08fca7 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -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 (); |