qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

gdbstub: send a termination packet instead of crashing gdb

Since the commit:
commit 4486e89c219c0d1b9bd8dfa0b1dd5b0d51ff2268
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: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
Message-id: 1521538773-30802-1-git-send-email-frederic.konrad@adacore.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

authored by

KONRAD Frederic and committed by
Peter Maydell
1bb982b8 f55e88f2

+11
+7
gdbstub.c
··· 2052 2052 return 0; 2053 2053 } 2054 2054 2055 + void gdbserver_cleanup(void) 2056 + { 2057 + if (gdbserver_state) { 2058 + put_packet(gdbserver_state, "W00"); 2059 + } 2060 + } 2061 + 2055 2062 static void register_types(void) 2056 2063 { 2057 2064 type_register_static(&char_gdb_type_info);
+2
include/exec/gdbstub.h
··· 103 103 int gdbserver_start(const char *port); 104 104 #endif 105 105 106 + void gdbserver_cleanup(void); 107 + 106 108 /** 107 109 * gdb_has_xml: 108 110 * This is an ugly hack to cope with both new and old gdb.
+2
vl.c
··· 4733 4733 4734 4734 main_loop(); 4735 4735 4736 + gdbserver_cleanup(); 4737 + 4736 4738 /* No more vcpu or device emulation activity beyond this point */ 4737 4739 vm_shutdown(); 4738 4740