qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH v1 5/6] gdbstub: drop gdbserver_cleanup in favour of gdb_exit
Date: Mon, 14 Dec 2020 15:30:11 +0000	[thread overview]
Message-ID: <20201214153012.12723-6-alex.bennee@linaro.org> (raw)
In-Reply-To: <20201214153012.12723-1-alex.bennee@linaro.org>

Despite it's name it didn't actually clean-up so let us document
gdb_exit() better and use that.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 include/exec/gdbstub.h | 14 +++++++++++---
 gdbstub.c              |  7 -------
 softmmu/vl.c           |  2 +-
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index 492db0f512..ff0b7bc45e 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -46,7 +46,17 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...);
 void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va);
 int use_gdb_syscalls(void);
 void gdb_set_stop_cpu(CPUState *cpu);
-void gdb_exit(int);
+
+/**
+ * gdb_exit: exit gdb session, reporting inferior status
+ * @code: exit code reported
+ *
+ * This closes the session and sends a final packet to GDB reporting
+ * the exit status of the program. It also cleans up any connections
+ * detritus before returning.
+ */
+void gdb_exit(int code);
+
 #ifdef CONFIG_USER_ONLY
 /**
  * gdb_handlesig: yield control to gdb
@@ -187,8 +197,6 @@ static inline uint8_t * gdb_get_reg_ptr(GByteArray *buf, int len)
  */
 int gdbserver_start(const char *port_or_device);
 
-void gdbserver_cleanup(void);
-
 /**
  * gdb_has_xml:
  * This is an ugly hack to cope with both new and old gdb.
diff --git a/gdbstub.c b/gdbstub.c
index f6566c7b82..7172f063a1 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -3547,13 +3547,6 @@ int gdbserver_start(const char *device)
     return 0;
 }
 
-void gdbserver_cleanup(void)
-{
-    if (gdbserver_state.init) {
-        put_packet("W00");
-    }
-}
-
 static void register_types(void)
 {
     type_register_static(&char_gdb_type_info);
diff --git a/softmmu/vl.c b/softmmu/vl.c
index e6e0ad5a92..0694a1d602 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -4509,7 +4509,7 @@ void qemu_init(int argc, char **argv, char **envp)
 
 void qemu_cleanup(void)
 {
-    gdbserver_cleanup();
+    gdb_exit(0);
 
     /*
      * cleaning up the migration object cancels any existing migration
-- 
2.20.1



  parent reply	other threads:[~2020-12-14 15:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 15:30 [PATCH v1 0/6] gdbstub (auxv, tests, cleanup) Alex Bennée
2020-12-14 15:30 ` [PATCH v1 1/6] test/guest-debug: echo QEMU command as well Alex Bennée
2020-12-14 15:30 ` [PATCH v1 2/6] configure: gate our use of GDB to 8.3.1 or above Alex Bennée
2020-12-14 15:47   ` Peter Maydell
2020-12-14 17:05     ` Alex Bennée
2020-12-14 17:14       ` Peter Maydell
2020-12-14 15:30 ` [PATCH v1 3/6] gdbstub: add support to Xfer:auxv:read: packet Alex Bennée
2020-12-16 19:54   ` Richard Henderson
2020-12-14 15:30 ` [PATCH v1 4/6] gdbstub: drop CPUEnv from gdb_exit() Alex Bennée
2020-12-16 19:55   ` Richard Henderson
2020-12-14 15:30 ` Alex Bennée [this message]
2020-12-16 19:56   ` [PATCH v1 5/6] gdbstub: drop gdbserver_cleanup in favour of gdb_exit Richard Henderson
2020-12-14 15:30 ` [PATCH v1 6/6] gdbstub: ensure we clean-up when terminated Alex Bennée
2020-12-16 19:56   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201214153012.12723-6-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).