Skip to content

Add debugger alias for exec(expr) #41794

Closed
@morenoh149

Description

@morenoh149

node v9.8.0
In the debugger you can quickly inspect the value of a variable at run-time using exec. Given

// test.js
var a = 1
$ node inspect test.js
< Debugger listening on ws://127.0.0.1:9229/4565e728-272a-497d-a3f8-73b03362df0f
< For help see https://nodejs.org/en/docs/inspector
< Debugger attached.
Break on start in test.js:1
> 1 (function (exports, require, module, __filename, __dirname) { var a = 1
  2
  3 });
debug> n
break in test.js:1
> 1 (function (exports, require, module, __filename, __dirname) { var a = 1
  2
  3 });
debug> n
break in test.js:3
  1 (function (exports, require, module, __filename, __dirname) { var a = 1
  2
> 3 });
debug> exec('a')
1
debug> .exit

To more quickly debug an application it would be nice to alias exec to e or p so one can do

debug> p('a')
1

Even better if the expression could be passed without parens and quotes

debug> p a
1

This is in the same spirit as when pressing Enter the debugger will repeat the previous command.
From #20963

Metadata

Metadata

Assignees

No one assigned

    Labels

    debuggerIssues and PRs related to the debugger subsystem.feature requestIssues that request new features to be added to Node.js.good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions