【问题标题】:c++ EXC_BAD_ACCESS error, how to debugc++ EXC_BAD_ACCESS错误,如何调试
【发布时间】:2016-12-17 17:19:14
【问题描述】:

我确实编译我的代码没有任何错误,当我运行它时,我得到分段错误 11。 使用 lldb 跟踪代码后,我在下面的代码中遇到了 EXC_BAD_ACCESS 错误。问题是它说有错误的行不在我的代码中。所以我不知道如何调试代码。

任何帮助表示赞赏,提前感谢。这是错误消息:

* thread #1: tid = 0x17be3, 0x000000010000393f p1ex01`Tree<int, std::__1::less<int> >::Tree(std::__1::list<int, std::__1::allocator<int> > const&) [inlined] std::__1::deque<int, std::__1::allocator<int> >::back(this=0x00007fff5fbfe868 size=0) + 96 at deque:1752, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x000000010000393f p1ex01`Tree<int, std::__1::less<int> >::Tree(std::__1::list<int, std::__1::allocator<int> > const&) [inlined] std::__1::deque<int, std::__1::allocator<int> >::back(this=0x00007fff5fbfe868 size=0) + 96 at deque:1752
1749    deque<_Tp, _Allocator>::back()
1750    {
1751        size_type __p = __base::size() + __base::__start_ - 1;
-> 1752     return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
1753    }
1754    
1755    template <class _Tp, class _Allocator>

【问题讨论】:

  • 在发生该错误时键入 'bt'。这将为您提供函数调用回溯。
  • @JoelCornett 谢谢!

标签: c++ debugging lldb


【解决方案1】:

当错误发生时输入“bt”。这将为您提供函数调用回溯。 ——乔尔·科内特

【讨论】:

    猜你喜欢
    • 2013-11-13
    • 2014-06-16
    • 2012-04-08
    • 2012-09-25
    • 2017-03-16
    • 2013-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多