Files
binutils-gdb/gdb/python
Tom de Vries 647adc6812 [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
2024-08-08 23:52:00 +02:00
..
2024-07-23 11:31:49 -06:00
2024-04-25 12:59:02 -04:00
2024-06-24 09:11:29 -06:00
2024-04-25 12:59:02 -04:00
2024-05-17 09:39:41 -06:00
2024-04-25 12:59:02 -04:00
2024-07-15 13:55:00 +00:00
2024-04-25 12:59:02 -04:00
2024-04-25 12:59:02 -04:00
2024-04-02 11:21:39 -06:00