• 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
..
BUILD.gn Loading commit data...
DEPS Loading commit data...
OWNERS Loading commit data...
custom-preview.cc Loading commit data...
custom-preview.h Loading commit data...
injected-script.cc Loading commit data...
injected-script.h Loading commit data...
inspected-context.cc Loading commit data...
inspected-context.h Loading commit data...
inspector_protocol_config.json Loading commit data...
remote-object-id.cc Loading commit data...
remote-object-id.h Loading commit data...
search-util.cc Loading commit data...
search-util.h Loading commit data...
string-16.cc Loading commit data...
string-16.h Loading commit data...
string-util.cc Loading commit data...
string-util.h Loading commit data...
test-interface.cc Loading commit data...
test-interface.h Loading commit data...
v8-console-agent-impl.cc Loading commit data...
v8-console-agent-impl.h Loading commit data...
v8-console-message.cc Loading commit data...
v8-console-message.h Loading commit data...
v8-console.cc Loading commit data...
v8-console.h Loading commit data...
v8-debugger-agent-impl.cc Loading commit data...
v8-debugger-agent-impl.h Loading commit data...
v8-debugger-script.cc Loading commit data...
v8-debugger-script.h Loading commit data...
v8-debugger.cc Loading commit data...
v8-debugger.h Loading commit data...
v8-heap-profiler-agent-impl.cc Loading commit data...
v8-heap-profiler-agent-impl.h Loading commit data...
v8-inspector-impl.cc Loading commit data...
v8-inspector-impl.h Loading commit data...
v8-inspector-session-impl.cc Loading commit data...
v8-inspector-session-impl.h Loading commit data...
v8-profiler-agent-impl.cc Loading commit data...
v8-profiler-agent-impl.h Loading commit data...
v8-regex.cc Loading commit data...
v8-regex.h Loading commit data...
v8-runtime-agent-impl.cc Loading commit data...
v8-runtime-agent-impl.h Loading commit data...
v8-schema-agent-impl.cc Loading commit data...
v8-schema-agent-impl.h Loading commit data...
v8-stack-trace-impl.cc Loading commit data...
v8-stack-trace-impl.h Loading commit data...
v8-string-conversions.cc Loading commit data...
v8-string-conversions.h Loading commit data...
v8-value-utils.cc Loading commit data...
v8-value-utils.h Loading commit data...
value-mirror.cc Loading commit data...
value-mirror.h Loading commit data...