问题描述
我读了 help breakpoint set
的文档,告诉我可以使用断点集-w< boolean>
设置一个异常抛出的断点。
I read the document of help breakpoint set
which tells me that I can use breakpoint set -w <boolean>
to set a breakpoint where an exception throws.
令我困惑的是我无法设置布尔值。
我试过断点集-w true
和断点设置-w 1
和断点集-w是
,但它们都没有意义,lldb总是告诉我错误:给定命令的选项的无效组合
what confused me is that I can't set the boolean value.I've tried breakpoint set -w true
and breakpoint set -w 1
and breakpoint set -w yes
, but they all make no sense, lldb always tells me that error: invalid combination of options for the given command
.
所以,我的问题是:如何使用断点设置异常断点-w< boolean>
命令?
so, my question is: how to enable a exception breakpoint using breakpoint set -w <boolean>
command?
是的,我知道Xcode可以很容易地做到这一点没有任何打字,但我想知道如何在命令行中启用它。
yes, I know Xcode can easily do this without any typing, but I want to know how to enable it in command line.
推荐答案
如果您查看帮助断点集
输出中的命令选项使用部分,您会看到-w和-h选项只能与-E选项配合使用。这是因为他们只是修改使用-E选项设置的特定于语言的异常断点。另请注意, -w true
是默认值,因此如果您不想打破给定语言异常的异常抛出,则只需要指定此选项。一般来说,如果你想破坏C ++异常抛出,你可以说:
If you look at the "Command Options usage" part of the help breakpoint set
output, you'll see that the -w and -h options are only allowed in conjunction with with the -E option. That's because they just modify the language specific exception breakpoint set with the -E option. Note also, -w true
is the default, so you only need to specify this option if you want to NOT break on exception throws for your given language exception. In general, if you want to break for instance on C++ exception throws you can say:
(lldb) break set -E c++
虽然您也可以说
(lldb) break set -E c++ -w true -h false
得到同样的效果。
这篇关于lldb将异常断点设置为“-w”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!