[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / runtime / main / StgTrace.lc
1 \begin{code}
2
3 #include "rtsdefs.h"
4
5 #if defined(DO_RUNTIME_TRACE_UPDATES)
6
7 /********** Debugging Tracing of Updates ***********/
8
9 /* These will only be called if StgUpdate.h macro calls
10    compiled with -DDO_RUNTIME_TRACE_UPDATES
11  */
12
13 extern I_ traceUpdates; /* a Bool, essentially */
14
15 void
16 TRACE_UPDATE_Ind(updclosure,heapptr)
17 P_ updclosure,heapptr;
18 {
19 #if defined(GCap)
20     if (traceUpdates) {
21         fprintf(stderr,"Upd Ind %s Gen: 0x%lx -> 0x%lx\n",
22                 (updclosure) <= StorageMgrInfo.OldLim ? "Old" : "New",
23                 (W_) updclosure, (W_) heapptr);
24     }
25 #else
26     if (traceUpdates) {
27         fprintf(stderr,"Upd Ind: 0x%lx -> 0x%lx\n",
28                         (W_) updclosure, (W_) heapptr);
29     }
30 #endif
31 }
32
33 void
34 TRACE_UPDATE_Inplace_NoPtrs(updclosure)
35 P_ updclosure;
36 {
37 #if defined(GCap)
38     if (traceUpdates) {
39         fprintf(stderr,"Upd Inplace  %s Gen: 0x%lx\n",
40                 (updclosure) <= StorageMgrInfo.OldLim ? "Old" : "New",
41                 (W_) updclosure);
42     }
43 #else
44     if (traceUpdates) {
45         fprintf(stderr,"Upd Inplace: 0x%lx\n", (W_) updclosure);
46     }
47 #endif
48 }
49
50 void
51 TRACE_UPDATE_Inplace_Ptrs(updclosure, hp)
52 P_ updclosure;
53 P_ hp;
54 {
55 #if defined(GCap)
56     if (traceUpdates) {
57         if ((updclosure) <= StorageMgrInfo.OldLim) {
58             fprintf(stderr,"Upd Redirect Old Gen (Ptrs): 0x%lx -> 0x%lx\n",
59                     (W_) updclosure,
60                     (W_) (hp + 1));
61         } else {
62             fprintf(stderr,"Upd Inplace  New Gen (Ptrs): 0x%lx\n", (W_) updclosure);
63         }
64     }
65 #else
66     if (traceUpdates) {
67         fprintf(stderr,"Update Inplace: 0x%lx\n", (W_) updclosure);
68     }
69 #endif
70 }
71
72 #endif /* DO_RUNTIME_TRACE_UPDATES */
73
74 \end{code}