Next: Numbers, Previous: Screen Size, Up: Controlling GDB
gdb can style its output on a capable terminal. This is enabled by default on most systems, but disabled by default when in batch mode (see Mode Options). Various style settings are available; and styles can also be disabled entirely.
set style enabled `
on|off'
show style enabled
set style sources `
on|off'
list
command, is styled. The
default is `on'. Note that source styling only works if styling
in general is enabled, and if a source highlighting library is
available to gdb.
There are two ways that highlighting can be done. First, if
gdb was linked with the GNU Source Highlight library, then it
is used. Otherwise, if gdb was configured with Python
scripting support, and if the Python Pygments package is available,
then it will be used.
show style sources
set style tui-current-position `
on|off'
show style tui-current-position
set style disassembler enabled `
on|off'
disassemble
command, is styled. Disassembler styling only works if styling in
general is enabled (with set style enabled on
), and if a source
highlighting library is available to gdb.
The two source highlighting libraries that gdb could use to style disassembler output are; gdb's builtin disassembler, or the Python Pygments package.
gdb's first choice will be to use the builtin disassembler for styling, this usually provides better results, being able to style different types of instruction operands differently. However, the builtin disassembler is not able to style all architectures.
For architectures that the builtin disassembler is unable to style, gdb will fall back to use the Python Pygments package where possible. In order to use the Python Pygments package, gdb must be built with Python support, and the Pygments package must be installed.
If neither of these options are available then gdb will produce unstyled disassembler output, even when this setting is `on'.
To discover if the current architecture supports styling using the
builtin disassembler library see maint show libopcodes-styling enabled.
show style disassembler enabled
Subcommands of set style
control specific forms of styling.
These subcommands all follow the same pattern: each style-able object
can be styled with a foreground color, a background color, and an
intensity.
For example, the style of file names can be controlled using the
set style filename
group of commands:
set style filename background
colorset style filename foreground
colorset style filename intensity
valueThe show style
command and its subcommands are styling
a style name in their output using its own style.
So, use show style to see the complete list of styles,
their characteristics and the visual aspect of each style.
The style-able objects are:
filename
function
set style function
family of commands. By default, this
style's foreground color is yellow.
This style is also used for symbol names in styled disassembler output
if gdb is using its builtin disassembler library for styling
(see set style disassembler enabled).
variable
set style variable
family of commands. By default, this style's
foreground color is cyan.
address
set style address
family of commands. By default, this style's
foreground color is blue.
This style is also used for addresses in styled disassembler output
if gdb is using its builtin disassembler library for styling
(see set style disassembler enabled).
version
In order to control how gdb styles the version number at
startup, add the set style version
family of commands to the
early initialization command file (see Initialization Files).
title
set style title
family of commands. By default, this style's
intensity is bold. Commands are using the title style to improve
the readability of large output. For example, the commands
apropos and help are using the title style
for the command names.
highlight
set style highlight
family of commands. By default, this style's
foreground color is red. Commands are using the highlight style to draw
the user attention to some specific parts of their output. For example,
the command apropos -v REGEXP uses the highlight style to
mark the documentation parts matching regexp.
metadata
tui-border
set style
. This was done for compatibility reasons, as TUI
controls to set the border's intensity predated the addition of
general styling to gdb. See TUI Configuration.
tui-active-border
disassembler comment
set style disassembler comment
family of
commands. This style is only used when gdb is styling using
its builtin disassembler library
(see set style disassembler enabled). By default, this style's intensity is dim, and its
foreground color is white.
disassembler immediate
set style disassembler immediate
family of commands. This style is not used for instruction operands
that represent addresses, in that case the `disassembler address'
style is used. This style is only used when gdb is styling
using its builtin disassembler library. By default, this style's
foreground color is blue.
disassembler address
disassembler symbol
disassembler mnemonic
set style disassembler
mnemonic
family of commands. This style is also used for assembler
directives, e.g. .byte
, .word
, etc. This style is
only used when gdb is styling using its builtin disassembler
library. By default, this style's foreground color is green.
disassembler register
set style disassembler register
family of commands. This style is only used when gdb is
styling using its builtin disassembler library. By default, this style's
foreground color is red.