]> Git Repo - qemu.git/commitdiff
dump-guest-memory.py: fix python 2 support
authorMarc-André Lureau <[email protected]>
Wed, 17 Jan 2018 11:13:00 +0000 (12:13 +0100)
committerMarc-André Lureau <[email protected]>
Sat, 20 Jan 2018 19:59:00 +0000 (20:59 +0100)
Python GDB support may use Python 2 or 3.

Inferior.read_memory() may return a 'buffer' with Python 2 or a
'memoryview' with Python 3 (see also
https://sourceware.org/gdb/onlinedocs/gdb/Inferiors-In-Python.html)

The elf.add_vmcoreinfo_note() method expects a "bytes" object. Wrap
the returned memory with bytes(), which works with both 'memoryview'
and 'buffer'.

Fixes a regression introduced with commit
d23bfa91b7789534d16ede6cb7d925bfac3f3c4c ("add vmcoreinfo").

Suggested-by: Peter Maydell <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
Acked-by: Laszlo Ersek <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
scripts/dump-guest-memory.py

index 09bec92b5087225572c1d778e46a7f403ac2c623..03fbf69f8a17533546b78467aaf1043922ad92ad 100644 (file)
@@ -564,7 +564,7 @@ shape and this command should mostly work."""
 
         vmcoreinfo = self.phys_memory_read(addr, size)
         if vmcoreinfo:
-            self.elf.add_vmcoreinfo_note(vmcoreinfo.tobytes())
+            self.elf.add_vmcoreinfo_note(bytes(vmcoreinfo))
 
     def invoke(self, args, from_tty):
         """Handles command invocation from gdb."""
This page took 0.027264 seconds and 4 git commands to generate.