Commit 763f63ff authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

[debugger] allow break on stack overflow

R=sigurds@chromium.org

Bug: chromium:997469
Change-Id: I83c8a50a5626b3e4679ff7977474d495cdbf7e90
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1768369
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63399}
parent b23dc42c
......@@ -1757,9 +1757,6 @@ bool Debug::IsFrameBlackboxed(JavaScriptFrame* frame) {
void Debug::OnException(Handle<Object> exception, Handle<Object> promise,
v8::debug::ExceptionType exception_type) {
// TODO(kozyatinskiy): regress-662674.js test fails on arm without this.
if (!AllowJavascriptExecution::IsAllowed(isolate_)) return;
Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher();
// Don't notify listener of exceptions that are internal to a desugaring.
......@@ -1803,6 +1800,7 @@ void Debug::OnException(Handle<Object> exception, Handle<Object> promise,
DisableBreak no_recursive_break(this);
Handle<Context> native_context(isolate_->native_context());
AllowJavascriptExecution for_callback(isolate_);
debug_delegate_->ExceptionThrown(
v8::Utils::ToLocal(native_context), v8::Utils::ToLocal(exception),
v8::Utils::ToLocal(promise), uncaught, exception_type);
......
......@@ -3482,6 +3482,36 @@ TEST(SyntaxErrorEventOnSyntaxException) {
CHECK_EQ(3, delegate.compile_error_event_count);
}
class ExceptionEventCounter : public v8::debug::DebugDelegate {
public:
void ExceptionThrown(v8::Local<v8::Context> paused_context,
v8::Local<v8::Value> exception,
v8::Local<v8::Value> promise, bool is_uncaught,
v8::debug::ExceptionType) override {
exception_event_count++;
}
int exception_event_count = 0;
};
TEST(BreakOnStackOverflow) {
i::FLAG_stack_size = 100;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
// For this test, we want to break on uncaught exceptions:
ChangeBreakOnException(true, true);
ExceptionEventCounter delegate;
v8::debug::SetDebugDelegate(env->GetIsolate(), &delegate);
CHECK_EQ(0, delegate.exception_event_count);
CompileRun(
"function f() { return f(); }"
"try { f() } catch {}");
CHECK_EQ(1, delegate.exception_event_count);
}
// Tests that break event is sent when event listener is reset.
TEST(BreakEventWhenEventListenerIsReset) {
LocalContext env;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment