From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Pedro Alves <pedro@palves.net>,
Andrew Burgess <andrew.burgess@embecosm.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: better handling of 'S' packets
Date: Thu, 7 Jan 2021 22:58:46 -0500 [thread overview]
Message-ID: <b4228728-0349-631f-63bc-5c1d690819ef@polymtl.ca> (raw)
In-Reply-To: <c4870f27-b11b-8bdb-bdda-e4672ffa755e@palves.net>
On 2021-01-07 7:51 p.m., Pedro Alves wrote:
>> +
>> + gdb_breakpoint "unlock_worker"
>> + gdb_continue_to_breakpoint "run to unlock_worker"
>> +
>> + # There should be two threads at this point with thread 1 selected.
>> + gdb_test "info threads" \
>> + "\\\* 1\[\t \]*Thread\[^\r\n\]*\r\n 2\[\t \]*Thread\[^\r\n\]*" \
>> + "second thread should now exist"
>> +
>> + # Switch threads.
>> + gdb_test "thread 2" ".*" "switch to second thread"
>> +
>> + # Single step. This will set all threads running but as there's
>> + # no reason for the first thread to report a stop we expect to
>> + # finish the step with thread 2 still selected.
>
> I think GDB will first switch to thread 1 to step over the breakpoint thread 1
> is stopped at and only after will it step thread 2 while letting thread 1 run free.
> I think that with your patch GDB will do the "right" thing and figure out the
> right thread for the first step stop of thread 1 correctly, since at that point
> no other thread is executing. It's just that the comment seems a bit off.
>
v2 uses scheduler-locking, I suppose to address that.
>> + gdb_test_multiple "stepi" "" {
>> + -re "Thread 1 received signal SIGTRAP" {
>
> Shouldn't this consume the prompt?
Is it important? We could probably just omit it and let gdb_test_multiple
time out if it doesn't see what we expect?
>
>> + fail $gdb_test_name
>> + }
>> + -re "$hex.*$decimal.*while \\(worker_blocked\\).*$gdb_prompt" {
>> + pass $gdb_test_name
>> + }
>> + }
>> +
>> + # Double check that thread 2 is still selected.
>> + gdb_test "info threads" \
>> + " 1\[\t \]*Thread\[^\r\n\]*\r\n\\\* 2\[\t \]*Thread\[^\r\n\]*" \
>> + "second thread should still be selected after stepi"
>> +
>> + # Now "continue" thread 2. Again there's no reason for thread 1
>> + # to report a stop so we should finish with thread 2 still
>> + # selected.
>
> Ditto here.
This also changed in v2, the test now lets both threads and the program
run until the end.
I tried to address all your comments that still apply in the version
I'll send.
Simon
prev parent reply other threads:[~2021-01-08 3:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 15:35 Andrew Burgess
2020-12-10 16:29 ` Andrew Burgess
2020-12-23 23:09 ` [PATCHv2] " Andrew Burgess
2021-01-06 21:19 ` Simon Marchi via Gdb-patches
2021-01-07 9:57 ` Andrew Burgess
2021-01-08 0:51 ` [PATCH] " Pedro Alves
2021-01-08 3:00 ` Simon Marchi via Gdb-patches
2021-01-08 10:15 ` Andrew Burgess
2021-01-08 3:58 ` Simon Marchi via Gdb-patches [this message]
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=b4228728-0349-631f-63bc-5c1d690819ef@polymtl.ca \
--to=gdb-patches@sourceware.org \
--cc=andrew.burgess@embecosm.com \
--cc=pedro@palves.net \
--cc=simon.marchi@polymtl.ca \
/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