From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24597 invoked by alias); 15 Oct 2014 19:32:59 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 24570 invoked by uid 55); 15 Oct 2014 19:32:58 -0000 From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug breakpoints/9649] Assertion failure in insert_single_step_breakpoint in breakpoint.c Date: Wed, 15 Oct 2014 19:32:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: breakpoints X-Bugzilla-Version: 6.8 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: palves at redhat dot com X-Bugzilla-Target-Milestone: 7.9 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q4/txt/msg00072.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=9649 --- Comment #5 from cvs-commit at gcc dot gnu.org --- This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gdb and binutils". The branch, master has been updated via 36728e82bd9bb5b472eb569dc11b8f2296d5e3df (commit) via 34b7e8a6ad0a735ecc0a953c8b65846d4776c88e (commit) via 5b834a0a5da717c7d1a8d539623e75f07a474e32 (commit) via a1fd2fa5999a17bc94fa8348326bc75ddb93476c (commit) via 7c16b83e0521a007e4d86fc30e334b41b01668b4 (commit) via 0cbcdb96eaba80fe8e94ccc2b6f1f382a467a04e (commit) via 963f9c80cb3f12fb779cf3189072ac48946da96c (commit) via 6cc83d2a4000e89e4f6f2eb33ffade2d72acfa0f (commit) from a2abc7de6804e7e9882a86375767b24a6c215f28 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=36728e82bd9bb5b472eb569dc11b8f2296d5e3df commit 36728e82bd9bb5b472eb569dc11b8f2296d5e3df Author: Pedro Alves Date: Wed Oct 15 20:18:32 2014 +0100 Non-stop + software single-step archs: don't force displaced-stepping for all single-steps This finally reverts this bit of commit 929dfd4f: 2009-07-31 Pedro Alves Julian Brown ... (resume): If this is a software single-stepping arch, and displaced-stepping is enabled, use it for all single-step requests. ... That means that in non-stop (or really displaced-stepping) mode, on software single-step archs - even those that only use sss breakpoints to deal with atomic sequences, like PPC - if we have more than one thread single-stepping, we'll always serialize the threads' single-steps, as only one thread may be displaced stepping at a given time, because there's only one scratch pad. We originally did that because GDB didn't support having multiple threads software-single-stepping simultaneously. The previous patches fixed that limitation, so we can now finally revert this too. Tested on: - x86_64 Fedora 20, on top of the 'software single-step on x86' series. gdb/ 2014-10-15 Pedro Alves * infrun.c (resume): Don't force displaced-stepping for all single-steps on software single-stepping archs. https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=34b7e8a6ad0a735ecc0a953c8b65846d4776c88e commit 34b7e8a6ad0a735ecc0a953c8b65846d4776c88e Author: Pedro Alves Date: Wed Oct 15 20:18:32 2014 +0100 Make single-step breakpoints be per-thread This patch finally makes each thread have its own set of single-step breakpoints. This paves the way to have multiple threads software single-stepping, though this patch doesn't flip that switch on yet. That'll be done on a subsequent patch. gdb/ 2014-10-15 Pedro Alves * breakpoint.c (single_step_breakpoints): Delete global. (insert_single_step_breakpoint): Adjust to store the breakpoint pointer in the current thread. (single_step_breakpoints_inserted, remove_single_step_breakpoints) (cancel_single_step_breakpoints): Delete functions. (breakpoint_has_location_inserted_here): Make extern. (single_step_breakpoint_inserted_here_p): Adjust to walk the breakpoint list. * breakpoint.h (breakpoint_has_location_inserted_here): New declaration. (single_step_breakpoints_inserted, remove_single_step_breakpoints) (cancel_single_step_breakpoints): Remove declarations. * gdbthread.h (struct thread_control_state) : New field. (delete_single_step_breakpoints) (thread_has_single_step_breakpoints_set) (thread_has_single_step_breakpoint_here): New declarations. * infrun.c (follow_exec): Also clear the single-step breakpoints. (singlestep_breakpoints_inserted_p, singlestep_ptid) (singlestep_pc): Delete globals. (infrun_thread_ptid_changed): Remove references to removed globals. (resume_cleanups): Delete the current thread's single-step breakpoints. (maybe_software_singlestep): Remove references to removed globals. (resume): Adjust to use thread_has_single_step_breakpoints_set and delete_single_step_breakpoints. (init_wait_for_inferior): Remove references to removed globals. (delete_thread_infrun_breakpoints): Delete the thread's single-step breakpoints too. (delete_just_stopped_threads_infrun_breakpoints): Don't delete single-step breakpoints here. (delete_stopped_threads_single_step_breakpoints): New function. (adjust_pc_after_break): Adjust to use thread_has_single_step_breakpoints_set. (handle_inferior_event): Remove references to removed globals. Use delete_stopped_threads_single_step_breakpoints. (handle_signal_stop): Adjust to per-thread single-step breakpoints. Swap test order to do cheaper tests first. (switch_back_to_stepped_thread): Extend debug output. Remove references to removed globals. * record-full.c (record_full_wait_1): Adjust to per-thread single-step breakpoints. * thread.c (delete_single_step_breakpoints) (thread_has_single_step_breakpoints_set) (thread_has_single_step_breakpoint_here): New functions. (clear_thread_inferior_resources): Also delete the thread's single-step breakpoints. https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5b834a0a5da717c7d1a8d539623e75f07a474e32 commit 5b834a0a5da717c7d1a8d539623e75f07a474e32 Author: Pedro Alves Date: Wed Oct 15 20:18:32 2014 +0100 thread.c: cleanup breakpoint deletion A little refactoring to reduce duplicate code. gdb/ 2014-10-15 Pedro Alves * thread.c (delete_thread_breakpoint): New function. (delete_step_resume_breakpoint) (delete_exception_resume_breakpoint): Use it. (delete_at_next_stop): New function. (clear_thread_inferior_resources): Use delete_at_next_stop. https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a1fd2fa5999a17bc94fa8348326bc75ddb93476c commit a1fd2fa5999a17bc94fa8348326bc75ddb93476c Author: Pedro Alves Date: Wed Oct 15 20:18:31 2014 +0100 Remove deprecated_insert_raw_breakpoint and friends There are no users of deprecated_{insert,remove}_raw_breakpoint left. gdb/ 2014-10-15 Pedro Alves * breakpoint.c (regular_breakpoint_inserted_here_p): Inline ... (breakpoint_inserted_here_p): ... here. Remove special case for software single-step breakpoints. (find_non_raw_software_breakpoint_inserted_here): Inline ... (software_breakpoint_inserted_here_p): ... here. Remove special case for software single-step breakpoints. (bp_target_info_copy_insertion_state) (deprecated_insert_raw_breakpoint) (deprecated_remove_raw_breakpoint): Delete functions. * breakpoint.h (deprecated_insert_raw_breakpoint) (deprecated_remove_raw_breakpoint): Remove declarations. https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7c16b83e0521a007e4d86fc30e334b41b01668b4 commit 7c16b83e0521a007e4d86fc30e334b41b01668b4 Author: Pedro Alves Date: Wed Oct 15 20:18:31 2014 +0100 Put single-step breakpoints on the bp_location chain This patch makes single-step breakpoints "real" breakpoints on the global location list. There are several benefits to this: - It removes the currently limitation that only 2 single-step breakpoints can be inserted. See an example here of a discussion around a case that wants more than 2, possibly unbounded: https://sourceware.org/ml/gdb-patches/2014-03/msg00663.html - makes software single-step work on read-only code regions. The logic to convert a software breakpoint to a hardware breakpoint if the memory map says the breakpoint address is in read only memory is in insert_bp_location. Because software single-step breakpoints bypass all that go and straight to target_insert_breakpoint, we can't software single-step over read only memory. This patch removes that limitation, and adds a test that makes sure that works, by forcing a code region to read-only with "mem LOW HIGH ro" and then stepping through that. - Fixes PR breakpoints/9649 This is an assertion failure in insert_single_step_breakpoint in breakpoint.c, because we may leave stale single-step breakpoints behind on error. The tests for stepping through read-only regions exercise the root cause of the bug, which is that we leave single-step breakpoints behind if we fail to insert any single-step breakpoint. Deleting the single-step breakpoints in resume_cleanups, delete_just_stopped_threads_infrun_breakpoints, and fetch_inferior_event fixes this. Without that, we'd no longer hit the assertion, as that code is deleted, but we'd instead run into errors/warnings trying to insert/remove the stale breakpoints on next resume. - Paves the way to have multiple threads software single-stepping at the same time, leaving update_global_location_list to worry about duplicate locations. - Makes the moribund location machinery aware of software single-step breakpoints, paving the way to enable software single-step on non-stop, instead of forcing serialized displaced stepping for all single steps. - It's generaly cleaner. We no longer have to play games with single-step breakpoints inserted at the same address as regular breakpoints, like we recently had to do for 7.8. See this discussion: https://sourceware.org/ml/gdb-patches/2014-06/msg00052.html. Tested on x86_64 Fedora 20, on top of my 'single-step breakpoints on x86' series. gdb/ 2014-10-15 Pedro Alves PR breakpoints/9649 * breakpoint.c (single_step_breakpoints, single_step_gdbarch): Delete array globals. (single_step_breakpoints): New global. (breakpoint_xfer_memory): Remove special handling for single-step breakpoints. (update_breakpoints_after_exec): Delete bp_single_step breakpoints. (detach_breakpoints): Remove special handling for single-step breakpoints. (breakpoint_init_inferior): Delete bp_single_step breakpoints. (bpstat_stop_status): Add comment. (bpstat_what, bptype_string, print_one_breakpoint_location) (adjust_breakpoint_address, init_bp_location): Handle bp_single_step. (new_single_step_breakpoint): New function. (set_momentary_breakpoint, bkpt_remove_location): Remove special handling for single-step breakpoints. (insert_single_step_breakpoint, single_step_breakpoints_inserted) (remove_single_step_breakpoints, cancel_single_step_breakpoints): Rewrite. (detach_single_step_breakpoints, find_single_step_breakpoint): Delete functions. (breakpoint_has_location_inserted_here): New function. (single_step_breakpoint_inserted_here_p): Rewrite. * breakpoint.h: Remove FIXME. (enum bptype) : New enum value. (insert_single_step_breakpoint): Update comment. * infrun.c (resume_cleanups) (delete_step_thread_step_resume_breakpoint): Remove single-step breakpoints. (fetch_inferior_event): Install a cleanup that removes infrun breakpoints. (switch_back_to_stepped_thread) : Clear step-over info. gdb/testsuite/ 2014-10-15 Pedro Alves PR breakpoints/9649 * gdb.base/breakpoint-in-ro-region.c (main): Add more instructions. * gdb.base/breakpoint-in-ro-region.exp (probe_target_hardware_step): New procedure. (top level): Probe hardware stepping and hardware breakpoint support. Test stepping through a read-only region, with both "breakpoint auto-hw" on and off and both "always-inserted" on and off. https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0cbcdb96eaba80fe8e94ccc2b6f1f382a467a04e commit 0cbcdb96eaba80fe8e94ccc2b6f1f382a467a04e Author: Pedro Alves Date: Wed Oct 15 20:18:30 2014 +0100 infrun.c: add for_each_just_stopped_thread This is a preparatory/cleanup patch that does two things: - Renames 'delete_step_thread_step_resume_breakpoint'. The "step_resume" part is misnomer these days, as the function deletes other kinds of breakpoints, not just the step-resume breakpoint. A following patch will want to make it delete yet another kind of breakpoint, even. - Splits out the logic of which threads get those breakpoints deleted to a separate "for_each"-style function, so that the same following patch may use it with a different callback. Tested on x86_64 Fedora 20. gdb/ 2014-10-15 Pedro Alves * infrun.c (delete_step_resume_breakpoint_callback): Delete. (delete_thread_infrun_breakpoints): New function, with parts salvaged from delete_step_resume_breakpoint_callback. (delete_step_thread_step_resume_breakpoint): Delete. (for_each_just_stopped_thread_callback_func): New typedef. (for_each_just_stopped_thread): New function. (delete_just_stopped_threads_infrun_breakpoints): New function. (delete_step_thread_step_resume_breakpoint_cleanup): Rename to ... (delete_just_stopped_threads_infrun_breakpoints_cleanup): ... this. Adjust. (wait_for_inferior, fetch_inferior_event): Adjust to renames. https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=963f9c80cb3f12fb779cf3189072ac48946da96c commit 963f9c80cb3f12fb779cf3189072ac48946da96c Author: Pedro Alves Date: Wed Oct 15 20:18:30 2014 +0100 Rewrite non-continuable watchpoints handling When GDB finds out the target triggered a watchpoint, and the target has non-continuable watchpoints, GDB sets things up to step past the instruction that triggered the watchpoint. This is just like stepping past a breakpoint, but goes through a different mechanism - it resumes only the thread that needs to step past the watchpoint, but also switches a "infwait state" global, that has the effect that the next target_wait only wait for events only from that thread. This forcing of a ptid to pass to target_wait obviously becomes a bottleneck if we ever support stepping past different watchpoints simultaneously (in separate processes). It's also unnecessary -- the target should only return events for threads that have been resumed; if no other thread than the one we're stepping past the watchpoint has been resumed, then those other threads should not report events. If we couldn't assume that, then stepping past regular breakpoints would be broken for not likewise forcing a similar infwait_state. So this patch eliminates infwait_state, and instead teaches keep_going to mark step_over_info in a way that has the breakpoints module skip inserting watchpoints (because we're stepping past one), like it skips breakpoints when we're stepping past one. Tested on: - x86_64 Fedora 20 (continuable watchpoints) - PPC64 Fedora 18 (non-steppable watchpoints) gdb/ 2014-10-15 Pedro Alves * breakpoint.c (should_be_inserted): Don't insert watchpoints if trying to step past a non-steppable watchpoint. * gdbthread.h (struct thread_info) : New field. * infrun.c (struct step_over_info): Add new field 'nonsteppable_watchpoint_p' and adjust comments. (set_step_over_info): New 'nonsteppable_watchpoint_p' parameter. Adjust. (clear_step_over_info): Clear nonsteppable_watchpoint_p as well. (stepping_past_nonsteppable_watchpoint): New function. (step_over_info_valid_p): Also return true if stepping past a nonsteppable watchpoint. (proceed): Adjust call to set_step_over_info. Remove reference to init_infwait_state. (init_wait_for_inferior): Remove reference to init_infwait_state. (waiton_ptid): Delete global. (struct execution_control_state) : Delete field. (wait_for_inferior, fetch_inferior_event): Always pass minus_one_ptid to target_wait. (init_thread_stepping_state): Clear 'stepping_over_watchpoint' field. (init_infwait_state): Delete function. (handle_inferior_event): Remove infwait_state handling. (handle_signal_stop) : Adjust after stepped_after_stopped_by_watchpoint removal. Don't remove breakpoints here nor set infwait_state. Set the thread's stepping_over_watchpoint flag, and call keep_going instead. (keep_going): Handle stepping_over_watchpoint. Adjust set_step_over_info calls. * infrun.h (stepping_past_nonsteppable_watchpoint): Declare function. https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6cc83d2a4000e89e4f6f2eb33ffade2d72acfa0f commit 6cc83d2a4000e89e4f6f2eb33ffade2d72acfa0f Author: Pedro Alves Date: Wed Oct 15 20:18:29 2014 +0100 Decide whether we may have removed breakpoints based on step_over_info ... instead of trap_expected. Gets rid of one singlestep_breakpoints_inserted_p reference, and is generally more to the point. gdb/ 2014-10-15 Pedro Alves * infrun.c (step_over_info_valid_p): New function. (resume): Use step_over_info_valid_p instead of checking the threads's trap_expected flag. ----------------------------------------------------------------------- Summary of changes: gdb/ChangeLog | 171 ++++++++ gdb/breakpoint.c | 413 +++++--------------- gdb/breakpoint.h | 31 +- gdb/gdbthread.h | 25 ++ gdb/infrun.c | 360 ++++++++--------- gdb/infrun.h | 4 + gdb/record-full.c | 8 +- gdb/testsuite/ChangeLog | 11 + gdb/testsuite/gdb.base/breakpoint-in-ro-region.c | 9 + gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp | 104 +++++ gdb/thread.c | 80 +++- 11 files changed, 672 insertions(+), 544 deletions(-) -- You are receiving this mail because: You are on the CC list for the bug.