v8/test
Simon Zünd 5242128f7a [debug] Fix crash in debug scope search
This CL fixes a crash when we build the scope chain after re-parsing
for Debugger.evaluateOnCallFrame.

The following script causes the crash:

class A {
  test(){
    debugger;
  }
  f = (x) => {}
}
let a = new A()
a.test()

The current scope search tries to be smart and descends deeper
into the scope tree based on source position. That is not a sound
approach as V8 doesn't guarantee that sibling scopes don't overlap.

In the above case V8 creates an instance initializer scope where
f is assigned (and the initializer scope is the parent scope for
the arrow function). The problem is that the initializer scope
uses the same source range as the class `A` itself, so when we
look for the scope for `test`, we descend wrongly into the
initializer scope and can't recover.

The solution is to not try and be too smart:
  - First, find the closure scope with a straight-up DFS.
  - Once we have that, descend from there and try to find the
    closest fitting scope around the break position.

R=bmeurer@chromium.org, jarin@chromium.org

Bug: chromium:1348186
Change-Id: Ic5e20c4d12b3d768f76a17367dc0f87bcc73763b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3807594
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82216}
2022-08-05 09:53:54 +00:00
..
benchmarks [test] Refactor testrunner (4) 2022-07-18 09:52:24 +00:00
bigint [test] Refactor testrunner (4) 2022-07-18 09:52:24 +00:00
cctest [wasm] Fix test condition in test-wasm-metrics.cc for lazy compilation 2022-08-04 19:46:44 +00:00
common [wasm-gc] Remove br_on_func & br_on_non_func op 2022-08-02 07:41:23 +00:00
debugger [test] Refactor testrunner (4) 2022-07-18 09:52:24 +00:00
debugging [test] Refactor testrunner (4) 2022-07-18 09:52:24 +00:00
fuzzer [fuzzer][wasm] Use externref in structs, locals and signatures 2022-08-01 15:48:02 +00:00
fuzzilli [test] Refactor testrunner (4) 2022-07-18 09:52:24 +00:00
inspector [debug] Fix crash in debug scope search 2022-08-05 09:53:54 +00:00
intl [Intl] Remove DateTimeFormat order check not throw RangeError 2022-07-27 05:31:00 +00:00
js-perf-test [TurboFan] Remove inappropriate perf tests for BigInt multiply 2022-07-27 14:27:48 +00:00
memory
message Reland "[riscv32] Add RISCV32 backend" 2022-08-04 12:47:44 +00:00
mjsunit Reland "[riscv32] Add RISCV32 backend" 2022-08-04 12:47:44 +00:00
mkgrokdump [test] Refactor testrunner (4) 2022-07-18 09:52:24 +00:00
mozilla [test] Refactor testrunner (4) 2022-07-18 09:52:24 +00:00
test262 [Temporal] Fix bug in Plain(Date|YearMonth|MonthDay) with() 2022-08-03 21:58:54 +00:00
torque Reland "Reland "[Torque] Generalize Torque literals to larger size"" 2022-02-04 09:40:24 +00:00
unittests [compiler] Improve reduction of Word64Comparisons 2022-08-05 01:51:33 +00:00
wasm-api-tests [wasm-gc] Split any and extern type 2022-07-28 13:09:55 +00:00
wasm-js [test] Refactor testrunner (4) 2022-07-18 09:52:24 +00:00
wasm-spec-tests Reland "[riscv32] Add RISCV32 backend" 2022-08-04 12:47:44 +00:00
webkit [test] Refactor testrunner (4) 2022-07-18 09:52:24 +00:00
BUILD.gn [test] Move cctest/interpreter to unittests 2022-06-10 08:37:10 +00:00
OWNERS