]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/doc/python.texi
gdb/python: allow Value.format_string to return styled output
authorAndrew Burgess <aburgess@redhat.com>
Mon, 24 Jan 2022 15:29:49 +0000 (15:29 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Mon, 7 Feb 2022 16:52:47 +0000 (16:52 +0000)
commit0642912e83168b9036d81e8a9950352d233affcb
treededd33995145b8d2ba8e2d863ad3231a68d22907
parent573269a87c89ae866db556428fe9ea63d6c4db5f
gdb/python: allow Value.format_string to return styled output

Add a new argument to the gdb.Value.format_string method, 'styling'.
This argument is False by default.

When this argument is True, then the returned string can contain output
styling escape sequences.

When this argument is False, then the returned string will not contain
any styling escape sequences.

If the returned string is going to be printed to the user, then it is
often nice to retain the GDB styling.

For the testing, we need to adjust the TERM environment variable, as
we do for all the styling tests.  I'm now running all of the C tests
in gdb.python/py-format-string.exp in an environment where styling
could be generated, but only my new test should actually produce
styled output, hopefully this will catch the case where a bug might
cause format_string to always produce styled output.
gdb/NEWS
gdb/doc/python.texi
gdb/python/py-value.c
gdb/testsuite/gdb.python/py-format-string.exp