• 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_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
COMMON_OWNERS Loading commit data...
DEPS Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...