[Lldb-commits] [lldb] [lldb-dap] Use LLDB_INVALID_LINE_NUMBER & LLDB_INVALID_COLUMN_NUMBER (PR #129948)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 5 14:25:43 PST 2025
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/129948
Consistently use LLDB_INVALID_LINE_NUMBER & LLDB_INVALID_COLUMN_NUMBER when parsing line and column numbers respectively.
>From 886bcf62cca14748bf7978062d310842416f95a0 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Wed, 5 Mar 2025 14:24:12 -0800
Subject: [PATCH] [lldb-dap] Use LLDB_INVALID_LINE_NUMBER &
LLDB_INVALID_COLUMN_NUMBER
Consistently use LLDB_INVALID_LINE_NUMBER & LLDB_INVALID_COLUMN_NUMBER
when parsing line and column numbers respectively.
---
lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp | 7 ++++---
lldb/tools/lldb-dap/SourceBreakpoint.cpp | 6 ++++--
2 files changed, 8 insertions(+), 5 deletions(-)
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;
More information about the lldb-commits
mailing list