From: Andrew Burgess <aburgess@redhat.com>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb: only allow one of thread or task on breakpoints or watchpoints
Date: Sun, 12 Feb 2023 05:50:18 +0000 [thread overview]
Message-ID: <878rh3v3dx.fsf@redhat.com> (raw)
In-Reply-To: <f05a273e-016d-62f2-e787-49df5887d2fb@palves.net>
Pedro Alves <pedro@palves.net> 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 <pedro@palves.net>
next prev parent reply other threads:[~2023-02-12 5:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 15:16 [PATCH 0/2] Prevent combining 'task' and 'thread' keywords Andrew Burgess
2023-02-08 15:16 ` [PATCH 1/2] gdb: only allow one of thread or task on breakpoints or watchpoints Andrew Burgess
2023-02-08 15:52 ` Eli Zaretskii
2023-02-08 18:10 ` Pedro Alves
2023-02-12 5:50 ` Andrew Burgess [this message]
2023-02-12 22:58 ` Tom Tromey
2023-02-13 11:26 ` Andrew Burgess
2023-02-08 15:16 ` [PATCH 2/2] gdb: use -1 for breakpoint::task default value Andrew Burgess
2023-02-08 18:10 ` Pedro Alves
2023-02-12 7:23 ` Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878rh3v3dx.fsf@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).