aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-01-19 12:18:14 +0000
committerPedro Alves <palves@redhat.com>2016-01-19 12:18:14 +0000
commitc2f4122d5cc2a21a441470336c8637b6a6965c6e (patch)
treee14f11987e3a0d6ced34db4a25b7cc6960045bd5 /gdb/cli
parentbd0a71fa16f668341a9361c695bc3ca44d27b322 (diff)
downloadgdb-c2f4122d5cc2a21a441470336c8637b6a6965c6e.zip
gdb-c2f4122d5cc2a21a441470336c8637b6a6965c6e.tar.gz
gdb-c2f4122d5cc2a21a441470336c8637b6a6965c6e.tar.bz2
Limit breakpoint re-set to the current program space
Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index b871a88..ede4909 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -818,7 +818,7 @@ edit_command (char *arg, int from_tty)
arg1 = arg;
location = string_to_event_location (&arg1, current_language);
cleanup = make_cleanup_delete_event_location (location);
- sals = decode_line_1 (location, DECODE_LINE_LIST_MODE, 0, 0);
+ sals = decode_line_1 (location, DECODE_LINE_LIST_MODE, NULL, NULL, 0);
filter_sals (&sals);
if (! sals.nelts)
@@ -971,7 +971,7 @@ list_command (char *arg, int from_tty)
location = string_to_event_location (&arg1, current_language);
make_cleanup_delete_event_location (location);
- sals = decode_line_1 (location, DECODE_LINE_LIST_MODE, 0, 0);
+ sals = decode_line_1 (location, DECODE_LINE_LIST_MODE, NULL, NULL, 0);
filter_sals (&sals);
if (!sals.nelts)
@@ -1015,10 +1015,10 @@ list_command (char *arg, int from_tty)
make_cleanup_delete_event_location (location);
if (dummy_beg)
sals_end = decode_line_1 (location,
- DECODE_LINE_LIST_MODE, 0, 0);
+ DECODE_LINE_LIST_MODE, NULL, NULL, 0);
else
sals_end = decode_line_1 (location, DECODE_LINE_LIST_MODE,
- sal.symtab, sal.line);
+ NULL, sal.symtab, sal.line);
filter_sals (&sals_end);
if (sals_end.nelts == 0)