You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 7, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 7, 2023. It is now read-only.
Proposal: add more debugging symbols related to Node internal structures #46
I'm writing a command to llnode to print all Handles and Requests on the queue of a core dump (similar to what node::GetActiveHandles and node::GetActiveRequests do). While I was working I noticed that, although there's plenty of debugging symbols to help navigate V8 structures (v8dbg_ symbols, thanks to the postmortem-metadata action on V8 build), there are no symbols to describe Node internal structures.
Using as example the command I'm implementing, I need to get the current Environment, navigate to the corresponding queue (let's say, handle_wrap_queue_), and then iterate over this queue (which was created with ListHead) to be able to get the HandleWrap objects. All of this can be done easily on a node debug build, but it's not possible to do on a common build.
I thought about implementing something similar to V8 postmortem-metadata: a script that creates a .cc file with all wanted symbols prefixed with something like nodedbg_. Would that be acceptable? I could probably publish a draft patch at the end of this week. I think this would be useful for other debugging tools, not just llnode.
I'm opened to suggestions.
In the meantime, thank you so much for your attention and participation.
This looks like a great step forward for post-mortem debugging of node internals (i.e. not just V8). The requirement raised here is typical: nodejs/llnode#100
Exposing the address of the Environment structure is a key step (as well as the offsets in that structure). You get that by setting a global symbol during node startup that you can then find in the debugger plugin?
Also you are wrapping this with NODE_POSTMORTEM_SUPPORT - is the intention to provide this in production builds of node? Thanks!
It would be great to incorporate this one into your new mechanism. And we'd love to use your proposed new metadata to provide an mdb_v8 dcmd to print active handles. As I'm sure you know, Node programs that don't exit when expected can be frustrating to debug, and that sort of problem is very amenable to debugging from a core file.
Activity
src, tools: add debug symbols for node internals
rnchamberlain commentedon Aug 18, 2017
This looks like a great step forward for post-mortem debugging of node internals (i.e. not just V8). The requirement raised here is typical: nodejs/llnode#100
Exposing the address of the Environment structure is a key step (as well as the offsets in that structure). You get that by setting a global symbol during node startup that you can then find in the debugger plugin?
Also you are wrapping this with NODE_POSTMORTEM_SUPPORT - is the intention to provide this in production builds of node? Thanks!
mhdawson commentedon Aug 18, 2017
@mmarchini thanks for suggesting/working on this. Additional meta data would be greatly appreciated.
davepacheco commentedon Aug 18, 2017
This sounds terrific. We already hardcode one Node offset in mdb_v8:
https://github.com/joyent/mdb_v8/blob/08571bf8d4ba1e7546b46e7d24011ca2f9be1f3d/src/mdb_v8_impl.h#L116
It would be great to incorporate this one into your new mechanism. And we'd love to use your proposed new metadata to provide an mdb_v8 dcmd to print active handles. As I'm sure you know, Node programs that don't exit when expected can be frustrating to debug, and that sort of problem is very amenable to debugging from a core file.
mmarchini commentedon Aug 18, 2017
@rnchamberlain yes, the intention is to provide this in production builds too (I already removed those guards from the PR).
@davepacheco I'll add this offset to nodejs/node#14901, I'm just having trouble finding
node_string.h, does it still exists on node's master branch?Suggestions of other constants or offsets that can be added to this PR would be really appreciated!
30 remaining items
src, test: node internals' postmortem metadata
src, test: node internals' postmortem metadata
src, test: node internals' postmortem metadata
src, test: node internals' postmortem metadata
mmarchini commentedon Mar 21, 2018
I'm closing because nodejs/node#14901 landed and is shipped on v9.7.0+, but feel free to reopen if you think there's something else to discuss here.
src, test: node internals' postmortem metadata
src, test: node internals' postmortem metadata
src, test: node internals' postmortem metadata
src, test: node internals' postmortem metadata
src, test: node internals' postmortem metadata