diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-01-24 15:29:49 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-02-07 16:52:47 +0000 |
commit | 0642912e83168b9036d81e8a9950352d233affcb (patch) | |
tree | dedd33995145b8d2ba8e2d863ad3231a68d22907 /gdb/doc | |
parent | 573269a87c89ae866db556428fe9ea63d6c4db5f (diff) | |
download | binutils-0642912e83168b9036d81e8a9950352d233affcb.zip binutils-0642912e83168b9036d81e8a9950352d233affcb.tar.gz binutils-0642912e83168b9036d81e8a9950352d233affcb.tar.bz2 |
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.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/python.texi | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index da88b8a..c1a3f5f 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -1079,6 +1079,16 @@ A string containing a single character representing the format to use for the returned string. For instance, @code{'x'} is equivalent to using the @value{GDBN} command @code{print} with the @code{/x} option and formats the value as a hexadecimal number. + +@item styling +@code{True} if @value{GDBN} should apply styling to the returned +string. When styling is applied, the returned string might contain +ANSI terminal escape sequences. Escape sequences will only be +included if styling is turned on, see @ref{Output Styling}. +Additionally, @value{GDBN} only styles some value contents, so not +every output string will contain escape sequences. + +When @code{False}, which is the default, no output styling is applied. @end table @end defun |