summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--exec.c4
-rw-r--r--hw/core/machine.c6
-rw-r--r--include/hw/boards.h1
3 files changed, 9 insertions, 2 deletions
diff --git a/exec.c b/exec.c
index b44a33c9ac..f55270bdeb 100644
--- a/exec.c
+++ b/exec.c
@@ -26,6 +26,7 @@
 #include "cpu.h"
 #include "tcg.h"
 #include "hw/hw.h"
+#include "hw/boards.h"
 #include "hw/qdev.h"
 #include "qemu/osdep.h"
 #include "sysemu/kvm.h"
@@ -1250,8 +1251,7 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t size)
     int ret;
 
     /* Use MADV_DONTDUMP, if user doesn't want the guest memory in the core */
-    if (!qemu_opt_get_bool(qemu_get_machine_opts(),
-                           "dump-guest-core", true)) {
+    if (!machine_dump_guest_core(current_machine)) {
         ret = qemu_madvise(addr, size, QEMU_MADV_DONTDUMP);
         if (ret) {
             perror("qemu_madvise");
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 5ad24093ad..80336839d5 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -285,6 +285,7 @@ static void machine_initfn(Object *obj)
 
     ms->kernel_irqchip_allowed = true;
     ms->kvm_shadow_mem = -1;
+    ms->dump_guest_core = true;
 
     object_property_add_str(obj, "accel",
                             machine_get_accel, machine_set_accel, NULL);
@@ -425,6 +426,11 @@ int machine_phandle_start(MachineState *machine)
     return machine->phandle_start;
 }
 
+bool machine_dump_guest_core(MachineState *machine)
+{
+    return machine->dump_guest_core;
+}
+
 static const TypeInfo machine_info = {
     .name = TYPE_MACHINE,
     .parent = TYPE_OBJECT,
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 0bf00f7717..bbac39d5e2 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -73,6 +73,7 @@ bool machine_kernel_irqchip_allowed(MachineState *machine);
 bool machine_kernel_irqchip_required(MachineState *machine);
 int machine_kvm_shadow_mem(MachineState *machine);
 int machine_phandle_start(MachineState *machine);
+bool machine_dump_guest_core(MachineState *machine);
 
 /**
  * MachineClass: