天天看點

GDB調試

gdb調試:資料http://dsec.pku.edu.cn/~yuhj/wiki/gdb.html

一般來說gdb主要調試的是c/c++的程式。要調試c/c++的程式,首先

在編譯時,我們必須要把調試資訊加到可執行檔案中。使用編譯器(

cc/gcc/g++)的 -g 參數可以做到這一點.

> cc -g hello.c -o hello

> g++ -g hello.cpp -o hello

list  set listsize  search forward-search reverse-search

r    break    n     c     p    finish    q    step

break if   -- condition

backtrace bt 棧

watch  rwatch  - awatch   info watchpoints

clear  delete  disable enable

info threads -- break frik.c:13 thread 28 if bartab > lim

記憶體

info line tst.c:func

disassemble func -- dump

p 位址@長度