mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
char: move callbacks in CharDriver
This makes the code more declarative, and avoids duplicating the information on all instances. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a1698bf183
commit
b68e956abe
10 changed files with 381 additions and 260 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue