cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-dump-guest-memory.py-fix-You-can-t-do-that-without-a.patch

5d360b
From c42ed2abf0e58a0c4cf069f52756bfa412794d15 Mon Sep 17 00:00:00 2001
5d360b
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
5d360b
Date: Wed, 13 Dec 2017 13:39:12 +0100
5d360b
Subject: [PATCH 41/41] dump-guest-memory.py: fix "You can't do that without a
5d360b
 process to debug"
5d360b
MIME-Version: 1.0
5d360b
Content-Type: text/plain; charset=UTF-8
5d360b
Content-Transfer-Encoding: 8bit
5d360b
5d360b
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
5d360b
Message-id: <20171213133912.26176-42-marcandre.lureau@redhat.com>
5d360b
Patchwork-id: 78391
5d360b
O-Subject: [RHEL-7.5 qemu-kvm PATCH v3 41/41] dump-guest-memory.py: fix "You can't do that without a process to debug"
5d360b
Bugzilla: 1411490
5d360b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
5d360b
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
5d360b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
5d360b
Upstream-status: <20171212172208.13588-1-marcandre.lureau@redhat.com>
5d360b
(reviewed, pending for release and merge window to open)
5d360b
5d360b
If the script is run with a core (no running process), it produces an
5d360b
error:
5d360b
5d360b
(gdb)  dump-guest-memory /tmp/vmcore X86_64
5d360b
guest RAM blocks:
5d360b
target_start     target_end       host_addr        message count
5d360b
---------------- ---------------- ---------------- ------- -----
5d360b
0000000000000000 00000000000a0000 00007f7935800000 added       1
5d360b
00000000000a0000 00000000000b0000 00007f7934200000 added       2
5d360b
00000000000c0000 00000000000ca000 00007f79358c0000 added       3
5d360b
00000000000ca000 00000000000cd000 00007f79358ca000 joined      3
5d360b
00000000000cd000 00000000000e8000 00007f79358cd000 joined      3
5d360b
00000000000e8000 00000000000f0000 00007f79358e8000 joined      3
5d360b
00000000000f0000 0000000000100000 00007f79358f0000 joined      3
5d360b
0000000000100000 0000000080000000 00007f7935900000 joined      3
5d360b
00000000fd000000 00000000fe000000 00007f7934200000 added       4
5d360b
00000000fffc0000 0000000100000000 00007f7935600000 added       5
5d360b
Python Exception <class 'gdb.error'> You can't do that without a process to debug.:
5d360b
Error occurred in Python command: You can't do that without a process
5d360b
to debug.
5d360b
5d360b
Replace the object_resolve_path_type() function call with a local
5d360b
volatile variable.
5d360b
5d360b
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5d360b
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5d360b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
---
5d360b
 hw/misc/vmcoreinfo.c         | 3 +++
5d360b
 scripts/dump-guest-memory.py | 3 +--
5d360b
 2 files changed, 4 insertions(+), 2 deletions(-)
5d360b
5d360b
diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
5d360b
index fa5f610..65b5755 100644
5d360b
--- a/hw/misc/vmcoreinfo.c
5d360b
+++ b/hw/misc/vmcoreinfo.c
5d360b
@@ -35,6 +35,8 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
5d360b
 {
5d360b
     VMCoreInfoState *s = VMCOREINFO(dev);
5d360b
     FWCfgState *fw_cfg = fw_cfg_find();
5d360b
+    /* for gdb script dump-guest-memory.py */
5d360b
+    static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED;
5d360b
 
5d360b
     /* Given that this function is executing, there is at least one VMCOREINFO
5d360b
      * device. Check if there are several.
5d360b
@@ -57,6 +59,7 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
5d360b
                              false);
5d360b
 
5d360b
     qemu_register_reset(vmcoreinfo_reset, dev);
5d360b
+    vmcoreinfo_state = s;
5d360b
 }
5d360b
 
5d360b
 static const VMStateDescription vmstate_vmcoreinfo = {
5d360b
diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py
5d360b
index 12b9b7d..8a13db0 100644
5d360b
--- a/scripts/dump-guest-memory.py
5d360b
+++ b/scripts/dump-guest-memory.py
5d360b
@@ -546,8 +546,7 @@ shape and this command should mostly work."""
5d360b
         return None
5d360b
 
5d360b
     def add_vmcoreinfo(self):
5d360b
-        vmci = '(VMCoreInfoState *)' + \
5d360b
-               'object_resolve_path_type("", "vmcoreinfo", 0)'
5d360b
+        vmci = 'vmcoreinfo_realize::vmcoreinfo_state'
5d360b
         if not gdb.parse_and_eval("%s" % vmci) \
5d360b
            or not gdb.parse_and_eval("(%s)->has_vmcoreinfo" % vmci):
5d360b
             return
5d360b
-- 
5d360b
1.8.3.1
5d360b