iOS:调试在 XCode 中不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5323529/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:31:16  来源:igfitidea点击:

iOS: Debugging not working in XCode

xcodedebuggingios

提问by cmart

I'm using XCode 4and iOS SDK 4.3.My debugging worked fine but now i discovered that when setting a breakpoint, the app pauses but XCode doesn't focus on the line in the Editor. Also the green arrow is not displayed when hitting the break point. I have a UINavigationControllerwhich is allocated in the AppDelegate. When i set a breakpoint in the didFinishLaunchingWithOptionseverything works as expected:

我正在使用XCode 4并且iOS SDK 4.3.我的调试工作正常,但现在我发现在设置断点时,应用程序暂停但 XCode 不关注编辑器中的行。到达断点时也不会显示绿色箭头。我有一个UINavigationControllerAppDelegate. 当我在didFinishLaunchingWithOptions一切按预期工作时设置断点:

enter image description here

在此处输入图片说明

This is when i a breakpoint has paused the app in the mapViewController which is the first item added to the navigation controller. (No green arrow but app is paused):

这是当 ia 断点暂停 mapViewController 中的应用程序时,它是添加到导航控制器的第一个项目。(没有绿色箭头但应用程序已暂停):

enter image description here

在此处输入图片说明

I really have no clue why debugging is working in AppDelegate but not in this controller. If you need additional info or screenshots in order to help me, please tell me.

我真的不知道为什么调试在 AppDelegate 中有效,但在这个控制器中无效。如果您需要其他信息或屏幕截图来帮助我,请告诉我。

UPDATE:

更新:

Now it's even not working in AppDelegateand changed nothing. I can also step through the lines and can see that values are assigned in the Locals and can therefore guess where the app is currently in the code. So obviously everything works, just the currently executed line is not marked as it should.

现在它甚至无法正常工作AppDelegate并且没有任何改变。我还可以逐行查看在 Locals 中分配的值,因此可以猜测应用程序当前在代码中的位置。所以很明显一切正常,只是当前执行的行没有被标记为它应该的。

回答by vokilam

In xCode4:

在 xCode4 中:

  • Your Project Name -> Edit Scheme
  • Info tab (in run configuration)
  • Set Build Configuration to "Debug", Debugger - to "LLDB" ("GDB" was before)
  • Run your project
  • 您的项目名称 -> 编辑方案
  • 信息选项卡(在运行配置中)
  • 将构建配置设置为“调试”,调试器 - 设置为“LLDB”(“GDB”之前是)
  • 运行你的项目

Worked for me. For "LLDB" green line is visible. Switching back to "GDB" brings me to this issue again.

对我来说有效。对于“LLDB”,绿线可见。切换回“GDB”再次让我想到这个问题。

回答by Levi

I have the same problem. XCode 4 just stops debugging but it doesn't display any errors. When I opened the SYSTEM console, I found this:

我也有同样的问题。XCode 4 只是停止调试,但不显示任何错误。当我打开SYSTEM控制台时,我发现了这个:

3/26/11 4:04:13 PM  Xcode[214]  [MT] Warning in /SourceCache/IDEDebugger/IDEDebugger-208/PlugIns/DebuggerGDB/DevToolsIDE/GDBMIDebuggingPlugin/GDBMI_Adaptor/PBXGDB_StackSequences.m:556
Details:  An unexpected error when executing stack-list-frames-lite : Previous frame inner to this frame (gdb could not unwind past this frame). Please attach your gdb log to your bug report.
Object:   <PBXGDB_UpdateStackSequence: 0x202a57b40>
Method:   -handleErrorForMICommand:
Thread:   <NSThread: 0x200020700>{name = (null), num = 1}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.

I have had this problem since XCode 3.2 and I have tried every solution I could find for it, but I have never been able to resolve it. At least XCode 3.2 told me the error. XCode 4 just stops working.

从 XCode 3.2 开始我就遇到了这个问题,我已经尝试了我能找到的所有解决方案,但我一直无法解决它。至少 XCode 3.2 告诉了我这个错误。XCode 4 停止工作。

Update:sorry forgot the answer part. Several people have solved this problem by switching their compiler to GCC for the project AND ALL projects that it is linked to. Others have deleted their symbol file for their device version and XCode re-downloaded them and it started working. Niether work for me, but hopefully one will work for you.

更新:抱歉忘记了答案部分。有几个人通过将项目及其链接到的所有项目的编译器切换到 GCC 来解决这个问题。其他人已经删除了他们设备版本的符号文件,XCode 重新下载了它们并开始工作。Niether 对我来说有效,但希望一个会为你工作。

回答by xlarsx

Try changing the compiler: "GCC_VERSION = com.apple.compilers.llvmgcc42" to "GCC_VERSION = com.apple.compilers.llvm.clang.1_0"

尝试更改编译器:“GCC_VERSION = com.apple.compilers.llvmgcc42”到“GCC_VERSION = com.apple.compilers.llvm.clang.1_0”

Then compile and run again

然后再次编译运行

Greetings

你好