Skip to content

Find an alternative to V8's Debug Mirror API for util.inspect #11875

Description

@TimothyGu

Currently we are able to display certain hidden properties of objects from util.inspect through the V8 debug context's MakeMirror:

  • Promise status and value:

    node/lib/util.js

    Lines 287 to 288 in e296ffb

    const mirror = Debug.MakeMirror(p, true);
    return {status: mirror.status(), value: mirror.promiseValue().value_};
  • Collection iterator:

    node/lib/util.js

    Lines 739 to 741 in e296ffb

    const mirror = Debug.MakeMirror(value, true);
    var nextRecurseTimes = recurseTimes === null ? null : recurseTimes - 1;
    var vals = mirror.preview();

While it works just fine currently, the V8 debugger API will be deprecated in V8 5.9 in favor of the v8 inspector API. We'll need to find a way to use the inspector API for this purpose.

/cc @nodejs/v8

Activity

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

    utilIssues and PRs related to the built-in util module.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions