This series replaces some of the call to exit in hardware used by Risc-V boards or made when gdb is requested to exit by shutdown requests. Otherwise, the gdb connection can be abruptly disconnected resulting in the last gdb packet "Wxx" being not sent.
For the gdbstub modification, gdb_exit calls ensure that the "Wxx" packet is sent before exiting. However, some features (see net/vhost-vdpa.c: vhost_vdpa_cleanup for example) are expecting that a cleanup is being made before exiting. This, it's probably safer to follow the same logic here as well. Difference with v2: - Add support to request a shutdown with a specific exit code. - Pass the exit code of the main loop to gdb_exit call in qemu_cleanup - gdbstub: move the request shutdown in a new new function to avoid having to worry about the request having already been sent. Clément Chigot (5): softmmu: add means to pass an exit code when requesting a shutdown softmmu: pass the main loop status to gdb "Wxx" packet hw/misc/sifive_test.c: replace exit calls with proper shutdown hw/char: riscv_htif: replace exit calls with proper shutdown gdbstub: replace exit calls with proper shutdown for softmmu gdbstub/gdbstub.c | 5 +++-- gdbstub/softmmu.c | 6 ++++++ gdbstub/user.c | 6 ++++++ hw/char/riscv_htif.c | 5 ++++- hw/misc/sifive_test.c | 9 +++++++-- include/gdbstub/syscalls.h | 9 +++++++++ include/sysemu/runstate.h | 2 ++ include/sysemu/sysemu.h | 2 +- softmmu/main.c | 2 +- softmmu/runstate.c | 16 +++++++++++++--- 10 files changed, 52 insertions(+), 10 deletions(-) -- 2.25.1