aboutsummaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 2d18ed73be..f4e36a9cd3 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1732,6 +1732,10 @@ int gdbserver_start(const char *device)
CharDriverState *chr = NULL;
CharDriverState *mon_chr;
ChardevCommon common = { 0 };
+ static const CharDriver driver = {
+ .kind = -1,
+ .chr_write = gdb_monitor_write,
+ };
if (!first_cpu) {
error_report("gdbstub: meaningless to attach gdb to a "
@@ -1770,8 +1774,7 @@ int gdbserver_start(const char *device)
qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL);
/* Initialize a monitor terminal for gdb */
- mon_chr = qemu_chr_alloc(&common, &error_abort);
- mon_chr->chr_write = gdb_monitor_write;
+ mon_chr = qemu_chr_alloc(&driver, &common, &error_abort);
monitor_init(mon_chr, 0);
} else {
if (qemu_chr_fe_get_driver(&s->chr)) {