1、GNU Assoc

1.1 GCC options

std c++lib

$ g++ -O2 -Wall -Wextra -pthread -I./include -std=C++11 prog.cc

1.2 GDB usage

Start

https://www.ibm.com/developerworks/cn/linux/sdk/gdb/index.html

gcc option: -g

gcc -g a.c -o a

**mount to remote server ** mount -t nfs -o nolock 10.82.20.97:/home/crash /tmp/crash

gdb start:

gdb exe [pid|-c core-dump-file]

basical command

  • run ; start prog
  • break 22 ; create a breakpoint at line 21
  • next ; step next line
  • continue ; go exec
  • print val ; display variable ‘val’
  • info break ; display all break
  • bt ; backtrace: display stack frames
  • frame 1 ; switch to frame 1{current frame 0}
  • set val=1 ; set variable ‘val’ to 1
  • quit ; exit gdb