查找 std::vector.at() 抛出 std::out_of_range 的位置
通常我会不处理它,调试器(gdb、Eclipse CDT)会向我显示调用堆栈。不幸的是,该代码正在由吸收所有异常的第三方库调用。我可以在第三方库之前捕获异常,但是我看不到调用堆栈(堆栈展开?)。
我怎样才能知道异常是在哪里抛出的呢?
Normally I would leave it unhandled and the debugger (gdb, Eclipse CDT) would show me the call stack. Unfortunately the code is being called by a third party library which absorbs all exceptions. I can catch the exception before the third party library however I cannot see the call stack (stack-unwinding?).
How can I figure out where the exception was thrown?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
catchpoints 有帮助吗?每当抛出异常时,您都可以通过在 gdb 中输入
catch throw
命令来中断。在 Eclipse 中,您可以通过 gdb 控制台来执行此操作。请参阅此问题。Would catchpoints help? You can break whenever an exception is thrown by entering the
catch throw
command in gdb. In Eclipse, you can do this through the gdb console. See this question.您可以在异常对象的构造函数中放置一个断点。由于这发生在引发异常之前,因此您可以很好地了解调用代码。
You can put a breakpoint in the constructor for the exception object. Since this occurs before the exception is thrown, you get great visibility into the calling code.