• 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
..
api Loading commit data...
asmjs Loading commit data...
ast Loading commit data...
base Loading commit data...
builtins Loading commit data...
codegen Loading commit data...
common Loading commit data...
compiler Loading commit data...
compiler-dispatcher Loading commit data...
d8 Loading commit data...
date Loading commit data...
debug Loading commit data...
deoptimizer Loading commit data...
diagnostics Loading commit data...
execution Loading commit data...
extensions Loading commit data...
flags Loading commit data...
handles Loading commit data...
heap Loading commit data...
ic Loading commit data...
init Loading commit data...
inspector Loading commit data...
interpreter Loading commit data...
json Loading commit data...
libplatform Loading commit data...
libsampler Loading commit data...
logging Loading commit data...
numbers Loading commit data...
objects Loading commit data...
parsing Loading commit data...
profiler Loading commit data...
protobuf Loading commit data...
regexp Loading commit data...
roots Loading commit data...
runtime Loading commit data...
sanitizer Loading commit data...
snapshot Loading commit data...
strings Loading commit data...
tasks Loading commit data...
third_party Loading commit data...
torque Loading commit data...
tracing Loading commit data...
trap-handler Loading commit data...
utils Loading commit data...
wasm Loading commit data...
zone Loading commit data...
DEPS Loading commit data...
OWNERS Loading commit data...