[liveedit] fix stepping after replacing bytecode.
R=mstarzinger@chromium.org BUG=v8:4765 Review-Url: https://codereview.chromium.org/1973213003 Cr-Commit-Position: refs/heads/master@{#36272}
This commit is contained in:
parent
ef3304ba1d
commit
f248a83d29
@ -1121,6 +1121,11 @@ void LiveEdit::ReplaceFunctionCode(
|
||||
DCHECK(old_code->kind() == Code::FUNCTION);
|
||||
ReplaceCodeObject(old_code, new_code);
|
||||
}
|
||||
if (shared_info->HasDebugInfo()) {
|
||||
// Existing break points will be re-applied. Reset the debug info here.
|
||||
isolate->debug()->RemoveDebugInfoAndClearFromShared(
|
||||
handle(shared_info->GetDebugInfo()));
|
||||
}
|
||||
Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo();
|
||||
if (code_scope_info->IsFixedArray()) {
|
||||
shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info));
|
||||
@ -1820,7 +1825,8 @@ static const char* DropActivationsInActiveThreadImpl(Isolate* isolate,
|
||||
// Adjust break_frame after some frames has been dropped.
|
||||
StackFrame::Id new_id = StackFrame::NO_ID;
|
||||
for (int i = bottom_js_frame_index + 1; i < frames.length(); i++) {
|
||||
if (frames[i]->type() == StackFrame::JAVA_SCRIPT) {
|
||||
if (frames[i]->type() == StackFrame::JAVA_SCRIPT ||
|
||||
frames[i]->type() == StackFrame::INTERPRETED) {
|
||||
new_id = frames[i]->id();
|
||||
break;
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ RUNTIME_FUNCTION(Runtime_DebugBreakOnBytecode) {
|
||||
JavaScriptFrameIterator it(isolate);
|
||||
isolate->debug()->Break(it.frame());
|
||||
|
||||
// If live-edit has dropped frames, we are not going back to dispatch.
|
||||
if (LiveEdit::SetAfterBreakTarget(isolate->debug())) return Smi::FromInt(0);
|
||||
|
||||
// Return the handler from the original bytecode array.
|
||||
DCHECK(it.frame()->is_interpreted());
|
||||
InterpretedFrame* interpreted_frame =
|
||||
|
67
test/mjsunit/debug-liveedit-exceptions.js
Normal file
67
test/mjsunit/debug-liveedit-exceptions.js
Normal file
@ -0,0 +1,67 @@
|
||||
// Copyright 2016 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.
|
||||
|
||||
// Flags: --expose-debug-as debug
|
||||
|
||||
Debug = debug.Debug
|
||||
|
||||
function BestEditor() {
|
||||
throw 'Emacs';
|
||||
}
|
||||
|
||||
var exception = null;
|
||||
var results = [];
|
||||
var log = []
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event != Debug.DebugEvent.Exception) return;
|
||||
try {
|
||||
var source_line = event_data.sourceLineText();
|
||||
print(source_line);
|
||||
log.push(source_line);
|
||||
switch (results.length) {
|
||||
case 0:
|
||||
Replace(BestEditor, "Emacs", "Eclipse");
|
||||
break;
|
||||
case 1:
|
||||
Replace(BestEditor, "Eclipse", "Vim");
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
default:
|
||||
assertUnreachable();
|
||||
}
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
};
|
||||
|
||||
function Replace(fun, original, patch) {
|
||||
var script = Debug.findScript(fun);
|
||||
if (fun.toString().indexOf(original) < 0) return;
|
||||
var patch_pos = script.source.indexOf(original);
|
||||
var change_log = [];
|
||||
Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, original.length, patch, change_log);
|
||||
}
|
||||
|
||||
Debug.setListener(listener);
|
||||
Debug.setBreakOnException();
|
||||
|
||||
for (var i = 0; i < 3; i++) {
|
||||
try {
|
||||
BestEditor();
|
||||
} catch (e) {
|
||||
results.push(e);
|
||||
}
|
||||
}
|
||||
Debug.setListener(null);
|
||||
|
||||
assertNull(exception);
|
||||
assertEquals(["Emacs", "Eclipse", "Vim"], results);
|
||||
print(JSON.stringify(log, 1));
|
||||
assertEquals([
|
||||
" throw 'Emacs';",
|
||||
" throw 'Eclipse';",
|
||||
" throw 'Vim';",
|
||||
], log);
|
@ -7,8 +7,7 @@
|
||||
Debug = debug.Debug
|
||||
|
||||
function BestEditor() {
|
||||
var best_editor = "Emacs";
|
||||
return best_editor;
|
||||
return 'Emacs';
|
||||
}
|
||||
|
||||
var exception = null;
|
||||
@ -62,20 +61,15 @@ print(JSON.stringify(log, 1));
|
||||
assertEquals([
|
||||
"debugger;",
|
||||
"results.push(BestEditor());",
|
||||
" var best_editor = \"Emacs\";",
|
||||
" return best_editor;","}",
|
||||
" return 'Emacs';","}",
|
||||
"results.push(BestEditor());",
|
||||
"results.push(BestEditor());",
|
||||
" var best_editor = \"Emacs\";",
|
||||
" return best_editor;",
|
||||
" var best_editor = \"Eclipse\";",
|
||||
" return best_editor;","}",
|
||||
" return 'Emacs';",
|
||||
" return 'Eclipse';","}",
|
||||
"results.push(BestEditor());",
|
||||
"results.push(BestEditor());",
|
||||
" var best_editor = \"Eclipse\";",
|
||||
" return best_editor;",
|
||||
" var best_editor = \"Vim\";",
|
||||
" return best_editor;",
|
||||
" return 'Eclipse';",
|
||||
" return 'Vim';",
|
||||
"}","results.push(BestEditor());",
|
||||
"Debug.setListener(null);"
|
||||
], log);
|
||||
|
@ -287,10 +287,6 @@
|
||||
############################################################################
|
||||
# Ignition
|
||||
|
||||
# TODO(rmcilroy,4765): assertion failures in LiveEdit tests.
|
||||
'debug-liveedit-stepin': [PASS, NO_IGNITION],
|
||||
'debug-liveedit-stack-padding': [PASS, NO_IGNITION],
|
||||
|
||||
# TODO(mythria, 4780): Related to type feedback for calls in interpreter.
|
||||
'array-literal-feedback': [PASS, NO_IGNITION],
|
||||
'regress/regress-4121': [PASS, NO_IGNITION],
|
||||
@ -841,10 +837,6 @@
|
||||
|
||||
##############################################################################
|
||||
['ignition or ignition_turbofan', {
|
||||
# TODO(rmcilroy,4765): assertion failures in LiveEdit tests.
|
||||
'debug-liveedit-stepin': [FAIL],
|
||||
'debug-liveedit-stack-padding': [SKIP],
|
||||
|
||||
# TODO(mythria, 4780): Related to type feedback for calls in interpreter.
|
||||
'array-literal-feedback': [FAIL],
|
||||
'regress/regress-4121': [FAIL],
|
||||
|
Loading…
Reference in New Issue
Block a user