简体   繁体   English

如何在xcode 5.1中使用gdb调试器

[英]How to use gdb debugger with xcode 5.1

Xcode 5.1 no longer officially supports GDB, instead defaulting only to LLDB. Xcode 5.1不再正式支持GDB,而是仅默认为LLDB。 The problem with LLDB is that it shows no useful debug information on app crashes. LLDB的问题在于,它没有显示有关应用程序崩溃的有用调试信息。 Furthermore, all Exception Breakpoints simply break on main.m. 此外,所有的异常断点仅在main.m上中断。 This makes debugging ridiculously tedious. 这使调试变得非常乏味。 I read here on SO that this is a common problem with LLDB and that GDB does a better job. 我在这里读到SO,这是LLDB的常见问题,而GDB做得更好。

How do I enable GDB for xcode 5.1? 如何为Xcode 5.1启用GDB?

There is no way to use gdb with more recent Xcodes. 无法将gdb与更新的Xcode一起使用。

I don't know what you mean by "it shows no useful debug information on app crashes." 我不知道您的意思是“它在应用程序崩溃时没有显示有用的调试信息”。 Probably best to file a bug with bugreporter.apple.com with some more detail, there may be a way to get lldb to work correctly for you. 最好向bugreporter.apple.com提交错误的详细信息,也许有一种使lldb为您正常工作的方法。

I am also not sure what you are seeing when you say "all Exception Breakpoints break on main.m". 我也不确定当您说“所有异常断点都在main.m上中断”时,您看到的内容。 If you go to the lldb console and do: 如果转到lldb控制台并执行以下操作:

(lldb) break list (lldb)中断列表

are the breakpoints actually on main.m? 断点实际上在main.m上吗?

One thing to be a little careful about with the Xcode 5 Debugging UI (maybe this started with 4, I can't remember.) When your program stops due to a crash or exception in a stack frame that starts with frames that have no debug information, Xcode will actually select the first frame up the stack that has debug information. 使用Xcode 5调试UI时要小心一点(也许是从4开始的,我不记得了。)当您的程序由于崩溃或堆栈框架中的异常而停止时,该框架以没有调试的框架开始信息,Xcode实际上将选择堆栈中具有调试信息的第一帧。 This is to avoid showing people screens full of disassembly, which some folks find frightening... So the source frame will show, say, main.m, though the actual bottom-most frame is something else. 这是为了避免向人们显示充满反汇编的屏幕,有些人对此感到恐惧...因此,源框架将显示例如main.m,尽管实际最底部的框架还有其他内容。

Xcode also has a "stack compression" feature that will hide "uninteresting" frames. Xcode还具有“堆栈压缩”功能,可以隐藏“无趣的”帧。 That can also make this kind of stop confusing - though it will generally show the bottom-most frame you might miss that and only see your source frame. 这也可能使这种停止混乱-尽管它通常会显示您可能会错过的最底端的帧,而只会看到您的源帧。 The stack compression can be turned off if you don't like it. 如果您不喜欢,可以关闭堆栈压缩。

Make sure that is not what you are seeing. 确保那不是您所看到的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM