qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gdbstub: Permit reverse step/break to provide stop response
@ 2023-06-23  3:53 Nicholas Piggin
  2023-06-23 12:18 ` Matheus Tavares Bernardino
  2023-06-27 10:33 ` Alex Bennée
  0 siblings, 2 replies; 5+ messages in thread
From: Nicholas Piggin @ 2023-06-23  3:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, qemu-stable, Matheus Tavares Bernardino,
	Alex Bennée, Taylor Simpson

The final part of the reverse step and break handling is to bring
the machine back to a debug stop state. gdb expects a response.

A gdb 'rsi' command hangs forever because the gdbstub filters out
the response (also observable with reverse_debugging.py avocado
tests).

Fix by setting allow_stop_reply for the gdb backward packets.

Fixes: 758370052fb ("gdbstub: only send stop-reply packets when allowed to")
Cc: qemu-stable@nongnu.org
Cc: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
Cc: Alex Bennée <alex.bennee@linaro.org>
Cc: Taylor Simpson <tsimpson@quicinc.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 gdbstub/gdbstub.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index be18568d0a..9496d7b175 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -1814,6 +1814,7 @@ static int gdb_handle_packet(const char *line_buf)
                 .handler = handle_backward,
                 .cmd = "b",
                 .cmd_startswith = 1,
+                .allow_stop_reply = true,
                 .schema = "o0"
             };
             cmd_parser = &backward_cmd_desc;
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] gdbstub: Permit reverse step/break to provide stop response
  2023-06-23  3:53 [PATCH] gdbstub: Permit reverse step/break to provide stop response Nicholas Piggin
@ 2023-06-23 12:18 ` Matheus Tavares Bernardino
  2023-06-27 10:48   ` Peter Maydell
  2023-06-27 10:33 ` Alex Bennée
  1 sibling, 1 reply; 5+ messages in thread
From: Matheus Tavares Bernardino @ 2023-06-23 12:18 UTC (permalink / raw)
  To: npiggin; +Cc: alex.bennee, qemu-devel, qemu-stable, quic_mathbern, tsimpson

> Nicholas Piggin <npiggin@gmail.com> wrote:
>
> The final part of the reverse step and break handling is to bring
> the machine back to a debug stop state. gdb expects a response.
> 
> A gdb 'rsi' command hangs forever because the gdbstub filters out
> the response (also observable with reverse_debugging.py avocado
> tests).
> 
> Fix by setting allow_stop_reply for the gdb backward packets.

Ah, it's interesting that [1] doesn't include 'bc' and 'bs' in the list
of cmds that may respond with a stop-reply packet:

    "The 'C', 'c', 'S', 's', 'vCont', 'vAttach', 'vRun', 'vStopped', and
    '?' packets can receive any of the below as a reply."

But their definitions at [2] do say the following:

    'bc' (and 'bc')
    [...]
    Reply: See Stop Reply Packets, for the reply specifications.

So I guess the list from [1] is not exhaustive. Anyway, thanks for the
fix!

Acked-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>

[1]: https://sourceware.org/gdb/onlinedocs/gdb/Stop-Reply-Packets.html#Stop-Reply-Packets
[2]: https://sourceware.org/gdb/onlinedocs/gdb/Packets.html#Packets


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gdbstub: Permit reverse step/break to provide stop response
  2023-06-23  3:53 [PATCH] gdbstub: Permit reverse step/break to provide stop response Nicholas Piggin
  2023-06-23 12:18 ` Matheus Tavares Bernardino
@ 2023-06-27 10:33 ` Alex Bennée
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Bennée @ 2023-06-27 10:33 UTC (permalink / raw)
  To: Nicholas Piggin
  Cc: qemu-devel, qemu-stable, Matheus Tavares Bernardino,
	Taylor Simpson


Nicholas Piggin <npiggin@gmail.com> writes:

> The final part of the reverse step and break handling is to bring
> the machine back to a debug stop state. gdb expects a response.
>
> A gdb 'rsi' command hangs forever because the gdbstub filters out
> the response (also observable with reverse_debugging.py avocado
> tests).
>
> Fix by setting allow_stop_reply for the gdb backward packets.
>
> Fixes: 758370052fb ("gdbstub: only send stop-reply packets when allowed to")
> Cc: qemu-stable@nongnu.org
> Cc: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> Cc: Alex Bennée <alex.bennee@linaro.org>
> Cc: Taylor Simpson <tsimpson@quicinc.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Queued to gdbstub/next, thanks.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gdbstub: Permit reverse step/break to provide stop response
  2023-06-23 12:18 ` Matheus Tavares Bernardino
