diff mbox

[v2] gdbstub: Close connection in gdb_exit

Message ID 92a1896f5af064a8ed5477c52c2556f2bb0f6948.1294918897.git.chouteau@adacore.com
State New
Headers show

Commit Message

Fabien Chouteau Jan. 13, 2011, 11:46 a.m. UTC
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>
---
 gdbstub.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Comments

Edgar E. Iglesias Jan. 13, 2011, 1:07 p.m. UTC | #1
On Thu, Jan 13, 2011 at 12:46:57PM +0100, Fabien Chouteau wrote:
> 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.

Hi, It seems a bit odd to explicitely close for system mode but
to implicitely close (at exit) for user mode. But if no one
complains, I'm OK with this version.

Cheers

> 
> Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
> ---
>  gdbstub.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/gdbstub.c b/gdbstub.c
> index 0aa081b..d6556c9 100644
> --- 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
> -- 
> 1.7.1
> 
>
Edgar E. Iglesias Jan. 16, 2011, 8:04 p.m. UTC | #2
On Thu, Jan 13, 2011 at 12:46:57PM +0100, Fabien Chouteau wrote:
> 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.

Applied, thanks.


> 
> Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
> ---
>  gdbstub.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/gdbstub.c b/gdbstub.c
> index 0aa081b..d6556c9 100644
> --- 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
> -- 
> 1.7.1
> 
>
diff mbox

Patch

diff --git a/gdbstub.c b/gdbstub.c
index 0aa081b..d6556c9 100644
--- 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