llnode icon indicating copy to clipboard operation
llnode copied to clipboard

No llnode command in the path when `brew install`ing

Open gibfahn opened this issue 6 years ago • 9 comments

I understand from @rnchamberlain that the latest llnode creates a wrapper script that loads the plugin and runs lldb. This doesn't seem to get installed via brew.

▶▶▶ brew reinstall llnode                                                                                                                                                          ~/tmp/inspector-zero 20s
==> Reinstalling llnode 
==> Downloading https://homebrew.bintray.com/bottles/llnode-1.6.2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring llnode-1.6.2.high_sierra.bottle.tar.gz
==> Caveats
`brew install llnode` does not link the plugin to LLDB PlugIns dir.

To load this plugin in LLDB, one will need to either

* Type `plugin load /usr/local/opt/llnode/llnode.dylib` on each run of lldb
* Install plugin into PlugIns dir manually:

    mkdir -p ~/Library/Application\ Support/LLDB/PlugIns
    ln -sf /usr/local/opt/llnode/llnode.dylib \
        ~/Library/Application\ Support/LLDB/PlugIns/
==> Summary
🍺  /usr/local/Cellar/llnode/1.6.2: 6 files, 279.8KB
▶▶▶ llnode                                                                                                                                                                          ~/tmp/inspector-zero 5s
zsh: command not found: llnode

gibfahn avatar Nov 09 '17 15:11 gibfahn

llnode is not an executable file. This is a plugin for another executable called lldb.

indutny avatar Nov 09 '17 15:11 indutny

https://github.com/nodejs/llnode#quick-start

I thought there was a script that was installed that wrappers lldb with the plugin install.

https://github.com/nodejs/llnode/blob/efaf0234bffc2cfe4871c6f15b2e14e7c5c7607f/package.json#L10

https://github.com/nodejs/llnode/blob/efaf0234bffc2cfe4871c6f15b2e14e7c5c7607f/scripts/configure.js#L142

gibfahn avatar Nov 09 '17 16:11 gibfahn

I think that the npm install for llnode does extra work to construct the llnode shell script. Probably the brew install does not do that, though perhaps it could - enhancement useful to MacOS users?

rnchamberlain avatar Nov 09 '17 16:11 rnchamberlain

I think it definitely could! This is a great idea.

@gibfahn sorry, I didn't know that it could do this with npm.

indutny avatar Nov 09 '17 16:11 indutny

I think basically what we need to do is make brew install llnode as a script that runs this

LLDB_EXE=/path/to/LLDB
LLNODE_PLUGIN=/path/to/the/built/plugin
$LLDB_EXE --one-line "plugin load $LLNODE_PLUGIN" --one-line "settings set prompt '(llnode) '" $@

BTW I usually just put plugin load /path/to/my/llnode/plugin into my ~/.lldbinit and it works out of the box no matter which version of lldb I am on

joyeecheung avatar Nov 09 '17 16:11 joyeecheung

@joyeecheung does that error if the plugin isn't installed?

gibfahn avatar Nov 09 '17 16:11 gibfahn

@gibfahn You mean the snippet or the lldbinit approach? I think in the first case the brew formula would know in advance. In the second case, there would be this:

(lldb) plugin load /path/to/my/llnode/plugin
error: no such file

joyeecheung avatar Nov 09 '17 16:11 joyeecheung

I meant the lldbinit approach.

So it prints an error but otherwise works fine? I was thinking of adding it to my dotfiles 😁 .

gibfahn avatar Nov 09 '17 19:11 gibfahn

@gibfahn Yes, it just prints an error and then keeps running, similar to what it does when trying to load a non-existent coredump. Of course v8 commands would be Unrecognized command if the plugin fails to load but other stuff still work as usual.

joyeecheung avatar Nov 10 '17 02:11 joyeecheung