[Lldb-commits] [lldb] [lldb] Allow languages to filter breakpoints set by line (PR #83908)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 5 09:54:00 PST 2024


================
@@ -199,13 +200,24 @@ bool operator<(const SourceLoc lhs, const SourceLoc rhs) {
 }
 } // namespace
 
+static void
+ApplyLanguageFilters(llvm::SmallVectorImpl<SymbolContext> &sc_list) {
+  llvm::erase_if(sc_list, [](SymbolContext &sc) {
+    if (Language *lang = Language::FindPlugin(sc.GetLanguage()))
+      return !lang->IsInterestingCtxForLineBreakpoint(sc);
+    return false;
+  });
+}
+
 void BreakpointResolver::SetSCMatchesByLine(
     SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue,
     llvm::StringRef log_ident, uint32_t line, std::optional<uint16_t> column) {
   llvm::SmallVector<SymbolContext, 16> all_scs;
   for (uint32_t i = 0; i < sc_list.GetSize(); ++i)
     all_scs.push_back(sc_list[i]);
 
+  ApplyLanguageFilters(all_scs);
----------------
felipepiovezan wrote:

Yup, I'll change that in the next iteration of this patch (it was uploaded before Adrian's comment)

https://github.com/llvm/llvm-project/pull/83908


More information about the lldb-commits mailing list