[Lldb-commits] [lldb] Reapply PR/87550 (again) (PR #95571)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 21 06:33:31 PDT 2024
================
@@ -65,16 +58,67 @@ DAP::DAP()
DAP::~DAP() = default;
+void DAP::PopulateExceptionBreakpoints() {
+ llvm::call_once(initExceptionBreakpoints, [this]() {
+ exception_breakpoints = std::vector<ExceptionBreakpoint> {};
+
+ if (lldb::SBDebugger::SupportsLanguage(lldb::eLanguageTypeC_plus_plus)) {
+ exception_breakpoints->emplace_back("cpp_catch", "C++ Catch",
+ lldb::eLanguageTypeC_plus_plus);
+ exception_breakpoints->emplace_back("cpp_throw", "C++ Throw",
+ lldb::eLanguageTypeC_plus_plus);
+ }
+ if (lldb::SBDebugger::SupportsLanguage(lldb::eLanguageTypeObjC)) {
+ exception_breakpoints->emplace_back("objc_catch", "Objective-C Catch",
+ lldb::eLanguageTypeObjC);
+ exception_breakpoints->emplace_back("objc_throw", "Objective-C Throw",
+ lldb::eLanguageTypeObjC);
+ }
+ if (lldb::SBDebugger::SupportsLanguage(lldb::eLanguageTypeSwift)) {
+ exception_breakpoints->emplace_back("swift_catch", "Swift Catch",
+ lldb::eLanguageTypeSwift);
+ exception_breakpoints->emplace_back("swift_throw", "Swift Throw",
+ lldb::eLanguageTypeSwift);
+ }
+ assert(exception_breakpoints.has_value() && "should have been initted");
+ assert(!exception_breakpoints->empty() && "should not be empty");
----------------
labath wrote:
That's the second assertion, not the first one. The first one is really just a test for the implementation of `optional::operator=`.
I don't have such strong feelings about the second one, although one could easily argue that the fact that lldb says it does not support any of the mentioned languages is not a bug (at least, not a bug in lldb-dap). Correctness of the code following the assertion does not depend on the vector being non-empty (only on its existence), so this feels like it would be better off as a test.
https://github.com/llvm/llvm-project/pull/95571
More information about the lldb-commits
mailing list