Skip to content

Debugging eval code: Debugger stops on a wrong code line #94437

Closed
@Ngorror

Description

@Ngorror
  • VSCode Version: 1.43.2
  • OS Version: Linux x64 5.3.0-45-generic
  • Node.js Version: >=12.16.0

Steps to Reproduce:

  1. Configure launch json skipFiles variable to <node_internals>/**/*.js to prevent skipping /<eval>/VM* files debugging.
    Here is my launch.json file:
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": ["<node_internals>/**/*.js"],
            "program": "${workspaceFolder}/index.js"
        }
    ]
}
  1. Create an index.js
const code = `    console.log(arg1);
    const a = arg1 + 1;
    console.log(a);
    return a;`;

const fn = new Function('arg1', code);
console.log(process.version);
const result = fn(1);
console.log('result', result);
  1. Set breakpoint on row 8 - const result = fn(1);
  2. Hit F11 to start debugging evaluated fn
  3. Use F10 to debug each row in fn code

Till Node.js 12.15.0 debugger marks the right row.
From Node.js 12.16.0 debugger marks a row but it already executed row+1 and it is on row+2

How it works well with Node 12.15.0
12 15 0

How it shows wrong current row with Node 12.16.0
12 16 0
When Debugger stops on row 3 - const a is not yet declared (row 4) but in fact debugger already executed row 4 and it is currently on row 5

Does this issue occur when all extensions are disabled?: Yes

Metadata

Metadata

Labels

debugDebug viewlet, configurations, breakpoints, adapter issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)upstream-issue-linkedThis is an upstream issue that has been reported upstream

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions