aboutsummaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2021-01-08 22:42:45 +0000
committerAlex Bennée <alex.bennee@linaro.org>2021-01-18 10:05:06 +0000
commitb9e10c6c7503d3c8073efc9ac302b9f33619d4fc (patch)
tree7740a8a53b418a27d7ca177c705fe26ecb125ac3 /gdbstub.c
parent5ef0317f58c0c88ad1146deab248b638148bd1b1 (diff)
downloadqemu-b9e10c6c7503d3c8073efc9ac302b9f33619d4fc.zip
qemu-b9e10c6c7503d3c8073efc9ac302b9f33619d4fc.tar.gz
qemu-b9e10c6c7503d3c8073efc9ac302b9f33619d4fc.tar.bz2
gdbstub: ensure we clean-up when terminated
If you kill the inferior from GDB we end up leaving our socket lying around. Fix this by calling gdb_exit() first. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20210108224256.2321-10-alex.bennee@linaro.org>
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 8fc41ea..c7ca7e9 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1978,6 +1978,7 @@ static void handle_v_kill(GdbCmdContext *gdb_ctx, void *user_ctx)
/* Kill the target */
put_packet("OK");
error_report("QEMU: Terminated via GDBstub");
+ gdb_exit(0);
exit(0);
}
@@ -2539,6 +2540,7 @@ static int gdb_handle_packet(const char *line_buf)
case 'k':
/* Kill the target */
error_report("QEMU: Terminated via GDBstub");
+ gdb_exit(0);
exit(0);
case 'D':
{