binutils-gdb/gdb/python
Andrew Burgess 3c72459681 gdb/python: extend gdb.write to support styled output
It is already possible to produce styled output from Python by
converting the gdb.Style to its escape code sequence, and writing that
to the output stream.

But this commit adds an alternative option to the mix by extending the
existing gdb.write() function to accept a 'style' argument.  The value
of this argument can be 'None' to indicate no style change should be
performed, this is the default, and matches the existing behaviour.

Or the new 'style' argument can be a gdb.Style object, in which case
the specified style is applied only for the string passed to
gdb.write, after which the default style is re-applied.

Using gdb.write with a style object more closely matches how GDB
handles styling internally, and has the benefit that the user doesn't
need to remember to restore the default style when they are done.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
2025-10-05 13:48:06 +01:00
..
lib/gdb gdb/python: new class gdb.StyleParameterSet 2025-10-05 13:47:18 +01:00
py-all-events.def Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-arch.c gdb/python: add void_type () method to gdb.Architecture object 2025-02-04 13:56:49 +00:00
py-auto-load.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-block.c gdb/python: check return value of PyObject_New in all cases 2025-08-21 11:47:17 +01:00
py-bpevent.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-breakpoint.c Change file initialization to use INIT_GDB_FILE macro 2025-06-26 06:15:59 -06:00
py-cmd.c gdb/python/guile: remove some explicit calls to xmalloc 2025-06-06 23:46:47 +01:00
py-color.c gdb/python/guile: check if styling is disabled in Color.escape_sequence 2025-05-06 11:24:28 +01:00
py-color.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-connection.c Change file initialization to use INIT_GDB_FILE macro 2025-06-26 06:15:59 -06:00
py-continueevent.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-dap.c Change file initialization to use INIT_GDB_FILE macro 2025-06-26 06:15:59 -06:00
py-disasm.c gdb/python: check return from final PyObject_New in py-disasm.c 2025-08-28 15:51:16 +01:00
py-event-types.def Have gdb.ThreadExitedEvent inherit from gdb.ThreadEvent 2025-09-18 08:07:49 -06:00
py-event.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-event.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-events.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-evtregistry.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-evts.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-exitedevent.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-finishbreakpoint.c gdb: modernize get_frame_pc_if_available 2025-08-14 13:40:19 -03:00
py-frame.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-framefilter.c gdb: rename address_class -> location_class 2025-08-19 09:49:46 -04:00
py-function.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-gdb-readline.c Require Python 3.4 2025-05-30 07:09:53 -06:00
py-inferior.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-infevents.c gdb/python: return gdbpy_ref<> from gdbpy_create_ptid_object 2025-08-26 22:02:40 +01:00
py-infthread.c gdb/python: return gdbpy_ref<> from gdbpy_create_ptid_object 2025-08-26 22:02:40 +01:00
py-instruction.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-instruction.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-lazy-string.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-linetable.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-membuf.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-mi.c Use gnulib c-ctype module in gdb 2025-09-09 11:59:04 -06:00
py-micmd.c Use gnulib c-ctype module in gdb 2025-09-09 11:59:04 -06:00
py-newobjfileevent.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-objfile.c Use gnulib c-ctype module in gdb 2025-09-09 11:59:04 -06:00
py-param.c gdb/python: allow empty gdb.Parameter.__doc__ string 2025-05-13 14:33:20 +01:00
py-prettyprint.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-progspace.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-record-btrace.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-record-btrace.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-record-full.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-record-full.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-record.c gdb/python: check return value of PyObject_New in all cases 2025-08-21 11:47:17 +01:00
py-record.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-ref.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-registers.c gdb/python: don't use PyObject_IsInstance in py-registers.c 2025-04-23 23:50:22 +01:00
py-signalevent.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-stopevent.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-stopevent.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-style.c gdb/python: extend gdb.write to support styled output 2025-10-05 13:48:06 +01:00
py-symbol.c Rename expand_symtabs_matching 2025-09-10 16:07:58 -06:00
py-symtab.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-threadevent.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-tui.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-type.c Fix bug in gdb.lookup_type 2025-09-30 08:08:30 -06:00
py-uiout.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-unwind.c gdb/python: check return value of PyObject_New in all cases 2025-08-21 11:47:17 +01:00
py-utils.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-value.c Fix gdb.Value.dynamic_type attribute 2025-09-09 21:11:27 +02:00
py-varobj.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
py-xmethods.c Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
python-config.py
python-internal.h gdb/python: extend gdb.write to support styled output 2025-10-05 13:48:06 +01:00
python.c gdb/python: extend gdb.write to support styled output 2025-10-05 13:48:06 +01:00
python.h Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00