From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 9ebMEyNpYGb7RScAWB0awg (envelope-from ) for ; Wed, 05 Jun 2024 09:33:23 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RMoSdzIP; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3FF1D1E0C0; Wed, 5 Jun 2024 09:33:23 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 201761E092 for ; Wed, 5 Jun 2024 09:33:21 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8C3B8398CC33 for ; Wed, 5 Jun 2024 13:33:20 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id EAF193935DFC for ; Wed, 5 Jun 2024 13:32:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EAF193935DFC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EAF193935DFC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717594371; cv=none; b=UNGIEy5490xCkhRJrvdb/8GAnmBZG809tTwYFHbu3I00jG3Wgs7/mGRsXeS6/iF+o4Iie07fDnZbsBrSfr0ablpqMecxofiFa2B6rIcsSD5SEOF40o6FTwgl2iFk3buQkMwFqeqG488dNuM1Pb1VctxI/1rj7acu1/PpclAiJV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717594371; c=relaxed/simple; bh=s+JIO4GRsC+D6dGqAJcc+QQXdCvZaujxRPXT2jD0vj0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=TpVsPsCsAtk1Qffd/lfPuHvnUTwL95UrysNE0Yk6vWeLexGaT3iE/7E3ov56EYGCl+Eee3PoAk2i020B8lT9Uoz1XE6CtX8R7FCB3HTnlxMtL8xCvmZmQb7dtc4F8lIOjxhhxrVVrzzitNagaVKallqrWycDJhveE/UTMkEK4so= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717594368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xqxWlzXhT/c+ss7nTI5vhdtni7TqT32LARG4Q/pTxRc=; b=RMoSdzIPe6SR4Jjbaqq1ZMx/0GOpS/fHokaA/JhSUkMpQFGYMFCqyOkdr6sciEgnLgsED2 xD7lrImMd1xi7mB6kuelK9Oulc8lmFTTERKgX7Wg8rIMUxEfkISt2vABXRa05jl9ZmaEbv h1pNGIP2/AoyQLqKQZpLrXNy+pOWEc0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-54-sW3_4DEZNXm6yX2YGk4XjQ-1; Wed, 05 Jun 2024 09:32:47 -0400 X-MC-Unique: sW3_4DEZNXm6yX2YGk4XjQ-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42120e033e2so35790665e9.0 for ; Wed, 05 Jun 2024 06:32:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717594366; x=1718199166; 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=xqxWlzXhT/c+ss7nTI5vhdtni7TqT32LARG4Q/pTxRc=; b=rhClayqUVD0O8PRpFFPre9zZuVTM5UtHspH1KcOQ1/UGgI9owrlnDHl5vIsuAKgt6N ALhVOEP0wM3lGjhKbmcwhLbqRgLWKaOHMGFr4vOoIwnyBLCiGhv6wtL5GNZVZV0+UtVx S2Cf7e8Wjzc+2yzWdwwhq7HHXzp/1GrUHhSyrLZJCdOn4S9y8mN1NN5MnKbywvuiZkdr DKvDs8DH5aOBqXScJ2rRO0Oigv6GVqyP0zICL6U5k70/Pv1ZPKui171zB3K+8P2gRV8H mekTuy/VUs25JkRXCvizuhdyfz0OWrAdoIqUmxdscBhXx5qHfrWZGfrhf7csrBf8CBud +nCg== X-Gm-Message-State: AOJu0YwvJ4Y4AjL/Xcp77cvNodI2FMJR4C+7A107nn+VjztZKQZBVolv trXbVNLqBT3F1FxwzkLAXS42d+wJuzOwAzLJ82LeI+wpsquDnxEjg+ZlpWUd0UovYzGzzYbj5iL S7z/5k1wOkdC1Su0uZg5iHsUhSs22+1T/cC+QA/Kf031npFy/EeiRv31AlUYKI6/x0thspfWKiQ EmjqSlTCYeY2S/skg6mKf6Cz8jmu98xkd8ja9ClwT2zzQ= X-Received: by 2002:a05:600c:4fd1:b0:421:5597:ea27 with SMTP id 5b1f17b1804b1-421562ed0damr24855945e9.22.1717594365906; Wed, 05 Jun 2024 06:32:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVDFOO7HuC5KK8uNGoZbZbhpCvk/AmlcLac4Ce82eYN5LGWNM9K1rkG68i519gO364TwvZxw== X-Received: by 2002:a05:600c:4fd1:b0:421:5597:ea27 with SMTP id 5b1f17b1804b1-421562ed0damr24855655e9.22.1717594365272; Wed, 05 Jun 2024 06:32:45 -0700 (PDT) Received: from localhost ([31.111.84.186]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4214a4abdd5sm38847785e9.0.2024.06.05.06.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:32:44 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv11 0/9] thread-specific breakpoints in just some inferiors Date: Wed, 5 Jun 2024 14:32:34 +0100 Message-Id: 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TVD_PH_BODY_ACCOUNTS_PRE, 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Feedback welcome. I'm keen to try and land this early within this next release cycle so it can get wider testing. Thanks, Andrew --- In v11: - Rebased on to current upstream master. No significant merge issues found. Retested, no issues found. In v10: - I merged the first 5 patches. These were mostly just adding extra asserts, or minor refactoring and cleanup that didn't change GDB's behaviour. Patch #2 did have a minor behaviour change, but this was just removing some (I think) unintended behaviour, - Rebased onto current upstream/master branch, - No other changes since v9. In v9: - Rebased onto current upstream/master branch, - Minor testsuite fix to account for updated output from GDB, - No other changes since v8. In v8: - Rebased onto current upstream/master branch. - Reordered the patches a little. Patches 0 to 8 are unchanged from previous. If there's no objections then I'm planning to merge these some point soon as I think these are all good cleanup patches. - Patches 9, 10, and 11 are new. These are also refactoring commits, but are all tied pretty tightly to what is now patch 12. - Patch 12 is the most important patch. This has had a complete rewrite since V7 in order to address Tom's feedback. The general idea is unchanged; the breakpoint condition string is parsed first forwards, and then backwards, but we now have a two phase analysis, rather than immediately parsing things like the thread-id as we find them. This resolves this problem: (gdb) break some_function if ( 3 == thread ) Previous GDB would try to match 'thread )' as a thread-id and give an error that ')' as invalid. Now GDB correctly understands that the 'thread )' is likely part of the 'if' condition, and parses it as such. - Patches 13 and 14 are unchanged from V7. These patches depend on the changes in patch 12 so can't be merged without that patch. In v7: - Addressed all the issues except one that Baris pointed out, this includes typos, some minor testsuite cleanups, and reformatting an assert (but not changing the meaning). - As requested, switched to use std::string_view in break-parse-cond.c file instead of a custom class, I agree that this is an improvement. - I've not changed the handling of -force-condition flag. I replied to the review email with my thoughts, TLDR: fixing this would be a bigger task which I'd rather leave for ... the future. - Rebased and retested. In v6: - Rebased to current master, one minor fix due to the C++17 changes, nothing major. Retested. In v5: - Updates after Lancelot's feedback, including, -force-condition can no longer be abbreviated to '-', and can't be used immediately after the breakpoint condition. - More tests to check some of the edge cases. In v4: - Big update, this series now handles thread-specific and inferior-specific breakpoints. In v3: - Rebased on to current upstream/master, this includes all Simon's recent breakpoint changes. Retested with no regressions seen. In v2: - Rebased on current upstream/master and retested, - No changes to code or docs. --- Andrew Burgess (9): gdb: don't display inferior list for pending breakpoints gdb: remove breakpoint_re_set_one gdb: remove tracepoint_probe_create_sals_from_location_spec gdb: make breakpoint_debug_printf global gdb: add another overload of startswith gdb: create new is_thread_id helper function gdb: parse pending breakpoint thread/task immediately gdb: don't set breakpoint::pspace in create_breakpoint gdb: only insert thread-specific breakpoints in the relevant inferior gdb/Makefile.in | 2 + gdb/NEWS | 11 + gdb/ada-lang.c | 6 +- gdb/break-catch-throw.c | 6 +- gdb/break-cond-parse.c | 702 +++++++++++++++++ gdb/break-cond-parse.h | 52 ++ gdb/breakpoint.c | 709 ++++++++---------- gdb/breakpoint.h | 55 +- gdb/testsuite/gdb.ada/tasks.exp | 6 +- gdb/testsuite/gdb.base/condbreak.exp | 57 +- gdb/testsuite/gdb.base/pending.exp | 23 +- gdb/testsuite/gdb.linespec/explicit.exp | 4 +- gdb/testsuite/gdb.linespec/keywords.exp | 8 +- gdb/testsuite/gdb.mi/mi-dprintf-pending.exp | 3 +- gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp | 8 +- .../gdb.mi/user-selected-context-sync.exp | 14 +- .../gdb.multi/bp-thread-specific.exp | 7 +- .../gdb.multi/inferior-specific-bp.exp | 16 +- .../gdb.multi/multi-target-continue.exp | 2 +- .../gdb.multi/multi-target-ping-pong-next.exp | 4 +- .../gdb.multi/pending-bp-del-inferior.c | 28 + .../gdb.multi/pending-bp-del-inferior.exp | 214 ++++++ gdb/testsuite/gdb.multi/pending-bp-lib.c | 22 + gdb/testsuite/gdb.multi/pending-bp.c | 66 ++ gdb/testsuite/gdb.multi/pending-bp.exp | 332 ++++++++ gdb/testsuite/gdb.multi/tids.exp | 6 +- .../gdb.threads/del-pending-thread-bp-lib.c | 22 + .../gdb.threads/del-pending-thread-bp.c | 85 +++ .../gdb.threads/del-pending-thread-bp.exp | 108 +++ gdb/tid-parse.c | 82 +- gdb/tid-parse.h | 8 + gdbsupport/common-utils.h | 10 + 32 files changed, 2202 insertions(+), 476 deletions(-) create mode 100644 gdb/break-cond-parse.c create mode 100644 gdb/break-cond-parse.h create mode 100644 gdb/testsuite/gdb.multi/pending-bp-del-inferior.c create mode 100644 gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp create mode 100644 gdb/testsuite/gdb.multi/pending-bp-lib.c create mode 100644 gdb/testsuite/gdb.multi/pending-bp.c create mode 100644 gdb/testsuite/gdb.multi/pending-bp.exp create mode 100644 gdb/testsuite/gdb.threads/del-pending-thread-bp-lib.c create mode 100644 gdb/testsuite/gdb.threads/del-pending-thread-bp.c create mode 100644 gdb/testsuite/gdb.threads/del-pending-thread-bp.exp base-commit: 2db414c36b4f030782c2c8a24c916c3033261af0 -- 2.25.4