{"id":13418489,"url":"https://github.com/nodejs/llnode","last_synced_at":"2025-05-14T04:07:39.748Z","repository":{"id":39351885,"uuid":"45659211","full_name":"nodejs/llnode","owner":"nodejs","description":"An lldb plugin for Node.js and V8, which enables inspection of JavaScript states for insights into Node.js processes and their core dumps.","archived":false,"fork":false,"pushed_at":"2024-12-21T09:35:20.000Z","size":1025,"stargazers_count":1160,"open_issues_count":69,"forks_count":99,"subscribers_count":38,"default_branch":"main","last_synced_at":"2025-05-12T21:23:38.006Z","etag":null,"topics":["node","nodejs"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodejs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":"GOVERNANCE.md","roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-11-06T04:28:46.000Z","updated_at":"2025-05-05T06:21:37.000Z","dependencies_parsed_at":"2023-01-21T01:49:03.744Z","dependency_job_id":"7cd78830-38d7-4f23-90a1-e9057bd635a1","html_url":"https://github.com/nodejs/llnode","commit_stats":{"total_commits":397,"total_committers":35,"mean_commits":"11.342857142857143","dds":0.6775818639798489,"last_synced_commit":"de1f01d70a5c58111dd873d340f898023e4e8fe6"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejs%2Fllnode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejs%2Fllnode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejs%2Fllnode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodejs%2Fllnode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodejs","download_url":"https://codeload.github.com/nodejs/llnode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069220,"owners_count":22009513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node","nodejs"],"created_at":"2024-07-30T22:01:02.868Z","updated_at":"2025-05-14T04:07:39.723Z","avatar_url":"https://github.com/nodejs.png","language":"C++","readme":"\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://github.com/nodejs/llnode\"\u003e\n    \u003cimg\n      alt=\"llnode\"\n      src=\"logo.svg\"\n      width=\"400\"\n    /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n[![npm](https://img.shields.io/npm/v/llnode.svg?style=flat-square)](https://npmjs.org/package/llnode)\n![ci](https://img.shields.io/github/workflow/status/nodejs/llnode/on%20push%20or%20pull_request/main?style=flat-square)\n[![coverage](https://img.shields.io/coveralls/github/nodejs/llnode/mmain?style=flat-square)](https://coveralls.io/github/nodejs/llnode)\n\n\nNode.js v10.x+ C++ plugin for the [LLDB](http://lldb.llvm.org) debugger.\n\nThe llnode plugin adds the ability to inspect JavaScript stack frames, objects,\nsource code and more to the standard C/C++ debugging facilities when working\nwith Node.js processes or core dumps in LLDB.\n\n## Demo\n\nhttps://asciinema.org/a/29589\n\n## Quick start\n\nStart an LLDB session with the llnode plugin automatically loaded:\n\n```bash\nnpm install -g llnode\nllnode `which node` -c /path/to/core/dump\n```\n\n- Never install llnode with `sudo` as it can easily lead to errors during\n  installation and execution.\n- For more details on starting llnode see the [Usage](#usage) section.\n- To get started with the llnode commands see the [Commands](#commands) section.\n\n## Install Instructions\n\n### Prerequisites: Official, active Node.js version\n\n`llnode` only supports currently active Node.js versions installed via official\nchannels. We recommend installing Node.js with [nvm](https://github.com/nvm-sh/nvm)\nas it allows users to install global packages without `sudo` by default, and\nit always installs the official executables from https://nodejs.org.\n\n**Do not install Node.js from the default Ubuntu/Debian apt repositories (or from\nthe default repositories of other Linux distributions), llnode is not compatible\nwith Node.js installed that way**. If you still want to install Node.js via\n`apt-get`, take a look at\n[nodesource/distributions](https://github.com/nodesource/distributions).\n\n### Prerequisites: Install LLDB and its Library\n\nTo use llnode you need to have the LLDB debugger installed. The recommended\nversion is LLDB 3.9 and above.\n\n- OS X/macOS\n  - You can install [Xcode](https://developer.apple.com/xcode/) and use the\n    LLDB that comes with it.\n  - Optionally, you can install newer versions of lldb using Homebrew with\n\n    ```bash\n    brew update \u0026\u0026 brew install --with-lldb --with-toolchain llvm\n    ```\n\n    and make sure `/usr/local/opt/llvm/bin` gets searched before `/usr/bin/`\n    on your `PATH`. llnode will link to the LLDB installation returned by\n    `llvm-config` if available.\n- Linux\n  - You can install the lldb package using the package manager of your\n    distribution. You may need to install additional packages for `liblldb`\n    as well.\n  - For example, on Ubuntu 18.04 you can install the prerequisites with\n\n    ```bash\n    apt-get install lldb-8 liblldb-8-dev\n    ```\n- FreeBSD\n\n  ```bash\n  # Install llvm with lldb and headers\n  pkg install llvm39\n  rm -f /usr/bin/lldb\n  ln -s /usr/local/bin/lldb39 /usr/bin/lldb\n  ```\n\n- Windows\n  - You can install a [binary distribution of LLVM](http://releases.llvm.org/download.html)\n    directly or using [Chocolatey](https://chocolatey.org/install#installing-chocolatey):\n\n    ```bat\n    cinst -y visualstudio2017buildtools visualstudio2017-workload-vctools llvm git\n    ```\n\n    Visual Studio is required for MSBuild and headers when building llnode. Git\n    is required to download the lldb headers.\n\n- Android / Termux (Experimental)\n  - Install Termux (https://termux.com)\n\n  - Install Termux Packages\n    - pkg install clang lldb lldb-dev make\n    - pkg install nodejs-lts nodejs-lts-dev\n  - To debug:\n  ```\n  llnode -- /data/data/com.termux/files/usr/bin/node --abort_on_uncaught_exception script.js\n  (llnode) run\n  ```\n\n### Install the Plugin\n\n#### Install llnode globally via npm\n\nIf you have `lldb` available on your `PATH`, simply run:\n\n```bash\nnpm install -g llnode\n```\n\nTo build llnode against a specific lldb version matching an lldb executable,\nuse the `--lldb_exe` npm option. For example, on Linux the executable on the\n`PATH` might be `lldb-3.9`:\n\n```bash\nnpm install --lldb_exe=`which lldb-3.9` -g llnode\n```\n\nAfter installing with npm, `llnode` should be available on your `PATH` as a\nshortcut for running LLDB with the llnode plugin.\n\n#### Optional: Install with Homebrew (OS X/macOS)\n\n```bash\nbrew install llnode\n```\n\n## Loading the llnode Plugin\n\nThere are several ways to load the llnode plugin:\n\n### 1. Using the llnode shortcut\n\nIf you install llnode globally via npm (`npm install -g llnode`), you can use\nthe `llnode` shortcut script. This starts `lldb` and automatically issues\nthe `plugin load` command. All parameters to the llnode script are passed\ndirectly to lldb. If you it's not a local installation, the shortcut will be in\n`node_modules/.bin/llnode`.\n\n### 2. Using `~/.lldbinit` to load the Plugin Automatically\n\nTo tell LLDB to load llnode automatically regardless of the\nversion of lldb that you are running, add this line to `~/.lldbinit`:\n\n```\nplugin load /path/to/the/llnode/plugin\n```\n\nThe path to the llnode plugin should be printed when the installation\nis finished. On OS X/macOS the plugin is typically\n`node_modules/llnode/llnode.dylib`, on Linux it's\n`node_modules/llnode/llnode.so`.\n\n### 3. Loading the Plugin Manually\n\nThe llnode plugin can also be manually loaded into LLDB using the\n`plugin load` command within lldb.\n\nIt does not matter whether the `plugin load` command is issued before or after\nloading a core dump or attaching to a process.\n\n### 4. Install the Plugin to the LLDB System Plugin Directory\n\nSimilar to the `~/.lldbinit` approach, this way LLDB will also load the plugin\nautomatically on start-up. Doing this may require additional permissions\nto be able to copy the plugin library to the system plugin directory.\n\nOn Linux, run `make install-linux` in the project directory, or if\ninstalling with npm, copy `node_modules/llnode/llnode.so`\nto `/usr/lib/lldb/plugins` or create a link there.\n\nOn OS X/macOS, run `make install-osx` in the project directory, or if\ninstalling with npm, copy `node_modules/llnode/llnode.dylib`\nto `~/Library/Application\\ Support/LLDB/PlugIns/` or create a link there.\n\n# Usage\n\nTo use llnode with a core dump the core dump needs to be loaded into lldb\nalong with the exact executable that created the core dump. The executable\ncontains information that lldb and the llnode plugin need to make sense of\nthe data in the core dump.\n\nTo load a core dump when starting llnode use:\n```\nllnode /path/to/bin/node -c /path/to/core\n```\nor to load the core dump after starting lldb:\n```\n(llnode) target create /path/to/bin/node -c /path/to/core\n```\n\nTo use llnode against a live process:\n```\nllnode -- /path/to/bin/node script.js\n(llnode) run\n```\nThis is ideal for debugging an npm package with native code.\nTo debug a Node.js crash on uncaught exception:\n```\nllnode -- /path/to/bin/node --abort_on_uncaught_exception script.js\n(llnode) run\n```\nlldb will stop your process when it crashes. To see where it stopped use the\nv8 bt command. See the [Commands](#commands) section below for more commands.\n\n### Commands\n\n```\n(llnode) v8 help\n     Node.js helpers\n\nSyntax: v8\n\nThe following subcommands are supported:\n\n      bt              -- Show a backtrace with node.js JavaScript functions and their args. An optional argument is accepted; if\n                         that argument is a number, it specifies the number of frames to display. Otherwise all frames will be\n                         dumped.\n\n                         Syntax: v8 bt [number]\n      findjsinstances -- List every object with the specified type name.\n                         Use -v or --verbose to display detailed `v8 inspect` output for each object.\n                         Accepts the same options as `v8 inspect`\n      findjsobjects   -- List all object types and instance counts grouped by typename and sorted by instance count. Use\n                         -d or --detailed to get an output grouped by type name, properties, and array length, as well as\n                         more information regarding each type.\n      findrefs        -- Finds all the object properties which meet the search criteria.\n                         The default is to list all the object properties that reference the specified value.\n                         Flags:\n\n                          * -v, --value expr     - all properties that refer to the specified JavaScript object (default)\n                          * -n, --name  name     - all properties with the specified name\n                          * -s, --string string  - all properties that refer to the specified JavaScript string value\n\n      getactivehandles  -- Print all pending handles in the queue. Equivalent to running process._getActiveHandles() on\n                           the living process.\n\n      getactiverequests -- Print all pending requests in the queue. Equivalent to running process._getActiveRequests() on\n                           the living process.\n\n      inspect         -- Print detailed description and contents of the JavaScript value.\n\n                         Possible flags (all optional):\n\n                          * -F, --full-string    - print whole string without adding ellipsis\n                          * -m, --print-map      - print object's map address\n                          * -s, --print-source   - print source code for function objects\n                          * -l num, --length num - print maximum of `num` elements from string/array\n\n                         Syntax: v8 inspect [flags] expr\n      nodeinfo        -- Print information about Node.js\n      print           -- Print short description of the JavaScript value.\n\n                         Syntax: v8 print expr\n      source list     -- Print source lines around the currently selected\n                         JavaScript frame.\n                         Syntax: v8 source list [flags]\n                         Flags:\n                         * -l \u003cline\u003e - Print source code below line \u003cline\u003e.\n\nFor more help on any particular subcommand, type 'help \u003ccommand\u003e \u003csubcommand\u003e'.\n```\n\n## Develop and Test\n\n### Configure and Build\n\nThe easiest way to build the plugin:\n\n```bash\n# Clone this repo\ngit clone https://github.com/nodejs/llnode.git \u0026\u0026 cd llnode\n\n# Configure and build the plugin with npm\nnpm install\n# To configure and build the plugin without npm\nnode scripts/configure.js \u0026\u0026 node scripts/install.js \u0026\u0026 node scripts/cleanup.js\n# Or use make\nmake plugin\n\n# To configure and build both the plugin and the addon\nnpm install --llnode_build_addon=true\n# To configure and build with a specific path to headers\nnpm install --llnode_lldb_include_dir=/path/to/lldb/include\n\n# Without npm\nLLNODE_BUILD_ADDON=true node scripts/configure.js \u0026\u0026 node scripts/install.js \u0026\u0026 node scripts/cleanup.js\n# Or use make\nmake addon # Builds the addon\nmake       # Builds both the addon and the plugin\n```\n\nTo configure the build yourself:\n\n```bash\n# Detect available lldb installation and download headers if necessary\nnode scripts/configure.js\n# To build the addon, set the environment variable LLNODE_BUILD_ADDON=true\n\n# To configure with the detected lldb installation\nnode-gyp configure\n# To configure with a specified path to headers, where `$lldb_include_dir`\n# contains the \u003clldb/*/*.h\u003e headers\nnode-gyp configure -- -Dlldb_include_dir=/usr/local/Cellar/llvm/5.0.0/include\n# To configure with a specified path to the libraries, where `$lldb_lib_dir`\n# contains `liblldb.so` or `liblldb.dylib`\nnode-gyp configure -- -Dlldb_lib_dir=/usr/lib/llvm-3.9/lib\n\n# Build the plugin (and the addon if LLNODE_BUILD_ADDON=true)\nnode-gyp build\n\n# Move the built plugin to the project directory\nnode scripts/cleanup.js\n```\n\n### Test\n\nTo run the tests, if `lldb` is an executable on the `PATH`:\n\n```bash\nnpm run test-all    # Run both addon and plugin tests\nnpm run test-plugin # Run plugin tests\nnpm run test-addon    # Run addon tests\n```\n\nIf the LLDB executable is named differently, point `TEST_LLDB_BINARY`\nto it before running the tests:\n\n```bash\nTEST_LLDB_BINARY=`which lldb-4.0` npm run test-all\n```\n\n### Useful Environment Variables\n\n* `LLNODE_DEBUG=true` to see additional debug info from llnode\n* `TEST_LLNODE_DEBUG=true` to see additional debug info coming from the tests\n* `LLNODE_CORE=/path/to/core/dump LLNODE_NODE_EXE=/path/to/node`\n  to use a prepared core dump instead of generating one on-the-fly when running\n  the tests.\n\nFor example, to inspect the process of `inspect-scenario.js`, run:\n\n```bash\nLLNODE_DEBUG=true lldb -- \\\n  node --abort_on_uncaught_exception --expose_externalize_string \\\n  test/fixtures/inspect-scenario.js\n(lldb) run\n```\n\nTo debug `test/scan-test.js` with a prepared core dump:\n\n```\nLLNODE_DEBUG=true TEST_LLNODE_DEBUG=true \\\n  LLNODE_CORE=/path/to/core/dump/of/inspect/scenario.js \\\n  LLNODE_NODE_EXE=/path/to/node \\\n  node test/scan-test.js\n```\n\n## LICENSE\n\nThis software is licensed under the MIT License.\n\nCopyright Fedor Indutny, 2016.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the\nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\nNO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":["Packages","TODO scan for Android support in followings","Repository","C++","包","目录","Debugging / Profiling","\u003ca id=\"004d0b9e325af207df8e1ca61af7b721\"\u003e\u003c/a\u003eLLDB"],"sub_categories":["Debugging / Profiling","Debugging","调试 / 分析","调试/分析","调试","\u003ca id=\"c20772abc204dfe23f3e946f8c73dfda\"\u003e\u003c/a\u003e工具"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodejs%2Fllnode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodejs%2Fllnode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodejs%2Fllnode/lists"}