Skip to contentSkip to conversation

gdbstub: init mon_chr through qemu_chr_alloc

PATCH In review Pavel Dovgalyuk 2 participants 2 messages Sep 10, 2014 – Sep 11, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gdbstub: init mon_chr through qemu_chr_alloc

This patch initializes monitor for gdbstub with the qemu_chr_alloc function instead of just allocating the memory. Initialization function call is required, because it also creates chr_write_lock mutex, which is used when writing to this character device.

---
 gdbstub.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gdbstub.c +1 -1
index 8afe0b7..71aaa23 100644
@@ -1707,7 +1707,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 = g_malloc0(sizeof(*mon_chr));
+        mon_chr = qemu_chr_alloc();
         mon_chr->chr_write = gdb_monitor_write;
         monitor_init(mon_chr, 0);
     } else {
#1 lore raw

Il 10/09/2014 16:34, Pavel Dovgalyuk ha scritto:

Quoted 16 lines

This patch initializes monitor for gdbstub with the qemu_chr_alloc function instead of just allocating the memory. Initialization function call is required, because it also creates chr_write_lock mutex, which is used when writing to this character device.

---
 gdbstub.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gdbstub.c +0 -0
index 8afe0b7..71aaa23 100644

gdbstub.c int gdbserver_start(const char *device) · line 1713

Quoted 8 lines
gdbstub.c +1 -1
@@ -1707,7 +1707,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 = g_malloc0(sizeof(*mon_chr));
+        mon_chr = qemu_chr_alloc();
         mon_chr->chr_write = gdb_monitor_write;
         monitor_init(mon_chr, 0);
     } else {

Thanks, will send a pull request soon.

Paolo