@ 2023-06-27 10:48   ` Peter Maydell
  2023-06-28 12:16     ` Matheus Tavares Bernardino
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2023-06-27 10:48 UTC (permalink / raw)
  To: Matheus Tavares Bernardino
  Cc: npiggin, alex.bennee, qemu-devel, qemu-stable, tsimpson

On Fri, 23 Jun 2023 at 13:19, Matheus Tavares Bernardino
<quic_mathbern@quicinc.com> wrote:
>
> > Nicholas Piggin <npiggin@gmail.com> wrote:
> >
> > The final part of the reverse step and break handling is to bring
> > the machine back to a debug stop state. gdb expects a response.
> >
> > A gdb 'rsi' command hangs forever because the gdbstub filters out
> > the response (also observable with reverse_debugging.py avocado
> > tests).
> >
> > Fix by setting allow_stop_reply for the gdb backward packets.
>
> Ah, it's interesting that [1] doesn't include 'bc' and 'bs' in the list
> of cmds that may respond with a stop-reply packet:
>
>     "The 'C', 'c', 'S', 's', 'vCont', 'vAttach', 'vRun', 'vStopped', and
>     '?' packets can receive any of the below as a reply."
>
> But their definitions at [2] do say the following:
>
>     'bc' (and 'bc')
>     [...]
>     Reply: See Stop Reply Packets, for the reply specifications.
>
> So I guess the list from [1] is not exhaustive. Anyway, thanks for the
> fix!

That looks like it's probably a gdb docs bug (forgetting to
update that list when the bc/bs packets were added); we
should probably report that to upstream gdb.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gdbstub: Permit reverse step/break to provide stop response
  2023-06-27 10:48   ` Peter Maydell
@ 2023-06-28 12:16     ` Matheus Tavares Bernardino
  0 siblings, 0 replies; 5+ messages in thread
From: Matheus Tavares Bernardino @ 2023-06-28 12:16 UTC (permalink / raw)
  To: peter.maydell
  Cc: alex.bennee, npiggin, qemu-devel, qemu-stable, quic_mathbern,
	tsimpson

Peter Maydell <peter.maydell@linaro.org> wrote:
> 
> On Fri, 23 Jun 2023 at 13:19, Matheus Tavares Bernardino <quic_mathbern@quicinc.com> wrote:
> >
> > Ah, it's interesting that [1] doesn't include 'bc' and 'bs' in the list
> > of cmds that may respond with a stop-reply packet:
> >
> >     "The 'C', 'c', 'S', 's', 'vCont', 'vAttach', 'vRun', 'vStopped', and
> >     '?' packets can receive any of the below as a reply."
> >
> > But their definitions at [2] do say the following:
> >
> >     'bc' (and 'bc')
> >     [...]
> >     Reply: See Stop Reply Packets, for the reply specifications.
> >
> > So I guess the list from [1] is not exhaustive. Anyway, thanks for the
> > fix!
> 
> That looks like it's probably a gdb docs bug (forgetting to
> update that list when the bc/bs packets were added); we
> should probably report that to upstream gdb.

Good idea, done: https://sourceware.org/pipermail/gdb/2023-June/050804.html


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-28 12:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-23  3:53 [PATCH] gdbstub: Permit reverse step/break to provide stop response Nicholas Piggin
2023-06-23 12:18 ` Matheus Tavares Bernardino
2023-06-27 10:48   ` Peter Maydell
2023-06-28 12:16     ` Matheus Tavares Bernardino
2023-06-27 10:33 ` Alex Bennée

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 NNTP newsgroup(s).