diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-01-27 00:49:13 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-06-02 11:33:53 +0400 |
commit | 1ce2610c106d925387669b3133fc18ea986f0476 (patch) | |
tree | bd08c41941ea2235cabde4c02739f6ca52ff07d7 /gdbstub.c | |
parent | a9b1ca38c2b1f062f22d4847e3b4c848d0fb84c3 (diff) |
char: make chr_fe_deinit() optionaly delete backend
This simplifies removing a backend for a frontend user (no need to
retrieve the associated driver and separate delete call etc).
NB: many frontends have questionable handling of ending a chardev. They
should probably delete the backend to prevent broken reusage.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'gdbstub.c')
-rw-r--r-- | gdbstub.c | 15 |
1 files changed, 2 insertions, 13 deletions
@@ -1678,9 +1678,6 @@ void gdb_exit(CPUArchState *env, int code) { GDBState *s; char buf[4]; -#ifndef CONFIG_USER_ONLY - Chardev *chr; -#endif s = gdbserver_state; if (!s) { @@ -1690,19 +1687,13 @@ void gdb_exit(CPUArchState *env, int code) if (gdbserver_fd < 0 || s->fd < 0) { return; } -#else - chr = qemu_chr_fe_get_driver(&s->chr); - if (!chr) { - return; - } #endif snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code); put_packet(s, buf); #ifndef CONFIG_USER_ONLY - qemu_chr_fe_deinit(&s->chr); - object_unparent(OBJECT(chr)); + qemu_chr_fe_deinit(&s->chr, true); #endif } @@ -2002,9 +1993,7 @@ int gdbserver_start(const char *device) NULL, &error_abort); monitor_init(mon_chr, 0); } else { - if (qemu_chr_fe_get_driver(&s->chr)) { - object_unparent(OBJECT(qemu_chr_fe_get_driver(&s->chr))); - } + qemu_chr_fe_deinit(&s->chr, true); mon_chr = s->mon_chr; memset(s, 0, sizeof(GDBState)); s->mon_chr = mon_chr; |