Skip to content

Commit 6595e7f

Browse files
authored
Revert "[lldb][lldb-dap] Cleanup breakpoint filters." (#93739)
Reverts #87550 because it broke `TestDAP*` lldb tests. https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64-rbe/b8746585790559468897/overview
1 parent b74f50a commit 6595e7f

File tree

7 files changed

+13
-54
lines changed

7 files changed

+13
-54
lines changed

lldb/include/lldb/API/SBDebugger.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ class LLDB_API SBDebugger {
5757

5858
static const char *GetBroadcasterClass();
5959

60-
static bool SupportsLanguage(lldb::LanguageType language);
61-
6260
lldb::SBBroadcaster GetBroadcaster();
6361

6462
/// Get progress data from a SBEvent whose type is eBroadcastBitProgress.

lldb/include/lldb/Symbol/TypeSystem.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ class TypeSystem : public PluginInterface,
209209
// TypeSystems can support more than one language
210210
virtual bool SupportsLanguage(lldb::LanguageType language) = 0;
211211

212-
static bool SupportsLanguageStatic(lldb::LanguageType language);
213212
// Type Completion
214213

215214
virtual bool GetCompleteType(lldb::opaque_compiler_type_t type) = 0;

lldb/source/API/SBDebugger.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,3 @@ bool SBDebugger::InterruptRequested() {
17421742
return m_opaque_sp->InterruptRequested();
17431743
return false;
17441744
}
1745-
1746-
bool SBDebugger::SupportsLanguage(lldb::LanguageType language) {
1747-
return TypeSystem::SupportsLanguageStatic(language);
1748-
}

lldb/source/Symbol/TypeSystem.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,3 @@ TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType language,
335335
}
336336
return GetTypeSystemForLanguage(language);
337337
}
338-
339-
bool TypeSystem::SupportsLanguageStatic(lldb::LanguageType language) {
340-
if (language == eLanguageTypeUnknown)
341-
return false;
342-
343-
LanguageSet languages =
344-
PluginManager::GetAllTypeSystemSupportedLanguagesForTypes();
345-
if (languages.Empty())
346-
return false;
347-
return languages[language];
348-
}

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ namespace lldb_dap {
3232
DAP g_dap;
3333

3434
DAP::DAP()
35-
: broadcaster("lldb-dap"), exception_breakpoints(),
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}}),
3643
focus_tid(LLDB_INVALID_THREAD_ID), stop_at_entry(false), is_attach(false),
3744
enable_auto_variable_summaries(false),
3845
enable_synthetic_child_debugging(false),
@@ -58,42 +65,16 @@ DAP::DAP()
5865

5966
DAP::~DAP() = default;
6067

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-
8368
ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const std::string &filter) {
84-
assert(exception_breakpoints.has_value() &&
85-
"PopulateExceptionBreakpoints must be called first");
86-
for (auto &bp : *exception_breakpoints) {
69+
for (auto &bp : exception_breakpoints) {
8770
if (bp.filter == filter)
8871
return &bp;
8972
}
9073
return nullptr;
9174
}
9275

9376
ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const lldb::break_id_t bp_id) {
94-
assert(exception_breakpoints.has_value() &&
95-
"PopulateExceptionBreakpoints must be called first");
96-
for (auto &bp : *exception_breakpoints) {
77+
for (auto &bp : exception_breakpoints) {
9778
if (bp.bp.GetID() == bp_id)
9879
return &bp;
9980
}

lldb/tools/lldb-dap/DAP.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ struct DAP {
156156
std::unique_ptr<std::ofstream> log;
157157
llvm::StringMap<SourceBreakpointMap> source_breakpoints;
158158
FunctionBreakpointMap function_breakpoints;
159-
std::optional<std::vector<ExceptionBreakpoint>> exception_breakpoints;
159+
std::vector<ExceptionBreakpoint> exception_breakpoints;
160160
std::vector<std::string> init_commands;
161161
std::vector<std::string> pre_run_commands;
162162
std::vector<std::string> post_run_commands;
@@ -228,8 +228,6 @@ struct DAP {
228228

229229
llvm::json::Value CreateTopLevelScopes();
230230

231-
void PopulateExceptionBreakpoints();
232-
233231
/// \return
234232
/// Attempt to determine if an expression is a variable expression or
235233
/// lldb command using a hueristic based on the first term of the

lldb/tools/lldb-dap/lldb-dap.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <cstdio>
1717
#include <cstdlib>
1818
#include <cstring>
19-
#include <optional>
2019
#include <sys/stat.h>
2120
#include <sys/types.h>
2221
#if defined(_WIN32)
@@ -1587,7 +1586,6 @@ void request_initialize(const llvm::json::Object &request) {
15871586
bool source_init_file = GetBoolean(arguments, "sourceInitFile", true);
15881587

15891588
g_dap.debugger = lldb::SBDebugger::Create(source_init_file, log_cb, nullptr);
1590-
g_dap.PopulateExceptionBreakpoints();
15911589
auto cmd = g_dap.debugger.GetCommandInterpreter().AddMultiwordCommand(
15921590
"lldb-dap", "Commands for managing lldb-dap.");
15931591
if (GetBoolean(arguments, "supportsStartDebuggingRequest", false)) {
@@ -1623,7 +1621,7 @@ void request_initialize(const llvm::json::Object &request) {
16231621
body.try_emplace("supportsEvaluateForHovers", true);
16241622
// Available filters or options for the setExceptionBreakpoints request.
16251623
llvm::json::Array filters;
1626-
for (const auto &exc_bp : *g_dap.exception_breakpoints) {
1624+
for (const auto &exc_bp : g_dap.exception_breakpoints) {
16271625
filters.emplace_back(CreateExceptionBreakpointFilter(exc_bp));
16281626
}
16291627
body.try_emplace("exceptionBreakpointFilters", std::move(filters));
@@ -2478,7 +2476,7 @@ void request_setExceptionBreakpoints(const llvm::json::Object &request) {
24782476
// Keep a list of any exception breakpoint filter names that weren't set
24792477
// so we can clear any exception breakpoints if needed.
24802478
std::set<std::string> unset_filters;
2481-
for (const auto &bp : *g_dap.exception_breakpoints)
2479+
for (const auto &bp : g_dap.exception_breakpoints)
24822480
unset_filters.insert(bp.filter);
24832481

24842482
for (const auto &value : *filters) {

0 commit comments

Comments
 (0)