aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-disasm.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-08-08 23:52:00 +0200
committerTom de Vries <tdevries@suse.de>2024-08-08 23:52:00 +0200
commit647adc681238f8ed1638520f7e09ed8b56af55af (patch)
tree243fd6e7610f6e64cba0f098b8401090d82d7901 /gdb/python/py-disasm.c
parentc45c3b4162148077765e94fd17d4481f18d6d44c (diff)
downloadbinutils-647adc681238f8ed1638520f7e09ed8b56af55af.zip
binutils-647adc681238f8ed1638520f7e09ed8b56af55af.tar.gz
binutils-647adc681238f8ed1638520f7e09ed8b56af55af.tar.bz2
[gdb/python] Fix handling of ^C during disassembly
Inspired by the trigger patch I used here [1], I tried this in gdbpy_print_insn: ... /* Call into the registered disassembler to (possibly) perform the disassembly. */ + set_quit_flag (); PyObject *insn_disas_obj = (PyObject *) disasm_info; gdbpy_ref<> result (PyObject_CallFunctionObjArgs (hook.get (), insn_disas_obj, ... and with test-case gdb.python/py-disasm-exec.exp ran into: ... (gdb) disassemble test^M Dump of assembler code for function test:^M 0x00000000004101ac <+0>: Python Exception <class 'KeyboardInterrupt'>: ^M ^M unknown disassembler error (error = -1)^M (gdb) ... This is incorrect, the KeyboardInterrupt should propagate and interrupt the command. Fix this by using gdbpy_print_stack_or_quit instead of gdbpy_print_stack in gdbpy_print_insn, giving us instead: ... (gdb) disassemble test^M Dump of assembler code for function test:^M 0x00000000004101ac <+0>: ^M Quit^M (gdb) ... Tested on aarch64-linux. Approved-By: Andrew Burgess <aburgess@redhat.com> [1] https://sourceware.org/pipermail/gdb-patches/2024-July/210798.html
Diffstat (limited to 'gdb/python/py-disasm.c')
-rw-r--r--gdb/python/py-disasm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/python/py-disasm.c b/gdb/python/py-disasm.c
index 87fea26..9b9b509 100644
--- a/gdb/python/py-disasm.c
+++ b/gdb/python/py-disasm.c
@@ -1306,7 +1306,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
}
else
{
- gdbpy_print_stack ();
+ gdbpy_print_stack_or_quit ();
return std::optional<int> (-1);
}