1.complileGCC:gcc -Wall -o2 -g file.cppMAKEFILE:CFLAGS = -Wall -o2 -gconfigure:./configure CFLAGS='-Wall -o2 -g'
2.gdb filename [core file] file core.29724 core.29724: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from './a.out'
3.commandset breakpoint : break -> bb function-nameb line-numberb file-name:line-numberb file-name:function-nameb +/- offsetb *address
注释:+/- offset :从当前位置的偏移行数*address 代码段内的地址example:info breakNum Type Disp Enb Address What2 breakpoint keep y 0x4112 in main(int, char**) at /home/lt/src/test/src/test.cpp:27
run -a(gdb)run -a
backtrace -> btbtbt N/-Nbt fullbt full N/-Nbt number
.info register -> info regrax 0x7ffff102cf40 1216rbx 0x4940d0 4800720rcx 0xb 11rdx 0x7fffffffe248 7720rsi 0x1 1rdi 0x7fffffffe10f 7407rbp 0x7fffffffe0c0 0x7fffffffe0c0rsp 0x7fffffffd040 0x7fffffffd040r8 0x0 0r9 0x5241564e20524148 59271792r10 0x4c422 5494989895845890115r11 0x7ffff0d3e740 7168r12 0x40f840 4257856r13 0x7fffffffe240 7712r14 0x0 0r15 0x0 0rip 0x453c98 0x453c98
显示register内容,使用$号:p $raxp/格式x 16进制d 10u 无符号十进制o 8t 2进制,twoa 地址c asciif 浮点s 字串i 机器语言