nodejs / llnode

An lldb plugin for Node.js and V8, which enables inspection of JavaScript states for insights into Node.js processes and their core dumps.
Other
1.15k stars 100 forks source link

Javascript API for llnode? #14

Open rnchamberlain opened 8 years ago

rnchamberlain commented 8 years ago

@indutny @hhellyer Hi Fedor, we've been discussing the possibility of an NPM/Javascript API on top of llnode, so that diagnostic tools could be written that exploit the llnode+lldb libraries. An alternative to using the line-mode lldb debugger + plugin itself to read a core dump. For example, an interactive web viewer for core dumps that are stored on a node server. Also possibility of user add-ons written in Javascript.

Here's a very basic prototype, just to load a core dump and list the thread stacks: https://github.com/indutny/llnode/compare/master...rnchamberlain:llnode_api

Any thoughts? Would need to design the API, make the calls async etc etc

indutny commented 8 years ago

Hello!

I totally enjoy the idea, it sounds lovely! Considering that there are quite a lot of people interested in this kind of thing:

https://github.com/nodejs/post-mortem

Do you think it may be worth opening an issue, and having some kind of discussion or even call?

This JS API looks amazing!

langhuihui commented 7 years ago

When it will be done?

rnchamberlain commented 7 years ago

@langhuihui Unfortunately I have not had time to work on this much this year. I have 2 branches, both quite old now (there has been quite a lot of other development on llnode recently): https://github.com/rnchamberlain/llnode/tree/llnode_api https://github.com/rnchamberlain/llnode/tree/javascript-api

There was also some discussion and other contributions in the post mortem workgroup: https://github.com/nodejs/post-mortem/issues/33

joyeecheung commented 7 years ago

I am interested in picking this one up. Will try to rebase previous work to master first.

joyeecheung commented 7 years ago

Some progress: got it working on MacOS and Ubuntu with linked libraries detected using llvm-config. Rewrote the API layer using Nan and bindings. Can load Linux coredumps on MacOS now. Will try to build a more full-fledged demo and polish the API on top of that.

https://github.com/joyeecheung/llnode/tree/js-api

No9 commented 7 years ago

@joyeecheung will take a look on FreeBSD over the weekend

joyeecheung commented 6 years ago

A few more progress: put the module (inherits ObjectWrap now) and the API into classes. To actually make it possible to instantiate multiple instances would require some surgery in llscan.cc and llnode.cc to remove the dependency on that global llv8 instance. The plan is to open a PR when the API is ready, not necessarily when the multiple instantiation is ready.

joyeecheung commented 6 years ago

Another progress: redesigned the API a bit, it's documented in https://github.com/joyeecheung/llnode/blob/js-api/JSAPI.md, the instance iterators is still WIP but the other parts are done and tested in https://github.com/joyeecheung/llnode/blob/js-api/test/jsapi-test.js

langhuihui commented 6 years ago

great job