From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH v3 4/5] gdb: generalize commit_resume, avoid commit-resuming when threads have pending statuses
Date: Tue, 12 Jan 2021 13:04:44 -0500 [thread overview]
Message-ID: <263a2b6f-c6fb-e20c-7c61-bd1d3700f3a1@efficios.com> (raw)
In-Reply-To: <ef5a6aad-fa3c-7887-9322-e6c9dbf87a34@polymtl.ca>
On 2021-01-12 12:14 p.m., Simon Marchi wrote:
> I think this patch introduces some regressions, when running
>
> $ while make check TESTS="gdb.threads/interrupt-while-step-over.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver"; do done
>
> I'll sometimes get:
>
> /home/smarchi/src/binutils-gdb/gdb/inline-frame.c:383: internal-error: void skip_inline_frames(thread_info*, bpstat): Assertion `find_inline_frame_state (thread) == NULL' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n)
Ok, I think I found the reason. We are missing a little something when
enqueuing phony stop replys (stop reply for a thread at was resumed but
not commit-resumed, still in the RESUMED_PENDING_VCONT state).
Imagine the following sequence:
1. Thread is resumed (goes into RESUMED_PENDING_VCONT)
2. Thread is stopped (phony stop reply is enqueued)
3. Core calls commit_resumed, sending a vCont;c for the thread
We are now in a state where we have a stop reply that we are going to
report as a stop to the core, but the thread is also running on the
target -> bad.
I think the state where the thread is in the RESUMED_PENDING_VCONT
resume state but there is a stop reply enqueued for it is wrong
and should be avoided. When we enqueue a phony stop reply, we want
to pretend that the thread has executed on the remote target, so I
think we should change the thread's state to "resumed".
If I stick a `remote_thr->set_resumed ();` at the place we enqueue
the phony stop replies, I no longer get the failure.
I think this is sufficient, but if we ever want to distinguish
threads that are currently resumed on the remote target vs threads
that are stopped and have a stop reply waiting to be processed,
we could add a 4th resume state STOP_REPLY_PENDING. When a enqueuing
a stop reply (real or phony), we would move the matching thread(s)
to that state. And when processing the stop reply / reporting the
event to the core, we would move the state to NOT_RESUMED, just like
we do now. But to be clear, I don't think we need this today.
Simon
next prev parent reply other threads:[~2021-01-12 18:04 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 4:17 [PATCH v3 0/5] Reduce back and forth with target when threads have pending statuses + better handling of 'S' packets Simon Marchi via Gdb-patches
2021-01-08 4:17 ` [PATCH v3 1/5] gdb: make the remote target track its own thread resume state Simon Marchi via Gdb-patches
2021-01-08 15:41 ` Pedro Alves
2021-01-08 18:56 ` Simon Marchi via Gdb-patches
2021-01-18 5:16 ` Sebastian Huber
2021-01-18 6:04 ` Simon Marchi via Gdb-patches
2021-01-18 10:36 ` Sebastian Huber
2021-01-18 13:53 ` Simon Marchi via Gdb-patches
2021-01-08 4:17 ` [PATCH v3 2/5] gdb: remove target_ops::commit_resume implementation in record-{btrace, full}.c Simon Marchi via Gdb-patches
2021-01-08 15:43 ` [PATCH v3 2/5] gdb: remove target_ops::commit_resume implementation in record-{btrace,full}.c Pedro Alves
2021-01-08 19:00 ` Simon Marchi via Gdb-patches
2021-01-08 4:17 ` [PATCH v3 3/5] gdb: move commit_resume to process_stratum_target Simon Marchi via Gdb-patches
2021-01-08 18:12 ` Andrew Burgess
2021-01-08 19:01 ` Simon Marchi via Gdb-patches
2021-01-09 20:29 ` Pedro Alves
2021-01-08 4:17 ` [PATCH v3 4/5] gdb: generalize commit_resume, avoid commit-resuming when threads have pending statuses Simon Marchi via Gdb-patches
2021-01-08 18:34 ` Andrew Burgess
2021-01-08 19:04 ` Simon Marchi via Gdb-patches
2021-01-09 20:34 ` Pedro Alves
2021-01-11 20:28 ` Simon Marchi via Gdb-patches
2021-01-22 2:46 ` Simon Marchi via Gdb-patches
2021-01-22 22:07 ` Simon Marchi via Gdb-patches
2021-01-12 17:14 ` Simon Marchi via Gdb-patches
2021-01-12 18:04 ` Simon Marchi via Gdb-patches [this message]
2021-01-15 19:17 ` Simon Marchi via Gdb-patches
2021-01-08 4:17 ` [PATCH v3 5/5] gdb: better handling of 'S' packets Simon Marchi via Gdb-patches
2021-01-08 18:19 ` Andrew Burgess
2021-01-08 19:11 ` Simon Marchi via Gdb-patches
2021-01-09 21:26 ` Pedro Alves
2021-01-11 20:36 ` Simon Marchi via Gdb-patches
2021-01-12 3:07 ` Simon Marchi via Gdb-patches
2021-01-13 20:17 ` Pedro Alves
2021-01-14 1:28 ` Simon Marchi via Gdb-patches
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=263a2b6f-c6fb-e20c-7c61-bd1d3700f3a1@efficios.com \
--to=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.com \
--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