-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcmd.gdb
More file actions
79 lines (68 loc) · 1.04 KB
/
cmd.gdb
File metadata and controls
79 lines (68 loc) · 1.04 KB
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
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2022 Iruatã Martins dos Santos Souza
define dstk
echo T\040\040\040\040
print/x $rax
set $p = $rbp
while $p < &dstack0
x/gx $p
set $p = $p + 8
end
end
define rstk
set $p = $rsp
while $p < $R0
x/gx $p
set $p = $p + 8
end
end
define state
dstk
echo \n
rstk
end
define instate
echo inpos\040\040
print/x (short)inpos
echo inbuflen\040\040
print/x (short)inbuflen
end
define dh
x/gx $arg0
x/gx $arg0+8
x/bx $arg0+16
set $namelen = (char)*($arg0+16)
set $i = 0
while $i < $namelen
x/c ($arg0+16+1+$i)
set $i = $i + 1
end
end
define ddict
set $word = $arg0
while $word != 0
dh $word
set $word = *$word
end
end
define findcfa
set $word = $arg1
while $word != 0
set $cfa = $word+8
if *$cfa == $arg0
dh $word
loop_break
end
set $word = *$word
end
end
document dh
Dump a header starting at address given as first argument
end
define go
step
state
end
break main
run
set $R0 = $rsp