FreeBSD’s base system includes LLDB, the LLVM family debugger. Compared to the GNU GDB debugger, FreeBSD’s LLDB currently has some limitations and is not yet a complete replacement. This multi-stage project aims to provide FreeBSD with a modern debugger and bring LLDB closer to being a fully featured GDB replacement.
The LLDB debugger on FreeBSD still lacks a drop-in replacement for kgdb(1), which wraps a modified version of GDB and depends on the libkvm interface for debugging post-mortem and live BSD kernel memory. A major limitation for FreeBSD kernel debugging with LLDB is its lack of remote protocol compatibility with GDB. This incompatibility means the LLDB frontend is not compatible with preexisting gdb-server implementations, most notably the one used by qemu. A major goal of part III is to resolve these incompatibilities, making installation of GDB for kernel debugging unnecessary and allowing FreeBSD developers to use LLDB for all their debugging needs.
GDB and LLDB both support remote debugging via TCP/IP. However, GDB additionally supports a variant of the gdb-remote protocol over serial port. As this is useful for remote kernel debugging without relying on the in-kernel TCP/IP stack, support will be added to LLDB.
libkvm, part of the FreeBSD base system, provides a uniform interface for accessing kernel virtual memory images and provides support for both the live kernel and kernel core dumps. In order to facilitate debugging kernel core dumps on non-FreeBSD platforms, libkvm needs to support these platforms. Another goal of part III, is to provide a libkvm-portable variant that integrates the original FreeBSD sources with a portable build system, following other *-portable packages such as openssh-portable. The hope is that libkvm-portable will permit support for working on FreeBSD kernel core dumps inside LLDB on all platforms supported by LLDB, including both different operating systems and different architectures. Live kernel debugging support on FreeBSD will be added, starting with amd64 and proceeding to other platforms (e.g. arm64 and i386) as time permits.