linux debug技巧和工具
-
print
优点:简单,直接,灵活运用二分法思想
缺点:需要重新编译,运行,比较费时
-
gdb
- starting the program
- stop at specified locations
- stop on specified conditions
- examine required information
- make changes to data in the program etc.
-
ddd
图形化debug界面
-
querying
大部分相关信息保存在/proc目录下
top,htop,ps等命令
-
Taring
- strace
- ltrace
-
Valgrind
- memory leaks
- double freeing
- boundary overruns
- using uninitialized memory
- using a memory after it has been freed etc.
valgrind –tool=memcheck –leak-check=yes test