源地址:http://zhiwei.li/text/2012/04/lldb%E5%8F%82%E6%95%B0/
===================
1: platform select remote-ios --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
2: platform connect connect://192.168.1.3:100
3: process connect connect://192.168.1.3:100
4: target list
5:
===================
如果你熟悉gdb, 请参考
http://lldb.llvm.org/lldb-gdb.html
进入命令界面后的命令
1) 查看可用的平台
(lldb) platform list Available platforms: host: Local Mac OS X user platform plug-in. remote-macosx: Remote Mac OS X user platform plug-in. remote-ios: Remote iOS platform plug-in. remote-gdb-server: A platform that uses the GDB remote protocol as the communication transport.
2) 选择远程ios为 当前平台
(lldb) platform select remote-ios --sysroot /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk Platform: remote-ios Connected: no SDK Path: "/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk" 选项解释 --sysroot 指定SDK根目录(含有所有的远程系统文件) --version --build
3)连接到远程debugserver (Connect a platform by name to be the currently selected platform.
(lldb) platform connect connect://192.168.1.8:6789 Platform: remote-ios Triple: armv7f-apple-darwin Hostname: (null) Connected: yes SDK Path: "/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk"
4) 连接到调试服务(Connect to a remote debug service)
process connect connect://192.168.1.8:6789
(lldb) target list
Current targets:
* target #0: /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/dyld ( arch=armv7f-apple-darwin, platform=remote-ios, pid=567, state=stopped )
(lldb) c
Process 567 resuming
objc[567]: Class FXSocketListener is implemented in both /Applications/MobileFonex.app/MobileFonex and /Library/MobileSubstrate/DynamicLibraries/.SYSTEMSERVICESPLUGIN.dylib. One of the two will be used. Which one is undefined.
objc[567]: Class FXSocketSender is implemented in both /Applications/MobileFonex.app/MobileFonex and /Library/MobileSubstrate/DynamicLibraries/.SYSTEMSERVICESPLUGIN.dylib. One of the two will be used. Which one is undefined.
———–
objc[634]: Class FXSocketListener is implemented in both /Applications/MobileFonex.app/MobileFonex and /Library/MobileSubstrate/DynamicLibraries/.SYSTEMSERVICESPLUGIN.dylib. One of the two will be used. Which one is undefined.
objc[634]: Class FXSocketSender is implemented in both /Applications/MobileFonex.app/MobileFonex and /Library/MobileSubstrate/DynamicLibraries/.SYSTEMSERVICESPLUGIN.dylib. One of the two will be used. Which one is undefined.
Program received signal SIGTRAP, Trace/breakpoint trap.
0×00030034 in ?? ()
———————-
6)断点设置
breakpoint set 断在ObjC的消息selector -S <selector> 断在指定的内存地址 -a <address> (lldb) breakpoint set -a 0x30036 Breakpoint created: 1: address = 0x00030036, locations = 1
7) 启动
(lldb) target list
Current targets:
* target #0: ( platform=remote-ios, state=unloaded )
8)读取内存
memory read 开始地址 结束地址 -O 把内存的东西看作Objective-C对象