The prompt¶
UDB’s prompt, by default, shows the status of the debugged program:
The execution mode (recording, not recording, etc.) or, if replaying, the progress through execution history.
The bbcount if the debugged program is running or replaying.
For instance, see how the prompt changes based on the status of the debugged program:
$ udb examples/hello-world
Reading symbols from examples/hello-world...
not running> start
Temporary breakpoint 1 at 0x1155: file hello-world.c, line 9.
Starting program: examples/hello-world
Temporary breakpoint 1, main () at hello-world.c:9
9 for (int i = 0; i < 3; i++)
recording 6,818> next
11 printf("[%d] Hello, world!\n", i);
recording 6,819> reverse-next
9 for (int i = 0; i < 3; i++)
99% 6,818> continue
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
Have switched to record mode.
main () at hello-world.c:11
11 printf("[%d] Hello, world!\n", i);
recording 6,819> reverse-next
9 for (int i = 0; i < 3; i++)
99% 6,818> ugo start
Have reached start of recorded history.
0x00007ffff7fe4540 in _start () from /lib64/ld-linux-x86-64.so.2
start 1> ugo time +100
get_next_env (prev_envp=<synthetic pointer>, val=<synthetic pointer>, name=<synthetic pointer>,
envp=0x7fffffffeca0) at ./elf/dl-tunables.c:48
48 while (envline[len] != '\0' && envline[len] != '=')
1% 101> info time -a
Current time is: 101:0x7ffff7fda920 (in recorded range: [1 - 6,819])
Bookmarks are only displayed if there are bookmarks at the current time in execution history (including the PC as well):
$ udb examples/hello-world
Reading symbols from examples/hello-world...
not running> start
Temporary breakpoint 1 at 0x1155: file hello-world.c, line 9.
Starting program: examples/hello-world
Temporary breakpoint 1, main () at hello-world.c:9
9 for (int i = 0; i < 3; i++)
recording 6,818> ubookmark beginning-of-main
Added bookmark 'beginning-of-main'.
recording 6,818 beginning-of-main> next
11 printf("[%d] Hello, world!\n", i);
recording 6,819> reverse-next
9 for (int i = 0; i < 3; i++)
99% 6,818 beginning-of-main> info bookmarks
Time Name
-------------------- -----------------
6,818:0x555555555155 beginning-of-main
The list of bookmarks is truncated if too long:
99% 6,818 beginning-of-main> ubookmark long-bookmark-name
Added bookmark 'long-bookmark-name'.
99% 6,818 beginning-of-main, long-…> info bookmarks
Time Name
-------------------- ------------------
6,818:0x555555555155 beginning-of-main
6,818:0x555555555155 long-bookmark-name
Changed in version 6.4: previously the prompt was always a static string, by default (udb)
.
Configuring the content of the prompt¶
The content of the prompt can be configured with the set prompt command, and the configured prompt can be displayed with the show prompt command.
set prompt [static-prompt|-status status-prompt-template|-reset]¶
Set the content of the prompt to the specified value.
If no option is specified, the rest of the command line is used literally as the prompt.
$ udb examples/hello-world Reading symbols from examples/hello-world... not running> set prompt udb> udb>show prompt UDB's prompt is: 'udb>'If the
-status
option is specified then a status prompt, whose content is updated automatically, is used. Fields inside curly braces ({
and}
) are replaced with values every time the prompt is displayed. For instance:udb>set prompt -status {mode} - Hello!>{space} not running - Hello!> start Temporary breakpoint 1 at 0x1155: file hello-world.c, line 9. Starting program: examples/hello-world Temporary breakpoint 1, main () at hello-world.c:9 9 for (int i = 0; i < 3; i++) recording - Hello!> show prompt UDB's status prompt is: '{mode} - Hello!>{space}' Values in braces are replaced with appropriate values based on the status of the debugged program or recording.
Valid fields in the status prompt template string are:
{bbcount}
The time in execution history as the number of BBs that the program has executed (the bbcount).
Use the set style status-prompt-time command to change the style used for this field.
{time}
The time in execution history as the number of BBs that the program has executed (the bbcount) and the PC.
Use the set style status-prompt-time command to change the style used for this field.
{mode}
Whether debugging has started, and if so, whether recording is enabled, and if so, whether we’re currently in record mode or replay mode.
Use the set style style-name attribute value command with style-name set to
status-prompt-mode-not-recording
,status-prompt-mode-not-running
,status-prompt-mode-recording
, orstatus-prompt-mode-replaying
to change the styles used for this field.
{history-progress}
The current position in execution history, as a percentage. The progress, as a percentage, across execution history. When at the first recorded BB,
start
is used instead of a percentage. Similarly, when at the last recorded BB,end
is used.Use the set style status-prompt-history-progress command to change the style used for this field.
{history-progress-or-mode}
If replaying, the same value as
history-progress
. Otherwise, the same value asmode
.See the documentation for the history-progress and mode fields.
{bookmarks}
The bookmarks, if any, at the current time in execution history. The list is truncated if there are several bookmarks or bookmarks with long names.
Use the set style status-prompt-bookmarks command to change the style used for this field.
{space}
A whitespace. Literal spaces in the template are omitted if next to a field without a value (to avoid extra unwanted space), while
{space}
is never omitted.
{scheduler-locking}
The scheduler-locking mode, if this is “on” or “step”.
The
-reset
option restores the default prompt. For example:recording - Hello!> set prompt -reset recording 6,818> show prompt UDB's status prompt is: '{history-progress-or-mode} {scheduler-locking} {bbcount} {bookmarks}> ' Values in braces are replaced with appropriate values based on the status of the debugged program or recording.New in version 6.4: the
-status
and-reset
options.
show prompt¶
Show the content of the prompt. For example:
$ udb examples/hello-world Reading symbols from examples/hello-world... not running> show prompt UDB's status prompt is: '{history-progress-or-mode} {scheduler-locking} {bbcount} {bookmarks}> ' Values in braces are replaced with appropriate values based on the status of the debugged program or recording. not running> set prompt udb> udb>show prompt UDB's prompt is: 'udb>'
Configuring the style of the prompt¶
By default, UDB styles its output, including the prompt, if the terminal supports this feature. It’s possible to disable styles completely with set style enabled off or change styles with set style.
show style enabled¶
Show whether styling is currently enabled or not.
set style enabled on|off¶
Enable or disable all styling (not just for status prompt).
show style [style-name]¶
Show the configured values for style-name. If style-name is omitted, show the configured values for all styles.
set style style-name attribute value¶
Set style-name's attribute to value.
style-name is one of the styles listed by show style.
attribute must be one of:
background
The background color. Valid values are: none (default as set by the terminal), black, red, green, yellow, blue, magenta, cyan and white.
foreground
The foreground color. Values as for background.
intensity
The intensity of the font which, depending on the terminal used, may set the font weight or change the color to make the text stand out more or less.
Valid intensities are:
none
(default font weight and color),bold
(bold text or more prominent text color),dim
(thin text or less prominent text color).