Browse Source

Debug web UI support for Throw notify

Duk_debug.js fixes for Throw notify

- Ignore unknown Notify messages, this is probably a better default than
  being strict and dropping the connection.

- Add Throw notify command number (earlier GC notify was unused).

- Add minimal web UI integration to report "THROW: xxx" or "UNCAUGHT: xxx"
  from Throw notifys

Add 'make rundebug' convenience duk_debug target with logging.
pull/347/head
Sami Vaarala 9 years ago
parent
commit
99a2e78a09
  1. 3
      debugger/Makefile
  2. 9
      debugger/duk_debug.js
  3. 2
      debugger/duk_debugcommands.yaml

3
debugger/Makefile

@ -16,6 +16,9 @@ all: run
run: node_modules static/socket.io-1.2.0.js static/jquery-1.11.1.min.js static/reset.css static/jquery-ui.min.js static/jquery-ui.min.css static/images
$(NODE) duk_debug.js --source-dirs=$(SOURCEDIRS)
rundebug: node_modules static/socket.io-1.2.0.js static/jquery-1.11.1.min.js static/reset.css static/jquery-ui.min.js static/jquery-ui.min.css static/images
$(NODE) duk_debug.js --source-dirs=$(SOURCEDIRS) --verbose --log-messages /tmp/dukdebug-messages --dump-debug-pretty /tmp/dukdebug-pretty
.PHONY: runproxy
runproxy: node_modules static/socket.io-1.2.0.js static/jquery-1.11.1.min.js static/reset.css static/jquery-ui.min.js static/jquery-ui.min.css static/images
$(NODE) duk_debug.js --json-proxy

9
debugger/duk_debug.js

@ -53,6 +53,7 @@ var CMD_STATUS = 0x01;
var CMD_PRINT = 0x02;
var CMD_ALERT = 0x03;
var CMD_LOG = 0x04;
var CMD_THROW = 0x05;
// Commands initiated by the debug client (= us)
var CMD_BASICINFO = 0x10;
@ -1696,9 +1697,13 @@ Debugger.prototype.processDebugMessage = function (msg) {
this.uiMessage('alert', prettyUiStringUnquoted(msg[2], UI_MESSAGE_CLIPLEN));
} else if (msg[1] === CMD_LOG) {
this.uiMessage({ type: 'log', level: msg[2], message: prettyUiStringUnquoted(msg[3], UI_MESSAGE_CLIPLEN) });
} else if (msg[1] === CMD_THROW) {
this.uiMessage({ type: 'throw', fatal: msg[2], message: (msg[2] ? 'UNCAUGHT: ' : 'THROW: ') + prettyUiStringUnquoted(msg[3], UI_MESSAGE_CLIPLEN), fileName: msg[4], lineNumber: msg[5] });
} else {
console.log('Unknown notify, dropping connection: ' + prettyDebugMessage(msg));
this.targetStream.destroy();
// Ignore unknown notify messages
console.log('Unknown notify, ignoring: ' + prettyDebugMessage(msg));
//this.targetStream.destroy();
}
} else {
console.log('Invalid initial dvalue, dropping connection: ' + prettyDebugMessage(msg));

2
debugger/duk_debugcommands.yaml

@ -5,7 +5,7 @@
- Print
- Alert
- Log
- Gc
- Throw
- Reserved_6
- Reserved_7
- Reserved_8

Loading…
Cancel
Save