From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119769 invoked by alias); 1 Apr 2015 22:40:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 119737 invoked by uid 89); 1 Apr 2015 22:40:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 01 Apr 2015 22:40:23 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t31MEM0B010143 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 1 Apr 2015 18:14:22 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t31MEEtp009701 for ; Wed, 1 Apr 2015 18:14:21 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 06/17] Make thread_still_needs_step_over consider stepping_over_watchpoint too Date: Wed, 01 Apr 2015 22:40:00 -0000 Message-Id: <1427926454-16431-7-git-send-email-palves@redhat.com> In-Reply-To: <1427926454-16431-1-git-send-email-palves@redhat.com> References: <1427926454-16431-1-git-send-email-palves@redhat.com> X-SW-Source: 2015-04/txt/msg00084.txt.bz2 I noticed that even though keep_going knows to start a step over for a watchpoint, thread_still_needs_step_over doesn't. gdb/ChangeLog: 2015-04-01 Pedro Alves * infrun.c (thread_still_needs_step_over): Rename to ... (thread_still_needs_step_over_bp): ... this. (enum step_over_what): New. (thread_still_needs_step_over): Reimplement. --- gdb/infrun.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 1e3a3db..5034261 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2491,7 +2491,7 @@ clear_proceed_status (int step) meanwhile, we can skip the whole step-over dance. */ static int -thread_still_needs_step_over (struct thread_info *tp) +thread_still_needs_step_over_bp (struct thread_info *tp) { if (tp->stepping_over_breakpoint) { @@ -2508,6 +2508,34 @@ thread_still_needs_step_over (struct thread_info *tp) return 0; } +/* Bit flags indicating what the thread needs to step over. */ + +enum step_over_what + { + STEP_OVER_BREAKPOINT = 1, + STEP_OVER_WATCHPOINT = 2 + }; + +/* Check whether thread TP still needs to start a step-over in order + to make progress when resumed. Returns a union of enum + step_over_what bits, indicating what needs to be stepped over. */ + +static int +thread_still_needs_step_over (struct thread_info *tp) +{ + struct inferior *inf = find_inferior_ptid (tp->ptid); + int what = 0; + + if (thread_still_needs_step_over_bp (tp)) + what |= STEP_OVER_BREAKPOINT; + + if (tp->stepping_over_watchpoint + && !target_have_steppable_watchpoint) + what |= STEP_OVER_WATCHPOINT; + + return what; +} + /* Returns true if scheduler locking applies. STEP indicates whether we're about to do a step/next-like command to a thread. */ @@ -6244,6 +6272,7 @@ keep_going (struct execution_control_state *ecs) int remove_bp; int remove_wps; enum gdb_signal signo; + enum step_over_what step_what; /* Either the trap was not expected, but we are continuing anyway (if we got a signal, the user asked it be passed to @@ -6264,11 +6293,6 @@ keep_going (struct execution_control_state *ecs) instruction, and then re-insert the breakpoint when that step is finished. */ - remove_bp = (ecs->hit_singlestep_breakpoint - || thread_still_needs_step_over (ecs->event_thread)); - remove_wps = (ecs->event_thread->stepping_over_watchpoint - && !target_have_steppable_watchpoint); - /* Do not deliver GDB_SIGNAL_TRAP (except when the user explicitly specifies that such a signal should be delivered to the target program). Typically, that would occur when a @@ -6285,6 +6309,12 @@ keep_going (struct execution_control_state *ecs) signo = ecs->event_thread->suspend.stop_signal; + step_what = thread_still_needs_step_over (ecs->event_thread); + + remove_bp = (ecs->hit_singlestep_breakpoint + || (step_what & STEP_OVER_BREAKPOINT)); + remove_wps = (step_what & STEP_OVER_WATCHPOINT); + if (remove_bp && !use_displaced_stepping_now_p (get_regcache_arch (regcache), signo)) @@ -6297,6 +6327,8 @@ keep_going (struct execution_control_state *ecs) else clear_step_over_info (); + ecs->event_thread->control.trap_expected = (remove_bp || remove_wps); + /* Stop stepping if inserting breakpoints fails. */ TRY { @@ -6311,8 +6343,6 @@ keep_going (struct execution_control_state *ecs) } END_CATCH - ecs->event_thread->control.trap_expected = (remove_bp || remove_wps); - discard_cleanups (old_cleanups); resume (ecs->event_thread->suspend.stop_signal); } -- 1.9.3