diff --git a/pwndbg/commands/context.py b/pwndbg/commands/context.py index 28678017a..1db79b84e 100644 --- a/pwndbg/commands/context.py +++ b/pwndbg/commands/context.py @@ -472,7 +472,14 @@ Unicorn emulation of code near the current instruction code_lines = pwndbg.config.Parameter('context-code-lines', 10, 'number of additional lines to print in the code context') def context_disasm(target=sys.stdout, with_banner=True, width=None): - flavor = gdb.execute('show disassembly-flavor', to_string=True).lower().split('"')[1] + try: + flavor = gdb.execute('show disassembly-flavor', to_string=True).lower().split('"')[1] + except gdb.error as e: + if str(e).find("disassembly-flavor") > -1: + flavor = 'intel' + else: + raise + syntax = pwndbg.disasm.CapstoneSyntax[flavor] # Get the Capstone object to set disassembly syntax diff --git a/pwndbg/disasm/__init__.py b/pwndbg/disasm/__init__.py index c5b300476..6fa498e9b 100644 --- a/pwndbg/disasm/__init__.py +++ b/pwndbg/disasm/__init__.py @@ -75,7 +75,13 @@ def get_disassembler_cached(arch, ptrsize, endian, extra=None): mode |= CapstoneEndian[endian] - flavor = gdb.execute('show disassembly-flavor', to_string=True).lower().split('"')[1] + try: + flavor = gdb.execute('show disassembly-flavor', to_string=True).lower().split('"')[1] + except gdb.error as e: + if str(e).find("disassembly-flavor") > -1: + flavor = 'intel' + else: + raise cs = Cs(arch, mode) cs.syntax = CapstoneSyntax[flavor]