summaryrefslogtreecommitdiffstats
path: root/tools/debugscripts/gdbinit.vinum
blob: 7ddfb5e989444435907e16f59fb44a6017877030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# $FreeBSD$
# gdb macros for debugging Vinum.
# This file gets included from the .gdbinit files in 
# the kernel build directory and /var/crash.
# Normally you won't need to include it directly.
# see gdbinit(9) for further details.

# Show information about the request pointed to by the variable rq in the current frame.
define rq
rqq rq
end
document rq
Show information about the request pointed to by the variable rq in the current frame.
end

# Show information about the request (struct rq) pointed at by the parameter
define rqq
set $rq = (struct request *) $arg0
printf "Request: \n" 
output/x *$rq
printf "\n"
bpp $rq->bp
set $rqg = $rq->rqg
while ($rqg != 0)
  printf "\nRequest group at %x:\n", $rqg
  output/x *$rqg
  printf "\n"
  set $rqno = 0
  while ($rqno < $rqg->count)
    printf "rqg->rqe [%d]: ", $rqno
    rrqe &$rqg->rqe[$rqno]
    set $rqno = $rqno + 1
    end
  set $rqg = $rqg->next
  end
end
document rqq
Show information about the request (struct rq) pointed at by the parameter
end

# Show information about the request element pointed to by the variable rqe in the current frame.
define rqe
rrqe rqe
end
document rqe
Show information about the request element pointed to by the variable rqe in the current frame.
end

# Show information about the request element (struct rqe) pointed at by the parameter.
define rrqe
set $rqe = (struct rqelement *) $arg0
    printf "sdoffset 0x%x, useroffset 0x%x, dataoffset 0x%x, datalen 0x%x, groupoffset 0x%x, grouplen 0x%x, buflen 0x%x\n", \
      $rqe->sdoffset, \
      $rqe->useroffset, \
      $rqe->dataoffset, \
      $rqe->datalen, \
      $rqe->groupoffset, \
      $rqe->grouplen, \
      $rqe->buflen
    printf "  Flags 0x%x,  Subdisk %d  Drive %d\n", \
      $rqe->flags, \
      $rqe->sdno, \
      $rqe->driveno
    bpp &$rqe->b
end
document rrqe
Show information about the request element (struct rqe) pointed at by the parameter.
end

define rqq0
printf "rq->prq [0].rqe[0].sdno: " 
output/x rq->prq[0].rqe[0].sdno
printf "\nBuffer: device: " 
output/x rq->prq[0].rqe[0].b.b_dev
printf " data: " 
output/x rq->prq[0].rqe[0].b.b_data
printf " length: " 
output/x rq->prq[0].rqe[0].b.b_bcount
printf " drive offset: " 
output/x rq->prq[0].rqe[0].b.b_blkno
printf " subdisk offset: " 
output/x rq->prq[0].rqe[0].sdoffset
printf "\nFlags: " 
if (rq->prq[0].rqe[0].b.b_flags & 0x10)
printf "busy "
end
if (rq->prq[0].rqe[0].b.b_flags & 0x200)
printf "done "
end
if (rq->prq[0].rqe[0].b.b_flags & 0x800)
printf "error "
end
if (rq->prq[0].rqe[0].b.b_flags & 0x100000)
printf "read "
end
output/x rq->prq[0].rqe[0].b.b_flags
printf "\nrq->prq [0].rqe[1].sdno: " 
output/x rq->prq[0].rqe[1].sdno
printf "\nBuffer: device: " 
output/x rq->prq[0].rqe[1].b.b_dev
printf " data: " 
output/x rq->prq[0].rqe[1].b.b_data
printf " length: " 
output/x rq->prq[0].rqe[1].b.b_bcount
printf " drive offset: " 
output/x rq->prq[0].rqe[1].b.b_blkno
printf " subdisk offset: " 
output/x rq->prq[0].rqe[1].sdoffset
printf "\nFlags: " 
output/x rq->prq[0].rqe[1].b.b_flags
echo \n
end
define rqq1
printf "\nrq->prq [1].rqe[0].sdno: " 
output/x rq->prq[1].rqe[0].sdno
printf "\nBuffer: device: " 
output/x rq->prq[1].rqe[0].b.b_dev
printf " data: " 
output/x rq->prq[1].rqe[0].b.b_data
printf " length: " 
output/x rq->prq[1].rqe[0].b.b_bcount
printf " drive offset: " 
output/x rq->prq[1].rqe[0].b.b_blkno
printf " subdisk offset: " 
output/x rq->prq[1].rqe[0].sdoffset
printf "\nFlags: " 
output/x rq->prq[1].rqe[0].b.b_flags
printf "\nrq->prq [1].rqe[1].sdno: " 
output/x rq->prq[1].rqe[1].sdno
printf "\nBuffer: device: " 
output/x rq->prq[1].rqe[1].b.b_dev
printf " data: 0x%x  length 0x%x  drive offset 0x%x  sd offset 0x%x\n" rq->prq[1].rqe[1].b.b_data,
 rq->prq[1].rqe[1].b.b_bcount,
 rq->prq[1].rqe[1].b.b_blkno,
 rq->prq[1].rqe[1].sdoffset
