binutils-gdb/gdb/python
Andrew Burgess 0af2f23333 gdb/python: rework how the disassembler API reads the result object
This commit is a refactor ahead of the next change which will make
disassembler styling available through the Python API.

Unfortunately, in order to make the styling support available, I think
the easiest solution is to make a very small change to the existing
API.

The current API relies on returning a DisassemblerResult object to
represent each disassembled instruction.  Currently GDB allows the
DisassemblerResult class to be sub-classed, which could mean that a
user tries to override the various attributes that exist on the
DisassemblerResult object.

This commit removes this ability, effectively making the
DisassemblerResult class final.

Though this is a change to the existing API, I'm hoping this isn't
going to cause too many issues:

  - The Python disassembler API was only added in the previous release
    of GDB, so I don't expect it to be widely used yet, and

  - It's not clear to me why a user would need to sub-class the
    DisassemblerResult type, I allowed it in the original patch
    because at the time I couldn't see any reason to NOT allow it.

Having prevented sub-classing I can now rework the tail end of the
gdbpy_print_insn function; instead of pulling the results out of the
DisassemblerResult object by calling back into Python, I now cast the
Python object back to its C++ type (disasm_result_object), and access
the fields directly from there.  In later commits I will be reworking
the disasm_result_object type in order to hold information about the
styled disassembler output.

The tests that dealt with sub-classing DisassemblerResult have been
removed, and a new test that confirms that DisassemblerResult can't be
sub-classed has been added.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Tom Tromey <tom@tromey.com>
2023-05-16 10:30:46 +01:00
..
lib/gdb Implement DAP register scope 2023-05-12 12:22:31 -06:00
py-all-events.def Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-arch.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-auto-load.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-block.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-bpevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-breakpoint.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-cmd.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-connection.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-continueevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-dap.c gdb: move struct ui and related things to ui.{c,h} 2023-05-01 15:40:54 -04:00
py-disasm.c gdb/python: rework how the disassembler API reads the result object 2023-05-16 10:30:46 +01:00
py-event-types.def Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-event.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-event.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-events.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-evtregistry.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-evts.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-exitedevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-finishbreakpoint.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-frame.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-framefilter.c Don't treat references to compound values as "simple". 2023-05-04 08:58:18 -06:00
py-function.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-gdb-readline.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-inferior.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-infevents.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-infthread.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-instruction.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-instruction.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-lazy-string.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-linetable.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-membuf.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-micmd.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-newobjfileevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-objfile.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-param.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-prettyprint.c Fix value chain use-after-free 2023-02-27 15:46:31 -07:00
py-progspace.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-record-btrace.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-record-btrace.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-record-full.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-record-full.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-record.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-record.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-ref.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-registers.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-signalevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-stopevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-stopevent.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-symbol.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-symtab.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-threadevent.c gdb: make find_thread_ptid an inferior method 2023-04-04 21:05:30 -04:00
py-tui.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-type.c Add dynamic_prop::is_constant 2023-05-12 12:30:28 -06:00
py-unwind.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-utils.c Python QUIT processing updates 2023-02-27 16:20:39 -07:00
py-value.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-varobj.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-xmethods.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
python-config.py gdb/python-config: replace deprecated distutils.sysconfig 2022-09-01 04:51:33 -04:00
python-internal.h gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
python.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
python.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00