Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +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 Architecture</title>
|
| 7 | </head>
|
| 8 |
|
| 9 | <body>
|
| 10 | <div class="www_title">
|
| 11 | The <strong>LLDB</strong> Debugger
|
| 12 | </div>
|
Eric Christopher | b7eb709 | 2010-06-10 05:35:26 +0000 | [diff] [blame] | 13 |
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 14 | <div id="container">
|
| 15 | <div id="content">
|
Greg Clayton | e4f90cd | 2010-06-10 02:50:28 +0000 | [diff] [blame] | 16 | <div id="left">
|
| 17 | <div class="urbangreymenu">
|
| 18 | <h1 class="headerbar">General</h1>
|
| 19 | <ul>
|
| 20 | <li><a href="index.html">About</a></li>
|
| 21 | <li><a href="architecture.html">Architecture</a></li>
|
| 22 | <li><a href="docs.html">Documentation</a></li>
|
| 23 | <li><a href="faq.html">FAQ</a></li>
|
| 24 | <li><a href="features.html">Features</a></li>
|
| 25 | <li><a href="goals.html">Goals</a></li>
|
| 26 | <li><a href="status.html">Status</a></li>
|
| 27 | </ul>
|
| 28 | </div>
|
| 29 | <div class="menu">
|
| 30 | <div class="urbangreymenu">
|
| 31 | <h1 class="headerbar">Mailing Lists</h1>
|
| 32 | <ul>
|
| 33 | <li><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev">lldb-dev</a></li>
|
| 34 | <li><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits">lldb-commits</a></li>
|
| 35 | </ul>
|
| 36 | </div>
|
| 37 | </div>
|
| 38 | <div class="menu">
|
| 39 | <div class="urbangreymenu">
|
| 40 | <h1 class="headerbar">Source</h1>
|
| 41 | <ul>
|
| 42 | <li><a href="download.html">Download</a></li>
|
| 43 | <li><a href="http://llvm.org/bugs">Bug Reports</a></li>
|
| 44 | <li><a href="http://llvm.org/svn/llvm-project/lldb/trunk">Browse SVN</a></li>
|
| 45 | <li><a href="http://llvm.org/viewvc/llvm-project/lldb/trunk">Browse ViewVC</a></li>
|
| 46 | </ul>
|
| 47 | </div>
|
| 48 | </div>
|
| 49 | </div>
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 50 | <div id="middle">
|
| 51 | <div class="post">
|
| 52 | <h1 class ="postheader">Architecture</h1>
|
| 53 | <div class="postcontent">
|
| 54 |
|
| 55 | <p>LLDB is a large and complex codebase. This section will help you become more familiar with
|
| 56 | the pieces that make up LLDB and give a general overview of the general architecture.</p>
|
| 57 | </div>
|
| 58 | <div class="postfooter"></div>
|
| 59 | </div>
|
| 60 | <div class="post">
|
| 61 | <h1 class ="postheader">Code Layout</h1>
|
| 62 | <div class="postcontent">
|
| 63 |
|
| 64 | <p>LLDB has many code groupings that makeup the source base:</p>
|
| 65 | <ul>
|
| 66 | <li><a href="#api">API</a></li>
|
| 67 | <li><a href="#breakpoint">Breakpoint</a></li>
|
| 68 | <li><a href="#commands">Commands</a></li>
|
| 69 | <li><a href="#core">Core</a></li>
|
| 70 | <li><a href="#expression">Expression</a></li>
|
| 71 | <li><a href="#host">Host</a></li>
|
| 72 | <li><a href="#interpreter">Interpreter</a></li>
|
| 73 | <li><a href="#symbol">Symbol</a></li>
|
| 74 | <li><a href="#targ">Target</a></li>
|
| 75 | <li><a href="#utility">Utility</a></li>
|
| 76 | </ul>
|
| 77 | </div>
|
| 78 | <div class="postfooter"></div>
|
| 79 | </div>
|
| 80 | <a name="api"></a>
|
| 81 | <div class="post">
|
| 82 | <h1 class ="postheader">API</h1>
|
| 83 | <div class="postcontent">
|
| 84 |
|
| 85 | <p>The API folder contains the public interface to LLDB.</p>
|
| 86 | <p>We are currently vending a C++ API. In order to be able to add
|
| 87 | methods to this API and allow people to link to our classes,
|
| 88 | we have certain rules that we must follow:</p>
|
| 89 | <ul>
|
| 90 | <li>Classes can't inherit from any other classes.</li>
|
| 91 | <li>Classes can't contain virtual methods.</li>
|
| 92 | <li>Classes should be compatible with script bridging utilities like <a href="http://www.swig.org/">swig</a>.</li>
|
| 93 | <li>Classes should be lighweight and be backed by a single object pointer, shared pointer or global variable in the lldb_private.</li>
|
| 94 | <li>The interface should be as minimal as possible in order to give a complete API.</li>
|
| 95 | </ul>
|
| 96 | <p>By adhering to these rules we should be able to continue to
|
| 97 | vend a C++ API, and make changes to the API as any additional
|
| 98 | methods added to these classes will just be a dynamic loader
|
| 99 | lookup and they won't affect the class layout (since they
|
| 100 | aren't virtual methods, and no members can be added to the
|
Benjamin Kramer | 46a8cf3 | 2010-06-10 08:12:17 +0000 | [diff] [blame^] | 101 | class).</p>
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 102 | </div>
|
| 103 | <div class="postfooter"></div>
|
| 104 | </div>
|
| 105 | <a name="breakpoint"></a>
|
| 106 | <div class="post">
|
| 107 | <h1 class ="postheader">Breakpoint</h1>
|
| 108 | <div class="postcontent">
|
| 109 |
|
| 110 | <p>A collection of classes that implement our breakpoint classes.
|
| 111 | Breakpoints are resolved symbolically and always continue to
|
| 112 | resolve themselves as your program runs. Wether settings breakpoints
|
| 113 | by file and line, by symbol name, by symbol regular expression,
|
| 114 | or by address, breakpoints will keep trying to resolve new locations
|
| 115 | each time shared libraries are loaded. Breakpoints will of course
|
| 116 | unresolve themselves when shared libraries are unloaded. Breakpoints
|
| 117 | can also be scoped to be set only in a specific shared library. By
|
| 118 | default, breakpoints can be set in any shared library and will continue
|
| 119 | to attempt to be resolved with each shared library load.</p>
|
| 120 | <p>Breakpoint options can be set on the breakpoint,
|
| 121 | or on the individual locations. This allows flexibility when dealing
|
Benjamin Kramer | 46a8cf3 | 2010-06-10 08:12:17 +0000 | [diff] [blame^] | 122 | with breakpoints and allows us to do what the user wants.</p>
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 123 | </div>
|
| 124 | <div class="postfooter"></div>
|
| 125 | </div>
|
| 126 | <a name="commands"></a>
|
| 127 | <div class="post">
|
| 128 | <h1 class ="postheader">Commands</h1>
|
| 129 | <div class="postcontent">
|
| 130 |
|
| 131 | <p>The command source files represent objects that implement
|
| 132 | the functionality for all textual commands available
|
| 133 | in our command line interface.</p>
|
| 134 | <p>Every command is backed by a <b>lldb_private::CommandObject</b>
|
| 135 | or <b>lldb_private::CommandObjectMultiword</b> object.</p>
|
| 136 | <p><b>lldb_private::CommandObjectMultiword</b> are commands that
|
| 137 | have subcommands and allow command line commands to be
|
Benjamin Kramer | 46a8cf3 | 2010-06-10 08:12:17 +0000 | [diff] [blame^] | 138 | logically grouped into a hiearchy.</p>
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 139 | <p><b>lldb_private::CommandObject</b> command line commands
|
| 140 | are the objects that implement the functionality of the
|
| 141 | command. They can optionally define
|
| 142 | options for themselves, as well as group those options into
|
| 143 | logical groups that can go together. The help system is
|
| 144 | tied into these objects and can extract the syntax and
|
| 145 | option groupings to display appropriate help for each
|
| 146 | command.</p>
|
| 147 | </div>
|
| 148 | <div class="postfooter"></div>
|
| 149 | </div>
|
| 150 | <a name="core"></a>
|
| 151 | <div class="post">
|
| 152 | <h1 class ="postheader">Core</h1>
|
| 153 | <div class="postcontent">
|
| 154 |
|
| 155 | <p>The Core source files contain basic functionality that
|
| 156 | is required in the debugger. A wide variety of classes
|
Benjamin Kramer | 46a8cf3 | 2010-06-10 08:12:17 +0000 | [diff] [blame^] | 157 | are implemented:</p>
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 158 |
|
| 159 | <ul>
|
| 160 | <li>Address (section offset addressing)</li>
|
| 161 | <li>AddressRange</li>
|
| 162 | <li>Architecture specification</li>
|
| 163 | <li>Broadcaster / Event / Listener </li>
|
| 164 | <li>Communication classes that use Connection objects</li>
|
| 165 | <li>Uniqued C strings</li>
|
| 166 | <li>Data extraction</li>
|
| 167 | <li>File specifications</li>
|
| 168 | <li>Mangled names</li>
|
| 169 | <li>Regular expressions</li>
|
| 170 | <li>Source manager</li>
|
| 171 | <li>Streams</li>
|
| 172 | <li>Value objects</li>
|
| 173 | </ul>
|
| 174 | </div>
|
| 175 | <div class="postfooter"></div>
|
| 176 | </div>
|
| 177 | <a name="expression"></a>
|
| 178 | <div class="post">
|
| 179 | <h1 class ="postheader">Expression</h1>
|
| 180 | <div class="postcontent">
|
| 181 |
|
| 182 | <p>Expression parsing files cover everything from evaluating
|
| 183 | DWARF expressions, to evaluating expressions using
|
| 184 | Clang.</p>
|
| 185 | <p>The DWARF expression parser has been heavily modified to
|
| 186 | support type promotion, new opcodes needed for evaluating
|
| 187 | expressions with symbolic variable references (expression local variables,
|
| 188 | program variables), and other operators required by
|
| 189 | typical expressions such as assign, address of, float/double/long
|
| 190 | double floating point values, casting, and more. The
|
| 191 | DWARF expression parser uses a stack of lldb_private::Value
|
| 192 | objects. These objects know how to do the standard C type
|
| 193 | promotion, and allow for symbolic references to variables
|
| 194 | in the program and in the LLDB process (expression local
|
| 195 | and expression global variables).</p>
|
| 196 | <p>The expression parser uses a full instance of the Clang
|
| 197 | compiler in order to accurately evaluate expressions.
|
| 198 | Hooks have been put into Clang so that the compiler knows
|
| 199 | to ask about indentifiers it doesn't know about. Once
|
| 200 | expressions have be compiled into an AST, we can then
|
| 201 | traverse this AST and either generate a DWARF expression
|
| 202 | that contains simple opcodes that can be quickly re-evaluated
|
| 203 | each time an expression needs to be evaluated, or JIT'ed
|
Benjamin Kramer | 46a8cf3 | 2010-06-10 08:12:17 +0000 | [diff] [blame^] | 204 | up into code that can be run on the process being debugged.</p>
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 205 | </div>
|
| 206 | <div class="postfooter"></div>
|
| 207 | </div>
|
| 208 | <a name="host"></a>
|
| 209 | <div class="post">
|
| 210 | <h1 class ="postheader">Host</h1>
|
| 211 | <div class="postcontent">
|
| 212 |
|
| 213 | <p>LLDB tries to abstract itself from the host upon which
|
| 214 | it is currently running by providing a host abstraction
|
| 215 | layer This layer involves everything from spawning, detaching,
|
| 216 | joing and killing native in process threads, to getting
|
| 217 | current information about the current host.</p>
|
Benjamin Kramer | 46a8cf3 | 2010-06-10 08:12:17 +0000 | [diff] [blame^] | 218 | <p>Host functionality includes abstraction layers for:</p>
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 219 | <ul>
|
| 220 | <li>Mutexes</li>
|
| 221 | <li>Conditions</li>
|
| 222 | <li>Timing functions</li>
|
| 223 | <li>Thread functions</li>
|
| 224 | <li>Host target triple</li>
|
| 225 | <li>Host child process notifications</li>
|
| 226 | <li>Host specific types</li>
|
| 227 | </ul>
|
| 228 | </div>
|
| 229 | <div class="postfooter"></div>
|
| 230 | </div>
|
| 231 | <a name="interpreter"></a>
|
| 232 | <div class="post">
|
| 233 | <h1 class ="postheader">Interpreter</h1>
|
| 234 | <div class="postcontent">
|
| 235 |
|
| 236 | <p>The interpreter classes are the classes responsible for
|
| 237 | being the base classes needed for each command object,
|
| 238 | and is responsible for tracking and running command line
|
Benjamin Kramer | 46a8cf3 | 2010-06-10 08:12:17 +0000 | [diff] [blame^] | 239 | commands.</p>
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 240 | </div>
|
| 241 | <div class="postfooter"></div>
|
| 242 | </div>
|
| 243 | <a name="symbol"></a>
|
| 244 | <div class="post">
|
| 245 | <h1 class ="postheader">Symbol</h1>
|
| 246 | <div class="postcontent">
|
| 247 | <p>Symbol classes involve everything needed in order to parse
|
| 248 | object files and debug symbols. All the needed classes
|
| 249 | for compilation units (code and debug info for a source file),
|
| 250 | functions, lexical blocks within functions, inlined
|
| 251 | functions, types, declaration locations, and variables
|
| 252 | are in this section.</p>
|
| 253 | </div>
|
| 254 | <div class="postfooter"></div>
|
| 255 | </div>
|
| 256 | <a name="targ"></a>
|
| 257 | <div class="post">
|
| 258 | <h1 class ="postheader">Target</h1>
|
| 259 | <div class="postcontent">
|
| 260 |
|
| 261 | <p>Classes that are related to a debug target include:</p>
|
| 262 | <ul>
|
| 263 | <li>Target</li>
|
| 264 | <li>Process</li>
|
| 265 | <li>Thread</li>
|
| 266 | <li>Stack frames</li>
|
| 267 | <li>Stack frame registers</li>
|
| 268 | <li>ABI for function calling in process being debugged</li>
|
| 269 | <li>Execution context batons</li>
|
| 270 | </ul>
|
| 271 | </div>
|
| 272 | <div class="postfooter"></div>
|
| 273 | </div>
|
| 274 | <a name="utility"></a>
|
| 275 | <div class="post">
|
| 276 | <h1 class ="postheader">Utility</h1>
|
| 277 | <div class="postcontent">
|
| 278 |
|
| 279 | <p>Utility files should be as stand alone as possible are
|
| 280 | are available for LLDB and any plug-ins or related
|
Eric Christopher | b7eb709 | 2010-06-10 05:35:26 +0000 | [diff] [blame] | 281 | applications to use.</p>
|
Greg Clayton | 854bb53 | 2010-06-10 02:48:57 +0000 | [diff] [blame] | 282 | <p>Files found in the Utility section include:</p>
|
| 283 | <ul>
|
| 284 | <li>Pseudo-terminal support</li>
|
| 285 | <li>Register numbering for specific architectures.</li>
|
| 286 | <li>String data extractors</li>
|
| 287 | </ul>
|
| 288 | </div>
|
| 289 | <div class="postfooter"></div>
|
| 290 | </div>
|
| 291 | </div>
|
| 292 | </div>
|
| 293 | </div>
|
| 294 | </body>
|
Eric Christopher | b7eb709 | 2010-06-10 05:35:26 +0000 | [diff] [blame] | 295 | </html>
|