当试图走出C ++ 11 std lib时,调试器会更深入 [英] Debugger steps deeper when trying to step out of C++11 std lib

查看:204
本文介绍了当试图走出C ++ 11 std lib时,调试器会更深入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Xcode 4.5中使用(Apple)LLVM 4.1(但是在较早版本的测试版中我看到了同样的事情)。
我有它针对C ++ 11,并使用libc ++(新的,C ++ 11启用,LLVM版本的std库)。

I'm using (Apple) LLVM 4.1 within Xcode 4.5 (but I saw the same thing in an earlier beta). I have it targeting C++11 and am using libc++ (the new, C++11 enabled, LLVM version of the std library).

调试版本,如果我尝试将调用进入std库函数的代码(例如std :: vector构造函数)调试器停止在std lib实现中,并且如果我尝试走出更深入的步骤!
在我回到自己的代码之前,可能需要几个(有时甚至是10个或更多)的步骤(而且我从来没有想过这个代码)。

In a debug build, if I try to step over code that calls into a std library function (e.g. a std::vector constructor) the debugger stops in the std lib implementation and if I try to step out it steps even deeper! It can take several (sometimes 10 or more) step-outs before I get back to my own code (and I never wanted to step in in this first place).

看起来似乎有一个_LIBCPP_DEBUG宏,以及_LIBCPP_INLINE_VISIBILITY - 但是这些宏似乎都是无处不在,所以我不知道这是一个相关性。尽管如此,它似乎与内联工作方式有关,但似乎似乎是有道理的。

There always seems to be a _LIBCPP_DEBUG macro in view, as well as _LIBCPP_INLINE_VISIBILITY - but these seem to be everywhere so I'm not sure it's a correlation. It does seem plausible that it has something to do with the way inlining is working, though.

我无法找到任何其他人出现此问题的示例 - 对于我来说,它已经持续到几个版本 - 发布 - 通过完全重新安装操作系统。

I've not been able to find any examples of anyone else with this problem - yet, for me, it has persisted across several betas - into the release - and through a complete reinstall of the OS.

有其他人甚至看到 / em>这个? - 但是最好还是知道发生了什么事情?

Has anyone else even seen this? - but better still knows what's going on?

推荐答案

Xcode 4.5中的lldb不处理内联函数。 libc ++标准库具有许多函数,它们始终是内联的,即使在-O0上构建时,这也是一个问题。一个月前,Jim Ingham看起来像这样做,例如请参阅第一个补丁 http://llvm.org/viewvc/llvm-project ?view = rev& revision = 163044 和几个后续修补程序在接下来的一两个星期,但当然这些还没有发布的lldb版本。您可以从公共网站构建和使用lldb的命令行版本, http://lldb.llvm.org/(特别参见 http://lldb.llvm.org/build.html ),唯一棘手的一点是记住按照lldb / docs / code-signature.txt中的代码签名指示。

lldb in Xcode 4.5 doesn't handle stepping over inlined functions. The libc++ standard library has many functions that are always inlined, even when built at -O0, which makes this a problem. It looks like Jim Ingham worked on this about a month ago, e.g. see the first patch http://llvm.org/viewvc/llvm-project?view=rev&revision=163044 and several follow-on patches over the following week or two, but of course those aren't in a released version of lldb yet. You can build and use a command line version of lldb from the public site, http://lldb.llvm.org/ (see in particular http://lldb.llvm.org/build.html ), the only tricky bit is to remember to follow the code signing instructions in lldb/docs/code-signing.txt.

这篇关于当试图走出C ++ 11 std lib时,调试器会更深入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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