[Lldb-commits] [lldb] [lldb] fix set SBLineEntryColumn (PR #130435)

Ebuka Ezike via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 10 08:38:18 PDT 2025


https://github.com/da-viper updated https://github.com/llvm/llvm-project/pull/130435

>From 02c34e87db59a0b87887aba479afbab70925241b Mon Sep 17 00:00:00 2001
From: Ezike Ebuka <yerimyah1 at gmail.com>
Date: Sat, 8 Mar 2025 19:47:17 +0000
Subject: [PATCH 1/3] [lldb] fix set SBLineEntryColumn

---
 lldb/source/API/SBLineEntry.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/API/SBLineEntry.cpp b/lldb/source/API/SBLineEntry.cpp
index 216ea6d18eab8..0f4936f32a074 100644
--- a/lldb/source/API/SBLineEntry.cpp
+++ b/lldb/source/API/SBLineEntry.cpp
@@ -137,7 +137,7 @@ void SBLineEntry::SetLine(uint32_t line) {
 void SBLineEntry::SetColumn(uint32_t column) {
   LLDB_INSTRUMENT_VA(this, column);
 
-  ref().line = column;
+  ref().column = column;
 }
 
 bool SBLineEntry::operator==(const SBLineEntry &rhs) const {

>From fa4a3cef8d299adfecdfe846620ed9257bbbf0b8 Mon Sep 17 00:00:00 2001
From: Ezike Ebuka <yerimyah1 at gmail.com>
Date: Sun, 9 Mar 2025 14:02:38 +0000
Subject: [PATCH 2/3] [lldb] add unittest for SBLineEntry

---
 lldb/unittests/API/CMakeLists.txt      |  1 +
 lldb/unittests/API/SBLineEntryTest.cpp | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 lldb/unittests/API/SBLineEntryTest.cpp

diff --git a/lldb/unittests/API/CMakeLists.txt b/lldb/unittests/API/CMakeLists.txt
index 52e9a5e991515..0cdadd1d40aee 100644
--- a/lldb/unittests/API/CMakeLists.txt
+++ b/lldb/unittests/API/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_lldb_unittest(APITests
   SBCommandInterpreterTest.cpp
+        SBLineEntryTest.cpp
 
   LINK_LIBS
     liblldb
diff --git a/lldb/unittests/API/SBLineEntryTest.cpp b/lldb/unittests/API/SBLineEntryTest.cpp
new file mode 100644
index 0000000000000..518893b554bd1
--- /dev/null
+++ b/lldb/unittests/API/SBLineEntryTest.cpp
@@ -0,0 +1,26 @@
+//===-- SBLineEntryTest.cpp -------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===/
+
+#include "gtest/gtest.h"
+
+#include "lldb/API/LLDB.h"
+
+TEST(SBLineEntryTest, SetLineAndColumn) {
+  constexpr uint32_t expected_line_no = 40;
+  constexpr uint32_t expected_column_no = 20;
+
+  lldb::SBLineEntry line_entry{};
+  line_entry.SetLine(expected_line_no);
+  line_entry.SetColumn(expected_column_no);
+
+  const uint32_t line_no = line_entry.GetLine();
+  const uint32_t column_no = line_entry.GetColumn();
+
+  EXPECT_EQ(line_no, line_no);
+  EXPECT_EQ(column_no, expected_column_no);
+}

>From 245ddee4b251a436a081620e26ef663eafcfe3b1 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <57949090+da-viper at users.noreply.github.com>
Date: Mon, 10 Mar 2025 15:38:09 +0000
Subject: [PATCH 3/3] Update lldb/unittests/API/CMakeLists.txt

Co-authored-by: Jonas Devlieghere <jonas at devlieghere.com>
---
 lldb/unittests/API/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/unittests/API/CMakeLists.txt b/lldb/unittests/API/CMakeLists.txt
index 0cdadd1d40aee..fe2ff684a5d92 100644
--- a/lldb/unittests/API/CMakeLists.txt
+++ b/lldb/unittests/API/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_lldb_unittest(APITests
   SBCommandInterpreterTest.cpp
-        SBLineEntryTest.cpp
+  SBLineEntryTest.cpp
 
   LINK_LIBS
     liblldb



More information about the lldb-commits mailing list