# Bookmarks¶

Bookmarks are a convenient mechanism to describe a particular point in the execution of a program.

## Named Bookmarks¶

Bookmarks can be created with the ubookmark command. For example:

13          for ( i=0; i<10; ++i)
(udb) ubookmark test
Bookmark test
(udb)


The bookmark test then refers to that position in the program’s execution; we can return to it at any time using the ugo bookmark command:

(udb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x0000000000400759 in main () at main.c:18
18      *(int*)0=0;
(udb) ugo bookmark test

13          for ( i=0; i<10; ++i)
(udb)


## Auto Bookmarks¶

Sometimes it’s possible to forget to set a bookmark, perform an operation, then want to go back to the previous place. This problem can be addressed by enabling Auto Bookmarks, which are automatically created by UndoDB every time a debuggee stops.

To enable auto bookmarks, specify --undodb-auto-bookmarks auto or set environmental variable UNDO_auto_bookmarks_format=auto. This will cause udb to set new a auto-bookmark whenever the debuggee stops, and show information about this bookmark and the current debuggee time.

Here’s an example:

UNDO_auto_bookmarks_format=auto udb ...

13          for ( i=0; i<10; ++i)
udb: [auto-bookmark=$0 time=29,262:0x400705] (udb) continue Continuing. Program received signal SIGSEGV, Segmentation fault. 0x0000000000400759 in main () at main.c:18 18 *(int*)0=0; udb: [auto-bookmark=$1 time=31,788:0x400759]
(udb)


If in this case we’d like to return to the position before continue, we can again use ugo bookmark:

(udb) ugo bookmark $0 13 for ( i=0; i<10; ++i) udb: [auto-bookmark=$0 time=29,262:0x400705]