gdbstub: Permit reverse step/break to provide stop response
PATCH 1/1 gdbstub: Permit reverse step/break to provide stop response
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.
--- gdbstub/gdbstub.c | 1 + 1 file changed, 1 insertion(+)
gdbstub/gdbstub.c +1 -0
@@ -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;
Signature · 1 line
2.40.1
Quoted 10 lines
Nicholas Piggin <[email protected]> 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.pyavocado tests).Fix by setting
allow_stop_replyfor 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!
[1]: https://sourceware.org/gdb/onlinedocs/gdb/Stop-Reply-Packets.html#Stop-Reply-Packets
[2]: https://sourceware.org/gdb/onlinedocs/gdb/Packets.html#Packets
Alex Bennée
AppliedQuoted 7 lines · Nicholas Piggin
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.pyavocado tests).
Quoted 8 lines
Fix by setting
allow_stop_replyfor the gdb backward packets.Fixes 758370052fb ("gdbstub: only send stop-reply packets when allowed to")Cc Matheus Tavares Bernardino <[email protected]>Cc Alex Bennée <[email protected]>Cc Taylor Simpson <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>
Queued to gdbstub/next, thanks.
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 18 lines · Matheus Tavares Bernardino
Quoted 11 lines
Nicholas Piggin <[email protected]> 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.pyavocado tests).Fix by setting
allow_stop_replyfor 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."
Quoted 8 lines
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
Quoted 15 lines · Peter Maydell
Quoted 13 lines · Matheus Tavares Bernardino
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.
Quoted 6 lines
Quoted 2 lines
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