|
|
5d360b |
From 8bd9fce5250f9abcca1e80afb5425bcf6e867b28 Mon Sep 17 00:00:00 2001
|
|
|
5d360b |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
5d360b |
Date: Mon, 22 Jan 2018 14:04:40 +0100
|
|
|
5d360b |
Subject: [PATCH 2/3] dump-guest-memory.py: fix python 2 support
|
|
|
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: <20180122140440.24988-1-marcandre.lureau@redhat.com>
|
|
|
5d360b |
Patchwork-id: 78692
|
|
|
5d360b |
O-Subject: [RHEL-7.5 qemu-kvm PATCH v2] dump-guest-memory.py: fix python 2 support
|
|
|
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 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
5d360b |
|
|
|
5d360b |
Python GDB support may use Python 2 or 3.
|
|
|
5d360b |
|
|
|
5d360b |
Inferior.read_memory() may return a 'buffer' with Python 2 or a
|
|
|
5d360b |
'memoryview' with Python 3 (see also
|
|
|
5d360b |
https://sourceware.org/gdb/onlinedocs/gdb/Inferiors-In-Python.html)
|
|
|
5d360b |
|
|
|
5d360b |
The elf.add_vmcoreinfo_note() method expects a "bytes" object. Wrap
|
|
|
5d360b |
the returned memory with bytes(), which works with both 'memoryview'
|
|
|
5d360b |
and 'buffer'.
|
|
|
5d360b |
|
|
|
5d360b |
Fixes a regression introduced with commit
|
|
|
5d360b |
d23bfa91b7789534d16ede6cb7d925bfac3f3c4c ("add vmcoreinfo").
|
|
|
5d360b |
|
|
|
5d360b |
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
5d360b |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
5d360b |
Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
5d360b |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
5d360b |
|
|
|
5d360b |
(cherry picked from commit 6f49ec4034e55dfb675a56a62c9579384f7fb8cc)
|
|
|
5d360b |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
5d360b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
5d360b |
---
|
|
|
5d360b |
scripts/dump-guest-memory.py | 2 +-
|
|
|
5d360b |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
5d360b |
|
|
|
5d360b |
diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py
|
|
|
5d360b |
index 8a13db0..adb942e 100644
|
|
|
5d360b |
--- a/scripts/dump-guest-memory.py
|
|
|
5d360b |
+++ b/scripts/dump-guest-memory.py
|
|
|
5d360b |
@@ -564,7 +564,7 @@ shape and this command should mostly work."""
|
|
|
5d360b |
|
|
|
5d360b |
vmcoreinfo = self.phys_memory_read(addr, size)
|
|
|
5d360b |
if vmcoreinfo:
|
|
|
5d360b |
- self.elf.add_vmcoreinfo_note(vmcoreinfo.tobytes())
|
|
|
5d360b |
+ self.elf.add_vmcoreinfo_note(bytes(vmcoreinfo))
|
|
|
5d360b |
|
|
|
5d360b |
def invoke(self, args, from_tty):
|
|
|
5d360b |
"""Handles command invocation from gdb."""
|
|
|
5d360b |
--
|
|
|
5d360b |
1.8.3.1
|
|
|
5d360b |
|