Index: src/d8.js |
=================================================================== |
--- src/d8.js (revision 6182) |
+++ src/d8.js (working copy) |
@@ -110,32 +110,17 @@ |
const kNoFrame = -1; |
Debug.State = { |
currentFrame: kNoFrame, |
- displaySourceStartLine: -1, |
- displaySourceEndLine: -1, |
currentSourceLine: -1 |
} |
var trace_compile = false; // Tracing all compile events? |
-var trace_debug_json = false; // Tracing all debug json packets? |
-var last_cmd_line = ''; |
-var repeat_cmd_line = ''; |
-var is_running = true; |
-// Copied from debug-delay.js. This is needed below: |
-function ScriptTypeFlag(type) { |
- return (1 << type); |
-} |
- |
// Process a debugger JSON message into a display text and a running status. |
// This function returns an object with properties "text" and "running" holding |
// this information. |
function DebugMessageDetails(message) { |
- if (trace_debug_json) { |
- print("received: '" + message + "'"); |
- } |
// Convert the JSON string to an object. |
var response = new ProtocolPackage(message); |
- is_running = response.running(); |
if (response.type() == 'event') { |
return DebugEventDetails(response); |
@@ -176,8 +161,6 @@ |
result += '\n'; |
result += SourceUnderline(body.sourceLineText, body.sourceColumn); |
Debug.State.currentSourceLine = body.sourceLine; |
- Debug.State.displaySourceStartLine = -1; |
- Debug.State.displaySourceEndLine = -1; |
Debug.State.currentFrame = 0; |
details.text = result; |
break; |
@@ -197,14 +180,10 @@ |
result += '\n'; |
result += SourceUnderline(body.sourceLineText, body.sourceColumn); |
Debug.State.currentSourceLine = body.sourceLine; |
- Debug.State.displaySourceStartLine = -1; |
- Debug.State.displaySourceEndLine = -1; |
Debug.State.currentFrame = 0; |
} else { |
result += ' (empty stack)'; |
Debug.State.currentSourceLine = -1; |
- Debug.State.displaySourceStartLine = -1; |
- Debug.State.displaySourceEndLine = -1; |
Debug.State.currentFrame = kNoFrame; |
} |
details.text = result; |
@@ -223,10 +202,6 @@ |
details.text = result; |
break; |
- case 'scriptCollected': |
- details.text = result; |
- break; |
- |
default: |
details.text = 'Unknown debug event ' + response.event(); |
} |
@@ -279,11 +254,7 @@ |
// Converts a text command to a JSON request. |
function DebugCommandToJSONRequest(cmd_line) { |
- var result = new DebugRequest(cmd_line).JSONRequest(); |
- if (trace_debug_json && result) { |
- print("sending: '" + result + "'"); |
- } |
- return result; |
+ return new DebugRequest(cmd_line).JSONRequest(); |
}; |
@@ -295,20 +266,6 @@ |
return; |
} |
- // Check for a simple carriage return to repeat the last command: |
- var is_repeating = false; |
- if (cmd_line == '\n') { |
- if (is_running) { |
- cmd_line = 'break'; // Not in debugger mode, break with a frame request. |
- } else { |
- cmd_line = repeat_cmd_line; // use command to repeat. |
- is_repeating = true; |
- } |
- } |
- if (!is_running) { // Only save the command if in debugger mode. |
- repeat_cmd_line = cmd_line; // save last command. |
- } |
- |
// Trim string for leading and trailing whitespace. |
cmd_line = cmd_line.replace(/^\s+|\s+$/g, ''); |
@@ -324,13 +281,6 @@ |
args = cmd_line.slice(pos).replace(/^\s+|\s+$/g, ''); |
} |
- if ((cmd === undefined) || !cmd) { |
- this.request_ = void 0; |
- return; |
- } |
- |
- last_cmd = cmd; |
- |
// Switch on command. |
switch (cmd) { |
case 'continue': |
@@ -340,24 +290,9 @@ |
case 'step': |
case 's': |
- this.request_ = this.stepCommandToJSONRequest_(args, 'in'); |
+ this.request_ = this.stepCommandToJSONRequest_(args); |
break; |
- case 'stepi': |
- case 'si': |
- this.request_ = this.stepCommandToJSONRequest_(args, 'min'); |
- break; |
- |
- case 'next': |
- case 'n': |
- this.request_ = this.stepCommandToJSONRequest_(args, 'next'); |
- break; |
- |
- case 'finish': |
- case 'fin': |
- this.request_ = this.stepCommandToJSONRequest_(args, 'out'); |
- break; |
- |
case 'backtrace': |
case 'bt': |
this.request_ = this.backtraceCommandToJSONRequest_(args); |
@@ -376,26 +311,6 @@ |
this.request_ = this.scopeCommandToJSONRequest_(args); |
break; |
- case 'disconnect': |
- case 'exit': |
- case 'quit': |
- this.request_ = this.disconnectCommandToJSONRequest_(args); |
- break; |
- |
- case 'up': |
- this.request_ = |
- this.frameCommandToJSONRequest_('' + |
- (Debug.State.currentFrame + 1)); |
- break; |
- |
- case 'down': |
- case 'do': |
- this.request_ = |
- this.frameCommandToJSONRequest_('' + |
- (Debug.State.currentFrame - 1)); |
- break; |
- |
- case 'set': |
case 'print': |
case 'p': |
this.request_ = this.printCommandToJSONRequest_(args); |
@@ -413,17 +328,11 @@ |
this.request_ = this.instancesCommandToJSONRequest_(args); |
break; |
- case 'list': |
- case 'l': |
- this.request_ = this.listCommandToJSONRequest_(args); |
- break; |
case 'source': |
this.request_ = this.sourceCommandToJSONRequest_(args); |
break; |
case 'scripts': |
- case 'script': |
- case 'scr': |
this.request_ = this.scriptsCommandToJSONRequest_(args); |
break; |
@@ -438,8 +347,6 @@ |
break; |
case 'clear': |
- case 'delete': |
- case 'd': |
this.request_ = this.clearCommandToJSONRequest_(args); |
break; |
@@ -447,42 +354,7 @@ |
this.request_ = this.threadsCommandToJSONRequest_(args); |
break; |
- case 'cond': |
- this.request_ = this.changeBreakpointCommandToJSONRequest_(args, 'cond'); |
- break; |
- |
- case 'enable': |
- case 'en': |
- this.request_ = |
- this.changeBreakpointCommandToJSONRequest_(args, 'enable'); |
- break; |
- |
- case 'disable': |
- case 'dis': |
- this.request_ = |
- this.changeBreakpointCommandToJSONRequest_(args, 'disable'); |
- break; |
- |
- case 'ignore': |
- this.request_ = |
- this.changeBreakpointCommandToJSONRequest_(args, 'ignore'); |
- break; |
- |
- case 'info': |
- case 'inf': |
- this.request_ = this.infoCommandToJSONRequest_(args); |
- break; |
- |
- case 'flags': |
- this.request_ = this.v8FlagsToJSONRequest_(args); |
- break; |
- |
- case 'gc': |
- this.request_ = this.gcToJSONRequest_(args); |
- break; |
- |
case 'trace': |
- case 'tr': |
// Return undefined to indicate command handled internally (no JSON). |
this.request_ = void 0; |
this.traceCommand_(args); |
@@ -498,6 +370,8 @@ |
default: |
throw new Error('Unknown command "' + cmd + '"'); |
} |
+ |
+ last_cmd = cmd; |
} |
DebugRequest.prototype.JSONRequest = function() { |
@@ -591,73 +465,59 @@ |
// Create a JSON request for the step command. |
-DebugRequest.prototype.stepCommandToJSONRequest_ = function(args, type) { |
+DebugRequest.prototype.stepCommandToJSONRequest_ = function(args) { |
// Requesting a step is through the continue command with additional |
// arguments. |
var request = this.createRequest('continue'); |
request.arguments = {}; |
// Process arguments if any. |
- |
- // Only process args if the command is 'step' which is indicated by type being |
- // set to 'in'. For all other commands, ignore the args. |
if (args && args.length > 0) { |
- args = args.split(/\s+/g); |
+ args = args.split(/\s*[ ]+\s*/g); |
if (args.length > 2) { |
throw new Error('Invalid step arguments.'); |
} |
if (args.length > 0) { |
- // Check if we have a gdb stype step command. If so, the 1st arg would |
- // be the step count. If it's not a number, then assume that we're |
- // parsing for the legacy v8 step command. |
- var stepcount = Number(args[0]); |
- if (stepcount == Number.NaN) { |
- // No step count at arg 1. Process as legacy d8 step command: |
- if (args.length == 2) { |
- var stepcount = parseInt(args[1]); |
- if (isNaN(stepcount) || stepcount <= 0) { |
- throw new Error('Invalid step count argument "' + args[0] + '".'); |
- } |
- request.arguments.stepcount = stepcount; |
+ // Get step count argument if any. |
+ if (args.length == 2) { |
+ var stepcount = parseInt(args[1]); |
+ if (isNaN(stepcount) || stepcount <= 0) { |
+ throw new Error('Invalid step count argument "' + args[0] + '".'); |
} |
+ request.arguments.stepcount = stepcount; |
+ } |
- // Get the step action. |
- switch (args[0]) { |
- case 'in': |
- case 'i': |
- request.arguments.stepaction = 'in'; |
- break; |
+ // Get the step action. |
+ switch (args[0]) { |
+ case 'in': |
+ case 'i': |
+ request.arguments.stepaction = 'in'; |
+ break; |
- case 'min': |
- case 'm': |
- request.arguments.stepaction = 'min'; |
- break; |
+ case 'min': |
+ case 'm': |
+ request.arguments.stepaction = 'min'; |
+ break; |
- case 'next': |
- case 'n': |
- request.arguments.stepaction = 'next'; |
- break; |
+ case 'next': |
+ case 'n': |
+ request.arguments.stepaction = 'next'; |
+ break; |
- case 'out': |
- case 'o': |
- request.arguments.stepaction = 'out'; |
- break; |
+ case 'out': |
+ case 'o': |
+ request.arguments.stepaction = 'out'; |
+ break; |
- default: |
- throw new Error('Invalid step argument "' + args[0] + '".'); |
- } |
- |
- } else { |
- // gdb style step commands: |
- request.arguments.stepaction = type; |
- request.arguments.stepcount = stepcount; |
+ default: |
+ throw new Error('Invalid step argument "' + args[0] + '".'); |
} |
} |
} else { |
- // Default is step of the specified type. |
- request.arguments.stepaction = type; |
+ // Default is step next. |
+ request.arguments.stepaction = 'next'; |
} |
return request.toJSONProtocol(); |
@@ -788,41 +648,6 @@ |
}; |
-// Create a JSON request for the list command. |
-DebugRequest.prototype.listCommandToJSONRequest_ = function(args) { |
- |
- // Default is ten lines starting five lines before the current location. |
- if (Debug.State.displaySourceEndLine == -1) { |
- // If we list forwards, we will start listing after the last source end |
- // line. Set it to start from 5 lines before the current location. |
- Debug.State.displaySourceEndLine = Debug.State.currentSourceLine - 5; |
- // If we list backwards, we will start listing backwards from the last |
- // source start line. Set it to start from 1 lines before the current |
- // location. |
- Debug.State.displaySourceStartLine = Debug.State.currentSourceLine + 1; |
- } |
- |
- var from = Debug.State.displaySourceEndLine + 1; |
- var lines = 10; |
- |
- // Parse the arguments. |
- args = args.split(/\s*,\s*/g); |
- if (args == '') { |
- } else if ((args.length == 1) && (args[0] == '-')) { |
- from = Debug.State.displaySourceStartLine - lines; |
- } else if (args.length == 2) { |
- from = parseInt(args[0]); |
- lines = parseInt(args[1]) - from + 1; // inclusive of the ending line. |
- } else { |
- throw new Error('Invalid list arguments.'); |
- } |
- Debug.State.displaySourceStartLine = from; |
- Debug.State.displaySourceEndLine = from + lines - 1; |
- var sourceArgs = '' + from + ' ' + lines; |
- return this.sourceCommandToJSONRequest_(sourceArgs); |
-}; |
- |
- |
// Create a JSON request for the source command. |
DebugRequest.prototype.sourceCommandToJSONRequest_ = function(args) { |
// Build a evaluate request from the text command. |
@@ -884,10 +709,7 @@ |
break; |
default: |
- // If the arg is not one of the know one aboves, then it must be a |
- // filter used for filtering the results: |
- request.arguments.filter = args[0]; |
- break; |
+ throw new Error('Invalid argument "' + args[0] + '".'); |
} |
} |
@@ -909,8 +731,6 @@ |
var request = this.createRequest('setbreakpoint'); |
- // Break the args into target spec and condition if appropriate. |
- |
// Check for breakpoint condition. |
pos = args.indexOf(' '); |
if (pos > 0) { |
@@ -981,178 +801,6 @@ |
}; |
-// Create a JSON request for the change breakpoint command. |
-DebugRequest.prototype.changeBreakpointCommandToJSONRequest_ = |
- function(args, command) { |
- |
- var request; |
- |
- // Check for exception breaks first: |
- // en[able] exc[eptions] [all|unc[aught]] |
- // en[able] [all|unc[aught]] exc[eptions] |
- // dis[able] exc[eptions] [all|unc[aught]] |
- // dis[able] [all|unc[aught]] exc[eptions] |
- if ((command == 'enable' || command == 'disable') && |
- args && args.length > 1) { |
- var nextPos = args.indexOf(' '); |
- var arg1 = (nextPos > 0) ? args.substring(0, nextPos) : args; |
- var excType = null; |
- |
- // Check for: |
- // en[able] exc[eptions] [all|unc[aught]] |
- // dis[able] exc[eptions] [all|unc[aught]] |
- if (arg1 == 'exc' || arg1 == 'exception' || arg1 == 'exceptions') { |
- |
- var arg2 = (nextPos > 0) ? |
- args.substring(nextPos + 1, args.length) : 'all'; |
- if (!arg2) { |
- arg2 = 'all'; // if unspecified, set for all. |
- } if (arg2 == 'unc') { // check for short cut. |
- arg2 = 'uncaught'; |
- } |
- excType = arg2; |
- |
- // Check for: |
- // en[able] [all|unc[aught]] exc[eptions] |
- // dis[able] [all|unc[aught]] exc[eptions] |
- } else if (arg1 == 'all' || arg1 == 'unc' || arg1 == 'uncaught') { |
- |
- var arg2 = (nextPos > 0) ? |
- args.substring(nextPos + 1, args.length) : null; |
- if (arg2 == 'exc' || arg1 == 'exception' || arg1 == 'exceptions') { |
- excType = arg1; |
- if (excType == 'unc') { |
- excType = 'uncaught'; |
- } |
- } |
- } |
- |
- // If we matched one of the command formats, then excType will be non-null: |
- if (excType) { |
- // Build a evaluate request from the text command. |
- request = this.createRequest('setexceptionbreak'); |
- |
- request.arguments = {}; |
- request.arguments.type = excType; |
- request.arguments.enabled = (command == 'enable'); |
- |
- return request.toJSONProtocol(); |
- } |
- } |
- |
- // Build a evaluate request from the text command. |
- request = this.createRequest('changebreakpoint'); |
- |
- // Process arguments if any. |
- if (args && args.length > 0) { |
- request.arguments = {}; |
- var pos = args.indexOf(' '); |
- var breakpointArg = args; |
- var otherArgs; |
- if (pos > 0) { |
- breakpointArg = args.substring(0, pos); |
- otherArgs = args.substring(pos + 1, args.length); |
- } |
- |
- request.arguments.breakpoint = parseInt(breakpointArg); |
- |
- switch(command) { |
- case 'cond': |
- request.arguments.condition = otherArgs ? otherArgs : null; |
- break; |
- case 'enable': |
- request.arguments.enabled = true; |
- break; |
- case 'disable': |
- request.arguments.enabled = false; |
- break; |
- case 'ignore': |
- request.arguments.ignoreCount = parseInt(otherArgs); |
- break; |
- default: |
- throw new Error('Invalid arguments.'); |
- } |
- } else { |
- throw new Error('Invalid arguments.'); |
- } |
- |
- return request.toJSONProtocol(); |
-}; |
- |
- |
-// Create a JSON request for the disconnect command. |
-DebugRequest.prototype.disconnectCommandToJSONRequest_ = function(args) { |
- var request; |
- request = this.createRequest('disconnect'); |
- return request.toJSONProtocol(); |
-}; |
- |
- |
-// Create a JSON request for the info command. |
-DebugRequest.prototype.infoCommandToJSONRequest_ = function(args) { |
- var request; |
- if (args && (args == 'break' || args == 'br')) { |
- // Build a evaluate request from the text command. |
- request = this.createRequest('listbreakpoints'); |
- last_cmd = 'info break'; |
- } else if (args && (args == 'locals' || args == 'lo')) { |
- // Build a evaluate request from the text command. |
- request = this.createRequest('frame'); |
- last_cmd = 'info locals'; |
- } else if (args && (args == 'args' || args == 'ar')) { |
- // Build a evaluate request from the text command. |
- request = this.createRequest('frame'); |
- last_cmd = 'info args'; |
- } else { |
- throw new Error('Invalid info arguments.'); |
- } |
- |
- return request.toJSONProtocol(); |
-}; |
- |
- |
-DebugRequest.prototype.v8FlagsToJSONRequest_ = function(args) { |
- var request; |
- request = this.createRequest('v8flags'); |
- request.arguments = {}; |
- request.arguments.flags = args; |
- return request.toJSONProtocol(); |
-}; |
- |
- |
-DebugRequest.prototype.gcToJSONRequest_ = function(args) { |
- var request; |
- if (!args) { |
- args = 'all'; |
- } |
- var args = args.split(/\s+/g); |
- var cmd = args[0]; |
- |
- switch(cmd) { |
- case 'all': |
- case 'quick': |
- case 'full': |
- case 'young': |
- case 'old': |
- case 'compact': |
- case 'sweep': |
- case 'scavenge': { |
- if (cmd == 'young') { cmd = 'quick'; } |
- else if (cmd == 'old') { cmd = 'full'; } |
- |
- request = this.createRequest('gc'); |
- request.arguments = {}; |
- request.arguments.type = cmd; |
- break; |
- } |
- // Else fall thru to the default case below to report the error. |
- default: |
- throw new Error('Missing arguments after ' + cmd + '.'); |
- } |
- return request.toJSONProtocol(); |
-}; |
- |
- |
// Create a JSON request for the threads command. |
DebugRequest.prototype.threadsCommandToJSONRequest_ = function(args) { |
// Build a threads request from the text command. |
@@ -1168,10 +816,6 @@ |
if (args == 'compile') { |
trace_compile = !trace_compile; |
print('Tracing of compiled scripts ' + (trace_compile ? 'on' : 'off')); |
- } else if (args === 'debug json' || args === 'json' || args === 'packets') { |
- trace_debug_json = !trace_debug_json; |
- print('Tracing of debug json packets ' + |
- (trace_debug_json ? 'on' : 'off')); |
} else { |
throw new Error('Invalid trace arguments.'); |
} |
@@ -1187,63 +831,24 @@ |
print('warning: arguments to \'help\' are ignored'); |
} |
- print('Note: <> denotes symbollic values to be replaced with real values.'); |
- print('Note: [] denotes optional parts of commands, or optional options / arguments.'); |
- print(' e.g. d[elete] - you get the same command if you type d or delete.'); |
- print(''); |
- print('[break] - break as soon as possible'); |
- print('b[reak] location [condition]'); |
- print(' - break on named function: location is a function name'); |
- print(' - break on function: location is #<id>#'); |
- print(' - break on script position: location is name:line[:column]'); |
- print(''); |
- print('clear <breakpoint #> - deletes the specified user defined breakpoint'); |
- print('d[elete] <breakpoint #> - deletes the specified user defined breakpoint'); |
- print('dis[able] <breakpoint #> - disables the specified user defined breakpoint'); |
- print('dis[able] exc[eptions] [[all] | unc[aught]]'); |
- print(' - disables breaking on exceptions'); |
- print('en[able] <breakpoint #> - enables the specified user defined breakpoint'); |
- print('en[able] exc[eptions] [[all] | unc[aught]]'); |
- print(' - enables breaking on exceptions'); |
- print(''); |
- print('b[ack]t[race] [n] | [-n] | [from to]'); |
- print(' - prints the stack back trace'); |
- print('f[rame] - prints info about the current frame context'); |
- print('f[rame] <frame #> - set context to specified frame #'); |
+ print('break'); |
+ print('break location [condition]'); |
+ print(' break on named function: location is a function name'); |
+ print(' break on function: location is #<id>#'); |
+ print(' break on script position: location is name:line[:column]'); |
+ print('clear <breakpoint #>'); |
+ print('backtrace [n] | [-n] | [from to]'); |
+ print('frame <frame #>'); |
print('scopes'); |
print('scope <scope #>'); |
- print(''); |
- print('up - set context to caller of current frame'); |
- print('do[wn] - set context to callee of current frame'); |
- print('inf[o] br[eak] - prints info about breakpoints in use'); |
- print('inf[o] ar[gs] - prints info about arguments of the current function'); |
- print('inf[o] lo[cals] - prints info about locals in the current function'); |
- print('inf[o] liveobjectlist|lol - same as \'lol info\''); |
- print(''); |
print('step [in | next | out| min [step count]]'); |
- print('c[ontinue] - continue executing after a breakpoint'); |
- print('s[tep] [<N>] - step into the next N callees (default N is 1)'); |
- print('s[tep]i [<N>] - step into the next N callees (default N is 1)'); |
- print('n[ext] [<N>] - step over the next N callees (default N is 1)'); |
- print('fin[ish] [<N>] - step out of N frames (default N is 1)'); |
- print(''); |
- print('p[rint] <expression> - prints the result of the specified expression'); |
- print('dir <expression> - prints the object structure of the result'); |
- print('set <var> = <expression> - executes the specified statement'); |
- print(''); |
- print('l[ist] - list the source code around for the current pc'); |
- print('l[ist] [- | <start>,<end>] - list the specified range of source code'); |
+ print('print <expression>'); |
+ print('dir <expression>'); |
print('source [from line [num lines]]'); |
- print('scr[ipts] [native|extensions|all]'); |
- print('scr[ipts] [<filter text>] - list scripts with the specified text in its description'); |
- print(''); |
- print('gc - runs the garbage collector'); |
- print(''); |
+ print('scripts'); |
+ print('continue'); |
print('trace compile'); |
- // hidden command: trace debug json - toggles tracing of debug json packets |
- print(''); |
- print('disconnect|exit|quit - disconnects and quits the debugger'); |
- print('help - prints this help information'); |
+ print('help'); |
} |
@@ -1325,27 +930,6 @@ |
} |
-function refObjectToString_(protocolPackage, handle) { |
- var value = protocolPackage.lookup(handle); |
- var result = ''; |
- if (value.isString()) { |
- result = '"' + value.value() + '"'; |
- } else if (value.isPrimitive()) { |
- result = value.valueString(); |
- } else if (value.isObject()) { |
- result += formatObject_(value, true); |
- } |
- return result; |
-} |
- |
- |
-// Rounds number 'num' to 'length' decimal places. |
-function roundNumber(num, length) { |
- var factor = Math.pow(10, length); |
- return Math.round(num * factor) / factor; |
-} |
- |
- |
// Convert a JSON response to text for display in a text based debugger. |
function DebugResponseDetails(response) { |
details = {text:'', running:false} |
@@ -1378,11 +962,6 @@ |
details.text = result; |
break; |
- case 'changebreakpoint': |
- result = 'successfully changed breakpoint'; |
- details.text = result; |
- break; |
- |
case 'listbreakpoints': |
result = 'breakpoints: (' + body.breakpoints.length + ')'; |
for (var i = 0; i < body.breakpoints.length; i++) { |
@@ -1395,9 +974,9 @@ |
if (breakpoint.script_name) { |
result += ' script_name=' + breakpoint.script_name; |
} |
- result += ' line=' + (breakpoint.line + 1); |
+ result += ' line=' + breakpoint.line; |
if (breakpoint.column != null) { |
- result += ' column=' + (breakpoint.column + 1); |
+ result += ' column=' + breakpoint.column; |
} |
if (breakpoint.groupId) { |
result += ' groupId=' + breakpoint.groupId; |
@@ -1413,27 +992,9 @@ |
} |
result += ' hit_count=' + breakpoint.hit_count; |
} |
- if (body.breakpoints.length === 0) { |
- result = "No user defined breakpoints\n"; |
- } else { |
- result += '\n'; |
- } |
- if (body.breakOnExceptions) { |
- result += '* breaking on ALL exceptions is enabled\n'; |
- } else if (body.breakOnUncaughtExceptions) { |
- result += '* breaking on UNCAUGHT exceptions is enabled\n'; |
- } else { |
- result += '* all exception breakpoints are disabled\n'; |
- } |
details.text = result; |
break; |
- case 'setexceptionbreak': |
- result = 'Break on ' + body.type + ' exceptions: '; |
- result += body.enabled ? 'enabled' : 'disabled'; |
- details.text = result; |
- break; |
- |
case 'backtrace': |
if (body.totalFrames == 0) { |
result = '(empty stack)'; |
@@ -1449,39 +1010,10 @@ |
break; |
case 'frame': |
- if (last_cmd === 'info locals') { |
- var locals = body.locals; |
- if (locals.length === 0) { |
- result = 'No locals'; |
- } else { |
- for (var i = 0; i < locals.length; i++) { |
- var local = locals[i]; |
- result += local.name + ' = '; |
- result += refObjectToString_(response, local.value.ref); |
- result += '\n'; |
- } |
- } |
- } else if (last_cmd === 'info args') { |
- var args = body.arguments; |
- if (args.length === 0) { |
- result = 'No arguments'; |
- } else { |
- for (var i = 0; i < args.length; i++) { |
- var arg = args[i]; |
- result += arg.name + ' = '; |
- result += refObjectToString_(response, arg.value.ref); |
- result += '\n'; |
- } |
- } |
- } else { |
- result = SourceUnderline(body.sourceLineText, |
- body.column); |
- Debug.State.currentSourceLine = body.line; |
- Debug.State.currentFrame = body.index; |
- Debug.State.displaySourceStartLine = -1; |
- Debug.State.displaySourceEndLine = -1; |
- } |
- details.text = result; |
+ details.text = SourceUnderline(body.sourceLineText, |
+ body.column); |
+ Debug.State.currentSourceLine = body.line; |
+ Debug.State.currentFrame = body.index; |
break; |
case 'scopes': |
@@ -1600,9 +1132,7 @@ |
if (body[i].name) { |
result += body[i].name; |
} else { |
- if (body[i].compilationType == Debug.ScriptCompilationType.Eval |
- && body[i].evalFromScript |
- ) { |
+ if (body[i].compilationType == Debug.ScriptCompilationType.Eval) { |
result += 'eval from '; |
var script_value = response.lookup(body[i].evalFromScript.ref); |
result += ' ' + script_value.field('name'); |
@@ -1632,9 +1162,6 @@ |
result += sourceStart; |
result += ']'; |
} |
- if (body.length == 0) { |
- result = "no matching scripts found"; |
- } |
details.text = result; |
break; |
@@ -1654,23 +1181,6 @@ |
details.text = "(running)"; |
break; |
- case 'v8flags': |
- details.text = "flags set"; |
- break; |
- |
- case 'gc': |
- details.text = "GC " + body.before + " => " + body.after; |
- if (body.after > (1024*1024)) { |
- details.text += |
- " (" + roundNumber(body.before/(1024*1024), 1) + "M => " + |
- roundNumber(body.after/(1024*1024), 1) + "M)"; |
- } else if (body.after > 1024) { |
- details.text += |
- " (" + roundNumber(body.before/1024, 1) + "K => " + |
- roundNumber(body.after/1024, 1) + "K)"; |
- } |
- break; |
- |
default: |
details.text = |
'Response for unknown command \'' + response.command() + '\'' + |
@@ -1957,11 +1467,6 @@ |
} |
-ProtocolValue.prototype.valueString = function() { |
- return this.value_.text; |
-} |
- |
- |
function ProtocolReference(handle) { |
this.handle_ = handle; |
} |
@@ -2108,9 +1613,7 @@ |
var property_value_json; |
switch (typeof property_value) { |
case 'object': |
- if (property_value === null) { |
- property_value_json = 'null'; |
- } else if (typeof property_value.toJSONProtocol == 'function') { |
+ if (typeof property_value.toJSONProtocol == 'function') { |
property_value_json = property_value.toJSONProtocol(true) |
} else if (property_value.constructor.name == 'Array'){ |
property_value_json = SimpleArrayToJSON_(property_value); |