All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 for-2.12] gdbstub: send a termination packet instead of crashing gdb
@ 2018-03-20  9:39 KONRAD Frederic
  2018-03-27  9:31 ` KONRAD Frederic
  0 siblings, 1 reply; 3+ messages in thread
From: KONRAD Frederic @ 2018-03-20  9:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: f4bug, stefanha, peter.maydell, eblake, KONRAD Frederic

Since the commit:
commit 4486e89c219c0d1b9bd8dfa0b1dd5b0d51ff2268
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date:   Wed Mar 7 14:42:05 2018 +0000

    vl: introduce vm_shutdown()

GDB crashes when qemu exits (at least on sparc-softmmu):
Remote communication error.  Target disconnected.: Connection reset by peer.
Quitting: putpkt: write failed: Broken pipe.

So send a packet to exit GDB before we exit QEMU:
[Inferior 1 (Thread 0) exited normally]

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
---

Notes:
    V1 -> V2:
      * fix typos
      * mark the patch for-2.12

 gdbstub.c              | 7 +++++++
 include/exec/gdbstub.h | 2 ++
 vl.c                   | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/gdbstub.c b/gdbstub.c
index f1d5148..a76b2fa 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2052,6 +2052,13 @@ int gdbserver_start(const char *device)
     return 0;
 }
 
+void gdbserver_cleanup(void)
+{
+    if (gdbserver_state) {
+        put_packet(gdbserver_state, "W00");
+    }
+}
+
 static void register_types(void)
 {
     type_register_static(&char_gdb_type_info);
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index 9aa7756..2e8a4b8 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -103,6 +103,8 @@ int gdbserver_start(int);
 int gdbserver_start(const char *port);
 #endif
 
+void gdbserver_cleanup(void);
+
 /**
  * gdb_has_xml:
  * This is an ugly hack to cope with both new and old gdb.
diff --git a/vl.c b/vl.c
index 19340a3..cd8d5cb 100644
--- a/vl.c
+++ b/vl.c
@@ -4725,6 +4725,8 @@ int main(int argc, char **argv, char **envp)
 
     main_loop();
 
+    gdbserver_cleanup();
+
     /* No more vcpu or device emulation activity beyond this point */
     vm_shutdown();
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2 for-2.12] gdbstub: send a termination packet instead of crashing gdb
  2018-03-20  9:39 [Qemu-devel] [PATCH v2 for-2.12] gdbstub: send a termination packet instead of crashing gdb KONRAD Frederic
@ 2018-03-27  9:31 ` KONRAD Frederic
  2018-03-27 21:03   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: KONRAD Frederic @ 2018-03-27  9:31 UTC (permalink / raw)
  To: peter.maydell; +Cc: qemu-devel, f4bug, stefanha

Peter, can this be cherry-picked in 2.12-rc1?

Thanks,
Fred

On 03/20/2018 10:39 AM, KONRAD Frederic wrote:
> Since the commit:
> commit 4486e89c219c0d1b9bd8dfa0b1dd5b0d51ff2268
> Author: Stefan Hajnoczi <stefanha@redhat.com>
> Date:   Wed Mar 7 14:42:05 2018 +0000
> 
>      vl: introduce vm_shutdown()
> 
> GDB crashes when qemu exits (at least on sparc-softmmu):
> Remote communication error.  Target disconnected.: Connection reset by peer.
> Quitting: putpkt: write failed: Broken pipe.
> 
> So send a packet to exit GDB before we exit QEMU:
> [Inferior 1 (Thread 0) exited normally]
> 
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
> ---
> 
> Notes:
>      V1 -> V2:
>        * fix typos
>        * mark the patch for-2.12
> 
>   gdbstub.c              | 7 +++++++
>   include/exec/gdbstub.h | 2 ++
>   vl.c                   | 2 ++
>   3 files changed, 11 insertions(+)
> 
> diff --git a/gdbstub.c b/gdbstub.c
> index f1d5148..a76b2fa 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -2052,6 +2052,13 @@ int gdbserver_start(const char *device)
>       return 0;
>   }
>   
> +void gdbserver_cleanup(void)
> +{
> +    if (gdbserver_state) {
> +        put_packet(gdbserver_state, "W00");
> +    }
> +}
> +
>   static void register_types(void)
>   {
>       type_register_static(&char_gdb_type_info);
> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
> index 9aa7756..2e8a4b8 100644
> --- a/include/exec/gdbstub.h
> +++ b/include/exec/gdbstub.h
> @@ -103,6 +103,8 @@ int gdbserver_start(int);
>   int gdbserver_start(const char *port);
>   #endif
>   
> +void gdbserver_cleanup(void);
> +
>   /**
>    * gdb_has_xml:
>    * This is an ugly hack to cope with both new and old gdb.
> diff --git a/vl.c b/vl.c
> index 19340a3..cd8d5cb 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4725,6 +4725,8 @@ int main(int argc, char **argv, char **envp)
>   
>       main_loop();
>   
> +    gdbserver_cleanup();
> +
>       /* No more vcpu or device emulation activity beyond this point */
>       vm_shutdown();
>   
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2 for-2.12] gdbstub: send a termination packet instead of crashing gdb
  2018-03-27  9:31 ` KONRAD Frederic
@ 2018-03-27 21:03   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2018-03-27 21:03 UTC (permalink / raw)
  To: KONRAD Frederic
  Cc: QEMU Developers, Philippe Mathieu-Daudé, Stefan Hajnoczi

On 27 March 2018 at 10:31, KONRAD Frederic <frederic.konrad@adacore.com> wrote:
> Peter, can this be cherry-picked in 2.12-rc1?
>
> Thanks,
> Fred
>
>
> On 03/20/2018 10:39 AM, KONRAD Frederic wrote:
>>
>> Since the commit:
>> commit 4486e89c219c0d1b9bd8dfa0b1dd5b0d51ff2268
>> Author: Stefan Hajnoczi <stefanha@redhat.com>
>> Date:   Wed Mar 7 14:42:05 2018 +0000
>>
>>      vl: introduce vm_shutdown()
>>
>> GDB crashes when qemu exits (at least on sparc-softmmu):
>> Remote communication error.  Target disconnected.: Connection reset by
>> peer.
>> Quitting: putpkt: write failed: Broken pipe.
>>
>> So send a packet to exit GDB before we exit QEMU:
>> [Inferior 1 (Thread 0) exited normally]
>>
>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
>> ---

Applied to master, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-27 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-20  9:39 [Qemu-devel] [PATCH v2 for-2.12] gdbstub: send a termination packet instead of crashing gdb KONRAD Frederic
2018-03-27  9:31 ` KONRAD Frederic
2018-03-27 21:03   ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.