xcode

xcode

C/C++/OC编译工具
mac clang
ubuntu gcc

编译生成可执行程序
clang -g -O2 -o helloworld helloworld.c -I… -L… -l
-g输出文件中的调试信息
-O对输出文件做指令优化
-o输出文件
-I指定头文件
-L指定库文件位置
-l指定使用哪个库
-c生成库文件 clang -g -c add.c -> add.o
libtool -static -o libmylib.a add.o
clang -g -o testlib testlib.c -I . -L .-lmylib

Gdb/lldb调试器
b 设置断点
r 运行程序
n 单步执行
s 跳入函数
finish 跳出函数
p 打印内容
c
quit

cd hellowrold.dSYM/Contents/Resources/DWARF
dwarfdump xx.xxx

You must be logged in to post a comment