diff options
author | Levente Orban <orbanl@inf.u-szeged.hu> | 2017-05-19 09:50:17 +0200 |
---|---|---|
committer | László Langó <llango.u-szeged@partner.samsung.com> | 2017-05-19 09:50:17 +0200 |
commit | d48c65d25805db4d72767057433ff147332d4457 (patch) | |
tree | 6b284987372f3cca2db860eb9ffe9f50fe745128 /jerry-debugger | |
parent | 7833270ca02c0d10c0c4a9fc0aeb8615e8e63038 (diff) |
Add pending breakpoints feature to HTML (JavaScript) Debugger client (#1828)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
Diffstat (limited to 'jerry-debugger')
-rw-r--r-- | jerry-debugger/jerry-client-ws.html | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/jerry-debugger/jerry-client-ws.html b/jerry-debugger/jerry-client-ws.html index d6bb2a54..fb3c224e 100644 --- a/jerry-debugger/jerry-client-ws.html +++ b/jerry-debugger/jerry-client-ws.html @@ -108,6 +108,7 @@ function DebuggerClient(address) var lastBreakpointHit = null; var activeBreakpoints = { }; var nextBreakpointIndex = 1; + var pendingBreakpoints = [ ]; var backtraceFrame = 0; var evalResult = null; @@ -722,6 +723,25 @@ function DebuggerClient(address) } } + if (pendingBreakpoints.length != 0) + { + appendLog("Available pending breakpoints"); + + for (var i in pendingBreakpoints) + { + if (Number.isInteger(pendingBreakpoints[i])) + { + pendingBreakpoints[i] = sourceName + ":" + pendingBreakpoints[i]; + } + appendLog("Try to add: " + pendingBreakpoints[i]); + debuggerObj.setBreakpoint(pendingBreakpoints[i], false); + } + } + else + { + appendLog("No pending breakpoints"); + } + parseObj = null; } } @@ -888,7 +908,7 @@ function DebuggerClient(address) appendLog("Breakpoint " + breakpoint.activeIndex + " at " + breakpointToString(breakpoint)); } - this.setBreakpoint = function(str) + this.setBreakpoint = function(str, pending) { line = /^(.+):([1-9][0-9]*)$/.exec(str); var found = false; @@ -927,6 +947,19 @@ function DebuggerClient(address) if (!found) { appendLog("Breakpoint not found"); + if (pending) + { + if (line) + { + pendingBreakpoints.push(Number(line[2])); + appendLog("Pending breakpoint index: " + line[0] + " added"); + } + else + { + pendingBreakpoints.push(str); + appendLog("Pending breakpoint function name: " + str + " added"); + } + } } } @@ -996,6 +1029,19 @@ function DebuggerClient(address) appendLog("Breakpoint " + index + " is deleted."); } + this.deletePendingBreakpoint = function(index) + { + if (index >= pendingBreakpoints.length) + { + appendLog("Pending breakpoint not found"); + } + else + { + pendingBreakpoints.splice(index, 1); + appendLog("Pending breakpoint " + index + " is deleted."); + } + } + this.listBreakpoints = function() { appendLog("List of active breakpoints:"); @@ -1011,6 +1057,18 @@ function DebuggerClient(address) { appendLog(" no active breakpoints"); } + + if (pendingBreakpoints.length != 0) + { + appendLog("List of pending breakpoints:"); + for (var i in pendingBreakpoints) + { + appendLog(" pending breakpoint " + i + " at " + pendingBreakpoints[i]); + } + } + else { + appendLog("No pending breakpoints"); + } } this.sendResumeExec = function(command) @@ -1148,7 +1206,9 @@ function debuggerCommand(event) appendLog("Debugger commands:\n" + " connect <IP address:PORT> - connect to server (default is localhost:5001)\n" + " break|b <file_name:line>|<function_name> - set breakpoint\n" + + " fbreak <file_name:line>|<function_name> - set breakpoint if not found, add to pending list\n" + " delete|d <id> - delete breakpoint\n" + + " pendingdel <id> - delete pending breakpoint\n" + " list - list breakpoints\n" + " continue|c - continue execution\n" + " step|s - step-in execution\n" + @@ -1207,7 +1267,11 @@ function debuggerCommand(event) { case "b": case "break": - debuggerObj.setBreakpoint(args[2]); + debuggerObj.setBreakpoint(args[2], false); + break; + + case "fbreak": + debuggerObj.setBreakpoint(args[2], true); break; case "d": @@ -1215,6 +1279,9 @@ function debuggerCommand(event) debuggerObj.deleteBreakpoint(args[2]); break; + case "pendingdel": + debuggerObj.deletePendingBreakpoint(args[2]); + case "st": case "stop": debuggerObj.encodeMessage("B", [ JERRY_DEBUGGER_STOP ]); |