gdbstub: Close connection in gdb_exit
authorFabien Chouteau <chouteau@adacore.com>
Thu, 13 Jan 2011 11:46:57 +0000 (12:46 +0100)
committerEdgar E. Iglesias <edgar.iglesias@petalogix.com>
Sun, 16 Jan 2011 19:56:01 +0000 (20:56 +0100)
On Windows, this is required to flush the remaining data in the IO stream,
otherwise Gdb do not receive the last packet.

Version 2:
   Fix linux-user build error.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
gdbstub.c

index 0aa081b13b8293d36602fe7e086adf3f706e3679..d6556c9a2fe1268ff3c53f9238a2e8a7fc428c0e 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2391,6 +2391,12 @@ void gdb_exit(CPUState *env, int code)
 
   snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code);
   put_packet(s, buf);
+
+#ifndef CONFIG_USER_ONLY
+  if (s->chr) {
+      qemu_chr_close(s->chr);
+  }
+#endif
 }
 
 #ifdef CONFIG_USER_ONLY