lldb:异常断点(相当于 gdb 的 catch throw)

发布于 2024-12-15 09:47:12 字数 97 浏览 4 评论 0原文

我正在尝试使用 lldb 进行 C++ 调试,并且希望在抛出异常时停止,例如 gdb 的 catch throw,并且我在 lldb 文档中找不到等效项。

I am trying to use lldb for c++ debugging and I want to halt if an exception is thrown, like gdb's catch throw, and I cannot find an equivalent in the lldb documentation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

哆啦不做梦 2024-12-22 09:47:12

使用 breakpoint set -E c++ 来中断所有异常,使用 breakpoint set -F std::range_error 来中断特定异常。

Use breakpoint set -E c++ to break on all exceptions and breakpoint set -F std::range_error to break on a specific exception.

猫腻 2024-12-22 09:47:12

在 Xcode 中,您可以设置异常断点(View > Navigators > Show Breakpoint Navigator,点击断点列表窗口底部的 + 按钮添加新断点)。

如果您使用命令行 lldb,请在 __cxa_throw 上放置一个断点(对于 C++ 异常抛出),在 objc_exception_throw 上放置一个断点(对于 Objective-C 异常抛出)。

对于所有 C++ 异常:break set -E C++

In Xcode, you can set an Exception breakpoint (View > Navigators > Show Breakpoint Navigator, hit the + button in the bottom of the breakpoint list window to add a new breakpoint).

If you're using command line lldb, put a breakpoint on __cxa_throw for C++ exception throws, objc_exception_throw for Objective-C exception throws.

For all c++ exceptions: break set -E C++.

看轻我的陪伴 2024-12-22 09:47:12

我认为 breakpoint set -w 是正确的答案,你可以使用 help breakpoint set 查看文档。

I think breakpoint set -w <boolean> is the correct answer, you can use help breakpoint set to see the document.

池予 2024-12-22 09:47:12

您可以进入

breakpoint set -E c++

LLDB 来执行此操作。

但如果您希望将 LLDB 配置为始终执行此操作,请打开 ~/.lldbinit 并将同一行放入该文件中。

You can enter

breakpoint set -E c++

into LLDB to do this.

But if you want to configure LLDB to always do this, open ~/.lldbinit and put the same line into that file.

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