@@ -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.
@@ -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);
@@ -775,7 +775,7 @@ void qemu_init_subsystems(void)
void qemu_cleanup(void)
{
- gdbserver_cleanup();
+ gdb_exit(0);
/*
* cleaning up the migration object cancels any existing migration