- Stack traces now include the names and values of variables for each frame. (Specifically, it lists
this
, then any function parameters, then any local variables.) - The logcontrol.plist entries for controlling stack traces have been removed. Instead, when the debug console is connected, they can be controlled with the properties
debugConsole.dumpStackForErrors
anddebugConsole.dumpStackForWarnings
(default:true
; changes are persisted in preferences). Without the debug console, stack traces are not dumped by default but can be enabled with the hidden settings “dump-stack-for-errors” and “dump-stack-for-warnings”. - When the debug console is connected, a stack trace can be dumped at any time with the
debugger;
statement. Without the debug console, this does nothing and takes essentially zero time. - Stack traces are always dumped when the time limiter kills a script.
Code: Select all
this.name = "debuggerTest";
this.version = "1.0";
this.shipWillLaunchFromStation = function shipWillLaunchFromStation(station)
{
function doStuff()
{
var somethingStrangeHappened = (station == system.mainStation);
if (somethingStrangeHappened)
{
log("debuggerTest.strangeness", "Something strange happened!");
debugger;
}
}
doStuff();
}
Code: Select all
[debuggerTest.strangeness]: Something strange happened!
[script.javaScript.debugger]: debugger invoked during debuggerTest 1.0:
[script.javaScript.stackTrace]: 0 /Users/jayton/Library/Application Support/Oolite/AddOns/script.js:12 doStuff()
[script.javaScript.stackTrace]: this: [object Global]
[script.javaScript.stackTrace]: somethingStrangeHappened: true
[script.javaScript.stackTrace]: 1 /Users/jayton/Library/Application Support/Oolite/AddOns/script.js:16 shipWillLaunchFromStation()
[script.javaScript.stackTrace]: this: [Script "debuggerTest" version 1.0]
[script.javaScript.stackTrace]: station: [Station "Coriolis Station" "Coriolis Station" position: (-49515.3, 60769.4, 427622) scanClass: CLASS_STATION status: STATUS_ACTIVE]
[script.javaScript.stackTrace]: doStuff: function doStuff