From 3719750c88f8fd38cb35368c2a7227cedf7fc82c Mon Sep 17 00:00:00 2001 From: miner <50past12am@gmail.com> Date: Thu, 2 Sep 2021 19:13:40 +0800 Subject: [PATCH] fix KEY ERROR of GDB debugger's target arch --- voltron/plugins/debugger/dbg_gdb.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/voltron/plugins/debugger/dbg_gdb.py b/voltron/plugins/debugger/dbg_gdb.py index ff26deff..1b3f9450 100644 --- a/voltron/plugins/debugger/dbg_gdb.py +++ b/voltron/plugins/debugger/dbg_gdb.py @@ -649,6 +649,14 @@ def get_arch(self): arch = gdb.selected_frame().architecture().name() except: arch = re.search('\(currently (.*)\)', gdb.execute('show architecture', to_string=True)).group(1) + + # Fix bug: + # Exception getting targets from debugger: KeyError('"i386"') + # gdb: 10.2 python: 3.9.2 kali-linux(WSL2) + quot = ['\'','"'] + if len(arch) > 2 and arch[0] in quot and arch[-1] in quot: + arch = arch.split(quot[quot.index(arch[0])])[1] + return self.archs[arch] def get_addr_size(self):