Skip to content

Conversation

@JDevlieghere
Copy link
Member

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

Consistently use LLDB_INVALID_LINE_NUMBER & LLDB_INVALID_COLUMN_NUMBER
when parsing line and column numbers respectively.
@llvmbot
Copy link
Member

llvmbot commented Mar 5, 2025

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

Changes

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 --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;

@JDevlieghere JDevlieghere merged commit b5e70d0 into llvm:main Mar 6, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants