22
33[ ![ Build Status] ( https://secure.travis-ci.org/nodejs/llnode.png )] ( http://travis-ci.org/nodejs/llnode )
44
5- Node.js v4.x-v6.x C++ plugin for [ LLDB] ( http://lldb.llvm.org ) - a next generation, high-performance debugger.
5+ Node.js v4.x-v8.x C++ plugin for the [ LLDB] ( http://lldb.llvm.org ) debugger.
6+
7+ The llnode plugin adds the ability to inspect JavaScript stack frames, objects,
8+ source code and more to the standard C/C++ debugging facilities when working
9+ with Node.js processes or core dumps in LLDB.
10+
11+ ### Quick start
12+
13+ Start an lldb session with the llnode plugin pre-loaded:
14+
15+ ``` bash
16+ npm install -g llnode
17+ llnode node -c core
18+ ```
19+
20+ - For more details on starting llnode see the [ Usage] ( #usage ) section.
21+ - To get started with the llnode commands see the [ Commands] ( #commands ) section.
622
723## Demo
824
925https://asciinema.org/a/29589
1026
1127## Install Instructions
1228
13- ### Install with npm
29+ To use llnode you need to have the LLDB debugger installed.
30+
31+ - On OS X lldb is installed as part of Xcode. You will need Xcode both to build and run llnode.
32+ - On Linux install the lldb package using your distributions package manager.
33+
34+ ### Global install with npm
1435
1536``` bash
16- npm install llnode
37+ npm install -g llnode
1738```
1839
1940To use a particular build of lldb, use the ` --lldb_exe ` option:
2041
2142``` bash
22- npm install --lldb_exe=` which lldb-3.9` llnode
43+ npm install --lldb_exe=` which lldb-3.9` -g llnode
2344```
2445
2546### Install with Homebrew (OS X)
@@ -75,11 +96,29 @@ make -C out/ -j9
7596sudo make install-linux
7697```
7798
78- ## Usage
99+ ## Loading the lldb plugin library.
100+
101+ The simplest method is:
102+ ``` bash
103+ npm install -g llnode
104+ llnode
105+ ```
106+
107+ If you do a global install (npm install -g llnode) you can use the ` llnode `
108+ shortcut script. This starts ` lldb ` and automatically issues the ` plugin load ` command.
109+ All parameters to the llnode script are passed directly to lldb. If you do not do a
110+ local install the shortcut will be in ` node_modules/.bin/llnode `
111+
112+ If you run either ` make install-linux ` or ` make install-osx ` the plugin will installed
113+ in the LLDB system plugin directory, in which case LLDB will load the plugin
114+ automatically on start-up. Using this may require additional permissions to be able to
115+ copy the plugin libary to the system plugin directory.
79116
80- The llnode plugin can be loaded into LLDB using the ` plugin load ` command.
81- Alternatively it can be installed in the LLDB system plugin directory, in
82- which case LLDB will load the plugin automatically on start-up.
117+ The llnode plugin can also be manually loaded into LLDB using the
118+ ` plugin load ` command within lldb.
119+
120+ It does not matter whether the ` plugin load ` command is issued before or after
121+ loading a core dump or attaching to a process.
83122
84123### OS X
85124
@@ -106,22 +145,35 @@ To install the plugin in the LLDB system plugin directory, use the
106145npm copy ` node_modules/llnode/llnode.so ` to
107146` /usr/lib/lldb/plugins ` .
108147
148+ # Usage
149+
109150To use llnode with a core dump the core dump needs to be loaded into lldb
110151along with the exact executable that created the core dump. The executable
111- contains information that lldb and llnode need to make sense of the data in
112- the core dump.
152+ contains information that lldb and the llnode plugin need to make sense of
153+ the data in the core dump.
113154
114- To load the core dump when starting lldb use:
155+ To load a core dump when starting llnode use:
115156```
116- lldb /path/to/bin/node -c /path/to/core
157+ llnode /path/to/bin/node -c /path/to/core
117158```
118159or to load the core dump after starting lldb:
119160```
120- (lldb ) target create /path/to/bin/node -c /path/to/core
161+ (llnode ) target create /path/to/bin/node -c /path/to/core
121162```
122163
123- It does not matter whether the ` plugin load ` command is issued before or after
124- loading a core dump.
164+ To use llnode against a live process:
165+ ```
166+ llnode -- /path/to/bin/node script.js
167+ (llnode) run
168+ ```
169+ This is ideal for debugging an npm package with native code.
170+ To debug a Node.js crash on uncaught exception:
171+ ```
172+ llnode -- /path/to/bin/node --abort_on_uncaught_exception script.js
173+ (llnode) run
174+ ```
175+ lldb will stop your process when it crashes. To see where it stopped use the
176+ v8 bt command. See the [ Commands] ( #commands ) section below for more commands.
125177
126178### Commands
127179
@@ -152,6 +204,7 @@ The following subcommands are supported:
152204 * -v, --value expr - all properties that refer to the specified JavaScript object (default)
153205 * -n, --name name - all properties with the specified name
154206 * -s, --string string - all properties that refer to the specified JavaScript string value
207+ * --array-length num - print maximum of `num` elements in array
155208
156209 inspect -- Print detailed description and contents of the JavaScript value.
157210
0 commit comments