Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watched variable declared in a while retains its watched value across iterations #47602

Open
louis-bompart opened this issue Apr 17, 2023 · 1 comment
Labels
debugger Issues and PRs related to the debugger subsystem. v8 engine Issues and PRs related to the V8 dependency.

Comments

@louis-bompart
Copy link

louis-bompart commented Apr 17, 2023

Version

v18.16.0

Platform

Microsoft Windows NT 10.0.19044.0 x64

Subsystem

Debugger

What steps will reproduce the bug?

  1. Create a file named index.js containing the following script:

    let i = 5;
    while (--i > 0) {
      const foo = "bar" + i;
    }
  2. Inspect it using node inspect index.js

  3. watch foo: watch('foo'). Optionally, watch('i') too.

  4. Go to l3 for the first time, assert that foo = undefined)

  5. Continue until you reach l3 again: the watched value of foo is then bar4 (and i=3): the debugger show the foo declared in the previous iteration

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

The reproducing steps are systematic, I reproduced similar behavior in longer scripts too

What is the expected behavior? Why is that the expected behavior?

I'd expect the watch value to stay undefined or in error until the declaration statement

What do you see instead?

image

Additional information

No response

@Trott Trott added the debugger Issues and PRs related to the debugger subsystem. label Apr 18, 2023
@cola119
Copy link
Member

cola119 commented Apr 20, 2023

image

Safari can correctly watch the variable. This looks like a bug in V8 engine.

@cola119 cola119 added the v8 engine Issues and PRs related to the V8 dependency. label Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger Issues and PRs related to the debugger subsystem. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

3 participants