Terminal command-line debug of iOS Simulator apps?

给你一囗甜甜゛ 提交于 2019-12-20 10:12:46

问题


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?


回答1:


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.

So:

  1. Run the iOS Simulator, having already gotten your app into it.
  2. In a terminal window:
    % gdb
    ...
    (gdb) attach --waitfor 'Name Of Your App'
  1. Launch your app from the simulator Springboard.
  2. gdb should attach to the process before main() is executed. So you can set some breakpoints, or whatever. Then:
    (gdb) continue

The procedure for lldb is similar:

    % lldb
    (lldb) process attach -n 'Name Of Your App' --waitfor
    <launch your app in the simulator>
    (lldb) continue

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. :-)



来源:https://stackoverflow.com/questions/10112164/terminal-command-line-debug-of-ios-simulator-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!