调试器在 xCode 4 中不存在的断点处停止

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5308971/
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:30:38  来源:igfitidea点击:

Debugger stopping at a non existent breakpoint in xCode 4

iphonexcodedebuggingxcode4breakpoints

提问by user278859

Since upgrading to xCode 4 my app stops at what I think are non existent break points. When it breaks there is no breakpoint showeing and the editor says "Thread:1 Stopped at breakpoint 17". Looking in the Breakpoint navigator there is not breakpoint 17 anywhere and the line it is stopping on is not listed anywhere.

由于升级到 xCode 4,我的应用程序在我认为不存在的断点处停止。当它中断时,没有断点显示,编辑器说“线程:1 在断点 17 处停止”。查看断点导航器,任何地方都没有断点 17,并且它停止的行没有在任何地方列出。

Anyone else seeing this? Is this something new, maybe?

还有人看到这个吗?这可能是新东西吗?

John

约翰

回答by fluke

Maybe it's a XCode's bug but still got solution.

也许这是 XCode 的错误,但仍然有解决方案。

You can use LLDB to see and manipulate all the actual breakpoints.

您可以使用 LLDB 来查看和操作所有实际断点。

just type command in lldb window.

只需在 lldb 窗口中键入命令。

(lldb) is the prompt.

(lldb) help    -> for help
(lldb) help breakpoint   -> for breakpoint subcommand's help
(lldb) breakpoint list    -> list all the breakpoints.
(lldb) breakpoint delete  -> Delete the specified breakpoint(s).  If no breakpoints are
               specified, delete them all.
(lldb) breakpoint delete 7.1   -> delete breanpoint 7.1

and, you can use this command to continue the program:
(lldb) c

回答by GameLoading

check the break point do as follow.

检查断点如下。

press command+alt+bto see all breakpoints.

command+alt+b查看所有断点。

select the breakpoint that you want to remove and press delete.

选择要删除的断点,然后按delete

回答by Akku

user278859's answer is basically really a true answer, as this seems to be a bug in Xcode 4. I just had the same problem. I set a breakpoint at one place in a UIWebView delegate's shoudlStartLoadWithRequest-method (no other active breakpoints in the project) and the debugger stops in another method (in this case repeatedly webViewDidFinishLoad:) of the same object.

user278859 的回答基本上是一个真实的答案,因为这似乎是 Xcode 4 中的一个错误。我刚刚遇到了同样的问题。我在 aUIWebView delegateshoudlStartLoadWithRequest-method 的一个地方设置了一个断点(项目中没有其他活动断点),调试器在webViewDidFinishLoad:同一个对象的另一种方法(在这种情况下重复)中停止。

So I'd say this is an Xcode bug. Found no way of fixing this btw., other than removing the above breakpoint ... Screenshot:

所以我会说这是一个 Xcode 错误。顺便说一句,除了删除上述断点之外,没有找到解决此问题的方法......截图:

enter image description here

在此处输入图片说明

回答by user278859

Ok, I deleted the only breakpoint in the offending class which was no where near the line where the debugger was breaking and the problem went away.

好的,我删除了违规类中唯一的断点,该断点离调试器中断的行不远,问题就消失了。

Fasttracks, thanks for the suggestion. I am using xCode 4 and command+alt+b no longer works. There is now a Breakpoint Navigator where all the brekpoints are listed. There was no breakpoint in the list that corresponded to the line where the break was happening.

快速通道,感谢您的建议。我正在使用 xCode 4 并且 command+alt+b 不再有效。现在有一个断点导航器,其中列出了所有断点。列表中没有与发生中断的行相对应的断点。

回答by Kelvin

I have the same problem before, I think its an Xcode bug. You may check if there any unwanted breakpoints created by Xcode in Breakpoint Navigator (cmd 6), delete them and it should be fine.

我以前也遇到过同样的问题,我认为这是 Xcode 的错误。您可以在 Breakpoint Navigator (cmd 6) 中检查 Xcode 创建的任何不需要的断点,删除它们应该没问题。

回答by Totty.js

Open the Breakpoints view: alt+shift+5 and then right click in the empty space and hit "delete all". It will actually remove the not existent breakpoints.

打开 Breakpoints 视图:alt+shift+5 然后在空白处右键单击并点击“全部删除”。它实际上会删除不存在的断点。

回答by Vladimir Vodolazkiy

I found one additional case when such breakpoint is activated:

当这种断点被激活时,我发现了另一种情况:

If you set breakpoint on the code, which is actually is not compiled for selected target this part of code is not highlighted or marked, and breakpoint is set actually elsewhere in this file where debugger consider is as close as it can.

如果您在代码上设置断点,实际上并未针对选定目标编译该部分代码,则该部分代码不会突出显示或标记,并且断点实际上设置在此文件中调试器考虑尽可能接近的其他位置。

So you need to be sure that code, where breakpoint is set is compiled :-)

因此,您需要确保已编译设置断点的代码:-)

回答by Honey

Not knowing what exactly Swift error breakpointis...I had enabled it by doing such:

不知道Swift 错误断点究竟是什么......我通过这样做启用了它:

enter image description here

在此处输入图片说明

Guess what happens?!

猜猜会发生什么?!

It will act like a breakpoint on errors thrown by your owncode, i.e. wherever you use a throwstatement.

它就像是您自己的代码抛出的错误的断点,即无论您在何处使用throw语句。

For more see hereand here

有关更多信息,请参阅此处此处

回答by Snowcrash

Xcode 4 introduced an Exception breakpoint which seems to be on by default. i.e. when there's an exception it breaks.

Xcode 4 引入了一个异常断点,默认情况下它似乎处于开启状态。即当有异常时它会中断。

This will catch an exception even if you haven't clicked the Breakpoints button.

即使您没有单击 Breakpoints 按钮,这也会捕获异常。

You can check via the Debug Navigator whether it's been triggered - you'll see an "objc_exception_throw".

您可以通过调试导航器检查它是否已被触发 - 您将看到“objc_exception_throw”。