Remove uses of stderr from .cmm code.
We can't reliably refer to stdin/stdout/stderr from .cmm, because the
C standard doesn't specify whether stderr is a variable or a macro.
// fn is in R1, no args on the stack
IF_DEBUG(apply,
- foreign "C" fprintf(W_[stderr] "ptr", stg_ap_0_ret_str);
+ foreign "C" debugBelch(stg_ap_0_ret_str);
foreign "C" printClosure(R1 "ptr"));
IF_DEBUG(sanity,
* the info was only displayed for an *uncaught* exception.
*/
if (RtsFlags_ProfFlags_showCCSOnException(RtsFlags)) {
- foreign "C" fprintCCS(W_[stderr] "ptr",W_[CCCS] "ptr");
+ foreign "C" fprintCCS_stderr(W_[CCCS] "ptr");
}
#endif
Sp(2) = R1;
Sp(1) = size;
Sp(0) = stg_gc_fun_info;
- // DEBUG_ONLY(foreign "C" fprintf(stderr, "stg_fun_gc_gen(ARG_GEN)"););
+ // DEBUG_ONLY(foreign "C" debugBelch("stg_fun_gc_gen(ARG_GEN)"););
GC_GENERIC
} else {
jump W_[stg_stack_save_entries + WDS(type)];
StgWeak_link(w) = W_[weak_ptr_list];
W_[weak_ptr_list] = w;
- IF_DEBUG(weak, foreign "C" fprintf(W_[stderr] "ptr",stg_weak_msg,w));
+ IF_DEBUG(weak, foreign "C" debugBelch(stg_weak_msg,w));
RET_P(w);
}
fprintf(f,">");
}
+/* For calling from .cmm code, where we can't reliably refer to stderr */
+void
+fprintCCS_stderr( CostCentreStack *ccs )
+{
+ fprintCCS(stderr, ccs);
+}
+
#ifdef DEBUG
void
debugCCS( CostCentreStack *ccs )
extern lnat RTS_VAR(total_prof_ticks);
extern void fprintCCS( FILE *f, CostCentreStack *ccs );
+extern void fprintCCS_stderr( CostCentreStack *ccs );
#ifdef DEBUG
extern void debugCCS( CostCentreStack *ccs );