From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by sourceware.org (Postfix) with ESMTPS id B21C23858010 for ; Wed, 13 Jul 2022 22:24:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B21C23858010 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f47.google.com with SMTP id l22-20020a05600c4f1600b003a2e10c8cdeso2676447wmq.1 for ; Wed, 13 Jul 2022 15:24:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p6ZscCGnVF8IohFEeCWb8BeLZinUPmG6HML/gD5LfVA=; b=ccvpvV7jQzIhyASD79RQFj4vDyLHo+OfNC4XrDKO/gTJiz3BUrcZwVCCLn+5FJj8B1 X7IfSXI2tpYWk/wj7Jbai4X2srQ3UwSck3GE8PQUmT4qL306PBXGzAU+6tnAmNqZL0Od wfzbKDvdR+JDNgJjcVc21xQ8aaAsvtqKIrI6Imc+jxW6PZJP9BXdTIexuOY+44sVAeYi t40cPlyMPuIuxAroCQ2/Kl7j0Y2uQm2u1qNTZR2tUTTjUacfSOPLRmxZb56XNCUO3RSA HWM5Wy3JOEXuOxH7QBPzPa6NhPoL/YaDdgn0VBZuztKMyTgI12GfkhqAE0Jd09SFzw3R vnUA== X-Gm-Message-State: AJIora+P+q4erD5wgyK8cn+pk9FMl/ZcG6prjDNkZPXsRlwKKlAC0O2h zjJpN94XQO6H7fvIGAGh/gkryHJK4ig= X-Google-Smtp-Source: AGRyM1tD5env4zAo+H0oe1DS3JIONah2S1jhAmT/JiN75avECgB73QsbaTqfjxu51IOF8nyxc97drw== X-Received: by 2002:a05:600c:3b17:b0:3a2:ee46:e312 with SMTP id m23-20020a05600c3b1700b003a2ee46e312mr11482111wms.49.1657751092974; Wed, 13 Jul 2022 15:24:52 -0700 (PDT) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id v8-20020a05600c214800b003a2cf1535aasm3902625wml.17.2022.07.13.15.24.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Jul 2022 15:24:52 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 08/29] Thread options & clone events (native Linux) Date: Wed, 13 Jul 2022 23:24:12 +0100 Message-Id: <20220713222433.374898-9-pedro@palves.net> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220713222433.374898-1-pedro@palves.net> References: <20220713222433.374898-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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-List-Received-Date: Wed, 13 Jul 2022 22:24:56 -0000 This commit teaches the native Linux target about the GDB_TO_CLONE thread option. It's actually simpler to just continue reporting all clone events unconditionally to the core. There's never any harm in reporting a clone event when the option is disabled. All we need to do report support for the option, otherwise GDB falls back to use target_thread_events(). Change-Id: If271f20320d864f074d8ac0d531cc1a323da847f Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19675 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27830 --- gdb/linux-nat.c | 7 +++++++ gdb/linux-nat.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 23d42b5fd55..4ddc54ff8bc 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4416,6 +4416,13 @@ linux_nat_target::thread_events (int enable) report_thread_events = enable; } +bool +linux_nat_target::supports_set_thread_options (gdb_thread_options options) +{ + constexpr gdb_thread_options supported_options = GDB_TO_CLONE; + return ((options & supported_options) == options); +} + linux_nat_target::linux_nat_target () { /* We don't change the stratum; this target will sit at diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index 683173dbd38..c449dc77a5e 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -82,6 +82,8 @@ class linux_nat_target : public inf_ptrace_target void thread_events (int) override; + bool supports_set_thread_options (gdb_thread_options options) override; + bool can_async_p () override; bool supports_non_stop () override; -- 2.36.0