From patchwork Thu May 24 10:50:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 27485 Received: (qmail 109682 invoked by alias); 24 May 2018 10:50:53 -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 109456 invoked by uid 89); 24 May 2018 10:50:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:sk:33-v6mr, sk:fetch_i X-HELO: mail-wr0-f173.google.com Received: from mail-wr0-f173.google.com (HELO mail-wr0-f173.google.com) (209.85.128.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 24 May 2018 10:50:50 +0000 Received: by mail-wr0-f173.google.com with SMTP id w3-v6so2218920wrl.12 for ; Thu, 24 May 2018 03:50:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=FzFL4LvNCDEZSlx0xgSFOB0fgf6MNVd/iKZSpAPo6rk=; b=l6cyW27If+xdXI47VaYh3Mxa/AZ6uvb/JcVd8Fh06JItWf2R2P/8pmVc9TQHudjYOK I+2KY8yI1SuxgTM+aeIsKIzoi5xyLNiPTXQ8HBLDoHy+u0/PwwEGI25JmsTqI8FM7ATK Kvf/KgTODqdSQis1/2g32mgU3CRiw15ehSU4SfvUvyr13ORxFpTwp1VPhnsdO0w9/Q6O 0mJVcgFkv/pd2/Kxt9+8TVXdioTbIcF3yfuHmqj7tH5tkZDrOh99lHwSPvqtQnxi3ORW /U220g/8LlSWZ8NVxT/NO+5HE790w7n0oRMS8ZefLnheemoa0COVaKsGfDGKfKoUe/zz NBLA== X-Gm-Message-State: ALKqPwdodZcCO9aUHGWesbyA2lkA9SNHHZgNa0s79Tqwe10stFQChx/3 y0/TALOwaC4mRYcsPJVQqFALQppc X-Google-Smtp-Source: AB8JxZoT2G/GZtGsXQom72KieDUCmXQJ7dCD8cAfoENGvn7ZFpo/Z++uBUDkZq69Gs2CuDXofrOqDQ== X-Received: by 2002:adf:8124:: with SMTP id 33-v6mr6215466wrm.109.1527159047730; Thu, 24 May 2018 03:50:47 -0700 (PDT) Received: from localhost (host86-164-85-144.range86-164.btcentralplus.com. [86.164.85.144]) by smtp.gmail.com with ESMTPSA id 5-v6sm8743646wre.41.2018.05.24.03.50.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 May 2018 03:50:47 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 3/4] gdb: Run INF_EXEC_COMPLETE handler for additional cases Date: Thu, 24 May 2018 11:50:39 +0100 Message-Id: <59b1b9214bf0db884bf2eefcdacbf4e148137e57.1527157948.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes When making an inferior call, and non-stop mode is off, then, once the inferior call is complete all threads will be stopped, and we should run the INF_EXEC_COMPLETE handler. This will result in a call to 'target_async(0)' to remove the event handlers for the target. This was discussed by Yao Qi in this mailing list thread: https://sourceware.org/ml/gdb/2017-10/msg00032.html Without this then the target event handlers are left in place even when the target is stopped, which is different to what happens during a standard stop proceedure (for example when one thread hits a breakpoint). gdb/ChangeLog: PR gdb/22882 * infrun.c (fetch_inferior_event): If GDB is not proceeding then run INF_EXEC_COMPLETE handler, even when not calling normal_stop. Move should_notify_stop local into more inner scope. --- gdb/ChangeLog | 8 ++++++++ gdb/infrun.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 1c4cd55e8f3..80721e822ab 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3932,7 +3932,6 @@ fetch_inferior_event (void *client_data) struct inferior *inf = find_inferior_ptid (ecs->ptid); int should_stop = 1; struct thread_info *thr = ecs->event_thread; - int should_notify_stop = 1; delete_just_stopped_threads_infrun_breakpoints (); @@ -3950,6 +3949,9 @@ fetch_inferior_event (void *client_data) } else { + int should_notify_stop = 1; + int proceeded = 0; + clean_up_just_stopped_threads_fsms (ecs); if (thr != NULL && thr->thread_fsm != NULL) @@ -3960,17 +3962,15 @@ fetch_inferior_event (void *client_data) if (should_notify_stop) { - int proceeded = 0; - /* We may not find an inferior if this was a process exit. */ if (inf == NULL || inf->control.stop_soon == NO_STOP_QUIETLY) proceeded = normal_stop (); + } - if (!proceeded) - { - inferior_event_handler (INF_EXEC_COMPLETE, NULL); - cmd_done = 1; - } + if (!proceeded) + { + inferior_event_handler (INF_EXEC_COMPLETE, NULL); + cmd_done = 1; } } }