[Lldb-commits] [lldb] [lldb-dap] Use LLDB_INVALID_LINE_NUMBER & LLDB_INVALID_COLUMN_NUMBER (PR #129948)

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 5 14:26:18 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

Consistently use LLDB_INVALID_LINE_NUMBER & LLDB_INVALID_COLUMN_NUMBER when parsing line and column numbers respectively.

---
Full diff: https://github.com/llvm/llvm-project/pull/129948.diff


2 Files Affected:

- (modified) lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp (+4-3) 
- (modified) lldb/tools/lldb-dap/SourceBreakpoint.cpp (+4-2) 


``````````diff
diff --git a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
index 468dacfe6737e..d6efd659ae8e0 100644
--- a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp
@@ -131,9 +131,10 @@ void BreakpointLocationsRequestHandler::operator()(
   auto *arguments = request.getObject("arguments");
   auto *source = arguments->getObject("source");
   std::string path = GetString(source, "path").str();
-  const auto start_line = GetInteger<uint64_t>(arguments, "line").value_or(0);
-  const auto start_column =
-      GetInteger<uint64_t>(arguments, "column").value_or(0);
+  const auto start_line = GetInteger<uint64_t>(arguments, "line")
+                              .value_or(LLDB_INVALID_LINE_NUMBER);
+  const auto start_column = GetInteger<uint64_t>(arguments, "column")
+                                .value_or(LLDB_INVALID_COLUMN_NUMBER);
   const auto end_line =
       GetInteger<uint64_t>(arguments, "endLine").value_or(start_line);
   const auto end_column = GetInteger<uint64_t>(arguments, "endColumn")
diff --git a/lldb/tools/lldb-dap/SourceBreakpoint.cpp b/lldb/tools/lldb-dap/SourceBreakpoint.cpp
index 37341fa387d40..7742dce2928b5 100644
--- a/lldb/tools/lldb-dap/SourceBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/SourceBreakpoint.cpp
@@ -27,8 +27,10 @@ namespace lldb_dap {
 SourceBreakpoint::SourceBreakpoint(DAP &dap, const llvm::json::Object &obj)
     : Breakpoint(dap, obj),
       logMessage(std::string(GetString(obj, "logMessage"))),
-      line(GetInteger<uint64_t>(obj, "line").value_or(0)),
-      column(GetInteger<uint64_t>(obj, "column").value_or(0)) {}
+      line(
+          GetInteger<uint64_t>(obj, "line").value_or(LLDB_INVALID_LINE_NUMBER)),
+      column(GetInteger<uint64_t>(obj, "column")
+                 .value_or(LLDB_INVALID_COLUMN_NUMBER)) {}
 
 void SourceBreakpoint::SetBreakpoint(const llvm::StringRef source_path) {
   lldb::SBFileSpecList module_list;

``````````

</details>


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


More information about the lldb-commits mailing list