The prompt

UDB’s prompt, by default, shows the status of the debugged program:

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 0x1141: 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 10,333> next
11              printf("[%d] Hello, world!\n", i);
recording 10,334> reverse-next
9           for (int i = 0; i < 3; i++)
99% 10,333> 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 10,334> reverse-next
9           for (int i = 0; i < 3; i++)
99% 10,333> ugo start
Have reached start of recorded history.
0x00007ffff7fe59c0 in _start () from /lib64/ld-linux-x86-64.so.2
start 1> ugo time +100
_dl_sysdep_parse_arguments (start_argptr=start_argptr@entry=0x7fffffffd730,
    args=args@entry=0x7fffffffd640) at ../sysdeps/unix/sysv/linux/dl-sysdep.c:82
82      ../sysdeps/unix/sysv/linux/dl-sysdep.c: No such file or directory.
0% 101> info time -a
Current time is: 101:0x7ffff7fe4600 (in recorded range: [1 - 10,334])

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 0x1141: 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 10,333> ubookmark beginning-of-main
Added bookmark 'beginning-of-main'.
recording 10,333 beginning-of-main> next
11              printf("[%d] Hello, world!\n", i);
recording 10,334> reverse-next
9           for (int i = 0; i < 3; i++)
99% 10,333 beginning-of-main> info bookmarks
Time                   Name
---------------------  -----------------
10,333:0x555555555141  beginning-of-main

The list of bookmarks is truncated if too long:

99% 10,333 beginning-of-main> ubookmark long-bookmark-name
Added bookmark 'long-bookmark-name'.
99% 10,333 beginning-of-main, long-…> info bookmarks
Time                   Name
---------------------  ------------------
10,333:0x555555555141  beginning-of-main
10,333:0x555555555141  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 0x1141: 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, or status-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 as mode.

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.

The -reset option restores the default prompt. For example:

recording - Hello!> set prompt -reset
recording 10,333> show prompt
UDB's status prompt is:
    '{history-progress-or-mode} {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} {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 colour. Valid values are: none (default as set by the terminal), black, red, green, yellow, blue, magenta, cyan and white.

foreground

The foreground colour. 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).