• Sigurd Schneider's avatar
    [debugger] Allow termination-on-resume when paused at a breakpoint · 9e52d5c5
    Sigurd Schneider authored
    This CL implements functionality to allow an embedder to mark a
    debug scope as terminate-on-resume. This results in a termination
    exception when that debug scope is left and execution is resumed.
    Execution of JavaScript remains possible after a debug scope is
    marked as terminate-on-resume (but before execution of the paused
    code resumes).
    This is used by blink to correctly prevent resuming JavaScript
    execution upon reload while being paused at a breakpoint.
    
    This is important for handling reloads while paused at a breakpoint
    in blink. The resume command terminates blink's nested message loop
    that is used while to keep the frame responsive while the debugger
    is paused. But if a reload is triggered while execution is paused
    on a breakpoint, but before execution is actually resumed from the
     breakpoint (that means before returning into the V8 JavaScript
    frames that are paused on the stack below the C++ frames that belong
    to the nested message loop), we re-enter V8 to do tear-down actions
    of the old frame. In this case Runtime.terminateExecution() cannot be
    used before Debugger.resume(), because the tear-down actions that
    re-enter V8 would trigger the termination exception and crash the
    browser (because the browser expected the tear-down to succeed).
    
    Hence we introduce this flag on V8 that says: It is OK if someone
    re-enters V8 (to execute JS), but upon resuming from the breakpoint
    (i.e. returning to the paused frames that are on the stack below),
    generate a termination exception.
    
    We deliberated adding a corresponding logic on the blink side (instead
    of V8) but we think this is the simplest solution.
    
    More details in the design doc:
    
    https://docs.google.com/document/d/1aO9v0YhoKNqKleqfACGUpwrBUayLFGqktz9ltdgKHMk
    
    Bug: chromium:1004038, chromium:1014415
    
    Change-Id: I896692d4c21cb0acae89c1d783d37ce45b73c113
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1924366
    Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
    Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
    Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#66084}
    9e52d5c5
Name
Last commit
Last update
..
benchmarks Loading commit data...
cctest Loading commit data...
common Loading commit data...
debugger Loading commit data...
fuzzer Loading commit data...
inspector Loading commit data...
intl Loading commit data...
js-perf-test Loading commit data...
memory Loading commit data...
message Loading commit data...
mjsunit Loading commit data...
mkgrokdump Loading commit data...
mozilla Loading commit data...
test262 Loading commit data...
torque Loading commit data...
unittests Loading commit data...
wasm-api-tests Loading commit data...
wasm-js Loading commit data...
wasm-spec-tests Loading commit data...
webkit Loading commit data...
BUILD.gn Loading commit data...
OWNERS Loading commit data...