Skip to content

Some statements have already been executed when debugger stops at line breakpoint #35660

@vi34

Description

@vi34
  • Version: 14.13.1
    (also checked all major versions, 13, 12, 11, 10 – issue persists)
  • Platform: MacOS
  • Subsystem: Debugger

What steps will reproduce the bug?

  1. Execute this script with any debugger (Chrome DevTools, VSCode, WebStorm).
  2. Place line breakpoints on lines with comments.
  3. Debugger stopped at the first breakpoint. (second(first()); line)
    Function first() have already been executed. – see console output
  4. Resume execution
  5. Debugger stopped at the second breakpoint (second(first(1)); line)
    The function first() has not yet been executed.
  6. Resume execution
  7. Function first() executed -> see console.
function first(x) {
    console.log("first() executed");
}

function second(x) {
    console.log("");
}

debugger;

second(first()); // place line breakpoint here

second(first(1)); // place line breakpoint here

breakpoints-node

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

It is expected that no statements have been executed before the debugger stopped at the line breakpoint.
Also, the behavior must be consistent. As we see it differs for second(first()); and second(first(1));

What do you see instead?

Function first has been executed before the stop at the breakpoint.

Additional information

WebStorm debugger in both cases debugger sets breakpoint with Debugger.setBreakpointByUrl method with specified lineNumber and with not specified columnNumber (which by default must work for the whole line)

Both breakpoints later resolved to the 0 column. But the order of execution may be different. So it is not possible for a debugger to set a line breakpoint which stops before any statement being executed.

The same script works perfectly in Chrome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    inspectorIssues and PRs related to the V8 inspector protocol

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions