From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3035 invoked by alias); 22 Oct 2013 15:15:01 -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 3023 invoked by uid 89); 22 Oct 2013 15:15:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS 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 ESMTP; Tue, 22 Oct 2013 15:14:59 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9MFEwvQ013845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 Oct 2013 11:14:58 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9MFEuLs019960 for ; Tue, 22 Oct 2013 11:14:57 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [COMMIT PATCH] infrun.c:keep_going: update comments. Date: Tue, 22 Oct 2013 15:15:00 -0000 Message-Id: <1382454896-28664-1-git-send-email-palves@redhat.com> X-SW-Source: 2013-10/txt/msg00686.txt.bz2 This function still has comments referring back to when it was a goto label in wait_for_inferior, eons ago. Looking closer, actually most of its comments could use a facelift (contents/formatting/typos). That's what this patch does. gdb/ 2013-10-22 Pedro Alves * infrun.c (keep_going): Update comments. --- gdb/infrun.c | 66 ++++++++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index b1f9611..b1d2dc5 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -5720,9 +5720,9 @@ stop_stepping (struct execution_control_state *ecs) ecs->wait_some_more = 0; } -/* This function handles various cases where we need to continue - waiting for the inferior. */ -/* (Used to be the keep_going: label in the old wait_for_inferior). */ +/* Called when we should continue running the inferior, because the + current event doesn't cause a user visible stop. This does the + resuming part; waiting for the next event is done elsewhere. */ static void keep_going (struct execution_control_state *ecs) @@ -5735,16 +5735,13 @@ keep_going (struct execution_control_state *ecs) ecs->event_thread->prev_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); - /* If we did not do break;, it means we should keep running the - inferior and not return to debugger. */ - if (ecs->event_thread->control.trap_expected && ecs->event_thread->suspend.stop_signal != GDB_SIGNAL_TRAP) { - /* We took a signal (which we are supposed to pass through to - the inferior, else we'd not get here) and we haven't yet - gotten our trap. Simply continue. */ - + /* We haven't yet gotten our trap, and either: intercepted a + non-signal event (e.g., a fork); or took a signal which we + are supposed to pass through to the inferior. Simply + continue. */ discard_cleanups (old_cleanups); resume (currently_stepping (ecs->event_thread), ecs->event_thread->suspend.stop_signal); @@ -5752,34 +5749,35 @@ keep_going (struct execution_control_state *ecs) else { /* Either the trap was not expected, but we are continuing - anyway (the user asked that this signal be passed to the - child) - -- or -- - The signal was SIGTRAP, e.g. it was our signal, but we - decided we should resume from it. + anyway (if we got a signal, the user asked it be passed to + the child) + -- or -- + We got our expected trap, but decided we should resume from + it. - We're going to run this baby now! + We're going to run this baby now! Note that insert_breakpoints won't try to re-insert already inserted breakpoints. Therefore, we don't care if breakpoints were already inserted, or not. */ - + if (ecs->event_thread->stepping_over_breakpoint) { struct regcache *thread_regcache = get_thread_regcache (ecs->ptid); if (!use_displaced_stepping (get_regcache_arch (thread_regcache))) - /* Since we can't do a displaced step, we have to remove - the breakpoint while we step it. To keep things - simple, we remove them all. */ - remove_breakpoints (); + { + /* Since we can't do a displaced step, we have to remove + the breakpoint while we step it. To keep things + simple, we remove them all. */ + remove_breakpoints (); + } } else { volatile struct gdb_exception e; - /* Stop stepping when inserting breakpoints - has failed. */ + /* Stop stepping if inserting breakpoints fails. */ TRY_CATCH (e, RETURN_MASK_ERROR) { insert_breakpoints (); @@ -5795,18 +5793,16 @@ keep_going (struct execution_control_state *ecs) ecs->event_thread->control.trap_expected = ecs->event_thread->stepping_over_breakpoint; - /* Do not deliver SIGNAL_TRAP (except when the user explicitly - specifies that such a signal should be delivered to the - target program). - - Typically, this would occure when a user is debugging a - target monitor on a simulator: the target monitor sets a - breakpoint; the simulator encounters this break-point and - halts the simulation handing control to GDB; GDB, noteing - that the break-point isn't valid, returns control back to the - simulator; the simulator then delivers the hardware - equivalent of a SIGNAL_TRAP to the program being debugged. */ - + /* 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 + user is debugging a target monitor on a simulator: the target + monitor sets a breakpoint; the simulator encounters this + breakpoint and halts the simulation handing control to GDB; + GDB, noting that the stop address doesn't map to any known + breakpoint, returns control back to the simulator; the + simulator then delivers the hardware equivalent of a + GDB_SIGNAL_TRAP to the program being debugged. */ if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP && !signal_program[ecs->event_thread->suspend.stop_signal]) ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0; -- 1.7.11.7