qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] dump-guest-memory.py: fix python 2 support


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH v2] dump-guest-memory.py: fix python 2 support
Date: Fri, 19 Jan 2018 20:18:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 01/19/18 17:25, Marc-André Lureau wrote:
> 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 <address@hidden>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  scripts/dump-guest-memory.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py
> index 09bec92b50..03fbf69f8a 100644
> --- a/scripts/dump-guest-memory.py
> +++ b/scripts/dump-guest-memory.py
> @@ -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."""
> 

Ugh, can you please point me to the v1->v2 difference?

Thanks
Laszlo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]