From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 85533385841C for ; Sun, 31 Mar 2024 10:32:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 85533385841C 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 85533385841C 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=1711881122; cv=none; b=YhpIuNILBcQ38nNzAXWhUhVHuK0vLQiFmm/smEH5T0kvOPddN9GWxIuMFqgBIpCeG3zyvPlfCHuItCqJx/m/91qYPpl2pl8S8GG2EW1qEeOty3TjIGjt8sZ6lLJJyEOFD/pNvQfrpCT59jbqtFxYPQzEElk116cMzT5C0DSJ1WA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711881122; c=relaxed/simple; bh=J9bVup8ugkkxbS8U/U6M8H6A3kISoeTTRZ4bgFi1EmY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ZrGFcfeyP6JMU5DA69m0b7tbBUbQKrwWX21xRtD2qJ38Yo0OGxnW2lwEUN6QNG8JzAnNsW6oRHhsByOE4SZ09i+ygvNIBa6V1sdTXfZd++MOqOtR5UG0iGhuopLXOwOaQWj/+8+8WhFKAKjQ6fzWt7CmUvnX0svL9L8btmLTpFw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711881120; 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=+mDAvMh+53+YtflwxGemuiZwaLPM8Stt3ywFDMlinh8=; b=fqMKlS4z1i37d4LmM4MaDE1zkB2/T11L/X6WI7khpL4HNF1cTnKvg0IwtHVBAoojf794/X FH+L/X4nP5MxzWhhwP4bQ3z4/bGZ9W+K3tLysDWFrKl1dK2zeFP1//QyikVlD90Tjl5hIn FRyW9aWx2zFsXZQPBVN1oOTwLJMMVaI= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-L0pCFFg_NVmv911HlDXs_g-1; Sun, 31 Mar 2024 06:31:58 -0400 X-MC-Unique: L0pCFFg_NVmv911HlDXs_g-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a4e61c7554fso24107166b.0 for ; Sun, 31 Mar 2024 03:31:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711881117; x=1712485917; 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=+mDAvMh+53+YtflwxGemuiZwaLPM8Stt3ywFDMlinh8=; b=DFdK0hYOZSsvmOhC5IdPpQEOC1kqzt38ZeJqc8bMT8Jk13bHlPtW19LQ89TFDC27im geCpqZTXCpq65/GZPPKO8GsbmqrwUXAQ4uIX7NNikHxa9aDIi0Z6s7DmZ02YcZrTqPmP 7h8nk77aBDe1nP9iZzoSJ4dhFan5xAkn+7JecIkSWJ4K3Mt3j9t3BksDdqy+Vsf03cZz Ux29ZDH41rbBPpheLmTcJjiK3sFXtwhdh5bEAcePOGJSaw/BoQtRES1ORG+aIPjOlupe LX0r4eHDpF09MgkztNMsQpNNbnBMUn9BihEHQppa/CwWl/c/NkSmdgNd23H7Uj7z+ZCE BKog== X-Gm-Message-State: AOJu0Yz+7J7Mwpy8++EJ91ThHRfpi79j+mLOmwNBUHUbq3ewCdqHmiEg 9E5fmbz/Ye5QMGyQUXc+9VOFB4XTBGdMG7w7qPik5Xs/wIfoLsPQZ7Jf3exdohOVfJPJD3nPwq8 D9fI/KDxuuJunYLVoDnHHuOD9/1afNWoH4mt/n8iN/PNQY/tyV0BKyfeuoD21wUjxTlllbqqWxs lWjI7THF9JmBqO69NAmFdO6gs6LMmZX2SI9oPxWP/+fR4= X-Received: by 2002:a17:906:33d1:b0:a4e:272e:166a with SMTP id w17-20020a17090633d100b00a4e272e166amr3905643eja.16.1711881116616; Sun, 31 Mar 2024 03:31:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaNCgacCegAglQ0+v3ltUKu0BnDxzIH8hr+79qh9kGN8HjP+TVGuZuBA1VIZ70ZcD7v6+bOg== X-Received: by 2002:a17:906:33d1:b0:a4e:272e:166a with SMTP id w17-20020a17090633d100b00a4e272e166amr3905630eja.16.1711881115882; Sun, 31 Mar 2024 03:31:55 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id o25-20020a17090611d900b00a4735fc654fsm3996914eja.205.2024.03.31.03.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 03:31:55 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv10 0/9] thread-specific breakpoints in just some inferiors Date: Sun, 31 Mar 2024 11:31:44 +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.9 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 | 701 +++++++++++++++++ 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, 2201 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: 8b4141cdb03e48826e2935529be7fd7499f9d815 -- 2.25.4