Xcode 7调试器不会中断内联标头功能

Xcode 7调试器不会中断内联标头功能

问题描述:

过去五年来,我一直将Xcode与各种C ++项目一起使用,而没有出现此问题。今天,我打开了一个较旧的项目(大约2年),并试图通过在该文件中放置活动断点来调试头文件中的内联函数。出于某种原因,调试器不会中断此代码。但是,如果我在调用此函数的.cpp文件中放置一个断点,则可以单步执行该函数的每一行。然后我注意到头文件中定义的所有(内联)函数都在发生这种情况。

I have been using Xcode with various C++ projects for the last five years without this issue. Today, I opened one of my older projects (~2 years old) and tried to debug an inline function in a header file by placing an active breakpoint within that function. For some reason, the debugger will not break on this code. However, if I put a breakpoint in the .cpp file where this function is called, I can step into and through each line of the function. I then noticed that this is happening for all (inline) functions defined in header files.

我以前从未遇到过此问题。我还有其他类似的项目没有这种行为-断点无处不在。

I have never had this problem before. I have other, similar, projects that do not exhibit this behaviour - breakpoints work everywhere.

我相信Xcode使用LLDB作为调试器-我将在哪里开始寻找

I believe that Xcode uses LLDB as the debugger - where would I start looking for a project setting that might cause this?

构建时没有相关的编译器警告。

I have no relevant compiler warnings when building.

我可能有在较新的Xcode中打开旧项目时,更新为推荐设置-这可能已更改了一些相关内容,尽管我不确定。我已经更新了其他项目,但没有发生此问题。

I may have "updated to recommended settings" when opening the old project in the newer Xcode - this may have changed something related, although I'm not sure what. I have updated other projects and not had this problem happen.

我正在El Capitan上使用Xcode 7。

I am using Xcode 7 on El Capitan.

让它正常工作!最后,此 Apple Developer Thread 包含解决方案:在调试器提示符下手动设置断点:

Got it working! finally, this Apple Developer Thread contained the solution: set manually the breakpoint from the debugger prompt:

(lldb) br s --file framework.ipp --line 577 

在此位置中断,同时从Xcode设置断点(使用8.3,但在4、5、6和7时存在相同的问题)不起作用。我尝试了许多其他解决方案,但没有一个完成这项工作。

breaks as expected, while setting the breakpoint from Xcode (using 8.3, but had the same problem with 4, 5, 6 and 7) in this location does not work. I tried many other solutions, and none of them did the job.