/* -----------------------------------------------------------------------------
- * $Id: Printer.c,v 1.49 2001/11/28 15:43:23 simonmar Exp $
+ * $Id: Printer.c,v 1.50 2001/12/06 14:33:02 simonmar Exp $
*
* (c) The GHC Team, 1994-2000.
*
printClosure(obj);
}
-static void printStdObject( StgClosure *obj, char* tag )
+static inline void
+printStdObjHdr( StgClosure *obj, char* tag )
{
- StgWord i, j;
- const StgInfoTable* info = get_itbl(obj);
fprintf(stdout,"%s(",tag);
printPtr((StgPtr)obj->header.info);
#ifdef PROFILING
fprintf(stdout,", %s", obj->header.prof.ccs->cc->label);
#endif
+}
+
+static void
+printStdObject( StgClosure *obj, char* tag )
+{
+ StgWord i, j;
+ const StgInfoTable* info;
+
+ printStdObjHdr( obj, tag );
+
+ info = get_itbl(obj);
for (i = 0; i < info->layout.payload.ptrs; ++i) {
fprintf(stdout,", ");
printPtr((StgPtr)obj->payload[i]);
fprintf(stdout,")\n");
}
-void printClosure( StgClosure *obj )
+void
+printClosure( StgClosure *obj )
{
StgInfoTable *info;
case MUT_VAR:
{
StgMutVar* mv = (StgMutVar*)obj;
- fprintf(stderr,"MUT_VAR(var=%p, link=%p)\n", mv->var, mv->mut_link);
+ fprintf(stdout,"MUT_VAR(var=%p, link=%p)\n", mv->var, mv->mut_link);
break;
}
}
case FOREIGN:
- fprintf(stderr,"FOREIGN(");
+ fprintf(stdout,"FOREIGN(");
printPtr((StgPtr)( ((StgForeignObj*)obj)->data ));
- fprintf(stderr,")\n");
+ fprintf(stdout,")\n");
break;
case IND:
break;
case THUNK_SELECTOR:
- printStdObject(obj,"THUNK_SELECTOR");
- break;
+ printStdObjHdr(obj, "THUNK_SELECTOR");
+ fprintf(stdout, ", %p)\n", ((StgSelector *)obj)->selectee);
+ break;
case ARR_WORDS:
{
putchar(arrWordsGetChar(obj,i));
} */
for (i=0; i<((StgArrWords *)obj)->words; i++)
- fprintf(stderr, "%ld", ((StgArrWords *)obj)->payload[i]);
- fprintf(stderr,"\")\n");
+ fprintf(stdout, "%ld", ((StgArrWords *)obj)->payload[i]);
+ fprintf(stdout,"\")\n");
break;
}
sp++;
small_bitmap:
while (bitmap != 0) {
- fprintf(stderr," stk[%ld] (%p) = ", spBottom-sp, sp);
+ fprintf(stdout," stk[%ld] (%p) = ", spBottom-sp, sp);
if ((bitmap & 1) == 0) {
printPtr((P_)*sp);
fprintf(stdout,"\n");
} else {
- fprintf(stderr,"Word# %ld\n", *sp);
+ fprintf(stdout,"Word# %ld\n", *sp);
}
sp++;
bitmap = bitmap >> 1;
break;
}
}
- fprintf(stderr,"Stack[%ld] (%p) = ", spBottom-sp, sp);
+ fprintf(stdout,"Stack[%ld] (%p) = ", spBottom-sp, sp);
sp = printStackObj(sp);
}
}
if (*q == (W_)p) {
if (i < arr_size) {
r = q;
- while (!LOOKS_LIKE_GHC_INFO(*r)) { r--; };
+ while (!LOOKS_LIKE_GHC_INFO(*r) || *r == NULL) {
+ r--;
+ }
fprintf(stdout, "%p = ", r);
printClosure((StgClosure *)r);
arr[i++] = r;