GDB: basics

Before Debugging, generating the debugging info using gcc -g3 *.c/cpp;

then gdb ~.out/exe

using commands:

b [n]      set breakpoint at line n

r        [re]run the program

l        look the code around cur-line

n        step into

c        continue run

x/nfu &i    check ram after i. n=int; f=2t8o16x float(f), char(c), string(s),instruction(i), unsigned decimal(u), address(a); u=bhwg, byte/short/int/double

p i        print var i value

p/x i      print i as hex

 

create a file named debugscript: r command parameters..

run gdb and input souce debugscript.. start running script with that script...

posted on 2016-07-18 20:11  三叁  阅读(146)  评论(0)    收藏  举报

导航