Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
319 views
in Technique[技术] by (71.8m points)

c++ - Debugger steps deeper when trying to step out of C++11 std lib

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).

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).

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.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...