Blame SOURCES/kvm-dump-guest-memory.py-fix-python-2-support.patch

4a2fec
From f342adbebaff74bae55e4ebb681683d951ba61a2 Mon Sep 17 00:00:00 2001
4a2fec
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
4a2fec
Date: Mon, 22 Jan 2018 13:51:41 +0100
4a2fec
Subject: [PATCH 20/21] dump-guest-memory.py: fix python 2 support
4a2fec
MIME-Version: 1.0
4a2fec
Content-Type: text/plain; charset=UTF-8
4a2fec
Content-Transfer-Encoding: 8bit
4a2fec
4a2fec
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
4a2fec
Message-id: <20180122135141.11068-1-marcandre.lureau@redhat.com>
4a2fec
Patchwork-id: 78691
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH] dump-guest-memory.py: fix python 2 support
4a2fec
Bugzilla: 1398633
4a2fec
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
4a2fec
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
4a2fec
Python GDB support may use Python 2 or 3.
4a2fec
4a2fec
Inferior.read_memory() may return a 'buffer' with Python 2 or a
4a2fec
'memoryview' with Python 3 (see also
4a2fec
https://sourceware.org/gdb/onlinedocs/gdb/Inferiors-In-Python.html)
4a2fec
4a2fec
The elf.add_vmcoreinfo_note() method expects a "bytes" object. Wrap
4a2fec
the returned memory with bytes(), which works with both 'memoryview'
4a2fec
and 'buffer'.
4a2fec
4a2fec
Fixes a regression introduced with commit
4a2fec
d23bfa91b7789534d16ede6cb7d925bfac3f3c4c ("add vmcoreinfo").
4a2fec
4a2fec
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
4a2fec
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
4a2fec
Acked-by: Laszlo Ersek <lersek@redhat.com>
4a2fec
Reviewed-by: Eric Blake <eblake@redhat.com>
4a2fec
4a2fec
(cherry picked from commit 6f49ec4034e55dfb675a56a62c9579384f7fb8cc)
4a2fec
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 scripts/dump-guest-memory.py | 2 +-
4a2fec
 1 file changed, 1 insertion(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py
4a2fec
index 09bec92..03fbf69 100644
4a2fec
--- a/scripts/dump-guest-memory.py
4a2fec
+++ b/scripts/dump-guest-memory.py
4a2fec
@@ -564,7 +564,7 @@ shape and this command should mostly work."""
4a2fec
 
4a2fec
         vmcoreinfo = self.phys_memory_read(addr, size)
4a2fec
         if vmcoreinfo:
4a2fec
-            self.elf.add_vmcoreinfo_note(vmcoreinfo.tobytes())
4a2fec
+            self.elf.add_vmcoreinfo_note(bytes(vmcoreinfo))
4a2fec
 
4a2fec
     def invoke(self, args, from_tty):
4a2fec
         """Handles command invocation from gdb."""
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec