From patchwork Tue Mar 24 18:52:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 5792 Received: (qmail 54316 invoked by alias); 24 Mar 2015 18:52:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 54300 invoked by uid 89); 24 Mar 2015 18:52:19 -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; Tue, 24 Mar 2015 18:52:18 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 3A3EAC63D9 for ; Tue, 24 Mar 2015 18:52:17 +0000 (UTC) Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2OIqGlC019338 for ; Tue, 24 Mar 2015 14:52:16 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Shuffle user_visible_resume_ptid Date: Tue, 24 Mar 2015 18:52:15 +0000 Message-Id: <1427223135-18814-1-git-send-email-palves@redhat.com> ... and move comment to declaration. gdb/ChangeLog: 2015-03-24 Pedro Alves * infrun.c (user_visible_resume_ptid): Rewrite going from most-locked to unlocked instead of the opposite. Move comment ... * infrun.h (user_visible_resume_ptid): ... here. --- gdb/ChangeLog | 6 ++++++ gdb/infrun.c | 32 ++++++++++++++++---------------- gdb/infrun.h | 8 +++++++- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fc65c603..a7d95f6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2015-03-24 Pedro Alves + * infrun.c (user_visible_resume_ptid): Rewrite going from + most-locked to unlocked instead of the opposite. Move comment ... + * infrun.h (user_visible_resume_ptid): ... here. + +2015-03-24 Pedro Alves + * linux-nat.c (linux_nat_resume): Output debug logs before trying to resume the event lwp. Use the lwp's ptid instead of the passed in (maybe wildcard) ptid. diff --git a/gdb/infrun.c b/gdb/infrun.c index 3c2d2fb..ce6fb1a 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1997,19 +1997,13 @@ maybe_software_singlestep (struct gdbarch *gdbarch, CORE_ADDR pc) return hw_step; } +/* See infrun.h. */ + ptid_t user_visible_resume_ptid (int step) { - /* By default, resume all threads of all processes. */ - ptid_t resume_ptid = RESUME_ALL; - - /* Maybe resume only all threads of the current process. */ - if (!sched_multi && target_supports_multi_process ()) - { - resume_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); - } + ptid_t resume_ptid; - /* Maybe resume a single thread after all. */ if (non_stop) { /* With non-stop mode on, threads are always handled @@ -2019,16 +2013,22 @@ user_visible_resume_ptid (int step) else if ((scheduler_mode == schedlock_on) || (scheduler_mode == schedlock_step && step)) { - /* User-settable 'scheduler' mode requires solo thread resume. */ + /* User-settable 'scheduler' mode requires solo thread + resume. */ resume_ptid = inferior_ptid; } + else if (!sched_multi && target_supports_multi_process ()) + { + /* Resume all threads of the current process (and none of other + processes). */ + resume_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); + } + else + { + /* Resume all threads of all processes. */ + resume_ptid = RESUME_ALL; + } - /* We may actually resume fewer threads at first, e.g., if a thread - is stopped at a breakpoint that needs stepping-off, but that - should not be visible to the user/frontend, and neither should - the frontend/user be allowed to proceed any of the threads that - happen to be stopped for internal run control handling, if a - previous command wanted them resumed. */ return resume_ptid; } diff --git a/gdb/infrun.h b/gdb/infrun.h index ab97eea..1f09e41 100644 --- a/gdb/infrun.h +++ b/gdb/infrun.h @@ -95,7 +95,13 @@ extern void proceed (CORE_ADDR, enum gdb_signal); extern void resume (enum gdb_signal); /* Return a ptid representing the set of threads that we will proceed, - in the perspective of the user/frontend. */ + in the perspective of the user/frontend. We may actually resume + fewer threads at first, e.g., if a thread is stopped at a + breakpoint that needs stepping-off, but that should not be visible + to the user/frontend, and neither should the frontend/user be + allowed to proceed any of the threads that happen to be stopped for + internal run control handling, if a previous command wanted them + resumed. */ extern ptid_t user_visible_resume_ptid (int step); extern void wait_for_inferior (void);