【gcc】:
1、编译四步骤:
预处理:gcc -E test.c -o test.i
编译: gcc -S test.i -o test.s
汇编: gcc -c test.s -o test.o
连接: gcc test.o -o test.out
2、指定输出文件名称:gcc test.c -o test.out
3、显示编译时的详细信息、编译器的版本、编译过程等 gcc -v
4、加入gdb调试信息 gcc -g
5、打开所有警告信息 gcc -Wall
6、使用优化选项 gcc -Ox 【x为0 1 2 3,0为不优化,等效于不加-O0】
7、增加备选头文件目录 gcc -l /home/xxx/xxx
8、增加首选库文件目录 gcc -L /home/xxx/xxx
9、生成静态连接库文件 gcc -static
【gdb】:
1、打开待调试文件【两种方式】:
a> gdb test.out
b> gdb
file test.out
2、开始执行程序【=右边是命令的缩写】
start =st
3、run
4、continue
5、step
6、break
a> 使能断点
b> 清除断点
7、display
8、print
9、watch
10、kill
11、frame
12、quit
13、backtrace
14、set
15、info
16、next
17、list
18、file
19、文件窗口的打开关闭及切换:src register assemble cmd
a>
b>
c>
d>
e>
f>
g>
【objdump】:
【nm】:
【readelf】: