binutils-gdb/gdb/python
Andrew Burgess aef117b737 gdb/python: hoist common invalid object repr code into py-utils.c
Many object types now have a __repr__() function implementation.  A
common pattern is that, if an object is invalid, we print its
representation as: <TYPENAME (invalid)>.

I thought it might be a good idea to move the formatting of this
specific representation into a utility function, and then update all
of our existing code to call the new function.

The only place where I haven't made use of the new function is in
unwind_infopy_repr, where we currently return a different string.
This case is a little different as the UnwindInfo is invalid because
it references a frame, and it is the frame itself which is invalid.
That said, I think it would be fine to switch to using the standard
format; if the UnwindInfo references an invalid frame, then the
UnwindInfo is itself invalid.  But changing this would be an actual
change in behaviour, while all the other changes in this commit are
just refactoring.

Approved-By: Tom Tromey <tom@tromey.com>
2024-01-12 11:21:25 +00:00
..
lib/gdb Avoid exception from attach in DAP 2023-12-22 09:57:49 -07:00
py-all-events.def gdb: add Python events for program space addition and removal 2023-10-02 17:06:40 +01:00
py-arch.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
py-auto-load.c gdb: add program_space parameters to some auto-load functions 2023-10-05 13:20:50 -04:00
py-block.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
py-bpevent.c Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-breakpoint.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
py-cmd.c gdb/python: display errors from command completion 2023-11-28 18:23:19 +00:00
py-connection.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
py-continueevent.c
py-dap.c [gdb/dap] Disable DAP for python <= 3.5 2023-08-02 23:14:58 +02:00
py-disasm.c gdb: Replace gdb::optional with std::optional 2023-11-21 11:52:35 +00:00
py-event-types.def gdb: add Python events for program space addition and removal 2023-10-02 17:06:40 +01:00
py-event.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-event.h gdb: add program_space parameter to emit_clear_objfiles_event 2023-10-05 13:20:50 -04:00
py-events.h
py-evtregistry.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-evts.c
py-exitedevent.c
py-finishbreakpoint.c Fix gdb.FinishBreakpoint when returning to an inlined function 2023-12-12 15:57:14 +01:00
py-frame.c gdb: change value_of_register and value_of_register_lazy to take the next frame 2023-12-14 16:04:49 +00:00
py-framefilter.c gdb: Replace gdb::optional with std::optional 2023-11-21 11:52:35 +00: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: avoid use of _PyOS_ReadlineTState 2023-12-13 10:46:44 +01:00
py-inferior.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
py-infevents.c
py-infthread.c gdb/python: New InferiorThread.ptid_string attribute 2024-01-12 09:22:25 +00:00
py-instruction.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-instruction.h
py-lazy-string.c Handle gdb.LazyString in DAP 2023-10-16 09:27:28 -06: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-mi.c Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-micmd.c gdb/python: generalize serialize_mi_result() 2023-10-10 11:22:56 +01:00
py-newobjfileevent.c gdb: add program_space parameter to emit_clear_objfiles_event 2023-10-05 13:20:50 -04:00
py-objfile.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
py-param.c [gdb/build] Fix enum param_types odr violation 2023-08-14 18:32:29 +02:00
py-prettyprint.c Introduce gdb.ValuePrinter 2023-09-26 09:29:14 -06:00
py-progspace.c gdb: implement missing debug handler hook for Python 2023-11-14 12:02:47 +00:00
py-record-btrace.c gdb: remove target_gdbarch 2023-10-10 10:44:35 -04:00
py-record-btrace.h
py-record-full.c
py-record-full.h
py-record.c python, btrace: Fix some small formatting issues. 2023-05-31 09:27:17 +02:00
py-record.h
py-ref.h
py-registers.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-signalevent.c Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-stopevent.c Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-stopevent.h Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-symbol.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00: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/Python: Added ThreadExitedEvent 2023-06-19 16:17:21 +02:00
py-tui.c Add keywords to TuiWindow.write 2023-12-30 12:21:44 -07:00
py-type.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
py-uiout.h Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-unwind.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
py-utils.c gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
py-value.c gdb/python: Add new gdb.Value.bytes attribute 2023-10-26 18:27:17 +01:00
py-varobj.c gdb: Use C++17's std::make_unique instead of gdb::make_unique 2023-11-21 11:52:35 +00:00
py-xmethods.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
python-config.py
python-internal.h gdb/python: hoist common invalid object repr code into py-utils.c 2024-01-12 11:21:25 +00:00
python.c gdb: move gdbpy_gil into python-internal.h 2023-12-13 10:46:39 +01:00
python.h