Debugging/CompiledCode: .gdbinit

File .gdbinit, 3.1 KB (added by simonmar, 9 years ago)
Line 
1# Change $r13 to whatever BaseReg is mapped to
2define pregs
3print *(StgRegTable *)$r13
4end
5
6define ptso
7print *((StgRegTable*)$r13)->rCurrentTSO
8end
9
10define pR1
11print (((StgRegTable)MainRegTable).rR1)
12end
13define pR2
14print (((StgRegTable)MainRegTable).rR2)
15end
16define pR3
17print (((StgRegTable)MainRegTable).rR3)
18end
19define pR4
20print (((StgRegTable)MainRegTable).rR4)
21end
22define pR5
23print (((StgRegTable)MainRegTable).rR5)
24end
25define pR6
26print (((StgRegTable)MainRegTable).rR6)
27end
28define pR7
29print (((StgRegTable)MainRegTable).rR7)
30end
31define pR8
32print (((StgRegTable)MainRegTable).rR8)
33end
34define pFlt1
35print (StgFloat) (((StgRegTable)MainRegTable).rFlt1)
36end
37define pDbl1
38print (StgDouble) (((StgRegTable)MainRegTable).rDbl1)
39end
40
41define pSp
42print (((StgRegTable)MainRegTable).rSp)
43end
44define pSu
45print (((StgRegTable)MainRegTable).rSu)
46end
47define pSpLim
48print (((StgRegTable)MainRegTable).rSpLim)
49end
50
51define pHp
52print (((StgRegTable)MainRegTable).rHp)
53end
54define pHpLim
55print (((StgRegTable)MainRegTable).rHpLim)
56end
57
58# Change $rbp to whatever Sp is mapped to
59define pstk
60pmem $ebp 16
61end
62
63define pstk_gc
64pmem MainTSO->sp 16
65end
66
67define pmem
68set $i = $arg1
69set $mem = ((unsigned long)$arg0) & (sizeof(void*)==8 ? ~7 : ~3)
70while $i > 0
71set $i = $i - 1
72x/1a (((long *)$mem) +$i)
73end
74end
75
76define p4
77pmem $arg0 4
78end
79
80define p8
81pmem $arg0 8
82end
83
84define p16
85pmem $arg0 16
86end
87
88define pmem_forwards
89set $mem = $arg0 & (sizeof(void*)==8 ? ~7 : ~3)
90set $i = 0
91while $i < $arg1
92x/1a (((int *)$mem) + $i)
93set $i = $i + 1
94end
95end
96
97define pheap
98pmem $edi-16 16
99end
100
101define dpc
102display /i $pc
103end
104
105define pinfo
106p *((StgInfoTable *)$arg0-1)
107end
108
109define pcinfo
110p *((StgConInfoTable *)$arg0-1)
111end
112
113define prinfo
114p *((StgRetInfoTable *)$arg0-1)
115end
116
117define pfinfo
118p *((StgFunInfoTable *)$arg0-1)
119end
120
121define pbd
122p sizeof(void *)==8 ? (* ((bdescr *)((($arg0 & 0xfffffffffff00000) | (($arg0 & 0xff000) >> 6)) & 0xffffffffffffffc0))) : * ((bdescr *)((($arg0 & 0xfff00000) | (($arg0 & 0xff000) >> 7)) & 0xffffffe0))
123end
124
125define pgen
126p generations[((bdescr *)((($arg0 & 0xfff00000) | (($arg0 & 0xff000) >> 7)) & 0xffffffe0))->gen_no]
127p * ((bdescr *)((($arg0 & 0xfff00000) | (($arg0 & 0xff000) >> 7)) & 0xffffffe0))->step
128end
129
130define getmark
131set $bd = (bdescr *)((($arg0 & 0xfff00000) | (($arg0 & 0xff000) >> 7)) & 0xffffffe0)
132set $offset = (StgPtr)$arg0 - $bd->start
133set $bitmap_word = $bd->u.bitmap + ($offset / 32)
134set $mask = 1 << ($offset & 31)
135p (*$bitmap_word & $mask) != 0
136end
137
138define getmark64
139set $bd = (bdescr *)((($arg0 & 0xfffffffffff00000) | (($arg0 & 0xff000) >> 6)) & 0xffffffffffffffc0)
140set $offset = (StgPtr)$arg0 - $bd->start
141set $bitmap_word = $bd->u.bitmap + ($offset / 64)
142set $mask = 1 << ($offset & 63)
143p (*$bitmap_word & $mask) != 0
144end
145
146# ignore SIGPIPEs
147handle SIGPIPE nostop noprint ignore
148
149define debug1
150p RtsFlags.DebugFlags.interpreter=1
151p RtsFlags.DebugFlags.apply=1
152p RtsFlags.DebugFlags.sanity=1
153end
154
155define debug2
156p RtsFlags.DebugFlags.interpreter=1
157p RtsFlags.DebugFlags.sanity=1
158end
159
160define sanity
161p RtsFlags.DebugFlags.sanity=1
162end
163
164define srch
165print findPtr($1,0)
166end
167define chain
168print findPtr($1,1)
169end