From patchwork Fri Oct 21 08:43:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 55236 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 4DA563852770 for ; Fri, 21 Oct 2022 08:44:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DA563852770 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666341867; bh=aCJ6R5lB7Dwgky+vw7dgEj872C/7HxFmJ8hh2OWotiU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=w13LWuCYQ3zuqjmDlcesDzJn3idwmZUza9gW104+8DKxwtBA5X6E4m2NvpB/UrwVj H8oCrHQwl2mkdBJONPVw6PdZxmovskW7lXPNDAe9Ys8/hc6db43M1VXNlAJkmd61e5 u9QBA+YLzbzq+aQ9wGqWxJ81h2J3LRaJ5LUG/1BE= 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.133.124]) by sourceware.org (Postfix) with ESMTPS id 846E5385C412 for ; Fri, 21 Oct 2022 08:43:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 846E5385C412 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-474-o2XPRzoEMwOR7G3iIQfobw-1; Fri, 21 Oct 2022 04:43:53 -0400 X-MC-Unique: o2XPRzoEMwOR7G3iIQfobw-1 Received: by mail-wm1-f72.google.com with SMTP id az35-20020a05600c602300b003c5273b79fdso3036357wmb.3 for ; Fri, 21 Oct 2022 01:43:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aCJ6R5lB7Dwgky+vw7dgEj872C/7HxFmJ8hh2OWotiU=; b=im6OULQlYTVvFSmU/53uxvGj9BbJwew+eWC+StW5PzXRjI6Rr7rSlDKroXfUciiQvF vCS8viWJIPuu/QovKb5ievL7v3TxCnIGjrDSwCxdnMQ4aTYmVMBrAWYPbCFsrhVA6UZ/ LL41yRZCPCozn75KeUBOp8EF/wGivBvwpqwVvM+dT/vEpVCjovb3UX5rt6R9RIUgUOpk 6AnBV7oKXC+mAtdcx93jXYwidyMlbXg3C+KvaRtb34CvFhcxUrBHL7ucjTOVoNR2yb0G rq1s18/yhz5v4743pFQBuwsCoEg3wninC1GNMuZ9tBiUxL+7GdTlqxhZ942L1z21ifal M39g== X-Gm-Message-State: ACrzQf2Oh8WTCeN1Wig1r2vcUFL5jBoCs0m9COvbExPXzuSj7xvkpt/J xp8jGmG6TgsGgvWQIMK42dYDRhgC8Zr1PaNqH5Uo669YgpRVG0wpg91Y4Dk93ElFjpMnMyOY+Oq zKVhl5ybIwcDEVqXHCIE05BR8mdYrRqqPbOnwVZi8QpTYgQ7JkdLRVAL5b9jqb3uXJeP5jnWc/g == X-Received: by 2002:adf:e84f:0:b0:235:d53a:2d7f with SMTP id d15-20020adfe84f000000b00235d53a2d7fmr5103453wrn.334.1666341831122; Fri, 21 Oct 2022 01:43:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4utXaaAowI8nAGPP7ef3Md4/0SCyeAQrEHMhFfAfEbB67lZ7tGNsn7MNJdbHkYivFmTKcuwQ== X-Received: by 2002:adf:e84f:0:b0:235:d53a:2d7f with SMTP id d15-20020adfe84f000000b00235d53a2d7fmr5103434wrn.334.1666341830770; Fri, 21 Oct 2022 01:43:50 -0700 (PDT) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id g13-20020a05600c310d00b003a1980d55c4sm2065037wmo.47.2022.10.21.01.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 01:43:50 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH 00/12] Infcalls from B/P conditions in multi-threaded inferiors Date: Fri, 21 Oct 2022 09:43:36 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-5.7 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_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 series aims to fix PR gdb/28942, GDB's inability to use inferior function calls from breakpoint conditions in multi-threaded inferiors. This work draws on the work done in this patch: https://sourceware.org/pipermail/gdb-patches/2021-March/176654.html Some of the changes in that series can be found in patch 10 in this series. There's a lot of patches here, but the work is really made of several mini-series: Patches 01 and 02 are trivial cleanup and debug output patches. These could probably be committed as obvious. Patch 03 improves the error message GDB gives when there is an error while evaluating a breakpoint condition. Patches 04, 05, and 06 are some gdbserver cleanup and then a gdbserver bug fix. Patches 07 and 08 are two further improvements for how the error is reported when a GDB fails to evaluate a breakpoint condition. Patches 09 and 10 actually fix using inferior function calls from breakpoint conditions in multi-threaded inferiors. Patch 11 is some new functionality to hopefully make GDB more robust when using inferior function calls, especially from a breakpoint condition. This patch is optional, we could stop at patch 10 if the ideas in this patch are not acceptable. Patch 12 is an adjustment for remote targets when not running in non-stop mode to improve how stops are reported to the user. Like patch 11, this work is optional. We could stop at either patch 10 or patch 11 if the work in this patch is not acceptable. Thanks, Andrew --- Andrew Burgess (12): gdb: int to bool conversion for normal_stop gdb/infrun: add debug print in print_signal_received_reason gdb: include breakpoint number in testing condition error message gdbserver: add comments to read_inferior_memory function gdbserver: allows agent_mem_read to return an error code gdbserver: allow agent expressions to fail with invalid memory access gdb: avoid repeated signal reporting during failed conditional breakpoint gdb: don't always print breakpoint location after failed condition check Revert "gdb: remove unnecessary parameter wait_ptid from do_target_wait" gdb: fix b/p conditions with infcalls in multi-threaded inferiors gdb: add timeouts for inferior function calls gdb/remote: avoid SIGINT after calling remote_target::stop gdb/NEWS | 16 ++ gdb/breakpoint.c | 17 +- gdb/doc/gdb.texinfo | 45 ++++ gdb/gdbthread.h | 3 + gdb/infcall.c | 174 +++++++++++++ gdb/infcmd.c | 2 +- gdb/infrun.c | 60 +++-- gdb/infrun.h | 4 +- gdb/remote.c | 17 ++ gdb/testsuite/gdb.base/bp-cond-failure.c | 30 +++ gdb/testsuite/gdb.base/bp-cond-failure.exp | 81 ++++++ .../gdb.base/catch-signal-siginfo-cond.exp | 2 +- gdb/testsuite/gdb.base/gnu-ifunc.exp | 2 +- gdb/testsuite/gdb.base/help.exp | 2 +- gdb/testsuite/gdb.base/infcall-failure.c | 48 ++++ gdb/testsuite/gdb.base/infcall-failure.exp | 182 ++++++++++++++ gdb/testsuite/gdb.base/infcall-timeout.c | 36 +++ gdb/testsuite/gdb.base/infcall-timeout.exp | 74 ++++++ .../gdb.python/py-finish-breakpoint.exp | 2 +- .../infcall-from-bp-cond-other-thread-event.c | 135 ++++++++++ ...nfcall-from-bp-cond-other-thread-event.exp | 175 +++++++++++++ .../gdb.threads/infcall-from-bp-cond-simple.c | 89 +++++++ .../infcall-from-bp-cond-simple.exp | 236 ++++++++++++++++++ .../gdb.threads/infcall-from-bp-cond-single.c | 139 +++++++++++ .../infcall-from-bp-cond-single.exp | 119 +++++++++ .../infcall-from-bp-cond-timeout.c | 169 +++++++++++++ .../infcall-from-bp-cond-timeout.exp | 121 +++++++++ gdb/testsuite/lib/gdb.exp | 8 + gdbserver/ax.cc | 12 +- gdbserver/ax.h | 3 +- gdbserver/target.cc | 2 + gdbserver/target.h | 3 + gdbserver/tracepoint.cc | 13 +- gdbserver/tracepoint.h | 9 +- 34 files changed, 1992 insertions(+), 38 deletions(-) create mode 100644 gdb/testsuite/gdb.base/bp-cond-failure.c create mode 100644 gdb/testsuite/gdb.base/bp-cond-failure.exp create mode 100644 gdb/testsuite/gdb.base/infcall-failure.c create mode 100644 gdb/testsuite/gdb.base/infcall-failure.exp create mode 100644 gdb/testsuite/gdb.base/infcall-timeout.c create mode 100644 gdb/testsuite/gdb.base/infcall-timeout.exp create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp