mdb_v8 icon indicating copy to clipboard operation
mdb_v8 copied to clipboard

want dcmd to find context and global object from threadlocals

Open arekinath opened this issue 6 years ago • 0 comments

v8 stashes a pointer to the current Isolate in a thread-local which we can very quickly read from mdb and use to walk down to the global object in use. This would be useful to quickly read (some) data out of process memory without doing a full heap scan.

https://gist.github.com/arekinath/f118c19af43d3955e674d22d3b0a5eb5 is an example of using this data to locate the "process" global and then the exports of all require() loaded modules in a nodejs process (and then it goes to specifically grab data that's accessible from the exports of the cueball module). I've also automated this process in https://gist.github.com/arekinath/6b46eb5291e400de117350f9bca905c6#file-diagnose-js-L380 which can run reliably with -o nostop.

It would be useful to turn basically this procedure into a couple of dcmds (the first of which would be this one, to get from the thread id to the context and global object)

arekinath avatar Feb 21 '19 01:02 arekinath