c++ - 苹果机 : I get SIGABRT but the call stack is useless

标签 c++ xcode debugging callstack

我正在用 C++ 为 Mac 编写一个游戏,我得到了一个 SIGABRT,并且控制台打印了以下内容:

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_lexical_cast> >'
  what():  bad lexical cast: source type value could not be interpreted as target
Program received signal:  “SIGABRT”.

所以,我在做一个糟糕的 lexical_cast。但问题是我不知道在哪里,因为调用堆栈如下:

#0  0x7fff85fb629a in mach_msg_trap
#1  0x7fff85fb690d in mach_msg
#2  0x7fff81f58932 in __CFRunLoopRun
#3  0x7fff81f57dbf in CFRunLoopRunSpecific
#4  0x7fff88dba7ee in RunCurrentEventLoopInMode
#5  0x7fff88dba5f3 in ReceiveNextEventCommon
#6  0x7fff88dba4ac in BlockUntilNextEventMatchingListInMode
#7  0x7fff84f85e64 in _DPSNextEvent
#8  0x7fff84f857a9 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#9  0x7fff84f4b48b in -[NSApplication run]
#10 0x7fff84f441a8 in NSApplicationMain
#11 0x1000ef759 in os_gameMainLoop at main-osx.mm:22
#12 0x10009a97d in main at words.cpp:18

那不是正确的堆栈。

什么是 match_msg_trap?
我为什么会得到这个调用堆栈?
我有什么方法可以在崩溃时获得良好的调用堆栈吗?

谢谢!

最佳答案

调试器在错误的线程中停止。在 GDB 中尝试 t a a bt 以查看所有线程的回溯。

mach_msg_trap 是线程在等待消息进入时停放的地方。因此,您正在查看一个未运行的线程。 Mach 是 OS X 上消息传递接口(interface)的名称。

关于c++ - 苹果机 : I get SIGABRT but the call stack is useless,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5590430/

相关文章:

c++ - Qt离线安装器和兼容的c++编译器安装

c++ - 我是否正确使用 std::map 查找功能?想要访问类数据

xcode - 将 UITableView 名称保存到按钮操作的数组中

php - Symfony2 中的 Doctrine2 : How can I see which object-call leads into a query?

c - 如何调试 "INT_MAX undeclared"

debugging - 在任意 scala 代码位置期间放入解释器

c++ - std::string 实现和表达式模板

c++ - 如何避免 OpenCL 中的常量内存复制

objective-c - 使用一个代码库构建多个应用程序的良好机制

swift - 从 UISlider - Swift 4 中隐藏/删除 .0 小数