[debug] scope iterator should not crash on API functions
Bug: v8:8333 Change-Id: I04bb28f909a1c144f513964115b4f2dfaced3146 Reviewed-on: https://chromium-review.googlesource.com/c/1291372 Commit-Queue: Yang Guo <yangguo@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#56846}
This commit is contained in:
parent
581192aab9
commit
77582a4b63
@ -54,13 +54,12 @@ Handle<Object> ScopeIterator::GetFunctionDebugName() const {
|
||||
}
|
||||
|
||||
ScopeIterator::ScopeIterator(Isolate* isolate, Handle<JSFunction> function)
|
||||
: isolate_(isolate),
|
||||
context_(function->context(), isolate),
|
||||
script_(Script::cast(function->shared()->script()), isolate) {
|
||||
: isolate_(isolate), context_(function->context(), isolate) {
|
||||
if (!function->shared()->IsSubjectToDebugging()) {
|
||||
context_ = Handle<Context>();
|
||||
return;
|
||||
}
|
||||
script_ = handle(Script::cast(function->shared()->script()), isolate);
|
||||
UnwrapEvaluationContext();
|
||||
}
|
||||
|
||||
@ -71,10 +70,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate,
|
||||
function_(generator->function(), isolate),
|
||||
context_(generator->context(), isolate),
|
||||
script_(Script::cast(function_->shared()->script()), isolate) {
|
||||
if (!function_->shared()->IsSubjectToDebugging()) {
|
||||
context_ = Handle<Context>();
|
||||
return;
|
||||
}
|
||||
CHECK(function_->shared()->IsSubjectToDebugging());
|
||||
TryParseAndRetrieveScopes(DEFAULT);
|
||||
}
|
||||
|
||||
|
@ -2818,6 +2818,21 @@ TEST(DebugBreakInWrappedScript) {
|
||||
CheckDebuggerUnloaded();
|
||||
}
|
||||
|
||||
static void EmptyHandler(const v8::FunctionCallbackInfo<v8::Value>& args) {}
|
||||
|
||||
TEST(DebugScopeIteratorWithFunctionTemplate) {
|
||||
LocalContext env;
|
||||
v8::HandleScope handle_scope(env->GetIsolate());
|
||||
v8::Isolate* isolate = env->GetIsolate();
|
||||
EnableDebugger(isolate);
|
||||
v8::Local<v8::Function> func =
|
||||
v8::Function::New(env.local(), EmptyHandler).ToLocalChecked();
|
||||
std::unique_ptr<v8::debug::ScopeIterator> iterator =
|
||||
v8::debug::ScopeIterator::CreateForFunction(isolate, func);
|
||||
CHECK(iterator->Done());
|
||||
DisableDebugger(isolate);
|
||||
}
|
||||
|
||||
TEST(DebugBreakWithoutJS) {
|
||||
i::FLAG_stress_compaction = false;
|
||||
#ifdef VERIFY_HEAP
|
||||
|
Loading…
Reference in New Issue
Block a user