Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.
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

Closed

Description

@mmarchini

Hello everyone!

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.

Activity

  1. rnchamberlain commented on Aug 18, 2017

    @rnchamberlain
    Contributor

    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!

  2. mhdawson commented on Aug 18, 2017

    @mhdawson
    Member

    @mmarchini thanks for suggesting/working on this. Additional meta data would be greatly appreciated.

  3. davepacheco commented on Aug 18, 2017

    @davepacheco

    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.

  4. mmarchini commented on Aug 18, 2017

    @mmarchini
    Author

    @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!

  5. 30 remaining items

  6. mmarchini commented on Mar 21, 2018

    @mmarchini
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions