• Simon Zünd's avatar
    [debug] Report variables in TDZ as 'value unavailable' · e417b339
    Simon Zünd authored
    Consider the function:
    
    function foo() {
      debugger;
      let y = 1;
    }
    
    V8 will elide the hole initialization for 'y'. When we pause at the
    debugger statement, then 'y' evaluates to 'undefined'.
    
    This CL fixes this in the ScopeIterator. When we encounter local
    variables with an `undefined` value we check the static scope
    information if we are stopped *before* the variable's initializer.
    If yes, then we are in the variable's TDZ and report
    "value unavailable".
    
    Drive-by: Mark `GetSourcePosition()` as `const` to make it available
    in the visitor method.
    
    R=bmeurer@chromium.org
    
    Bug: chromium:1328681
    Change-Id: I8b966eaa2af64a35a58095a744440851760921a0
    Fixed: chromium:1303493
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3829539
    Commit-Queue: Simon Zünd <szuend@chromium.org>
    Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#82483}
    e417b339
Name
Last commit
Last update
..
wasm/gdb-server Loading commit data...
DIR_METADATA Loading commit data...
OWNERS Loading commit data...
debug-coverage.cc Loading commit data...
debug-coverage.h Loading commit data...
debug-evaluate.cc Loading commit data...
debug-evaluate.h Loading commit data...
debug-frames.cc Loading commit data...
debug-frames.h Loading commit data...
debug-interface.cc Loading commit data...
debug-interface.h Loading commit data...
debug-property-iterator.cc Loading commit data...
debug-property-iterator.h Loading commit data...
debug-scope-iterator.cc Loading commit data...
debug-scope-iterator.h Loading commit data...
debug-scopes.cc Loading commit data...
debug-scopes.h Loading commit data...
debug-stack-trace-iterator.cc Loading commit data...
debug-stack-trace-iterator.h Loading commit data...
debug-type-profile.cc Loading commit data...
debug-type-profile.h Loading commit data...
debug-wasm-objects-inl.h Loading commit data...
debug-wasm-objects.cc Loading commit data...
debug-wasm-objects.h Loading commit data...
debug-wasm-objects.tq Loading commit data...
debug.cc Loading commit data...
debug.h Loading commit data...
interface-types.h Loading commit data...
liveedit-diff.cc Loading commit data...
liveedit-diff.h Loading commit data...
liveedit.cc Loading commit data...
liveedit.h Loading commit data...