[debug] Only create stack frames for user JS code

Each frame within an optimized frame needs to be re-verified as being
subject to debugging. The specific crash from the linked bug was caused
by the fact that non-user JS frames don't necessarily have an associated
script. We'd ignore that and attempt to call
Script::GetPositionInfo() on the Undefined constant.

BUG=chromium:732408

Change-Id: Ib2982890529623d150092fa57e26fcb237fef59f
Reviewed-on: https://chromium-review.googlesource.com/545895
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46186}
This commit is contained in:
jgruber 2017-06-23 17:09:43 +02:00 committed by Commit Bot
parent 1982604218
commit 44e578e4c4

View File

@ -768,12 +768,13 @@ Handle<FixedArray> Isolate::CaptureCurrentStackTrace(
List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
frame->Summarize(&frames);
for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) {
FrameSummary& frame = frames[i];
if (!frame.is_subject_to_debugging()) continue;
// Filter frames from other security contexts.
if (!(options & StackTrace::kExposeFramesAcrossSecurityOrigins) &&
!this->context()->HasSameSecurityTokenAs(*frames[i].native_context()))
!this->context()->HasSameSecurityTokenAs(*frame.native_context()))
continue;
Handle<StackFrameInfo> new_frame_obj =
helper.NewStackFrameObject(frames[i]);
Handle<StackFrameInfo> new_frame_obj = helper.NewStackFrameObject(frame);
stack_trace_elems->set(frames_seen, *new_frame_obj);
frames_seen++;
}