From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by sourceware.org (Postfix) with ESMTPS id A38F63858C50 for ; Wed, 8 Feb 2023 18:10:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A38F63858C50 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-wr1-f42.google.com with SMTP id o18so17658689wrj.3 for ; Wed, 08 Feb 2023 10:10:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vNN+wILn8XWljEiW8h+8OOYbzSiZF+37jUCTZk/fuF0=; b=cM9p+VBCRhTO0VaozhwVyQj+9/hdUKuWcbroAgTzUmxP+Ut0CI+J15y0vxzrN107pt Ih62NyrHJZiGJ4HLp6iIcP9TvEw0q5uZLpzdJtCPBJA15Em+s0SHacoQZNeb1kakVwVD riDHhsLOkkL3Uk25d1BJR3I+B7EWTyF4D4yyH9y5AN9yHqmtcz20n6SDfcqeJdtVHJed TAyIG4Bv6tyfrfP+i4AklMx6bxBr1qGxQMhfJmCdUIIC2NbbuvRRUhZU4rSIKZNFroW9 IIiOk+jP9TmUbPQw3O2H9iIpS3OOXO6fxekK2/Q2M6+QIIg2i3Ox7az3QNcAEOzh+Crr 5FwA== X-Gm-Message-State: AO0yUKXAxcii4671wIP6c8yWtLL/fvI1idMQkiu7ahRcO1xikQeXZD7C sJluR6FQv6MwC15q/XvzB5NY7fnOUweydA== X-Google-Smtp-Source: AK7set8hxDqSmfLzH6aQiAUF1VJl0k6IpJSY+F2Vp5AJUGeHy+hwwUW9z7tn1zpmrkjj481KdIuWpw== X-Received: by 2002:adf:ded2:0:b0:2c4:689:9d27 with SMTP id i18-20020adfded2000000b002c406899d27mr1551140wrn.49.1675879836429; Wed, 08 Feb 2023 10:10:36 -0800 (PST) Received: from ?IPv6:2001:8a0:f92b:9e00::1fe? ([2001:8a0:f92b:9e00::1fe]) by smtp.gmail.com with ESMTPSA id p12-20020a5d48cc000000b00241fab5a296sm14040017wrs.40.2023.02.08.10.10.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Feb 2023 10:10:36 -0800 (PST) Subject: Re: [PATCH 1/2] gdb: only allow one of thread or task on breakpoints or watchpoints To: Andrew Burgess , gdb-patches@sourceware.org References: From: Pedro Alves Message-ID: Date: Wed, 8 Feb 2023 18:10:34 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,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: On 2023-02-08 3:16 p.m., Andrew Burgess via Gdb-patches wrote: > @@ -57,8 +77,67 @@ gdb_test "info breakpoints" "foo.adb:${decimal}\r\n\\s+stop only in task 1" \ > # extract its number. > gdb_breakpoint "break_me task 3" message > set bp_number [get_integer_valueof "\$bpnum" -1] > -if {$bp_number < 0} { > - return > +gdb_assert { $bp_number > 0 } "check for a valid breakpoint number" > + > +# Test the Python API for the breakpoint task attribute. > +if {[allow_python_tests]} { > + gdb_test_no_output "python bp = gdb.breakpoints()\[$bp_number - 1\]" AFAICS, this leaks the $bp_number number to gdb.sum. Typically we'll avoid it, by writing an explicit test message, sometimes by using "\$bp_number" in the test message so that "$bp_number" is written literally instead of the expanded number. Like: gdb_test_no_output \ "python bp = gdb.breakpoints()\[$bp_number - 1\]" \ "python bp = gdb.breakpoints()\[\$bp_number - 1\]" but a descriptive test message would be fine too, of course. I see now that in Guile below you used "get breakpoint from list": > + > + gdb_scm_test_silent_cmd "guile (define blist (breakpoints))" \ > + "get breakpoint list" > + gdb_scm_test_silent_cmd "guile (define bp (list-ref blist (- $bp_number 1)))" \ > + "get breakpoint from list" Otherwise, Approved-By: Pedro Alves