[Lldb-commits] [lldb] [lldb-dap] assembly breakpoints (PR #139969)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Sat May 17 18:33:59 PDT 2025


================
@@ -71,22 +101,26 @@ BreakpointLocationsRequestHandler::Run(
       locations.emplace_back(line, column);
     }
   }
+}
 
-  // The line entries are sorted by addresses, but we must return the list
-  // ordered by line / column position.
-  std::sort(locations.begin(), locations.end());
-  locations.erase(llvm::unique(locations), locations.end());
+template <unsigned N>
+void BreakpointLocationsRequestHandler::AddAssemblyBreakpointLocations(
+    llvm::SmallVector<std::pair<uint32_t, uint32_t>, N> &locations,
----------------
JDevlieghere wrote:

Looking at how this is called, maybe you don't even need to take this by reference, and you can have this return a `llvm::SmallVector<std::pair<uint32_t, uint32_t>, 8>`. Honestly I don't even know if the `SmallVector` optimization is worth it here, personally I would've just returned a regular `std::vector`. If you change the return type, you can also change the name of the method from `Add` to `Get`. Now it looks like there's potentially multiple calls adding values to the location list.

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


More information about the lldb-commits mailing list