forked from OSchip/llvm-project
236 lines
14 KiB
HTML
Executable File
236 lines
14 KiB
HTML
Executable File
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
<link href="style.css" rel="stylesheet" type="text/css" />
|
|
<title>Building LLDB</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="www_title">
|
|
The <strong>LLDB</strong> Debugger
|
|
</div>
|
|
|
|
<div id="container">
|
|
<div id="content">
|
|
|
|
<!--#include virtual="sidebar.incl"-->
|
|
|
|
<div id="middle">
|
|
<h1 class ="postheader">Continuous Integraton</h1>
|
|
<div class="postcontent">
|
|
<p> The following LLVM buildbots build and test LLDB trunk:
|
|
<ul>
|
|
<li> <a href="http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang">LLDB Linux x86_64 build with Clang (automake)</a>
|
|
<li> <a href="http://lab.llvm.org:8011/builders/lldb-x86_64-linux">LLDB Linux x86_64 build with GCC 4.6 (automake)</a>
|
|
<li> <a href="http://lab.llvm.org:8011/builders/lldb-x86_64-darwin11">LLDB Mac OS X x86_64 build with Clang (XCode)</a>
|
|
</ul>
|
|
</div>
|
|
<div class="postfooter"></div>
|
|
<div class="post">
|
|
<h1 class ="postheader">Building LLDB on Mac OS X</h1>
|
|
<div class="postcontent">
|
|
<p>Building on Mac OS X is as easy as downloading the code and building the Xcode project or workspace:</p>
|
|
</div>
|
|
<div class="postcontent">
|
|
<h2>Preliminaries</h2>
|
|
<ul>
|
|
<li>XCode 4.3 or newer requires the "Command Line Tools" component (XCode->Preferences->Downloads->Components).</li>
|
|
<li>Mac OS X Lion or newer requires installing <a href="http://swig.org">Swig</a>.</li>
|
|
</ul>
|
|
<h2>Building LLDB</h2>
|
|
<ul>
|
|
<li><a href="download.html">Download</a> the lldb sources.</li>
|
|
<li>Follow the code signing instructions in <b>lldb/docs/code-signing.txt</b></li>
|
|
<li>In Xcode 3.x: <b>lldb/lldb.xcodeproj</b>, select the <b>lldb-tool</b> target, and build.</li>
|
|
<li>In Xcode 4.x: <b>lldb/lldb.xcworkspace</b>, select the <b>lldb-tool</b> scheme, and build.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="postfooter"></div>
|
|
</div>
|
|
<div class="post">
|
|
<h1 class ="postheader">Building LLDB on Linux</h1>
|
|
<div class="postcontent">
|
|
<p>This document describes the steps needed to compile LLDB on most Linux systems.</a></p>
|
|
</div>
|
|
<div class="postcontent">
|
|
<h2>Preliminaries</h2>
|
|
<p>LLDB relies on many of the technologies developed by the larger LLVM project.
|
|
In particular, it requires both Clang and LLVM itself in order to build. Due to
|
|
this tight integration the <em>Getting Started</em> guides for both of these projects
|
|
come as prerequisite reading:</p>
|
|
<ul>
|
|
<li><a href="http://llvm.org/docs/GettingStarted.html">LLVM</a></li>
|
|
<li><a href="http://clang.llvm.org/get_started.html">Clang</a></li>
|
|
</ul>
|
|
<p>Supported compilers for building LLDB on Linux include:</p>
|
|
<ul>
|
|
<li>Clang 3.2</li>
|
|
<li><a href="http://gcc.gnu.org">GCC</a> 4.6.2 (later versions should work as well)</li>
|
|
</ul>
|
|
<p>It is recommended to use libstdc++ 4.6 (or higher) to build LLDB on Linux, but using libc++ is also known to work.</p>
|
|
<p>In addition to any dependencies required by LLVM and Clang, LLDB needs a few
|
|
development packages that may also need to be installed depending on your
|
|
system. The current list of dependencies are:</p>
|
|
<ul>
|
|
<li><a href="http://swig.org">Swig</a></li>
|
|
<li><a href="http://www.thrysoee.dk/editline">libedit</a></li>
|
|
<li><a href="http://www.python.org">Python</a></li>
|
|
</ul>
|
|
<p>So for example, on a Fedora system one might run:</p>
|
|
<code>> yum install swig python-devel libedit-devel</code>
|
|
<p>On an Ubuntu system one might run:</p>
|
|
<code>> sudo apt-get install build-essential subversion swig python-dev libedit-dev </code>
|
|
<p>If you wish to build the optional reference documentation, additional dependencies are required:</p>
|
|
<ul>
|
|
<li> Graphviz (for the 'dot' tool).
|
|
<li> doxygen (only if you wish to build the C++ API reference)
|
|
<li> epydoc (only if you wish to build the Python API reference)
|
|
</ul>
|
|
<p>To install the prerequisites for building the documentation (on Ubuntu) do:</p>
|
|
<code>
|
|
<br>> sudo apt-get install doxygen graphviz
|
|
<br>> sudo pip install epydoc
|
|
</code>
|
|
<h2 >Building LLDB</h2>
|
|
<p>We first need to checkout the source trees into the appropriate locations. Both
|
|
Clang and LLDB build as subprojects of LLVM. This means we will be checking out
|
|
the source for both Clang and LLDB into the <tt>tools</tt> subdirectory of LLVM. We
|
|
will be setting up a directory hierarchy looking something like this:</p>
|
|
<p>
|
|
<pre><tt>
|
|
llvm
|
|
|
|
|
`-- tools
|
|
|
|
|
+-- clang
|
|
|
|
|
`-- lldb
|
|
</tt></pre>
|
|
</p>
|
|
<p>For reference, we will call the root of the LLVM project tree <tt>$llvm</tt>, and the
|
|
roots of the Clang and LLDB source trees <tt>$clang</tt> and <tt>$lldb</tt> respectively.</p>
|
|
<p>Change to the directory where you want to do development work and checkout LLVM:</p>
|
|
<code>> svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</code>
|
|
|
|
<p>Now switch to LLVM’s tools subdirectory and checkout both Clang and LLDB:</p>
|
|
<code>> cd $llvm/tools
|
|
<br>> svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
|
|
<br>> svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
|
|
</code>
|
|
|
|
<p>In general, building the LLDB trunk revision requires trunk revisions of both
|
|
LLVM and Clang.
|
|
<p>It is highly recommended that you build the system out of tree. Create a second
|
|
build directory and configure the LLVM project tree to your specifications as
|
|
outlined in LLVM’s <em>Getting Started Guide</em>. A typical build procedure
|
|
might be:</p>
|
|
<code>> cd $llvm/..
|
|
<br>> mkdir build
|
|
<br>> cd build
|
|
</code>
|
|
<h2>To build with CMake</h2>
|
|
<p>Using CMake is documented on the <a href="http://llvm.org/docs/CMake.html">Building LLVM with CMake</a>
|
|
page. Building LLDB is possible using one of the following generators:
|
|
</p>
|
|
<ul>
|
|
<li> Ninja </li>
|
|
<li> Unix Makefiles </li>
|
|
</ul>
|
|
<h3>Using CMake + Ninja</h3>
|
|
<p>Ninja is the fastest way to build LLDB! In order to use ninja, you need to have recent versions of CMake and
|
|
ninja on your system. To build using ninja:
|
|
</p>
|
|
<code>
|
|
> cmake -C .. -G Ninja
|
|
<br>> ninja lldb
|
|
<br>> ninja check-lldb
|
|
</code>
|
|
<h3>Using CMake + Unix Makefiles</h3>
|
|
<p>If you do not have Ninja, you can still use CMake to generate Unix Makefiles that build LLDB:</p>
|
|
<code>
|
|
> cmake -C ..
|
|
<br>> make
|
|
<br>> make check-lldb
|
|
</code>
|
|
<h2>To build with autoconf</h2>
|
|
<p>If you do not have CMake, it is still possible to build LLDB using the autoconf build system. If you are using
|
|
Clang or GCC 4.7+, run:</p>
|
|
<code>
|
|
> $llvm/configure --enable-cxx11
|
|
<br>> make </code>
|
|
<p>Or, if you are using a version of GCC that does not support the <tt>-std=c++11</tt> option:</p>
|
|
<code>
|
|
> $llvm/configure
|
|
<br>> make CXXFLAGS=-std=c++0x</code>
|
|
<p>If you are building with a GCC that isn't the default gcc/g++, like gcc-4.7/g++-4.7</p>
|
|
<code>
|
|
> $llvm/configure --enable-cxx11 CC=gcc-4.7 CXX=g++-4.7
|
|
<br>> make CC=gcc-4.7 CXX=g++-4.7</code>
|
|
<p>If you are running in a system that doesn't have a lot of RAM (less than 4GB), you might want to disable
|
|
debug symbols by specifying DEBUG_SYMBOLS=0 when running make. You will know if you need to enable this
|
|
because you will fail to link clang (the linker will get a SIGKILL and exit with status 9).</p>
|
|
<code>
|
|
> make DEBUG_SYMBOLS=0</code>
|
|
<p> To run the LLDB test suite, run:</p>
|
|
<code>
|
|
<br>> make -C tools/lldb/test</code>
|
|
<p>Note that once both LLVM and Clang have been configured and built it is not
|
|
necessary to perform a top-level <tt>make</tt> to rebuild changes made only to LLDB.
|
|
You can run <tt>make</tt> from the <tt>build/tools/lldb</tt> subdirectory as well.</p>
|
|
<p> If you wish to build with libc++ instead of libstdc++ (the default), run configure with the
|
|
<tt>--enable-libcpp</tt> flag.</p>
|
|
<p> If you wish to build a release version of LLDB, run configure with the <tt>--enable-optimized</tt> flag.</p>
|
|
|
|
<h2>Testing</h2>
|
|
<p>By default, the <tt>check-lldb</tt> target builds the 64-bit variants of the test programs with the same
|
|
compiler that was used to build LLDB. It is possible to customize the architecture and compiler by appending -A and
|
|
-C options respectively to the CMake variable <tt>LLDB_TEST_ARGS</tt>. For example, to test LLDB against 32-bit binaries
|
|
built with a custom version of clang, do:</p>
|
|
<code>
|
|
<br>> cmake -DLLDB_TEST_ARGS="-A i386 -C /path/to/custom/clang" -G Ninja
|
|
<br>> ninja check-lldb
|
|
</code>
|
|
<p>Note that multiple -A and -C flags can be specified to <tt>LLDB_TEST_ARGS</tt>.</p>
|
|
<p>In addition to running all the LLDB test suites with the "check-lldb" CMake target above, it is possible to
|
|
run individual LLDB tests. For example, to run the test cases defined in TestInferiorCrashing.py, run:</p>
|
|
<code>
|
|
<br>> cd $lldb/test
|
|
<br>> python dotest.py --executable <path-to-lldb> -p TestInferiorCrashing.py
|
|
</code>
|
|
<p>In addition to running a test by name, it is also possible to specify a directory path to <tt>dotest.py</tt>
|
|
in order to run all the tests under that directory. For example, to run all the tests under the
|
|
'functionalities/data-formatter' directory, run:</p>
|
|
<code>
|
|
<br>> python dotest.py --executable <path-to-lldb> functionalities/data-formatter
|
|
</code>
|
|
<p>To dump additional information to <tt>stdout</tt> about how the test harness is driving LLDB, run
|
|
<tt>dotest.py</tt> with the <tt>-t</tt> flag. Many more options that are available. To see a list of all of them, run:</p>
|
|
<code>
|
|
<br>> python dotest.py -h
|
|
</code>
|
|
<h2>Building API reference documentation</h2>
|
|
<p>LLDB exposes a C++ as well as a Python API. To build the reference documentation for these two APIs, ensure you have
|
|
the required dependencies installed, and build the <tt>lldb-python-doc</tt> and <tt>lldb-cpp-doc</tt> CMake targets.</p>
|
|
<p> The output HTML reference documentation can be found in <tt><build-dir>/tools/lldb/docs/</tt>.<p>
|
|
<h2>Additional Notes</h2>
|
|
<p>LLDB has a Python scripting capability and supplies its own Python module named <tt>lldb</tt>.
|
|
If a script is run inside the command line <tt>lldb</tt> application, the Python module
|
|
is made available automatically. However, if a script is to be run by a Python interpreter
|
|
outside the command line application, the <tt>PYTHONPATH</tt> environment variable can be used
|
|
to let the Python interpreter find the <tt>lldb</tt> module.
|
|
<p>The correct path can be obtained by invoking the command line <tt>lldb</tt> tool with the -P flag:</p>
|
|
<code>> export PYTHONPATH=`$llvm/build/Debug+Asserts/bin/lldb -P`</code>
|
|
<p>If you used a different build directory or made a release build, you may need to adjust the
|
|
above to suit your needs. To test that the lldb Python module
|
|
is built correctly and is available to the default Python interpreter, run:</p>
|
|
<code>> python -c 'import lldb'</code></p>
|
|
</div>
|
|
<div class="postfooter"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|