Bug 487684 - Store the last trace PC to pass into the decompiler. r=igor

This commit is contained in:
Blake Kaplan 2009-04-10 14:06:28 -07:00
Родитель 8dde9a922d
Коммит 5e45c9c2e3
4 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -1607,7 +1607,7 @@ js_ReportValueErrorFlags(JSContext *cx, uintN flags, const uintN errorNumber,
#if defined DEBUG && defined XP_UNIX
/* For gdb usage. */
void js_traceon(JSContext *cx) { cx->tracefp = stderr; cx->tracePrevOp = JSOP_LIMIT; }
void js_traceon(JSContext *cx) { cx->tracefp = stderr; cx->tracePrevPc = NULL; }
void js_traceoff(JSContext *cx) { cx->tracefp = NULL; }
#endif

Просмотреть файл

@ -932,7 +932,7 @@ struct JSContext {
char *lastMessage;
#ifdef DEBUG
void *tracefp;
JSOp tracePrevOp;
jsbytecode *tracePrevPc;
#endif
/* Per-context optional error reporter. */

Просмотреть файл

@ -2104,9 +2104,10 @@ js_TraceOpcode(JSContext *cx)
* Operations in prologues don't produce interesting values, and
* js_DecompileValueGenerator isn't set up to handle them anyway.
*/
if (cx->tracePrevOp != JSOP_LIMIT && regs->pc >= fp->script->main) {
ndefs = js_GetStackDefs(cx, &js_CodeSpec[cx->tracePrevOp],
cx->tracePrevOp, fp->script, regs->pc);
if (cx->tracePrevPc && regs->pc >= fp->script->main) {
JSOp tracePrevOp = JSOp(*cx->tracePrevPc);
ndefs = js_GetStackDefs(cx, &js_CodeSpec[tracePrevOp], tracePrevOp,
fp->script, cx->tracePrevPc);
/*
* If there aren't that many elements on the stack, then
@ -2159,7 +2160,7 @@ js_TraceOpcode(JSContext *cx)
}
fprintf(tracefp, " @ %u\n", (uintN) (regs->sp - StackBase(fp)));
}
cx->tracePrevOp = op;
cx->tracePrevPc = regs->pc;
/* It's nice to have complete traces when debugging a crash. */
fflush(tracefp);
@ -7288,6 +7289,10 @@ js_Interpret(JSContext *cx)
ok &= js_UnwindScope(cx, fp, 0, ok || cx->throwing);
JS_ASSERT(regs.sp == StackBase(fp));
#ifdef DEBUG
cx->tracePrevPc = NULL;
#endif
if (inlineCallCount)
goto inline_return;

Просмотреть файл

@ -1882,7 +1882,7 @@ Tracing(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
if (cx->tracefp && cx->tracefp != stderr)
fclose((FILE *)cx->tracefp);
cx->tracefp = file;
cx->tracePrevOp = JSOP_LIMIT;
cx->tracePrevPc = NULL;
return JS_TRUE;
bad_argument: