Output Styling (Debugging with GDB)
Next: Numbers, Previous: Screen Size, Up: Controlling GDB [Contents][Index]
22.5 Output Styling
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’Enable or disable all styling. The default is host-dependent, with most hosts defaulting to ‘
on’.show style enabledShow the current state of styling.
set style sources ‘on|off’Enable or disable source code styling. This affects whether source code, such as the output of the
listcommand, 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 sourcesShow the current state of source code styling.
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 color- Set the background to
color. Valid colors are ‘none’ (meaning the terminal’s default color), ‘black’, ‘red’, ‘green’, ‘yellow’, ‘blue’, ‘magenta’, ‘cyan’, and‘white’. set style filename foreground color- Set the foreground to
color. Valid colors are ‘none’ (meaning the terminal’s default color), ‘black’, ‘red’, ‘green’, ‘yellow’, ‘blue’, ‘magenta’, ‘cyan’, and‘white’. set style filename intensity value- Set the intensity to
value. Valid intensities are ‘normal’ (the default), ‘bold’, and ‘dim’.
The 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:
filenameControl the styling of file names. By default, this style’s foreground color is green.
functionControl the styling of function names. These are managed with the
set style functionfamily of commands. By default, this style’s foreground color is yellow.variableControl the styling of variable names. These are managed with the
set style variablefamily of commands. By default, this style’s foreground color is cyan.addressControl the styling of addresses. These are managed with the
set style addressfamily of commands. By default, this style’s foreground color is blue.versionControl the styling of GDB’s version number text. By default, this style’s foreground color is magenta and it has bold intensity. The version number is displayed in two places, the output of
show version, and when GDB starts up.In order to control how GDB styles the version number at startup, add the
set style versionfamily of commands to the early initialization command file (see Initialization Files).titleControl the styling of titles. These are managed with the
set style titlefamily 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 commandsaproposandhelpare using the title style for the command names.highlightControl the styling of highlightings. These are managed with the
set style highlightfamily 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 commandapropos -v REGEXPuses the highlight style to mark the documentation parts matchingregexp.tui-borderControl the styling of the TUI border. Note that, unlike other styling options, only the color of the border can be controlled via
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-borderControl the styling of the active TUI border; that is, the TUI window that has the focus.
Next: Numbers, Previous: Screen Size, Up: Controlling GDB [Contents][Index]