====== FreeBSD LLDB port ======
===== Background =====
LLDB, part of the LLVM family of projects, is a modern, high-performance source-level debugger. It supports (at some level) OS X, Linux, %%FreeBSD%%, %%NetBSD%%, and Windows. This page describes the ongoing work to bring the %%FreeBSD%% LLDB port to completion.
===== Links =====
* [[http://lldb.llvm.org/lldb-gdb.html|LLDB to GDB command map]]
* [[http://lldb.llvm.org/tutorial.html|Tutorial with command info]]
* [[http://llvm.org/bugs/buglist.cgi?f1=op_sys&list_id=44176&o1=equals&resolution=---&query_format=advanced&v1=FreeBSD&product=lldb|LLDB FreeBSD bug list]] ([[http://llvm.org/bugs/buglist.cgi?list_id=46812&resolution=---&resolution=FIXED&resolution=INVALID&resolution=WONTFIX&resolution=LATER&resolution=REMIND&resolution=DUPLICATE&resolution=WORKSFORME&resolution=MOVED&op_sys=FreeBSD&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&component=All%20Bugs&product=lldb|including resolved]])
* [[http://llvm-amd64.freebsd.your.org:8010/builders/lldb-amd64-freebsd|FreeBSD-hosted FreeBSD amd64 buildbot]] ([[http://llvm-amd64.freebsd.your.org:8010/builders/lldb-amd64-freebsd?numbuilds=200|last 200 builds]]) (2014-11-26: currently offline)
* [[http://lab.llvm.org:8011/builders/lldb-amd64-ninja-freebsd11|LLVM-hosted FreeBSD amd64 buildbot]]
* [[http://llvm-amd64.freebsd.your.org:8010/builders/lldb-i386-freebsd|FreeBSD i386 buildbot]]
* [[http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang|Debian Linux amd64 buildbot]]
===== Installation =====
==== FreeBSD HEAD (in-tree LLDB snapshot) ====
%%FreeBSD%%-HEAD contains LLDB release version 3.8 (as of the last update of this wiki page) and is typically updated along with Clang/LLVM. It is enabled by default on amd64 and arm64 and may be enabled elsewhere by adding ''%%WITH_LLDB=YES%%'' to ''%%/etc/src.conf%%'', and then following a standard [[http://www.freebsd.org/doc/handbook/makeworld.html|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:
* python
* swig (I used swig 1.3)
* cmake
* ninja
* git
This can be accomplished by running:
pkg install git python cmake ninja swig13
==== Virtual Machine ====
LLDB developers working on other platforms who wish to test their changes on %%FreeBSD%% can start with a virtual machine image from the table below.
^ Image Link ^ Description ^
| [[https://download.freebsd.org/ftp/releases/VM-IMAGES/10.3-RELEASE/amd64/Latest/|FreeBSD 10.3 Release]] | Most recent release |
| [[https://download.freebsd.org/ftp/snapshots/VM-IMAGES/11.0-CURRENT/amd64/Latest//|FreeBSD 11.0-CURRENT]] | Subversion HEAD development snapshot |
Quick start instructions:
- Log in as root on the console
- Run "ifconfig -l" to list network interfaces The virtual nic will likely be em0 or vtnet0 depending on the VM software.
- Add to /etc/rc.conf (assuming vtnet0 interface here):
ifconfig_vtnet0="DHCP"
sshd_enable="YES"
- Run ''%%dhclient vtnet0%%'' to fetch an IP address for the current session.
- Run ''%%pkg%%'' and answer Y to install the package management tool
- Run ''%%pkg install git python27 cmake ninja swig13 zsh%%''
- Run ''%%adduser%%'' to create a user account
- Run ''%%shutdown -r now%%'' to reboot
- 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
* //For details on the need for -std=c++11 see [[http://lists.cs.uiuc.edu/pipermail/lldb-dev/2013-November/002755.html]]//
* //''%%CC=%%'' and ''%%CXX=%%'' are required for 9.x builds only; clang is the default compiler on 10.0 and later.//
===== Status =====
^ Feature ^ Status ^
| process launch | Works |
| process attach (pid) | Works |
| process attach (name) | Works |
| userland core files | Works |
| Breakpoints | Works |
| Watchpoints | Works |
| Threads | Works |
| Testsuite | All non-passing tests have PRs |
| Remote debugging (gdbserver / debugserver) | [[http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-gdbserver/|In Progress]] |
| Kernel debugging | In progress (%%GSoC%% 2014) |
| Cross debugging | Untested |
^ Architecture ^ Host Status ^ Target Status ^
| amd64 | Works | Works |
| arm | Unknown | Unknown |
| arm64 (aarch64) | Works | Works |
| i386 | In progress | In progress |
| mips | Unknown | In progress |
| mips64 | Unknown | In progress |
| powerpc | In progress | In progress |
| powerpc64 | In progress | In progress |
===== Tasks =====
- Investigate and fix open PRs. To find annotated failing or skipped tests, try:
find packages/Python/lldbsuite/test -name '*.py' -print0 | xargs -r0 egrep 'skipIfFreeBSD|expectedFailureFreeBSD'
----
{{tag>HowTo}}
{{tag>Project}}
{{tag>Stale}}