自从更新到iOS 5和Xcode 4.2之后,看来Xcode在运行完成时不再打印"Program ended with exit code: #"
。还有其他人注意到这一点吗,有什么办法可以再次启用它吗?我有一个自动测试工具,依靠此输出来确定测试是否通过,因此将其恢复将非常有帮助。
更新:我对此进行了更详细的研究,这似乎是一个更深层次的问题。看来,每当我运行一个应用程序时,它就会因退出时的分段错误而崩溃。有时,这恰好在退出代码打印之前发生,有时恰好在之后,这就是为什么退出代码消息出现不一致的原因。 seg故障消息出现在设备的控制台中,尽管Xcode调试输出中没有任何内容。
最佳答案
我也注意到了这一点。在Xcode 4.1(tty /dev/ttys000
)中,gdb
似乎是这样启动的:
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
但是在Xcode 4.2中-没有
tty /dev/ttys000
:This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
要解决此问题,您可以从命令行(Terminal.app/iTerm/etc)执行以下操作:
echo 'tty /dev/ttys000' >> ~/.gdbinit
# Or, put it into the global gdb config:
# echo 'tty /dev/ttys000' >> /etc/gdb.conf
然后重新启动Xcode,然后返回退出代码!
自4.1以来,似乎Xcode 4.2的gdb包装器已更改
[ 13:29 Jonathan@MacBookPro / ]$ ls -l /Developer/Library/Xcode/PrivatePlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB /Developer-4.2/Library/Xcode/PrivatePlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB
-rwxrwxr-x 1 root admin 351936 Sep 20 13:23 /Developer/Library/Xcode/PrivatePlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB
-rwxrwxr-x 1 root admin 353776 Oct 8 14:21 /Developer-4.2/Library/Xcode/PrivatePlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB
[ 13:33 Jonathan@MacBookPro / ]$ ls -l /Developer/Library/Xcode/PrivatePlugIns/DebuggerGDB.ideplugin/Contents/MacOS/DebuggerGDB /Developer-4.2/Library/Xcode/PrivatePlugIns/DebuggerGDB.ideplugin/Contents/MacOS/DebuggerGDB
-rwxrwxr-x 1 root admin 1976144 Sep 20 13:23 /Developer/Library/Xcode/PrivatePlugIns/DebuggerGDB.ideplugin/Contents/MacOS/DebuggerGDB
-rwxrwxr-x 1 root admin 1948240 Oct 8 14:21 /Developer-4.2/Library/Xcode/PrivatePlugIns/DebuggerGDB.ideplugin/Contents/MacOS/DebuggerGDB