From f3cef337911955e13967d310e0c178fe40ed335f Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 24 Jan 2021 13:15:49 +0100 Subject: [PATCH] tools/gdb_panic_server: wrap b"" with bytes() for py2.7 compatibility Fixes the exception while decoding the stack dump: File "tools/gdb_panic_server.py", line 270, in _respond_mem result += "{:02x}".format(stack_data[addr - stack_addr_min]) ValueError: Unknown format code 'x' for object of type 'str' --- tools/gdb_panic_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/gdb_panic_server.py b/tools/gdb_panic_server.py index 2a45a00f8a..fab5b59d62 100644 --- a/tools/gdb_panic_server.py +++ b/tools/gdb_panic_server.py @@ -112,7 +112,7 @@ def get_stack_addr_and_data(res): # type: (ParseResults) -> typing.Tuple[int, b stack_base_addr = 0 # First reported address in the dump base_addr = 0 # keeps track of the address for the given line of the dump bytes_in_line = 0 # bytes of stack parsed on the previous line; used to validate the next base address - stack_data = b'' # accumulates all the dumped stack data + stack_data = bytes(b'') # accumulates all the dumped stack data for line in res.stack_dump.lines: # update and validate the base address prev_base_addr = base_addr @@ -124,7 +124,7 @@ def get_stack_addr_and_data(res): # type: (ParseResults) -> typing.Tuple[int, b # convert little-endian hex words to byte representation words = [int(w, 16) for w in line.data] - line_data = b''.join([struct.pack('