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.129.124]) by sourceware.org (Postfix) with ESMTPS id 7C8A43858D32 for ; Sun, 12 Feb 2023 05:50:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C8A43858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676181023; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BRKTjzPjiJqyKmOcrxdloVI/W2WxfwG9ohc+2hc2Pyo=; b=aqilPGHtdstCkdvMfUK/C3tYNv4HnTVNEj9bPJwMGliqJM/xPJXGn3wd38+ZESGHIQLlCx Ok96dGWN28C6y6xtERpk2pDZqF/3IaOkwULTGwCCw0HDO4AyhdaIQ2O/OsXIuYL2pt2tAa 3GxsF+N+d8uOFwzjMssZzSkXYgpt3O8= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-213-98gLn825Ooy9uHMfa9NTkA-1; Sun, 12 Feb 2023 00:50:21 -0500 X-MC-Unique: 98gLn825Ooy9uHMfa9NTkA-1 Received: by mail-qv1-f69.google.com with SMTP id kd28-20020a056214401c00b0053cd4737a42so5258790qvb.22 for ; Sat, 11 Feb 2023 21:50:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BRKTjzPjiJqyKmOcrxdloVI/W2WxfwG9ohc+2hc2Pyo=; b=kP/2rdq9RK776/vSPQXvIjndl5hMys8r/QoA/HycF3arGZ25stPuBpwbVOOfwawUfK +FqQ/om3+f4yTZjWjfkVduxVpfYKFCzPoS/Epi7pKeIyx1vlgUGjmRjY2NVYp00Usqud W+5j9VLQzWb8gqTWQ1X3wxquu9lXGvBaOTEXHXUMueDevIRPW6YLi+G7UJwx1QD99wc6 GJxrKQT7bukOucQCw23YAnMrIlPoP+UG7rwgYEuzAhwqJK4YZOz29NpbNwvZmyM0bcYH p6fayhI4qdrizjNofqRZEyVb6GH64I9V3cXhspjL6U5j3JP5Yz/FDzOtWmiJXaULc1yf SnvA== X-Gm-Message-State: AO0yUKVcQ1xpOcTKtLuslpHCCtc7mw/4CvlCJXe3y6KIXP3F9d1OzT/R IgS7ImjUao0yMNW1wDTV+RjQn/yatcpVofvY5h2gB1oD916zGEnK7378ZPZxurfBZNM1qqiw4GY 6ikMBgXXYSNEG2/Yn9UreltrYhP8= X-Received: by 2002:a05:622a:64b:b0:3bb:89be:8b45 with SMTP id a11-20020a05622a064b00b003bb89be8b45mr15329055qtb.65.1676181021125; Sat, 11 Feb 2023 21:50:21 -0800 (PST) X-Google-Smtp-Source: AK7set/AhaBIJdoj/Q0N1zEB5ObVkZNDi93aF0faD1a2iAqt5LhHzVISz5WsuXvcz6cJIjPtMgdRxQ== X-Received: by 2002:a05:622a:64b:b0:3bb:89be:8b45 with SMTP id a11-20020a05622a064b00b003bb89be8b45mr15329042qtb.65.1676181020906; Sat, 11 Feb 2023 21:50:20 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id k13-20020ac8074d000000b003b630ea0ea1sm6547107qth.19.2023.02.11.21.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 21:50:20 -0800 (PST) From: Andrew Burgess To: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] gdb: only allow one of thread or task on breakpoints or watchpoints In-Reply-To: References: Date: Sun, 12 Feb 2023 05:50:18 +0000 Message-ID: <878rh3v3dx.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 List-Id: Pedro Alves writes: > 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": I gave the test a more descriptive name, and pushed both patches in this series. Thanks, Andrew > >> + >> + 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