Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml">
|
| 3 | <head>
|
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
| 5 | <link href="style.css" rel="stylesheet" type="text/css" />
|
| 6 | <title>LLDB FAQ</title>
|
| 7 | </head>
|
| 8 |
|
| 9 | <body>
|
| 10 | <div class="www_title">
|
| 11 | The <strong>LLDB</strong> Debugger
|
| 12 | </div>
|
| 13 |
|
| 14 | <div id="container">
|
| 15 | <div id="content">
|
| 16 |
|
| 17 | <!--#include virtual="sidebar.incl"-->
|
| 18 |
|
| 19 | <div id="middle">
|
| 20 | <div class="post">
|
| 21 | <h1 class ="postheader">Building LLDB on Mac OS X</h1>
|
| 22 | <div class="postcontent">
|
| 23 | <p>Building on Mac OS X is as easy as downloading the code and building the Xcode project or workspace:</p>
|
| 24 | <ul>
|
| 25 | <li><a href="download.html">Download</a> the lldb sources.</li>
|
| 26 | <li>Follow the code signing instructions in <b>lldb/docs/code-signing.txt</b></li>
|
| 27 | <li>In Xcode 3.x: <b>lldb/lldb.xcodeproj</b>, select the <b>lldb-tool</b> target, and build.</li>
|
| 28 | <li>In Xcode 4.x: <b>lldb/lldb.xcworkspace</b>, select the <b>lldb-tool</b> scheme, and build.</li>
|
| 29 | </ul>
|
| 30 | </div>
|
| 31 | <div class="postfooter"></div>
|
| 32 | </div>
|
| 33 | <div class="post">
|
| 34 | <h1 class ="postheader">Building LLDB on Linux</h1>
|
| 35 | <div class="postcontent">
|
| 36 | <p>This document describes the steps needed to compile LLDB on most Linux systems.</a></p>
|
| 37 | </div>
|
| 38 | <div class="postcontent">
|
| 39 | <h2>Preliminaries</h2>
|
| 40 | <p>LLDB relies on many of the technologies developed by the larger LLVM project.
|
| 41 | In particular, it requires both Clang and LLVM itself in order to build. Due to
|
| 42 | this tight integration the <em>Getting Started</em> guides for both of these projects
|
| 43 | come as prerequisite reading:</p>
|
| 44 | <ul>
|
| 45 | <li><a href="http://llvm.org/docs/GettingStarted.html">LLVM</a></li>
|
| 46 | <li><a href="http://clang.llvm.org/get_started.html">Clang</a></li>
|
| 47 | </ul>
|
| 48 | <p>In addition to any dependencies required by LLVM and Clang, LLDB needs a few
|
| 49 | development packages that may also need to be installed depending on your
|
| 50 | system. The current list of dependencies are:</p>
|
| 51 | <ul>
|
| 52 | <li><a href="http://swig.org">Swig</a></li>
|
| 53 | <li><a href="http://www.thrysoee.dk/editline">libedit</a></li>
|
| 54 | <li><a href="http://www.python.org">Python</a></li>
|
| 55 | </ul>
|
| 56 | <p>So for example, on a Fedora system one might say:</p>
|
| 57 | <code>> yum install swig python-devel libedit-devel</code>
|
| 58 | <h2 >Building LLDB</h2>
|
| 59 | <p>We first need to checkout the source trees into the appropriate locations. Both
|
| 60 | Clang and LLDB build as subprojects of LLVM. This means we will be checking out
|
| 61 | the source for both Clang and LLDB into the <tt>tools</tt> subdirectory of LLVM. We
|
| 62 | will be setting up a directory hierarchy looking something like this:</p>
|
| 63 | <p>
|
| 64 | <pre><tt>
|
| 65 | llvm
|
| 66 | |
|
| 67 | `-- tools
|
| 68 | |
|
| 69 | +-- clang
|
| 70 | |
|
| 71 | `-- lldb
|
| 72 | </tt></pre>
|
| 73 | </p>
|
| 74 | <p>For reference, we will call the root of the LLVM project tree <tt>$llvm</tt>, and the
|
| 75 | roots of the Clang and LLDB source trees <tt>$clang</tt> and <tt>$lldb</tt> respectively.</p>
|
| 76 | <p>Change to the directory where you want to do development work and checkout LLVM:</p>
|
| 77 | <code>> svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</code>
|
| 78 |
|
| 79 | <p>Now switch to LLVM’s tools subdirectory and checkout both Clang and LLDB:</p>
|
| 80 | <code>> cd $llvm/tools
|
| 81 | <br>> svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
|
| 82 | <br>> svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
|
| 83 | </code>
|
| 84 |
|
| 85 | <p>In general, LLDB requires specific revisions of both LLVM and Clang in order to
|
| 86 | build. This requirement insulates LLDB a bit from the constant development
|
| 87 | happening in both of these projects. The required revision can be discovered by
|
| 88 | consulting the Perl script <tt>$lldb/scripts/build-llvm.pl</tt> and locating the
|
| 89 | <tt>$llvm_revision</tt> variable. At the time of this writing, the required revision
|
| 90 | is <tt>r127682</tt>, so we might check and revert our LLVM and Clang trees to the
|
| 91 | required state as follows:</p>
|
| 92 | <code>> grep -m 1 llvm_revision $lldb/scripts/build-llvm.pl
|
| 93 | <br>our $llvm_revision = "127682";
|
| 94 | <br>> cd $clang
|
| 95 | <br>> svn update -r 127682
|
| 96 | <br>> cd $llvm
|
| 97 | <br>> svn update -r 127682</code>
|
| 98 |
|
| 99 | <p>It is highly recommended that you build the system out of tree. Create a second
|
| 100 | build directory and configure the LLVM project tree to your specifications as
|
| 101 | outlined in LLVM’s <em>Getting Started Guide</em>. For Linux development the x86
|
| 102 | backend and JIT compiler should be enabled. A typical build procedure might be:</p>
|
| 103 | <code>> cd $llvm/..
|
| 104 | <br>> mkdir build
|
| 105 | <br>> cd build
|
| 106 | <br>> $llvm/configure --enable-targets=x86 --enable-jit
|
| 107 | <br>> make</code>
|
| 108 |
|
| 109 | <p>Note that once both LLVM and Clang have been configured and built it is not
|
| 110 | necessary to perform a top-level <tt>make</tt> to rebuild changes made only to LLDB.
|
| 111 | You can build from the <tt>build/tools/lldb</tt> subdirectory as well.</p>
|
| 112 |
|
| 113 | <h2>Additional Notes</h2>
|
| 114 | <p>LLDB has a Python scripting capability and supplies it’s own Python module,
|
| 115 | <tt>lldb.py</tt>, built alongside the <tt>lldb</tt> binary. Python needs to know where to
|
| 116 | look for this module when LLDB starts up. There are two options available:</p>
|
| 117 | <ol class="arabic">
|
| 118 | <li>
|
| 119 | <p>Keep a copy of <tt>lldb.py</tt> in the current working directory when starting lldb.</p>
|
| 120 | </li>
|
| 121 | <li>
|
| 122 | <p>Set <tt>PYTHONPATH</tt> to point to the directory holding <tt>lldb.py</tt>.</p>
|
| 123 | </li>
|
| 124 | </ol>
|
| 125 | </div>
|
| 126 | <div class="postfooter"></div>
|
| 127 | </div>
|
| 128 | </div>
|
| 129 | </div>
|
| 130 | </div>
|
| 131 | </body>
|
| 132 | </html> |