trying to fix stack tracing

This commit is contained in:
Danny Yoo 2011-08-30 12:53:07 -04:00
parent 2d87115d2d
commit 36e3fb39cf
3 changed files with 33 additions and 2 deletions

View File

@ -419,12 +419,33 @@ var invokeMainModule = function() {
}
},
function(MACHINE, e) {
var contMarkSet, appNames, i, appName;
// On main module invokation failure
if (console && console.log) {
console.log(e.stack || e);
}
MACHINE.params.currentErrorDisplayer(
MACHINE, $(plt.baselib.format.toDomNode(e.stack || e)).css('color', 'red'));
if (e.hasOwnProperty('racketError') &&
plt.baselib.exceptions.isExn(e.racketError)) {
contMarkSet = plt.baselib.exceptions.exnContMarks(e.racketError);
if (contMarkSet) {
appNames = contMarkSet.ref(plt.runtime.getTracedAppKey(MACHINE));
while (plt.baselib.lists.isPair(appNames)) {
appName = appNames.first;
console.log(appName);
MACHINE.params.currentErrorDisplayer(
MACHINE,
$('<div/>').text(' at ' + appName.elts[0] +
', line ' + appName.elts[2] +
', column ' + appName.elts[3])
.css('color', 'red'));
appNames = appNames.rest;
}
}
}
})},
function() {
// On module loading failure

View File

@ -28,9 +28,10 @@
ContinuationMarkSet.prototype.ref = function(key) {
var i, j;
var result = [];
var kvlist;
for (i = 0; i < this.kvlists.length; i++) {
var kvlist = this.kvlists[i];
for (j = 0; j < this.kvlist.length; j++) {
kvlist = this.kvlists[i];
for (j = 0; j < kvlist.length; j++) {
if (baselib.equality.equals(kvlist[j][0], key)) {
result.push(kvlist[j][1]);
}

View File

@ -509,6 +509,14 @@
// Try to get the continuation mark key used for procedure application tracing.
var getTracedAppKey = function(MACHINE) {
if (MACHINE.modules['whalesong/lang/private/traced-app.rkt']) {
return MACHINE.modules['whalesong/lang/private/traced-app.rkt'].namespace['traced-app-key'];
}
return undefined;
};
@ -746,5 +754,6 @@
exports['Struct'] = Struct;
exports['StructType'] = StructType;
exports['getTracedAppKey'] = getTracedAppKey;
}(this.plt, this.plt.baselib));