From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id CF6883858CDB for ; Mon, 12 Jun 2023 19:36:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF6883858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-33b3f2f7989so20344675ab.0 for ; Mon, 12 Jun 2023 12:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1686598591; x=1689190591; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DVnm8QmJNFOc4NCT3ET9B7ILoViDQgCb23CDLFocV/g=; b=XToQKqR8pYfYhGQpguWgMH3QZaZdprXR1luFUqmj0VUldNd6/ehT5ds9Tdp2qobtBJ 1vr8Nj9hTGoeTlzQDt8fyPE+hjoMZN3zG0L9dbmBvE0q/m2Fog+GI9jHO3JvCNdKuD5w MU3jbdEl5aPpLaCej+Exg+GfW0thKdeUNZ/qZmzzaoRkOOIkcb6t7l0/FGhfiawuPy13 CVcG7LGJgjPmLF5EoEW+/+vBRv/mgoCmPvTWKNCyphgI3aAEEk/F0dA6Kb03Nez0pPPQ DhqoAXv0q24V3UAnvALGPu/Xy63ZK6aeLyX0UipFivONbLdOVzr40+m9BzIIxl4XVjSc glcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686598591; x=1689190591; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DVnm8QmJNFOc4NCT3ET9B7ILoViDQgCb23CDLFocV/g=; b=Tpvra1/X9iN8pXQgDj18h6e7GHeuNSxbI5vHQM3MfHzNQq80g3V0xDe3SA2eCSUAex goF+5M+d9DpQPjS1488SLWs6KpyuyWre//iEaaVJysBsgA0iax7Ym7OUYlME4mxIT8q/ mcApsetQi8maZ0/mZhs3eI4j+ftCfRv9txKqAhlIZudqEgaJv7O0fL5xnGSDY0I5jOKl 8AYBLC7urdmEPoc61lfVVb080t0ANQQYx6QbdpWzG8Q84O0FKbATVavB1CTSf9RG+Okm Xnqdjk/dZNCOuC4iLUw40qK/q8RPD/0xROQsJfuZuBST9+lJ7C6y2XjEtUW2duJkstXz 88yQ== X-Gm-Message-State: AC+VfDzVCuI92d+zCWCTyZE2CWkEVbsOrY0ev7SpxSx6WwwI3g1WfvP1 fsMbbBURlRCj03qZSVBI25ZYWyTKQA4q1itIwY6JmQ== X-Google-Smtp-Source: ACHHUZ53Xamn9Ya7eiCmSWScneR9GhVGqBO19O6FKy3dI7YkFiNQ3toFS1/PTrL8uux8aVohLOfZug== X-Received: by 2002:a92:7302:0:b0:33d:3b69:2d28 with SMTP id o2-20020a927302000000b0033d3b692d28mr7452706ilc.29.1686598591037; Mon, 12 Jun 2023 12:36:31 -0700 (PDT) Received: from localhost.localdomain (75-166-136-83.hlrn.qwest.net. [75.166.136.83]) by smtp.gmail.com with ESMTPSA id m12-20020a056638224c00b00418a5e0e93esm2938091jas.162.2023.06.12.12.36.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 12:36:30 -0700 (PDT) From: Tom Tromey Date: Mon, 12 Jun 2023 13:36:28 -0600 Subject: [PATCH 1/7] Fix type of DAP hitCondition MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230612-more-dap-v1-1-ad868f1a4cc0@adacore.com> References: <20230612-more-dap-v1-0-ad868f1a4cc0@adacore.com> In-Reply-To: <20230612-more-dap-v1-0-ad868f1a4cc0@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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 List-Id: DAP specifies a breakpoint's hitCondition as a string, meaning it is an expression to be evaluated. However, gdb implemented this as if it were an integer instead. This patch fixes this oversight. --- gdb/python/lib/gdb/dap/breakpoint.py | 11 +++++++---- gdb/testsuite/gdb.dap/cond-bp.exp | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py index 20e65aa0e61..2cb8db68907 100644 --- a/gdb/python/lib/gdb/dap/breakpoint.py +++ b/gdb/python/lib/gdb/dap/breakpoint.py @@ -95,10 +95,13 @@ def _set_breakpoints_callback(kind, specs, creator): # FIXME handle exceptions here bp = creator(**spec) - if condition is not None: - bp.condition = condition - if hit_condition is not None: - bp.ignore_count = hit_condition + bp.condition = condition + if hit_condition is None: + bp.ignore_count = 0 + else: + bp.ignore_count = int( + gdb.parse_and_eval(hit_condition, global_context=True) + ) breakpoint_map[kind][keyspec] = bp result.append(breakpoint_descriptor(bp)) diff --git a/gdb/testsuite/gdb.dap/cond-bp.exp b/gdb/testsuite/gdb.dap/cond-bp.exp index 376db4b3548..6369b6f579c 100644 --- a/gdb/testsuite/gdb.dap/cond-bp.exp +++ b/gdb/testsuite/gdb.dap/cond-bp.exp @@ -35,7 +35,7 @@ set obj [dap_check_request_and_response "set conditional breakpoint" \ [format {o source [o path [%s]] \ breakpoints [a [o line [i %d] \ condition [s "i == 3"] \ - hitCondition [i 3]]]} \ + hitCondition [s 3]]]} \ [list s $srcfile] $line]] set fn_bpno [dap_get_breakpoint_number $obj] -- 2.40.1