步骤:
01,c代码:
include
void f1(){ printf("f1---\n");
int main(){
printf("hello, world\n");
f1();
return 0;
}
02,用clang编译c代码(xcode 5.0.1)
/Applications/xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot
/Applications/xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -o g01 g01.c
03, file g01
g01: Mach-O executable arm
nm g01
0000bfb4 s stub helpers
00004000 T _mhexecute_header
0000bf6c T _f1
0000bf88 T _main
U _printf
U dyld_stub_binder
04, scp g01 到 iphone 4上( iOS7.1.2)
05, ./debugserver -x backboard *:1234 ./g01
- /Application/xcode/Xcode.app/Contents/Developer/usr/bin/lldb
process connect connect://192.168.0.3:1234
b main 失败
br s -a 0xbf88 成功
但是c的时候, 无法断住,程序直接运行完了, 请问可能什么原因?
07, 用了image list 也不行
(lldb) image list -o -f
[ 0] 0x000f9000 /Users/GNN/Library/Developer/Xcode/iOS DeviceSupport/7.1.2 (11D257)/Symbols/usr/lib/dyld
(lldb) br s -a '0xf9000 + 0xbf88'
Breakpoint 1: address = 0x00104f88
(lldb) br list
Current breakpoints:
1: address = 0x00104f88, locations = 1, resolved = 1
1.1: address = 0x00104f88, resolved, hit count = 0
(lldb) c
Process 1395 resuming
(lldb) hello, world
f1---
Process 1395 exited with status = 0 (0x00000000)