@@ -32,14 +32,7 @@ namespace lldb_dap {
32
32
DAP g_dap;
33
33
34
34
DAP::DAP ()
35
- : broadcaster(" lldb-dap" ),
36
- exception_breakpoints (
37
- {{" cpp_catch" , " C++ Catch" , lldb::eLanguageTypeC_plus_plus},
38
- {" cpp_throw" , " C++ Throw" , lldb::eLanguageTypeC_plus_plus},
39
- {" objc_catch" , " Objective-C Catch" , lldb::eLanguageTypeObjC},
40
- {" objc_throw" , " Objective-C Throw" , lldb::eLanguageTypeObjC},
41
- {" swift_catch" , " Swift Catch" , lldb::eLanguageTypeSwift},
42
- {" swift_throw" , " Swift Throw" , lldb::eLanguageTypeSwift}}),
35
+ : broadcaster(" lldb-dap" ), exception_breakpoints(),
43
36
focus_tid (LLDB_INVALID_THREAD_ID), stop_at_entry(false ), is_attach(false ),
44
37
enable_auto_variable_summaries(false ),
45
38
enable_synthetic_child_debugging(false ),
@@ -65,16 +58,42 @@ DAP::DAP()
65
58
66
59
DAP::~DAP () = default ;
67
60
61
+ void DAP::PopulateExceptionBreakpoints () {
62
+ exception_breakpoints = {};
63
+ if (debugger.SupportsLanguage (lldb::eLanguageTypeC_plus_plus)) {
64
+ exception_breakpoints->emplace_back (" cpp_catch" , " C++ Catch" ,
65
+ lldb::eLanguageTypeC_plus_plus);
66
+ exception_breakpoints->emplace_back (" cpp_throw" , " C++ Throw" ,
67
+ lldb::eLanguageTypeC_plus_plus);
68
+ }
69
+ if (debugger.SupportsLanguage (lldb::eLanguageTypeObjC)) {
70
+ exception_breakpoints->emplace_back (" objc_catch" , " Objective-C Catch" ,
71
+ lldb::eLanguageTypeObjC);
72
+ exception_breakpoints->emplace_back (" objc_throw" , " Objective-C Throw" ,
73
+ lldb::eLanguageTypeObjC);
74
+ }
75
+ if (debugger.SupportsLanguage (lldb::eLanguageTypeSwift)) {
76
+ exception_breakpoints->emplace_back (" swift_catch" , " Swift Catch" ,
77
+ lldb::eLanguageTypeSwift);
78
+ exception_breakpoints->emplace_back (" swift_throw" , " Swift Throw" ,
79
+ lldb::eLanguageTypeSwift);
80
+ }
81
+ }
82
+
68
83
ExceptionBreakpoint *DAP::GetExceptionBreakpoint (const std::string &filter) {
69
- for (auto &bp : exception_breakpoints) {
84
+ assert (exception_breakpoints.has_value () &&
85
+ " PopulateExceptionBreakpoints must be called first" );
86
+ for (auto &bp : *exception_breakpoints) {
70
87
if (bp.filter == filter)
71
88
return &bp;
72
89
}
73
90
return nullptr ;
74
91
}
75
92
76
93
ExceptionBreakpoint *DAP::GetExceptionBreakpoint (const lldb::break_id_t bp_id) {
77
- for (auto &bp : exception_breakpoints) {
94
+ assert (exception_breakpoints.has_value () &&
95
+ " PopulateExceptionBreakpoints must be called first" );
96
+ for (auto &bp : *exception_breakpoints) {
78
97
if (bp.bp .GetID () == bp_id)
79
98
return &bp;
80
99
}
0 commit comments