From 63b199ee682e71cce0b21ee44693e217e67082e7 Mon Sep 17 00:00:00 2001 From: hugsy Date: Sun, 8 Mar 2020 20:47:55 -0700 Subject: [PATCH] Fixed #508: partial revert of cae071ef3248eba511491257e292e559f8eae8ac to ensure any exception from block_for_line is caught --- gef.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gef.py b/gef.py index 4e7ff2119..902825b69 100644 --- a/gef.py +++ b/gef.py @@ -1005,7 +1005,7 @@ def _show_code_line(fname, idx): gef_print("* OS: {:s} - {:s} ({:s})".format(platform.system(), platform.release(), platform.machine())) if which("lsb_release"): gef_print("") - gdb.execute("lsb_release -a") + gdb.execute("!lsb_release -a") gef_print(HORIZONTAL_LINE*80) gef_print("") return @@ -7481,8 +7481,11 @@ def print_guessed_arguments(self, function_name): def __get_current_block_start_address(): pc = current_arch.pc - block = gdb.block_for_pc(pc) - block_start = block.start if block else gdb_get_nth_previous_instruction_address(pc, 5) + try: + block = gdb.block_for_pc(pc) + block_start = block.start if block else gdb_get_nth_previous_instruction_address(pc, 5) + except RuntimeError: + block_start = gdb_get_nth_previous_instruction_address(pc, 5) return block_start