Rod*_*osa 6 c++ debugging lldb libc++ xcode4.4
当我尝试在c ++上进行列表迭代调试时遇到问题.
我做了一个简单的测试应用:
int main(int argc, const char * argv[])
{
// insert code here...
std::cout << "Hello, World!\n";
std::list<int> list;
list.push_back(1);
list.push_back(2);
--> list.push_back(3); //Line before step over
for (std::list<int>::const_iterator i = list.begin(); i != list.end(); i++)
{
std::cout << *i << std::endl;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在调试时,当我在标有箭头的行上时,当我跳过时,它开始踩踏来自c ++文件的代码:'list'.我必须跨越15次,直到它最终到达for语句中的代码.
此问题仅发生在Xcode 4.4中.在Xcode 4.3中,调试工作得很好.
这里有一些不同的场景,结果不同:
在我正在开发的项目中,我们正在使用Apple LLVM编译器4.0和libc ++(支持C++ 11的LLVM C++标准库),所以我需要为场景3解决这个问题.
有谁知道会发生什么,以及是否有解决方法?
这是 lldb / llvm 与 libc++ 交互的问题,自从我们启用它以来我就看到了它,尽管我认为只有 libc++ / lldb 开发人员才能知道那是什么。
虽然这不是一个解决方案,但这似乎是 llvm 3.1(Xcode 4.5 的当前版本)的命令行问题。如果我做:
clang++ -g -O0 -stdlib=libc++ -std=c++11 test.cpp -o test
lldb test
breakpoint set --file test.cpp --line 8
Run Code Online (Sandbox Code Playgroud)
...然后尝试使用 'n' 逐步执行直到 main 结束,它跳转到列表的源代码:
* thread #1: tid = 0x1c03, 0x00000001000010a2 test`main [inlined] std::__1::__list_imp<int, std::__1::allocator<int> >::begin() at list:543, stop reason = step over
frame #0: 0x00000001000010a2 test`main [inlined] std::__1::__list_imp<int, std::__1::allocator<int> >::begin() at list:543
540 {
541 #if _LIBCPP_DEBUG_LEVEL >= 2
542 return iterator(__end_.__next_, this);
-> 543 #else
544 return iterator(__end_.__next_);
545 #endif
546 }
Run Code Online (Sandbox Code Playgroud)
我同意,这确实减慢了开发/调试时间,应该向lldb 开发人员报告
| 归档时间: |
|
| 查看次数: |
928 次 |
| 最近记录: |