小编Rod*_*osa的帖子

在Xcode 4.4中使用libc ++调试问题

当我尝试在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中,调试工作得很好.

这里有一些不同的场景,结果不同:

  1. 使用LLVM GCC 4.2作为编译器→它工作正常.
  2. 使用Apple LLVM编译器4.0并为C++标准库设置libstdc ++(GNU C++标准库)→它可以正常工作.
  3. Apple LLVM编译器4.0并为C++标准库设置libc ++(支持C++ 11的LLVM C++标准库)→问题出现了.

在我正在开发的项目中,我们正在使用Apple LLVM编译器4.0和libc ++(支持C++ 11的LLVM C++标准库),所以我需要为场景3解决这个问题.

有谁知道会发生什么,以及是否有解决方法?

c++ debugging lldb libc++ xcode4.4

6
推荐指数
1
解决办法
928
查看次数

标签 统计

c++ ×1

debugging ×1

libc++ ×1

lldb ×1

xcode4.4 ×1