printf "\nFlags: " 
output/x rq->prq[1].rqe[1].b.b_flags
echo \n
end
define xy
bpp
echo stripeoffset
p stripeoffset
echo stripebase
p stripebase
echo sdno
p sdno
echo sdoffset
p sdoffset
echo rqe->sectors
p rqe->sectors
echo rqe->sdoffset
p rqe->sdoffset
end
# kernel equivalent of 'info -V'
define rqi
   set $rqipe = rqip
   set $rqip = $rqipe + 1
   set $rqend  = rqinfo + 128
   if ($rqip == $rqend)
      set $rqip = rqinfo
   end
   set $done = 0
   while ($done == 0)
     if ($rqip->bp != 0)
        printf "%X:\t%d.%06d\tUBP: %x\t", $rqip, $rqip->timestamp.tv_sec, $rqip->timestamp.tv_usec, $rqip->bp
        p $rqip->type
	printf " user  "
        bpp $rqip->bp
        if ($rqip->type < loginfo_rqe)
	   printf " copied"
           bpp &$rqip->info
        else 
           rrqe &$rqip->info
        end
      end
      set $rqip = $rqip + 1
      if ($rqip == $rqipe)
         set $done = 1
      end
      if ($rqip == $rqend)
         set $rqip = rqinfo
      end
   end
