查找 std::vector.at() 抛出 std::out_of_range 的位置

发布于 2024-11-18 16:55:26 字数 131 浏览 3 评论 0原文

通常我会不处理它,调试器(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

行雁书 2024-11-25 16:55:26

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.

抱猫软卧 2024-11-25 16:55:26

您可以在异常对象的构造函数中放置一个断点。由于这发生在引发异常之前,因此您可以很好地了解调用代码。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文