Commit e9f5e1e9 authored by jgruber's avatar jgruber Committed by Commit bot

[debug] Handle OOM events in debugger tests

Map OOM breaks generated by inspector to DebugEvent.OOM.
This avoids generating unintentional DebugEvent.Break events.

Also be more future-proof in event categorization.

On a related note, this CL also fixes a DCHECK in
Runtime::GetFrameDetails.

The receiver needs to be grabbed from the inlined frame, not
the outer optimized frame. Optimized frames only provide the
receiver on a best-effort basis.

BUG=v8:5950

Review-Url: https://codereview.chromium.org/2696173002
Cr-Commit-Position: refs/heads/master@{#43244}
parent 140ec9d7
......@@ -732,9 +732,12 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
}
// Add the receiver (same as in function frame).
Handle<Object> receiver(it.frame()->receiver(), isolate);
Handle<Object> receiver = frame_inspector.summary().receiver();
DCHECK(function->shared()->IsUserJavaScript());
DCHECK_IMPLIES(is_sloppy(shared->language_mode()), receiver->IsJSReceiver());
// Optimized frames only restore the receiver as best-effort (see
// OptimizedFrame::Summarize).
DCHECK_IMPLIES(!is_optimized && is_sloppy(shared->language_mode()),
receiver->IsJSReceiver());
details->set(kFrameDetailsReceiverIndex, *receiver);
DCHECK_EQ(details_size, details_index);
......
......@@ -26,10 +26,6 @@
# Too slow in debug mode and on slow platforms.
'regress/regress-2318': [PASS, ['mode == debug or (arch != ia32 and arch != x64) or asan == True or msan == True', SKIP]],
# Issue 5950: Flaky with --optimize-for-size.
'debug/es6/generators-debug-scopes': [PASS, ['system == linux and arch == x64', SKIP]],
'debug/harmony/modules-debug-scopes1': [PASS, ['system == linux and arch == x64', SKIP]],
}], # ALWAYS
##############################################################################
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function f() {
debugger;
}
function g() {
f();
}
function h() {
'use strict';
return g();
}
h();
h();
var Debug = debug.Debug;
var exception = null;
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
var all_scopes = exec_state.frame().allScopes();
} catch (e) {
exception = e;
}
}
Debug.setListener(listener);
%OptimizeFunctionOnNextCall(h);
h();
Debug.setListener(null);
assertNull(exception);
......@@ -32,6 +32,7 @@ class DebugWrapper {
Exception: 2,
AfterCompile: 3,
CompileError: 4,
OOM: 5,
};
// The different types of steps.
......@@ -818,10 +819,21 @@ class DebugWrapper {
case "promiseRejection":
debugEvent = this.DebugEvent.Exception;
break;
default:
// TODO(jgruber): More granularity.
case "OOM":
debugEvent = this.DebugEvent.OOM;
break;
case "other":
debugEvent = this.DebugEvent.Break;
break;
case "ambiguous":
case "XHR":
case "DOM":
case "EventListener":
case "assert":
case "debugCommand":
assertUnreachable();
default:
assertUnreachable();
}
if (!params.callFrames[0]) return;
......
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