end
define rqinfo
   set $rqipe = rqip
   set $rqip = $rqipe + 1
   set $rqend  = rqinfo + 128
   if ($rqip == $rqend)
      set $rqip = rqinfo
   end
   set $done = 0
   printf "\nTime\t\t\t Event\t\t     Buf\tDev\t  Offset\tBytes\tSD\tSDoff\tDoffset\tGoffset\n\n"
   while ($done == 0)
     if ($rqip->bp != 0)
        printf "%d.%06d\t", $rqip->timestamp.tv_sec, $rqip->timestamp.tv_usec
	if ($rqip->type ==  loginfo_user_bp)
	  if ($rqip->info.b.b_flags & 0x00100000)
	    printf "1VS Read"
	  else
	    printf "1VS Write"
	  end
	printf "\t%p\t%d.%d\t0x%-9x\t%ld\n", $rqip->bp, $rqip->devmajor, $rqip->devminor & 0xff, $rqip->info.b.b_blkno, $rqip->info.b.b_bcount
	end
	
      if ($rqip->type == loginfo_user_bpl)
	  if ($rqip->info.b.b_flags & 0x00100000)
	    printf "2LR Read"
	  else
	    printf "2LR Write"
	  end
	printf "\t%p\t%d.%d\t0x%-9x\t%ld\n", $rqip->bp, $rqip->devmajor, $rqip->devminor & 0xff, $rqip->info.b.b_blkno, $rqip->info.b.b_bcount
	end
	 
      if ($rqip->type == loginfo_rqe)
	  if ($rqip->info.b.b_flags & 0x00100000)
	    printf "3RQ Read"
	  else
	    printf "3RQ Write"
	  end
	printf "\t%p\t%d.%d\t0x%-9x\t%ld\t%d\t%x\t%x\t%x\n", $rqip->bp, $rqip->devmajor, $rqip->devminor & 0xff, $rqip->info.rqe.b.b_blkno, $rqip->info.rqe.b.b_bcount, $rqip->info.rqe.sdno, $rqip->info.rqe.sdoffset, $rqip->info.rqe.dataoffset, $rqip->info.rqe.groupoffset
	end
	
      if ($rqip->type == loginfo_iodone)
	  if ($rqip->info.b.b_flags & 0x00100000)
	    printf "4DN Read"
	  else
	    printf "4DN Write"
	  end
	printf "\t%p\t%d.%d\t0x%-9x\t%ld\t%d\t%x\t%x\t%x\n", $rqip->bp, $rqip->devmajor, $rqip->devminor & 0xff, $rqip->info.rqe.b.b_blkno, $rqip->info.rqe.b.b_bcount, $rqip->info.rqe.sdno, $rqip->info.rqe.sdoffset, $rqip->info.rqe.dataoffset, $rqip->info.rqe.groupoffset
	end
	
      if ($rqip->type == loginfo_raid5_data)
	  if ($rqip->info.b.b_flags & 0x00100000)
	    printf "5RD Read"
	  else
	    printf "5RD Write"
	  end
	printf "\t%p\t%d.%d\t0x%-9x\t%ld\t%d\t%x\t%x\t%x\n", $rqip->bp, $rqip->devmajor, $rqip->devminor & 0xff, $rqip->info.rqe.b.b_blkno, $rqip->info.rqe.b.b_bcount, $rqip->info.rqe.sdno, $rqip->info.rqe.sdoffset, $rqip->info.rqe.dataoffset, $rqip->info.rqe.groupoffset
	end
	
      if ($rqip->type == loginfo_raid5_parity)
	  if ($rqip->info.b.b_flags & 0x00100000)
	    printf "6RP Read"
	  else
	    printf "6RP Write"
	  end
	printf "\t%p\t%d.%d\t0x%-9x\t%ld\t%d\t%x\t%x\t%x\n", $rqip->bp, $rqip->devmajor, $rqip->devminor & 0xff, $rqip->info.rqe.b.b_blkno, $rqip->info.rqe.b.b_bcount, $rqip->info.rqe.sdno, $rqip->info.rqe.sdoffset, $rqip->info.rqe.dataoffset, $rqip->info.rqe.groupoffset
	end

      if ($rqip->type == loginfo_sdio)
	  if ($rqip->info.b.b_flags & 0x00100000)
	    printf "7VS Read"
	  else
	    printf "7VS Write"
	  end
	printf "\t%p\t\t  0x%-9x\t%ld\t%d\n", $rqip->bp, $rqip->info.b.b_blkno, $rqip->info.b.b_bcount, $rqip->devminor & 0xff
	end

      if ($rqip->type == loginfo_sdiol)
	  if ($rqip->info.b.b_flags & 0x00100000)
	    printf "8LR Read"
	  else
	    printf "8LR Write"
	  end
	printf "\t%p\t%d.%d\t0x%-9x\t%ld\n", $rqip->bp, $rqip->devmajor, $rqip->devminor & 0xff, $rqip->info.b.b_blkno, $rqip->info.b.b_bcount
	end
	 
      if ($rqip->type == loginfo_lockwait)
	printf "Lockwait  %p\t%d\t  0x%x\n", $rqip->bp, $rqip->info.lockinfo.plexno, $rqip->info.lockinfo.stripe
	end

      if ($rqip->type == loginfo_lock)
	printf "Lock      \t%p\t%d\t  0x%x\n", $rqip->bp, $rqip->info.lockinfo.plexno, $rqip->info.lockinfo.stripe
	end

      if ($rqip->type == loginfo_unlock)
	printf "Unlock    \t%p\t%d\t  0x%x\n", $rqip->bp, $rqip->info.lockinfo.plexno, $rqip->info.lockinfo.stripe
	end

	if ($rqip->type == loginfo_sdiodone)
	  if ($rqip->info.b.b_flags & 0x00100000)
	    printf "9DN Read"
	  else
	    printf "9DN Write"
	  end
	printf "\t%p\t\t  0x%-9x\t%ld\t%d\n", $rqip->bp, $rqip->info.b.b_blkno, $rqip->info.b.b_bcount, $rqip->devminor
	end

	end
      set $rqip = $rqip + 1
      if ($rqip == $rqipe)
         set $done = 1
      end
      if ($rqip == $rqend)
         set $rqip = rqinfo
      end
   end
end 
document rqinfo
Show the Vinum request log buffer, like 'vinum info -V'
end
define meminfo
y
printf "Block\t\tTime\t\tSequence\t  size\t  address\t  line\t\tfile\n"
set $i = 0
while $i < malloccount
  printf "%6d\t%10d.%06d\t%6d\t\t%6d\t0x%08x\t%6d\t\t%s\n", $i, malloced [$i].time.tv_sec, malloced [$i].time.tv_usec, malloced [$i].seq, malloced[$i].size, malloced[$i].address, malloced[$i].line, &malloced[$i].file
  set $i = $i + 1
end
end
document meminfo
Equivalent of 'vinum info -v' command
end
define finfo
y
printf "Block\t\tTime\t\tSequence\t  size\t  address\t  line\t\tfile\n"
set $i = lastfree
set $j = 0
while $j < 64
  if $i == 64
    set $i = 0
  end
  if freeinfo[$i].line != 0
    printf "%6d\t%10d.%06d\t%6d\t\t%6d\t0x%08x\t%6d\t\t%s\n", $i, freeinfo [$i].time.tv_sec, freeinfo [$i].time.tv_usec, freeinfo [$i].seq, freeinfo[$i].size, freeinfo[$i].address, freeinfo[$i].line, &freeinfo[$i].file
  end
  set $i = $i + 1
  set $j = $j + 1
end
end
document finfo
Equivalent of 'vinum info -v' command
end
OpenPOWER on IntegriCloud