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.
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)
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 thecueball
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)