当使用Xcode 4.5调试c ++时,逐步停止代码正在停止STL代码 [英] Stepping through the code is stopping on STL code when debugging c++ with Xcode 4.5

查看:160
本文介绍了当使用Xcode 4.5调试c ++时,逐步停止代码正在停止STL代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用Xcode 4.5调试c ++代码,用llvm 4.1编译。

I try to debug c++ code with Xcode 4.5, compiled with llvm 4.1. The code is very simple, just inserting several items to a map.

当我跨越STL函数时,执行停止在STL代码中,而不是像往常一样执行步骤。

When I step over STL functions, the execution stops inside STL code, instead of performing the step as usual.

当我使用LLVM-GCC 4.2编译时,调试是很好的,但是这个编译器没有C ++ 11支持。

When I compile using LLVM-GCC 4.2 the debug is just fine, but this compiler doesn't have C++11 support.

之前有人遇到过这个问题,知道是否可以修复它?

Did anyone encounter this problem before, and knows if it can be fixed?

推荐答案

在Xcode 4.5.x中不支持逐步调用内联函数。 C ++ 11标准库具有积极的功能内联,即使在-O0时构建,因此这个问题尤其明显。内置的步进支持已添加到lldb,v。 http:// llvm .org / viewvc / llvm-project?view = rev& revision = 163044 ,可在 http://lldb.llvm.org/ ,但是您将无法使用这些源代替Xcode中的lldb(自4.5发布以来API已更改)。

The lldb in Xcode 4.5.x doesn't have support for stepping over inlined functions. The C++11 standard library has aggressive function inlining even when built at -O0 so this problem is especially obvious. Inlined stepping support has since been added to lldb, v. http://llvm.org/viewvc/llvm-project?view=rev&revision=163044 and is available for use in the sources at http://lldb.llvm.org/ but you won't be able to replace the lldb inside Xcode with these sources (the APIs have changed since 4.5 was released).

注意,逐步调用内联函数 - 使它们在调试器中工作时看起来像真正的函数 - 是一个复杂的功能,并且调试中的不准确clang生成的信息可能会导致错误的步进行为。由于调试信息不​​足或者lldb中的错误,有一些(仍然会有)无法正常工作的情况 - 这很难得到100%的权利。

Note that stepping over inlined functions -- making them appear to be "real" functions as you work in the debugger -- is a complicated feature and any inaccuracies in the debug information generated by clang can cause bad stepping behavior. There are (and still will be) corner cases that don't work properly either because of insufficient debug information or because of bugs in lldb - this is tricky to get 100% right.

您可以尝试通过放置

settings set target.process.thread.step-avoid-regexp ^[^ ]+ std::|^std::

〜/ .lldbinit 文件中。我不认为这将有助于内联函数,但如果对stdlib方法的调用不在线,它将至少跨过它。

in your ~/.lldbinit file. I don't think this will help with inlined functions but if a call to a stdlib method is out of line it will at least step over it.

这篇关于当使用Xcode 4.5调试c ++时,逐步停止代码正在停止STL代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