FreeBSD LLDB port

Background

LLDB, part of the LLVM family of projects, is a modern, high-performance source-level debugger. This page describes the ongoing work to port LLDB to FreeBSD.

Installation

FreeBSD HEAD (in-tree LLDB snapshot)

FreeBSD-HEAD contains a snapshot of LLDB at upstream revision 196322 / git 49c127a (as of the last update of this wiki page). It is not yet built by default and may be enabled by adding WITH_LLDB= to /etc/src.conf, and then following a standard buildworld and installworld, or building directly in lib/clang and then usr.bin/clang/lldb.

FreeBSD HEAD or 10 (upstream LLDB tree)

Install the following ports / packages:

This can be accomplished by running:

pkg install git python cmake ninja swig13

FreeBSD 9 (upstream LLDB tree)

Install the ports / packages listed above for FreeBSD 10, and also install:

and build and install libc++:

cd /usr/src/lib/libcxxrt
CXX=clang++ make all install clean
cd /usr/src/lib/libc++
CXX=clang++ make all install clean

Virtual Machine

LLDB developers working on other platforms who wish to test their changes on FreeBSD can start with a virtual machine image from http://ftp.freebsd.org/pub/FreeBSD/snapshots/VM-IMAGES/10.0-RELEASE/amd64/Latest/. Quick start instructions:

  1. Log in as root on the console
  2. Run "ifconfig -l" to list network interfaces The virtual nic will likely be em0 or vtnet0 depending on the VM software.
  3. Add to /etc/rc.conf (assuming vtnet0 interface here):
    ifconfig_vtnet0="DHCP"                                                       
    sshd_enable="YES"                                                            
  4. Run pkg and answer Y to install the package management tool

  5. Run pkg install git python27 cmake ninja swig13 zsh

  6. Run adduser to create a user account

  7. Run shutdown -r now to reboot

  8. ssh to the VM as your user account and follow the steps below under "Checkout and Build".

Checkout and Build

I build LLDB with the in-tree Clang and libc++. It should also be possible to build with a recent GCC port installed (and dropping CC=, CXX=, and -stdlib= from the cmake line below), but I encountered a number of issues.

Checkout and build LLDB (assuming a Bourne shell):

git clone http://llvm.org/git/llvm.git
cd llvm/tools
git clone http://llvm.org/git/clang.git
git clone http://llvm.org/git/lldb.git
cd ..
mkdir build
cd build
CC=clang CXX=clang++ cmake ../ -G Ninja -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -I/usr/local/include/python2.7 -g"
ninja lldb
ninja check-lldb # if you want to run tests

Status

Feature

Status

process launch

Works

process attach (pid)

Works

process attach (name)

Works

userland core files

Works (amd64 only)

Breakpoints

Works

Watchpoints

In Progress

Threads

Works

Testsuite

All non-passing tests have PRs

Remote debugging (gdbserver / debugserver)

In Progress

Kernel debugging

Unimplemented

Cross debugging

Untested

Architecture

Host Status

Target Status

amd64

Works

Works

i386

Unknown

Unknown

arm

Unknown

Unknown

mips

Unknown

In progress

Tasks

  1. Investigate and fix open PRs. To find annotated failing or skipped tests, try:

    find test -name '*.py' -print0 | xargs -r0 egrep 'skipIfFreeBSD|expectedFailureFreeBSD'

lldb (last edited 2014-03-20 15:19:50 by EdMaste)