[Linux] gdb debugging

Understanding common suffix

  • .c source code file
  • .s assembly source code files
  • .h header file
  • .I file after preprocessing
  • .o object files

gcc option

  • -o filename executable file
  • -c generate an object file
  • -S generated assembly file
  • -g generate an executable file containing debugging information
  • The pre-generated files -E
  • -Wall output all warning
  • -w Inhibit all warning
  • -Dmacro Assign Macro
  • -I dir Add search directory of header files default / usr / include
  • -L dir Add search catalog file default / usr / lib
  • -static static library link

Proof of an executable file

Pretreatment

gcc -E talkback.c -o talkback.i
ls
more talkback.i

compilation

gcc -S talkback.i -o talkback.s
ls
more talkback.s

Object code files

gcc -c talkback.s -o talkback.o
ls
more talkback.o

Executable file

gcc -o talk talkback.o
ls
./talk

Guess you like

Origin www.cnblogs.com/tailiang/p/11802340.html