219f4a9eb4
Instead of modifying a context chain and then modifying it back, causing potential mismatches, we clone the inner context chain and evaluate the expression in this cloned context. We then copy all local variable values back if needed. R=yangguo@chromium.org,yurys@chromium.org Review URL: https://codereview.chromium.org/1088503003 Cr-Commit-Position: refs/heads/master@{#27809}
49 lines
877 B
JavaScript
49 lines
877 B
JavaScript
// Copyright 2014 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
|
|
var exception = null;
|
|
var break_count = 0;
|
|
|
|
var f = null;
|
|
var i = null;
|
|
function listener(event, exec_state, event_data, data) {
|
|
try {
|
|
if (event == Debug.DebugEvent.Break) {
|
|
var frameMirror = exec_state.frame(0);
|
|
|
|
f = frameMirror.evaluate('f = function() { i = 5; }, f(), f').value();
|
|
print(f);
|
|
}
|
|
} catch(e) {
|
|
exception = e;
|
|
print(e, e.stack);
|
|
}
|
|
};
|
|
|
|
Debug.setListener(listener);
|
|
|
|
(function (){
|
|
|
|
var i = 0;
|
|
|
|
try {
|
|
throw new Error();
|
|
} catch (e) {
|
|
assertEquals(0, i);
|
|
debugger;
|
|
assertEquals(5, i);
|
|
}
|
|
}());
|
|
|
|
assertNull(exception);
|
|
|
|
assertNull(i);
|
|
f();
|
|
assertNull(i);
|
|
|
|
Debug.setListener(null);
|