Red Hat Developer Toolset
delivers the latest stable versions of essential GCC C, C++, Fortran, and supporting development
tools to enhance developer productivity and improve deployment times. html
About GCC version, recommend to use the latest version,
wihle adding new features to compiler, it may introduce some ABI changes and new defects(especially c++11)
if we use a third-party lib complied with gcc of a different version, sometimes it may cause link failure(backwards compatibility).
https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html (part 3)
https://gcc.gnu.org/wiki/Cxx11AbiCompatibility
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.htmllinux
linux so information:
readelf vs objdump : recommend to use readelf
https://stackoverflow.com/questions/8979664/readelf-vs-objdump-why-are-both-neededc++
direct dependency: readelf -d
recursive ones : lddui
elf sections: .comment debug symtab text
gcc version : readelf -p .comment elf-filespa
check whether elf is compiled with '-g' (debugging)
1) use gdb
2) readelf -S elf //to see if there are .debug_x sections
- readelf --debug-dump=decodeline elf // to show section:.debug_line
3)if Elf are built with '-gsplit-dwarf', it would generate *.dwo to contain debug info
find its path in .debug_str線程
Windbg 概念debug
Local cache MS Symbol Store Symbol (search) Path調試
.symfix (path) : 把 Store 覆蓋 Symbol Path (不須要記憶官方地址)c++11
.symfix+ path : 把Store 添加到已有Symbol Pathcode
.sympath (path) : 顯示(覆蓋)當前Symbol Path
Source: src path 只要相對路徑不被破壞,只需指定一處(源文件的根目錄),windbg會自動關聯。
- 須要的src path一般是包含在pdb文件中,只有在加載pdb後可知,好比打印堆
load executable/ dump file / attach to process |
|
lm 查看模塊及是否加載symbol !lmi module-name 查看模塊的symbol 位置
~ 顯示thread數 ~ NO. S 切換thread
K顯示堆 .frame NO. 前往指定堆
查找符號斷點 - 根據k 顯示的符號 - X [<*|module>!]<*|symbol> - view symbols Bp function-name & bc 刪除
打開源文件, 若是沒設置對路徑,無反應 .open -a function-name
調試 g – run p – step over t – step in
查看變量 dv varialble
|
i sh 查看加載的動態模塊
Info threads 查看線程 thread NO. 切換線程
bt 堆 frame NO 前往指定堆
查看符號斷點 - Info functions 查看有的符號 - b functon-name / delete NO. 刪除斷點 - info b 查看breakpoints
Info sources 查看引用source 路徑 Show directories 來查看source search path 使用set directories / substitute-path 來設置目錄 List - 當前行 list function / NO.
Debug r – run n – step over s - step into c - continue
Variables p variable set variable = new-v |
提供了 查看map, list 命令 |
Info args / where / condition / (force) return |