From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76939 invoked by alias); 22 May 2015 18:35:16 -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 76925 invoked by uid 89); 22 May 2015 18:35:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-pa0-f73.google.com Received: from mail-pa0-f73.google.com (HELO mail-pa0-f73.google.com) (209.85.220.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 22 May 2015 18:35:14 +0000 Received: by pablj1 with SMTP id lj1so1938158pab.1 for ; Fri, 22 May 2015 11:35:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:message-id:date:subject:from:to:cc :content-type; bh=NsbU3y94xjWUhHXVZhWGir+qO0f2bEUD/e/JS6CKz/U=; b=R6Ex/t1PODhWaD77K3M80VnDMMly0BnfSYiMhfd7TOpz1n+E3l+TwKduJWUomxYrne 3PLreLabsvoXZpGgfEGKigNQGk77XUXrKf47otvUdOR7f/PVMwsK0XUUpfnSlK4TK1dG rlNS4mQEryRGRwk3at/fQpHOgyOIO83EPcaWXBO+45gnuNK5EcEn4/9mVLT3JGaeACB8 cYZD+ul++RHwvZk1gBB99MkoJvODfPvrN7ERkG8Xvfhav+/wj9T9finGLReyGjNKt7Gd FXtRpkiMFs5vq2XvXQIUkF2qmi4br2kkFcw2pPwjqwQv9HL1xA7ZavNuZm5/FvgQODfb ySGA== X-Gm-Message-State: ALoCoQn2NAOxvE9arawzRRncctdXHrsy7I4jRuj2lu/azcMCuQ++UM5QnNTe/rZjpbmotGtirJx+ MIME-Version: 1.0 X-Received: by 10.66.122.70 with SMTP id lq6mr11072412pab.48.1432319712455; Fri, 22 May 2015 11:35:12 -0700 (PDT) Message-ID: <047d7b2e4e86aaa0ff0516afeb5c@google.com> Date: Fri, 22 May 2015 18:35:00 -0000 Subject: Re: [PATCH 11/18] Implement all-stop on top of a target running non-stop mode From: Doug Evans To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00612.txt.bz2 Pedro Alves writes: > ... > gdb/ChangeLog: > 2015-05-21 Pedro Alves > > * NEWS: Mention "maint set/show target-non-stop". > * breakpoint.c (update_global_location_list): Check > target_is_non_stop_p instead of non_stop. > * infcmd.c (attach_command_post_wait, attach_command): Likewise. > * infrun.c (show_can_use_displaced_stepping) > (can_use_displaced_stepping_p, start_step_over_inferior): > Likewise. > (resume): Always resume a single thread if the target is in > non-stop mode. > (proceed): Check target_is_non_stop_p instead of non_stop. If in > all-stop mode but the target is always in non-stop mode, start all > the other threads that are implicitly resumed too. > (for_each_just_stopped_thread, fetch_inferior_event) > (adjust_pc_after_break, stop_all_threads): Check > target_is_non_stop_p instead of non_stop. > (handle_inferior_event): Likewise. Handle detach-fork in all-stop > with the target always in non-stop mode. > (handle_signal_stop) : Check target_is_non_stop_p > instead of non_stop. > (switch_back_to_stepped_thread): Check target_is_non_stop_p > instead of non_stop. > (keep_going_stepped_thread): Always resume a single thread if the > target is in non-stop mode. > (stop_waiting): If in all-stop mode, and the target is in non-stop > mode, stop all threads. > (keep_going_pass): Likewise, when starting a new in-line step-over > sequence. > * linux-nat.c (get_pending_status, select_event_lwp) > (linux_nat_filter_event, linux_nat_wait_1, linux_nat_wait): Check > target_is_non_stop_p instead of non_stop. > (linux_nat_always_non_stop_p): New function. > (linux_nat_stop): Check target_is_non_stop_p instead of non_stop. > (linux_nat_add_target): Install linux_nat_always_non_stop_p. > * target-delegates.c: Regenerate. > * target.c (target_is_non_stop_p): New function. > (target_non_stop_enabled, target_non_stop_enabled_1): New globals. > (maint_set_target_non_stop_command) > (maint_show_target_non_stop_command): New functions. > (_initilize_target): Install "maint set/show target-non-stop" > commands. > * target.h (struct target_ops) : New field. > (target_non_stop_enabled): New declaration. > (target_is_non_stop_p): New declaration. > > gdb/doc/ChangeLog: > 2015-05-21 Pedro Alves > > * gdb.texinfo (Maintenance Commands): Document "maint set/show > target-non-stop". > > ... > diff --git a/gdb/infrun.c b/gdb/infrun.c > index 75c5080..d9fc4e5 100644 > --- a/gdb/infrun.c > +++ b/gdb/infrun.c > ... > @@ -2383,7 +2384,15 @@ resume (enum gdb_signal sig) > insert_single_step_breakpoint (gdbarch, aspace, pc); > insert_breakpoints (); > > - resume_ptid = user_visible_resume_ptid (user_step); > + /* In non-stop, we always control threads individually. > + Note that the target may always work in non-stop mode > + even with "set non-stop off", in which case > + user_visible_resume_ptid could return a wildcard > + ptid. */ > + if (target_is_non_stop_p ()) > + resume_ptid = inferior_ptid; > + else > + resume_ptid = user_visible_resume_ptid (user_step); > do_target_resume (resume_ptid, 0, GDB_SIGNAL_0); > discard_cleanups (old_cleanups); > tp->resumed = 1; re: improved comment: Better, thanks. I found another instance in keep_going_stepped_thread: if (target_is_non_stop_p ()) resume_ptid = inferior_ptid; else resume_ptid = user_visible_resume_ptid (tp->control.stepping_command); Can you add a comment here too? Thanks. [An alternative would be to add a utility function that contained this code and then put the comment there, but I'll leave it to you to decide if you want such a function.]