Commit 4fb4f340 authored by jgruber's avatar jgruber Committed by Commit bot

[debug-wrapper] LiveEdit, frame.restart(), breakpoints

This adds access to the LiveEdit API object, frame.restart(), and
various breakpoint setters. The LiveEdit API still depends on the JS
debugging context and blocks its removal; but it should be removed
once LiveEdit is rewritten in the midterm.

BUG=v8:5530

Review-Url: https://codereview.chromium.org/2503293002
Cr-Commit-Position: refs/heads/master@{#41062}
parent 5f0be34c
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --noalways-opt // Flags: --noalways-opt
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
// In this test case we edit a script so that techincally function text // In this test case we edit a script so that techincally function text
// hasen't been changed. However actually function became one level more nested // hasen't been changed. However actually function became one level more nested
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --noalways-opt // Flags: --noalways-opt
// Get the Debug object exposed from the debug context global object.
// In this test case we edit a script so that techincally function text // In this test case we edit a script so that techincally function text
// hasen't been changed. However actually function became one level more nested // hasen't been changed. However actually function became one level more nested
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --allow-natives-syntax
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-debug-as debug
Debug = debug.Debug Debug = debug.Debug
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
// Scenario: a function is being changed, which causes enclosing function to // Scenario: a function is being changed, which causes enclosing function to
// have its positions patched; position changing requires new instance of Code // have its positions patched; position changing requires new instance of Code
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug; Debug = debug.Debug;
Debug.setListener(listener); Debug.setListener(listener);
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-debug-as debug
Debug = debug.Debug Debug = debug.Debug
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test that live-editing a frame that uses new.target fails. // Test that live-editing a frame that uses new.target fails.
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test that live-editing a frame to introduce new.target fails. // Test that live-editing a frame to introduce new.target fails.
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test that live-editing a frame above one that uses new.target succeeds. // Test that live-editing a frame above one that uses new.target succeeds.
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax
var Debug = debug.Debug; var Debug = debug.Debug;
var LiveEdit = Debug.LiveEdit; var LiveEdit = Debug.LiveEdit;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-async-await // Flags: --harmony-async-await
// Flags: --expose-debug-as debug --allow-natives-syntax
var Debug = debug.Debug; var Debug = debug.Debug;
var LiveEdit = Debug.LiveEdit; var LiveEdit = Debug.LiveEdit;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-debug-as debug
function static() { function static() {
print("> static"); // Break print("> static"); // Break
...@@ -43,7 +42,7 @@ for (var script of scripts) { ...@@ -43,7 +42,7 @@ for (var script of scripts) {
} }
Debug.setScriptBreakPointById(dynamic_script.id, 1); Debug.setScriptBreakPointById(dynamic_script.id, 1);
Debug.setScriptBreakPointById(static_script.id, 7); Debug.setScriptBreakPointById(static_script.id, 6);
dynamic(); dynamic();
static(); static();
......
...@@ -42,4 +42,13 @@ ...@@ -42,4 +42,13 @@
'debug/harmony/async-debug-caught-exception-cases2': [SKIP], 'debug/harmony/async-debug-caught-exception-cases2': [SKIP],
'debug/harmony/async-debug-caught-exception-cases3': [SKIP], 'debug/harmony/async-debug-caught-exception-cases3': [SKIP],
}], # 'gc_stress == True' }], # 'gc_stress == True'
##############################################################################
['arch == s390 or arch == s390x', {
# Stack manipulations in LiveEdit is not implemented for this arch.
'debug/debug-liveedit-check-stack': [SKIP],
'debug/debug-liveedit-stack-padding': [SKIP],
'debug/debug-liveedit-restart-frame': [SKIP],
}], # 'arch == s390 or arch == s390x'
] ]
...@@ -70,6 +70,11 @@ class DebugWrapper { ...@@ -70,6 +70,11 @@ class DebugWrapper {
BreakPosition: 1 BreakPosition: 1
}; };
// The different script break point types.
this.ScriptBreakPointType = { ScriptId: 0,
ScriptName: 1,
ScriptRegExp: 2 };
// Store the current script id so we can skip corresponding break events. // Store the current script id so we can skip corresponding break events.
this.thisScriptId = %FunctionGetScriptId(receive); this.thisScriptId = %FunctionGetScriptId(receive);
...@@ -141,8 +146,37 @@ class DebugWrapper { ...@@ -141,8 +146,37 @@ class DebugWrapper {
params.condition = opt_condition; params.condition = opt_condition;
} }
const {msgid, msg} = this.createMessage( const {msgid, msg} = this.createMessage("Debugger.setBreakpoint", params);
"Debugger.setBreakpoint", params); this.sendMessage(msg);
const reply = this.takeReplyChecked(msgid);
assertTrue(reply.result !== undefined);
const breakid = reply.result.breakpointId;
assertTrue(breakid !== undefined);
return breakid;
}
setScriptBreakPoint(type, scriptid, opt_line, opt_column, opt_condition) {
// Only sets by script id are supported for now.
assertEquals(this.ScriptBreakPointType.ScriptId, type);
return this.setScriptBreakPointById(scriptid, opt_line, opt_column,
opt_condition);
}
setScriptBreakPointById(scriptid, opt_line, opt_column, opt_condition) {
const loc = %ScriptLocationFromLine2(scriptid, opt_line, opt_column, 0);
const params = { location :
{ scriptId : scriptid.toString(),
lineNumber : loc.line,
columnNumber : loc.column,
}};
if (!!opt_condition) {
params.condition = opt_condition;
}
const {msgid, msg} = this.createMessage("Debugger.setBreakpoint", params);
this.sendMessage(msg); this.sendMessage(msg);
const reply = this.takeReplyChecked(msgid); const reply = this.takeReplyChecked(msgid);
...@@ -247,6 +281,11 @@ class DebugWrapper { ...@@ -247,6 +281,11 @@ class DebugWrapper {
this.takeReplyChecked(msgid); this.takeReplyChecked(msgid);
} }
get LiveEdit() {
const debugContext = %GetDebugContext();
return debugContext.Debug.LiveEdit;
}
// --- Internal methods. ----------------------------------------------------- // --- Internal methods. -----------------------------------------------------
getNextMessageId() { getNextMessageId() {
...@@ -463,7 +502,6 @@ class DebugWrapper { ...@@ -463,7 +502,6 @@ class DebugWrapper {
return { value : () => value, return { value : () => value,
isUndefined : () => obj.type == "undefined" isUndefined : () => obj.type == "undefined"
}; };
} }
evaluateOnCallFrame(frame, expr) { evaluateOnCallFrame(frame, expr) {
...@@ -480,6 +518,14 @@ class DebugWrapper { ...@@ -480,6 +518,14 @@ class DebugWrapper {
return this.reconstructRemoteObject(result); return this.reconstructRemoteObject(result);
} }
execStateFrameRestart(frame) {
const frameid = frame.callFrameId;
const {msgid, msg} = this.createMessage(
"Debugger.restartFrame", { callFrameId : frameid });
this.sendMessage(msg);
this.takeReplyChecked(msgid);
}
execStateFrame(frame) { execStateFrame(frame) {
const scriptid = parseInt(frame.location.scriptId); const scriptid = parseInt(frame.location.scriptId);
const line = frame.location.lineNumber; const line = frame.location.lineNumber;
...@@ -504,6 +550,7 @@ class DebugWrapper { ...@@ -504,6 +550,7 @@ class DebugWrapper {
localCount : () => this.execStateFrameLocalCount(frame), localCount : () => this.execStateFrameLocalCount(frame),
localName : (ix) => this.execStateFrameLocalName(frame, ix), localName : (ix) => this.execStateFrameLocalName(frame, ix),
localValue: (ix) => this.execStateFrameLocalValue(frame, ix), localValue: (ix) => this.execStateFrameLocalValue(frame, ix),
restart : () => this.execStateFrameRestart(frame),
scopeCount : () => frame.scopeChain.length, scopeCount : () => frame.scopeChain.length,
scope : (index) => this.execStateScope(frame, index), scope : (index) => this.execStateScope(frame, index),
allScopes : allScopes.bind(this) allScopes : allScopes.bind(this)
......
...@@ -530,9 +530,6 @@ ...@@ -530,9 +530,6 @@
['arch == s390 or arch == s390x', { ['arch == s390 or arch == s390x', {
# Stack manipulations in LiveEdit is not implemented for this arch. # Stack manipulations in LiveEdit is not implemented for this arch.
'debug-liveedit-check-stack': [SKIP],
'debug-liveedit-stack-padding': [SKIP],
'debug-liveedit-restart-frame': [SKIP],
'debug-liveedit-double-call': [SKIP], 'debug-liveedit-double-call': [SKIP],
}], # 'arch == s390 or arch == s390x' }], # 'arch == s390 or arch == s390x'
......
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