提交 1bb982b8 编写于 作者: K KONRAD Frederic 提交者: Peter Maydell

gdbstub: send a termination packet instead of crashing gdb

Since the commit:
commit 4486e89c
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date:   Wed Mar 7 14:42:05 2018 +0000

    vl: introduce vm_shutdown()

GDB crashes when qemu exits (at least on sparc-softmmu):
Remote communication error.  Target disconnected.: Connection reset by peer.
Quitting: putpkt: write failed: Broken pipe.

So send a packet to exit GDB before we exit QEMU:
[Inferior 1 (Thread 0) exited normally]
Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: NKONRAD Frederic <frederic.konrad@adacore.com>
Message-id: 1521538773-30802-1-git-send-email-frederic.konrad@adacore.com
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
上级 f55e88f2
......@@ -2052,6 +2052,13 @@ int gdbserver_start(const char *device)
return 0;
}
void gdbserver_cleanup(void)
{
if (gdbserver_state) {
put_packet(gdbserver_state, "W00");
}
}
static void register_types(void)
{
type_register_static(&char_gdb_type_info);
......
......@@ -103,6 +103,8 @@ int gdbserver_start(int);
int gdbserver_start(const char *port);
#endif
void gdbserver_cleanup(void);
/**
* gdb_has_xml:
* This is an ugly hack to cope with both new and old gdb.
......
......@@ -4733,6 +4733,8 @@ int main(int argc, char **argv, char **envp)
main_loop();
gdbserver_cleanup();
/* No more vcpu or device emulation activity beyond this point */
vm_shutdown();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册