* [Qemu-devel] [PATCH] gdbstub: Send a reply to the vKill packet.
@ 2019-02-12 21:47 Sandra Loosemore
2019-02-14 17:48 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Sandra Loosemore @ 2019-02-12 21:47 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial
Per the GDB remote protocol documentation
https://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#index-vKill-packet
the debug stub is expected to send a reply to the 'vKill' packet. At
least some versions of GDB crash if the gdb stub simply exits without
sending a reply. This patch fixes QEMU's gdb stub to conform to the
expected behavior.
Note that QEMU's existing handling of the legacy 'k' packet is
correct: in that case GDB does not expect a reply, and QEMU does not
send one.
Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
---
gdbstub.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdbstub.c b/gdbstub.c
index 70cf330..eb129f6 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1363,6 +1363,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
break;
} else if (strncmp(p, "Kill;", 5) == 0) {
/* Kill the target */
+ put_packet(s, "OK");
error_report("QEMU: Terminated via GDBstub");
exit(0);
} else {
--
2.8.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] gdbstub: Send a reply to the vKill packet.
2019-02-12 21:47 [Qemu-devel] [PATCH] gdbstub: Send a reply to the vKill packet Sandra Loosemore
@ 2019-02-14 17:48 ` Peter Maydell
2019-02-14 18:27 ` Sandra Loosemore
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2019-02-14 17:48 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: QEMU Developers, QEMU Trivial
On Tue, 12 Feb 2019 at 21:52, Sandra Loosemore <sandra@codesourcery.com> wrote:
>
> Per the GDB remote protocol documentation
>
> https://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#index-vKill-packet
>
> the debug stub is expected to send a reply to the 'vKill' packet. At
> least some versions of GDB crash if the gdb stub simply exits without
> sending a reply. This patch fixes QEMU's gdb stub to conform to the
> expected behavior.
>
> Note that QEMU's existing handling of the legacy 'k' packet is
> correct: in that case GDB does not expect a reply, and QEMU does not
> send one.
>
> Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
Thanks, applied to target-arm.next.
As an aside, do you know if there is any kind of test suite for
the remote protocol that implementors of a debug stub can use to
check that they're conforming to it?
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] gdbstub: Send a reply to the vKill packet.
2019-02-14 17:48 ` Peter Maydell
@ 2019-02-14 18:27 ` Sandra Loosemore
2019-08-27 22:20 ` Aleksandar Markovic
0 siblings, 1 reply; 4+ messages in thread
From: Sandra Loosemore @ 2019-02-14 18:27 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, QEMU Trivial
On 2/14/19 10:48 AM, Peter Maydell wrote:
> On Tue, 12 Feb 2019 at 21:52, Sandra Loosemore <sandra@codesourcery.com> wrote:
>>
>> Per the GDB remote protocol documentation
>>
>> https://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#index-vKill-packet
>>
>> the debug stub is expected to send a reply to the 'vKill' packet. At
>> least some versions of GDB crash if the gdb stub simply exits without
>> sending a reply. This patch fixes QEMU's gdb stub to conform to the
>> expected behavior.
>>
>> Note that QEMU's existing handling of the legacy 'k' packet is
>> correct: in that case GDB does not expect a reply, and QEMU does not
>> send one.
>>
>> Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
>
> Thanks, applied to target-arm.next.
>
> As an aside, do you know if there is any kind of test suite for
> the remote protocol that implementors of a debug stub can use to
> check that they're conforming to it?
Well, I discovered this problem by running the GDB testsuite (using QEMU
for nios2-elf target with the other target-specific patches I recently
posted). I'm not sure if it's designed to exhaustively test the entire
remote protocol, but it does a pretty good job of covering user-visible
GDB features that depend on the remote target doing something
reasonable, even if it's just saying "Huh? I don't know how to do
that." :-)
-Sandra
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] gdbstub: Send a reply to the vKill packet.
2019-02-14 18:27 ` Sandra Loosemore
@ 2019-08-27 22:20 ` Aleksandar Markovic
0 siblings, 0 replies; 4+ messages in thread
From: Aleksandar Markovic @ 2019-08-27 22:20 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: QEMU Trivial, Peter Maydell, QEMU Developers
14.02.2019. 19.27, "Sandra Loosemore" <sandra@codesourcery.com> је
написао/ла:
>
> On 2/14/19 10:48 AM, Peter Maydell wrote:
>>
>> On Tue, 12 Feb 2019 at 21:52, Sandra Loosemore <sandra@codesourcery.com>
wrote:
>>>
>>>
>>> Per the GDB remote protocol documentation
>>>
>>>
https://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#index-vKill-packet
>>>
>>> the debug stub is expected to send a reply to the 'vKill' packet. At
>>> least some versions of GDB crash if the gdb stub simply exits without
>>> sending a reply. This patch fixes QEMU's gdb stub to conform to the
>>> expected behavior.
>>>
>>> Note that QEMU's existing handling of the legacy 'k' packet is
>>> correct: in that case GDB does not expect a reply, and QEMU does not
>>> send one.
>>>
>>> Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
>>
>>
>> Thanks, applied to target-arm.next.
>>
>> As an aside, do you know if there is any kind of test suite for
>> the remote protocol that implementors of a debug stub can use to
>> check that they're conforming to it?
>
>
> Well, I discovered this problem by running the GDB testsuite (using QEMU
for nios2-elf target with the other target-specific patches I recently
posted). I'm not sure if it's designed to exhaustively test the entire
remote protocol, but it does a pretty good job of covering user-visible GDB
features that depend on the remote target doing something reasonable, even
if it's just saying "Huh? I don't know how to do that." :-)
>
Debugging using gdb/qemu setups is fairly frequent use case and perhaps we
should have a test module for interoperability of gdb and qemu, and also
"make check-gdb".
Thanks for pinpointing and fixing bugs in this area, Sandra!
Aleksandar
> -Sandra
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-27 22:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-12 21:47 [Qemu-devel] [PATCH] gdbstub: Send a reply to the vKill packet Sandra Loosemore
2019-02-14 17:48 ` Peter Maydell
2019-02-14 18:27 ` Sandra Loosemore
2019-08-27 22:20 ` Aleksandar Markovic
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).