Remote debugging is used in situations where a program must be run on a different machine to where it is developed; in these cases it’s typically convenient to run the debugger on the development machine and have it control a program running on the test machine.
Installing udbserver on the target¶
udbserver is the component of UDB which tightly controls the program and enables it to be recorded and rewound. For those familiar with remote debugging via GDB, it is analogous to gdbserver. As such it must be installed on the target machine.
Installing can be as simple as copying the Undo release directory to the
target machine, or making it available via a file-sharing mechanism such as
NFS. Where storage space on the target is limited, the only required files are
the version of udbserver appropriate to your target (see below) and the
It is important that the date and time on the target device are set (approximately) correctly, otherwise udbserver will refuse to run.
The version of udbserver installed on the target must match the version of UDB used on the development machine.
Choosing the appropriate udbserver executable¶
Your LiveRecorder download contains a number of udbserver executables. The correct executable depends on the architecture for which the program was compiled, as follows:
In previous versions of UDB, the remote debugging server was called
undodb-server (and the executables were called
arch is the program’s architecture).
For compatibility, the old executable names are still available but are
now symbolic links to the
Start udbserver, using the
--connect-port 0 option to request it to choose a TCP/IP port to listen on, and
specifying the program and arguments to be debugged:
$ udbserver_x64 --connect-port 0 examples/cache & udbserver 6.8.0-dev.gac629b0a7437. Copyright 2022 Undo Ltd. using inferred keyfile: key Listening on port 39067
Connect to the server in UDB using the
target remote command, for
$ udb examples/cache Reading symbols from examples/cache... not running> target remote localhost:39067 Remote debugging using localhost:39067 Connection established Connection established not running> start Temporary breakpoint 1 at 0x1309: file cache.c, line 65. Starting program: examples/cache Temporary breakpoint 1, main () at cache.c:65 65 cache_init();
If the program is already running, use the
--pid option, for example:
$ examples/deadlock & Running as pid 2622904 $ udbserver_x64 --pid 2622904 --connect-port 0 & udbserver 6.8.0-dev.gac629b0a7437. Copyright 2022 Undo Ltd. using inferred keyfile: key Listening on port 41839
Automatically start the program as soon as UDB connects. For example:
$ udbserver_x64 --autostart --connect-port 0 examples/cache & udbserver 6.8.0-dev.gac629b0a7437. Copyright 2022 Undo Ltd. using inferred keyfile: key Listening on port 36229 $ udb examples/cache Reading symbols from examples/cache... not running> target remote localhost:36229 Remote debugging using localhost:36229 No more reverse-execution history. Have reached start of recorded history. 0x00007f17d9db1100 in ?? () from /lib64/ld-linux-x86-64.so.2 Connection established Connection established
Autostart is required for remote debugging to work correctly from some IDEs, including CLion and Eclipse, and is implicit in the suggested command-line when launching for IDE remote debugging.
- --connect-port PORT¶
Listen for new connections on
PORT. Specify port 0 to choose an available port.
- --keyfile KEYFILE¶
Use the license key from
KEYFILE. By default, use the file named
keyin the same directory as udbserver.
- --load-file RECORDING¶
Load the LiveRecorder recording named by
- --pid PID¶
Attach to the process with id
- --tmpdir-root DIRECTORY¶
The directory used by udbserver for its temporary files. See Temporary directory root.
- --version, -v¶
Print version information and then exit.
A common case in remote debugging is to have a developer machine running udb, connected over a network to a test machine running udbserver, and where the developer and test machines have different CPU architectures. In this case, use the set architecture command to tell udb the architecture of the program being debugged.
set architecture arch¶
Set the target architecture to arch. Supported architectures are:
ARMv8 AArch64 (enabled licenses only)
Show the target architecture.
IDE remote debugging¶
IDEs, including Eclipse and CLion, make certain assumptions about the behaviour of the remote debugging server. These assumptions are based on vanilla gdb’s behaviour. In order to match those expectations, the suggested command-line when launching the server for remote debugging within an IDE is:
udbserver_<arch> <port-number> <full-path-to-program>