+2016-02-09 Pedro Alves <palves@redhat.com>
+
+ PR breakpoints/19548
+ * breakpoint.c (create_overlay_event_breakpoint): Don't update
+ global location list here.
+ (create_longjmp_master_breakpoint)
+ (create_std_terminate_master_breakpoint)
+ (create_exception_master_breakpoint, create_jit_event_breakpoint)
+ (update_breakpoint_locations):
+ (breakpoint_re_set): Update global location list after all
+ breakpoints are re-set.
+
2016-02-08 Simon Marchi <simon.marchi@ericsson.com>
* remote.c (remote_register_number_and_offset): Remove unused
overlay_events_enabled = 0;
}
}
- update_global_location_list (UGLL_MAY_INSERT);
}
static void
}
}
}
- update_global_location_list (UGLL_MAY_INSERT);
do_cleanups (old_chain);
}
}
}
- update_global_location_list (UGLL_MAY_INSERT);
-
do_cleanups (old_chain);
}
b->location = new_explicit_location (&explicit_loc);
b->enable_state = bp_disabled;
}
-
- update_global_location_list (UGLL_MAY_INSERT);
}
void
struct breakpoint *
create_jit_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address)
{
- struct breakpoint *b;
-
- b = create_internal_breakpoint (gdbarch, address, bp_jit_event,
- &internal_breakpoint_ops);
- update_global_location_list_nothrow (UGLL_MAY_INSERT);
- return b;
+ return create_internal_breakpoint (gdbarch, address, bp_jit_event,
+ &internal_breakpoint_ops);
}
/* Remove JIT code registration and unregistration breakpoint(s). */
/* Ranged breakpoints have only one start location and one end
location. */
b->enable_state = bp_disabled;
- update_global_location_list (UGLL_MAY_INSERT);
printf_unfiltered (_("Could not reset ranged breakpoint %d: "
"multiple locations found\n"),
b->number);
if (!locations_are_equal (existing_locations, b->loc))
observer_notify_breakpoint_modified (b);
-
- update_global_location_list (UGLL_MAY_INSERT);
}
/* Find the SaL locations corresponding to the given LOCATION.
save_input_radix = input_radix;
old_chain = save_current_space_and_thread ();
+ /* Note: we must not try to insert locations until after all
+ breakpoints have been re-set. Otherwise, e.g., when re-setting
+ breakpoint 1, we'd insert the locations of breakpoint 2, which
+ hadn't been re-set yet, and thus may have stale locations. */
+
ALL_BREAKPOINTS_SAFE (b, b_tmp)
{
/* Format possible error msg. */
create_longjmp_master_breakpoint ();
create_std_terminate_master_breakpoint ();
create_exception_master_breakpoint ();
+
+ /* Now we can insert. */
+ update_global_location_list (UGLL_MAY_INSERT);
}
\f
/* Reset the thread number of this breakpoint:
proc test { always_inserted } {
global exec1
+ global gdb_prompt
clean_restart ${exec1}
return -1
}
- # On a buggy GDB, with always-inserted on, we'd see:
+ # Set a second breakpoint (whose original address also ends up
+ # unmmapped after the exec), for PR 19548.
+ gdb_test "break some_function" "Breakpoint .*"
+
+ # PR17431: with always-inserted on, we'd see:
# (gdb) continue
# Continuing.
# Warning:
# Cannot insert breakpoint 1.
# Cannot access memory at address 0x10000ff
- gdb_test "continue" "Breakpoint 1, main.*" "continue across exec"
+
+ # PR 19548: with more than one breakpoint, we'd see:
+ # (gdb) continue
+ # Continuing.
+ # process (...) is executing new program: (...)/execl-update-breakpoints2
+ # Error in re-setting breakpoint 1: Warning:
+ # Cannot insert breakpoint 2.
+ # Cannot access memory at address 0x1000764
+ set not_nl "\[^\r\n\]*"
+ set regex ""
+ append regex \
+ "^continue\r\n" \
+ "Continuing\\.\r\n" \
+ "${not_nl} is executing new program: ${not_nl}\r\n" \
+ "(Reading ${not_nl} from remote target\\.\\.\\.\r\n)*" \
+ "\r\n" \
+ "Breakpoint 1, main.*$gdb_prompt $"
+ set message "continue across exec"
+ gdb_test_multiple "continue" $message {
+ -re $regex {
+ pass $message
+ }
+ }
}
foreach always_inserted { "off" "on" } {