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

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