From patchwork Tue Jan 31 17:27:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 64030 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7CE5A3858C39 for ; Tue, 31 Jan 2023 17:50:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CE5A3858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675187425; bh=iM7811YNimi4dHql0gtvTnaJkZLrG1ns2bSGYUHGK9U=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=r24gc8IdVqx5b8Kt68CM2wrFOweU4U9zS1CfM3ZIIAkOxA2vAcCnUnjoABHQz0Mlf nWqE3HqpLnNW6MPqm1EhyVmh9PWfM1bs57BColQv83VPV2clYYZ3KsfHuyPaTUN2Dv jbT7SIu5kRPNHmYdL7o70uppQ1MEjnt/k78NDDAc= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 4354E3858C5F for ; Tue, 31 Jan 2023 17:49:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4354E3858C5F Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-636-GjNfyKQtNCKjsaGG48vD2w-1; Tue, 31 Jan 2023 12:27:37 -0500 X-MC-Unique: GjNfyKQtNCKjsaGG48vD2w-1 Received: by mail-qt1-f200.google.com with SMTP id a24-20020ac84d98000000b003b9a4958f0cso2072911qtw.3 for ; Tue, 31 Jan 2023 09:27:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iM7811YNimi4dHql0gtvTnaJkZLrG1ns2bSGYUHGK9U=; b=baXPmGTOAYBfQthZJoZ68yyQKC+i0XGhw9Mk2GYm8vfDvTzV3yGOcczwGhLI9YwtBC 1eFjlL+BISzi4H4s+l1M7Rc1b2HnFHCFmtDtTdrEE77SQCbb1hDHDy/pfwaW+a/gbVNp gPuEAMRvkWuWlq3WK7OSlKRESYUcwIQ24WimIlrWC0pfulxDCeleXSD8N7Klo7IONY2W jrbNl3v/AphbWiYYx57PtUpB0R1mEpa7gtXVdw44tnFISTJ3ZwDjB5zZq6PdqbohcCd4 Pp/445meEQWbPcarYvxwLOO1v4q7set50tYCK+84j8TXD/FJjh5F2IdoUC78IesDgVxa 2NeQ== X-Gm-Message-State: AO0yUKUkBezIBlBHPrBeffGxZK+UKwFvhzHYoz5KV/DsE3cga6zoMcZN Ipz+JiyBsKc+B2VclJ/TIIKH35g2N2huDWxd3nVZSBIeER33c47OhzDbbNsmo5/U8A4fi4Nh7Ib Rnex9McUlU1yEFoNqcmzpnZWZcolkFnFpDpTSSNithUESIipiugFsNg/0AZSLJSnA4zT7Oom27Q == X-Received: by 2002:ac8:5a41:0:b0:3b8:6db0:7565 with SMTP id o1-20020ac85a41000000b003b86db07565mr10101100qta.11.1675186057121; Tue, 31 Jan 2023 09:27:37 -0800 (PST) X-Google-Smtp-Source: AK7set+kKMhKZq8jb0j4hDN+iF+kb44dpi00p4I9cLhLd0kkKLR7loBQmB+FddFoVryEiXY5LVzljQ== X-Received: by 2002:ac8:5a41:0:b0:3b8:6db0:7565 with SMTP id o1-20020ac85a41000000b003b86db07565mr10101070qta.11.1675186056824; Tue, 31 Jan 2023 09:27:36 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id a26-20020aed279a000000b003b8484fdfccsm6251747qtd.42.2023.01.31.09.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 09:27:36 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 08/13] Revert "gdb: remove unnecessary parameter wait_ptid from do_target_wait" Date: Tue, 31 Jan 2023 17:27:13 +0000 Message-Id: <4cc6209933e165e056ad97dfd9b946eaea1f38ea.1675185990.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This reverts commit ac0d67ed1dcf470bad6a3bc4800c2ddc9bedecca. There was nothing wrong with the commit which I'm reverting here, but it removed some functionality that will be needed for a later commit; that is, the ability for GDB to ask for events from a specific ptid_t via the do_target_wait function. In a follow up commit, this functionality will be used to implement inferior function calls in multi-threaded inferiors. This is not a straight revert of the above commit. Reverting the above commit replaces a 'nullptr' with 'NULL', I've gone in and changed that, preserving the 'nullptr'. --- gdb/infrun.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index edfb5ab0a91..f97349f47d2 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3741,7 +3741,8 @@ do_target_wait_1 (inferior *inf, ptid_t ptid, more events. Polls for events from all inferiors/targets. */ static bool -do_target_wait (execution_control_state *ecs, target_wait_flags options) +do_target_wait (ptid_t wait_ptid, execution_control_state *ecs, + target_wait_flags options) { int num_inferiors = 0; int random_selector; @@ -3751,9 +3752,10 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options) polling the rest of the inferior list starting from that one in a circular fashion until the whole list is polled once. */ - auto inferior_matches = [] (inferior *inf) + auto inferior_matches = [&wait_ptid] (inferior *inf) { - return inf->process_target () != nullptr; + return (inf->process_target () != nullptr + && ptid_t (inf->pid).matches (wait_ptid)); }; /* First see how many matching inferiors we have. */ @@ -3792,7 +3794,7 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options) auto do_wait = [&] (inferior *inf) { - ecs->ptid = do_target_wait_1 (inf, minus_one_ptid, &ecs->ws, options); + ecs->ptid = do_target_wait_1 (inf, wait_ptid, &ecs->ws, options); ecs->target = inf->process_target (); return (ecs->ws.kind () != TARGET_WAITKIND_IGNORE); }; @@ -4169,7 +4171,7 @@ fetch_inferior_event () the event. */ scoped_disable_commit_resumed disable_commit_resumed ("handling event"); - if (!do_target_wait (&ecs, TARGET_WNOHANG)) + if (!do_target_wait (minus_one_ptid, &ecs, TARGET_WNOHANG)) { infrun_debug_printf ("do_target_wait returned no event"); disable_commit_resumed.reset_and_commit ();