Software Debug¶
Overview¶
GDB¶
- GDB: The GNU Project Debugger
- gdb Debugging Full Example (Tutorial): ncurses
- GDB - Debugging stripped binaries
- 一次调试C++程序的艰苦历程
- 图文并茂 | 彻底弄懂GDB调试原理
Build¶
Start GDB¶
Usage¶
Bash
(gdb) directory
(gdb) show directories
(gdb) set args xxx
(gdb) show args
(gdb) i r
(gdb) set print pretty
(gdb) p /d var # /x /o /t /f /c
(gdb) p &var
(gdb) p var = 20
(gdb) p sizeof(long)
(gdb) set print array on
(gdb) x addr
(gdb) bt
(gdb) info frame
(gdb) info args
(gdb) info locals
(gdb) info catch
Debug Utils¶
-
dmesg
-
readelf
-
strace
-
addr2line
-
nm: list symbols from object files
-
strip
-
Backward-cpp: a beautiful stack trace pretty printer for C++
-
od: dump files in octal and other formats
-
objdump: display information from object files
-
ldd: print shared object dependencies
-
WinDbg
- 不仅可以用于Kernel模式调试和用户模式调试,还可以调试Dump文件
- Dump文件是进程的内存镜像,可以把程序的执行状态通过调试器保存到dump文件中
-
SxsTrace: 跟踪调试应用程序