-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgdbinit
70 lines (60 loc) · 1.22 KB
/
gdbinit
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
# Tell 'list' command to show 50 lines.
set listsize 50
# Pretty print arrays.
set print array on
# Pretty print structures.
set print pretty on
# Print object's derived type based on vtable info.
set print object on
# Print source filename and line number with <symbol>.
set print symbol-filename on
# History.
set history filename ~/.cache/gdb/history
set history save on
set history expansion on
define history
show commands
end
document history
Print list of recent commands.
end
define pl
info args
info locals
end
document pl
Print locals (args and stack).
end
define cls
shell clear
end
document cls
Clear the terminal screen.
end
define ps
print $arg0.c_str()
end
document ps
Print value of <string> which is a C++ string.
end
define pws
echo "
set $c = (wchar_t*)$arg0
while ( *$c )
if ( *$c > 0x7f )
printf "[%x]", *$c
else
printf "%c", *$c
end
set $c++
end
echo "\n
end
document pws
Print value of <wide_string> which is a C++ wchar_t* or wstring.
end
# Give some hints.
echo gdb command aliases:\n
echo \ \ pl: print locals\n
echo \ \ ps STR: print value of C++ std::string STR\n
echo \ \ pws STR: print value of C++ std::wstring STR\n