aboutsummaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-22 12:52:55 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:27:21 +0200
commit5345fdb4467816c44f6752b3a1f4e73aa25919f9 (patch)
tree9930cf4370d2325d113408f7b314cd77aa43f8a3 /gdbstub.c
parentfbf3cc3a67a7131e258764aa1f19d5324e9e9f7a (diff)
char: use qemu_chr_fe* functions with CharBackend argument
This also switches from qemu_chr_add_handlers() to qemu_chr_fe_set_handlers(). Note that qemu_chr_fe_set_handlers() now takes the focus when fe_open (qemu_chr_add_handlers() did take the focus) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-16-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 347bd4de51..33b056e323 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -404,7 +404,7 @@ static void put_buffer(GDBState *s, const uint8_t *buf, int len)
#else
/* XXX this blocks entire thread. Rewrite to use
* qemu_chr_fe_write and background I/O callbacks */
- qemu_chr_fe_write_all(s->chr.chr, buf, len);
+ qemu_chr_fe_write_all(&s->chr, buf, len);
#endif
}
@@ -1471,6 +1471,9 @@ void gdb_exit(CPUArchState *env, int code)
{
GDBState *s;
char buf[4];
+#ifndef CONFIG_USER_ONLY
+ CharDriverState *chr;
+#endif
s = gdbserver_state;
if (!s) {
@@ -1481,7 +1484,8 @@ void gdb_exit(CPUArchState *env, int code)
return;
}
#else
- if (!s->chr.chr) {
+ chr = qemu_chr_fe_get_driver(&s->chr);
+ if (!chr) {
return;
}
#endif
@@ -1490,7 +1494,7 @@ void gdb_exit(CPUArchState *env, int code)
put_packet(s, buf);
#ifndef CONFIG_USER_ONLY
- qemu_chr_delete(s->chr.chr);
+ qemu_chr_delete(chr);
#endif
}
@@ -1764,8 +1768,8 @@ int gdbserver_start(const char *device)
mon_chr->chr_write = gdb_monitor_write;
monitor_init(mon_chr, 0);
} else {
- if (s->chr.chr) {
- qemu_chr_delete(s->chr.chr);
+ if (qemu_chr_fe_get_driver(&s->chr)) {
+ qemu_chr_delete(qemu_chr_fe_get_driver(&s->chr));
}
mon_chr = s->mon_chr;
memset(s, 0, sizeof(GDBState));
@@ -1775,8 +1779,8 @@ int gdbserver_start(const char *device)
s->g_cpu = first_cpu;
if (chr) {
qemu_chr_fe_init(&s->chr, chr, &error_abort);
- qemu_chr_add_handlers(s->chr.chr, gdb_chr_can_receive, gdb_chr_receive,
- gdb_chr_event, NULL);
+ qemu_chr_fe_set_handlers(&s->chr, gdb_chr_can_receive, gdb_chr_receive,
+ gdb_chr_event, NULL, NULL);
}
s->state = chr ? RS_IDLE : RS_INACTIVE;
s->mon_chr = mon_chr;