iOS模拟器应用程序的终端命令行调试? [英] Terminal command-line debug of iOS Simulator apps?
问题描述
是否可以在Mac OS X的终端命令行中使用GDB或LLDB来调试在iOS模拟器上运行的应用程序? (例如,不是从Xcode的GUI或控制台中,而是使用外部命令行或进程).如果可以,怎么办?
Is it possible to use GDB or LLDB from the Terminal command-line under Mac OS X to debug apps running on the iOS Simulator? (e.g. not from within Xcode's GUI or console, but using an external command-line or process). If so, how?
推荐答案
您需要已经在模拟器的Springboard中安装了该应用;您无法从Xcode在模拟器中启动该应用,然后期望能够将gdb的命令行实例附加到该应用.
You'll need to have the app already in the simulator's Springboard; you can't launch the app in the simulator from Xcode and then expect to be able to have a command line instance of gdb attach to it.
所以:
- 运行iOS模拟器,并且已经将您的应用程序加入其中.
- 在终端窗口中:
% gdb
...
(gdb) attach --waitfor 'Name Of Your App'
- 从模拟器Springboard启动您的应用.
- gdb应该在执行
main()
之前附加到进程.因此,您可以设置一些断点或其他任何内容.然后:
- Launch your app from the simulator Springboard.
- gdb should attach to the process before
main()
is executed. So you can set some breakpoints, or whatever. Then:
(gdb) continue
lldb
的过程类似:
% lldb
(lldb) process attach -n 'Name Of Your App' --waitfor
<launch your app in the simulator>
(lldb) continue
我不确定为什么要这样做,但是作为老命令行gdb(和dbx),我会很感激. :-)
I am not sure why you'd want or need to do this, but as an old command line gdb (and dbx) guy, I can appreciate it. :-)
这篇关于iOS模拟器应用程序的终端命令行调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!