diff mbox series

[v1,6/6] gdbstub: ensure we clean-up when terminated

Message ID 20201214153012.12723-7-alex.bennee@linaro.org
State Superseded
Headers show
Series gdbstub (auxv, tests, cleanup) | expand

Commit Message

Alex Bennée Dec. 14, 2020, 3:30 p.m. UTC
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>

---
 gdbstub.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.20.1

Comments

Richard Henderson Dec. 16, 2020, 7:56 p.m. UTC | #1
On 12/14/20 9:30 AM, Alex Bennée wrote:
> 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>

> ---

>  gdbstub.c | 2 ++

>  1 file changed, 2 insertions(+)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/gdbstub.c b/gdbstub.c
index 7172f063a1..61fe2360e3 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':
         {