[Lldb-commits] [lldb] [lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (PR #145872)

2025-06-26 Thread Michael Buch via lldb-commits

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/145872

Desugar any potential references/typedefs before checking `isStdTemplate`. 
Previously, the typename might've been:
```
const std::unordered_map<...> &
```
for references. This patch gets the pointee type before grabbing the canonical 
type. `GetNonReferenceType` will unwrap typedefs too, so we should always end 
up with a non-reference before we get to `GetCanonicalType`.

https://github.com/llvm/llvm-project/issues/145847

>From f86827c1592779537b10dafcbf8b8abba4acccf2 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Thu, 26 Jun 2025 12:06:13 +0100
Subject: [PATCH] [lldb][DataFormatter] Unwrap reference type when formatting
 std::unordered_map

Desugar any potential references/typedefs before checking
`isStdTemplate`. Previously, the typename might've been:
```
const std::unordered_map<...> &
```
for references. This patch gets the pointee type before grabbing the
canonical type. `GetNonReferenceType` will unwrap typedefs too, so we
should always end up with a non-reference before we get to
`GetCanonicalType`.

https://github.com/llvm/llvm-project/issues/145847
---
 .../Language/CPlusPlus/LibCxxUnorderedMap.cpp |   6 +-
 .../TestDataFormatterLibccUnorderedMap.py | 128 ++
 .../libcxx/unordered_map/main.cpp |  13 ++
 3 files changed, 145 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
index ffc33395830bb..501fd0945b82c 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
@@ -113,8 +113,10 @@ CompilerType 
lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
   // wraps a std::pair. Peel away the internal wrapper type - whose structure 
is
   // of no value to users, to expose the std::pair. This matches the structure
   // returned by the std::map synthetic provider.
-  if (isUnorderedMap(
-  m_backend.GetCompilerType().GetCanonicalType().GetTypeName())) {
+  if (isUnorderedMap(m_backend.GetCompilerType()
+ .GetNonReferenceType()
+ .GetCanonicalType()
+ .GetTypeName())) {
 std::string name;
 CompilerType field_type =
 element_type.GetFieldAtIndex(0, name, nullptr, nullptr, nullptr);
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
index c021a46a17b51..3b412996c6cb4 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
@@ -64,3 +64,131 @@ def test_iterator_formatters(self):
 ValueCheck(name="second", summary='"Qux"'),
 ],
 )
+
+lldbutil.continue_to_breakpoint(process, bkpt)
+
+# Test references to std::unordered_map
+self.expect_var_path(
+"ref1",
+summary="size=2",
+type="const StringMapT &",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref2",
+summary="size=2",
+type="StringMapT &",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref3",
+summary="size=2",
+type="StringMapTRef",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueChe

[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)

2025-06-26 Thread via lldb-commits

https://github.com/Nerixyz updated 
https://github.com/llvm/llvm-project/pull/143177

>From 7815eeb573f52617fb5a3ade247c9d45ae808371 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Wed, 18 Jun 2025 21:49:16 +0200
Subject: [PATCH] [LLDB] Add type summaries for MSVC STL strings

---
 .../lldb/DataFormatters/StringPrinter.h   |  13 ++
 lldb/packages/Python/lldbsuite/test/dotest.py |  41 +
 .../Python/lldbsuite/test/test_categories.py  |   1 +
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  | 139 +
 .../Plugins/Language/CPlusPlus/LibStdcpp.cpp  | 127 ++--
 .../Plugins/Language/CPlusPlus/LibStdcpp.h|   4 +-
 .../Plugins/Language/CPlusPlus/MsvcStl.cpp| 143 ++
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |  35 +
 .../msvcstl/string/Makefile   |   3 +
 .../string/TestDataFormatterMsvcStlString.py  | 118 +++
 .../msvcstl/string/main.cpp   |  40 +
 .../msvcstl/u8string/Makefile |   4 +
 .../TestDataFormatterMsvcStlU8String.py   |  31 
 .../msvcstl/u8string/main.cpp |  14 ++
 15 files changed, 569 insertions(+), 145 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStl.cpp
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/Makefile
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/TestDataFormatterMsvcStlString.py
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/main.cpp
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/Makefile
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/TestDataFormatterMsvcStlU8String.py
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/main.cpp

diff --git a/lldb/include/lldb/DataFormatters/StringPrinter.h 
b/lldb/include/lldb/DataFormatters/StringPrinter.h
index 4169f53e63f38..3b50be68dd939 100644
--- a/lldb/include/lldb/DataFormatters/StringPrinter.h
+++ b/lldb/include/lldb/DataFormatters/StringPrinter.h
@@ -152,6 +152,19 @@ class StringPrinter {
   template 
   static bool
   ReadBufferAndDumpToStream(const ReadBufferAndDumpToStreamOptions &options);
+
+  template 
+  static constexpr uint64_t ElementByteSize() {
+switch (element_type) {
+case StringElementType::ASCII:
+case StringElementType::UTF8:
+  return 1;
+case StringElementType::UTF16:
+  return 2;
+case StringElementType::UTF32:
+  return 3;
+}
+  }
 };
 
 } // namespace formatters
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py 
b/lldb/packages/Python/lldbsuite/test/dotest.py
index d7f274ac4f60e..90c8e32afa507 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -831,6 +831,46 @@ def checkLibstdcxxSupport():
 configuration.skip_categories.append("libstdcxx")
 
 
+def canRunMsvcStlTests():
+from lldbsuite.test import lldbplatformutil
+
+platform = lldbplatformutil.getPlatform()
+if platform != "windows":
+return False, f"Don't know how to build with MSVC's STL on {platform}"
+
+with tempfile.NamedTemporaryFile() as f:
+cmd = [configuration.compiler, "-xc++", "-o", f.name, "-E", "-"]
+p = subprocess.Popen(
+cmd,
+stdin=subprocess.PIPE,
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE,
+universal_newlines=True,
+)
+_, stderr = p.communicate(
+"""
+#include 
+#ifndef _MSVC_STL_VERSION
+#error _MSVC_STL_VERSION not defined
+#endif
+"""
+)
+if not p.returncode:
+return True, "Compiling with MSVC STL"
+return (False, f"Not compiling with MSVC STL: {stderr}")
+
+
+def checkMsvcStlSupport():
+result, reason = canRunMsvcStlTests()
+if result:
+return  # msvcstl supported
+if "msvcstl" in configuration.categories_list:
+return  # msvcstl category explicitly requested, let it run.
+if configuration.verbose:
+print(f"msvcstl tests will not be run because: {reason}")
+configuration.skip_categories.append("msvcstl")
+
+
 def canRunWatchpointTests():
 from lldbsuite.test import lldbplatformutil
 
@@ -1044,6 +1084,7 @@ def run_suite():
 
 checkLibcxxSupport()
 checkLibstdcxxSupport()
+checkMsvcStlSupport()
 checkWatchpointSupport()
 checkDebugInfoSupport()
 checkDebugServerSupport()
diff --git a/lldb/packages/Python/lldbsuite/test/test_categories.py 
b/lldb/packages/Python/lldbsuite/test/test_categories.py
index b585f695adeab..1f6e8a78e0c0d 100644

[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)

2025-06-26 Thread via lldb-commits


@@ -299,6 +299,8 @@ def parseOptionsAndInitTestdirs():
 configuration.libcxx_library_dir = args.libcxx_library_dir
 configuration.cmake_build_type = args.cmake_build_type.lower()
 
+configuration.target_triple = args.target_triple
+

Nerixyz wrote:

> Linaro's Windows on Arm bot uses clang-cl and the target triple is set to 
> `aarch64-pc-windows-msvc`. I can test things there if that would help.

That would be great!

https://github.com/llvm/llvm-project/pull/143177
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (PR #145872)

2025-06-26 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/145872

>From f86827c1592779537b10dafcbf8b8abba4acccf2 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Thu, 26 Jun 2025 12:06:13 +0100
Subject: [PATCH 1/2] [lldb][DataFormatter] Unwrap reference type when
 formatting std::unordered_map

Desugar any potential references/typedefs before checking
`isStdTemplate`. Previously, the typename might've been:
```
const std::unordered_map<...> &
```
for references. This patch gets the pointee type before grabbing the
canonical type. `GetNonReferenceType` will unwrap typedefs too, so we
should always end up with a non-reference before we get to
`GetCanonicalType`.

https://github.com/llvm/llvm-project/issues/145847
---
 .../Language/CPlusPlus/LibCxxUnorderedMap.cpp |   6 +-
 .../TestDataFormatterLibccUnorderedMap.py | 128 ++
 .../libcxx/unordered_map/main.cpp |  13 ++
 3 files changed, 145 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
index ffc33395830bb..501fd0945b82c 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
@@ -113,8 +113,10 @@ CompilerType 
lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
   // wraps a std::pair. Peel away the internal wrapper type - whose structure 
is
   // of no value to users, to expose the std::pair. This matches the structure
   // returned by the std::map synthetic provider.
-  if (isUnorderedMap(
-  m_backend.GetCompilerType().GetCanonicalType().GetTypeName())) {
+  if (isUnorderedMap(m_backend.GetCompilerType()
+ .GetNonReferenceType()
+ .GetCanonicalType()
+ .GetTypeName())) {
 std::string name;
 CompilerType field_type =
 element_type.GetFieldAtIndex(0, name, nullptr, nullptr, nullptr);
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
index c021a46a17b51..3b412996c6cb4 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
@@ -64,3 +64,131 @@ def test_iterator_formatters(self):
 ValueCheck(name="second", summary='"Qux"'),
 ],
 )
+
+lldbutil.continue_to_breakpoint(process, bkpt)
+
+# Test references to std::unordered_map
+self.expect_var_path(
+"ref1",
+summary="size=2",
+type="const StringMapT &",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref2",
+summary="size=2",
+type="StringMapT &",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref3",
+summary="size=2",
+type="StringMapTRef",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+ 

[Lldb-commits] [lldb] [lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (PR #145872)

2025-06-26 Thread Michael Buch via lldb-commits


@@ -64,3 +64,131 @@ def test_iterator_formatters(self):
 ValueCheck(name="second", summary='"Qux"'),
 ],
 )
+
+lldbutil.continue_to_breakpoint(process, bkpt)
+
+# Test references to std::unordered_map
+self.expect_var_path(

Michael137 wrote:

makes sense. Simplified this in the latest commit. I just passed the "type" as 
a parameter to a helper function

https://github.com/llvm/llvm-project/pull/145872
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits


@@ -228,9 +228,9 @@ static const CoreDefinition g_core_definitions[] = {
 {eByteOrderLittle, 4, 4, 4, llvm::Triple::hexagon,
  ArchSpec::eCore_hexagon_hexagonv5, "hexagonv5"},
 
-{eByteOrderLittle, 4, 2, 4, llvm::Triple::riscv32, ArchSpec::eCore_riscv32,
+{eByteOrderLittle, 4, 2, 8, llvm::Triple::riscv32, ArchSpec::eCore_riscv32,
  "riscv32"},
-{eByteOrderLittle, 8, 2, 4, llvm::Triple::riscv64, ArchSpec::eCore_riscv64,
+{eByteOrderLittle, 8, 2, 8, llvm::Triple::riscv64, ArchSpec::eCore_riscv64,

tedwoodward wrote:

> I read that RISC-V instructions are variable length in multiples of 16, 
> though nothing standard uses greater than 32.
> 
> So what's the logic of this change, that a really large number is very silly, 
> but you do know of people using 64 bit custom instructions?

Exactly!

RISC-V instruction lengths are effectively unlimited (they talk about 192 in 
the spec). I don't know of any that large (very silly, as you say). The people 
working on https://github.com/quic/riscv-elf-psabi-quic-extensions told me they 
have some 64 bit instructions, so I wanted to bump the max to 8 bytes.


https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (PR #145872)

2025-06-26 Thread Michael Buch via lldb-commits

https://github.com/Michael137 closed 
https://github.com/llvm/llvm-project/pull/145872
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][darwin] force BuiltinHeadersInSystemModules to be always false (PR #144913)

2025-06-26 Thread Michael Buch via lldb-commits

Michael137 wrote:

> We could mark these tests as requiring macOS 15+, but given how often they 
> break I am not sure we want to do that?

Happy to mark them as unsupported on older SDKs if it's blocking other work.

https://github.com/llvm/llvm-project/pull/144913
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [NFC][lldb-dap] Add missing header guard for DAPError and ProgressEvent. (PR #145915)

2025-06-26 Thread Ebuka Ezike via lldb-commits

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

>From fbfc26bd78b815334af4beb786ac8276f782b370 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Thu, 26 Jun 2025 16:07:28 +0100
Subject: [PATCH 1/2] [NFC][lldb-dap] add missing header guard.

delete the copy, move construction and assignment.
---
 lldb/tools/lldb-dap/DAPError.h  |  5 +
 lldb/tools/lldb-dap/ProgressEvent.h | 13 ++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lldb/tools/lldb-dap/DAPError.h b/lldb/tools/lldb-dap/DAPError.h
index e18614fe71935..e3ad10806a343 100644
--- a/lldb/tools/lldb-dap/DAPError.h
+++ b/lldb/tools/lldb-dap/DAPError.h
@@ -6,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_TOOLS_LLDB_DAP_DAPERROR_H
+#define LLDB_TOOLS_LLDB_DAP_DAPERROR_H
+
 #include "llvm/Support/Error.h"
 #include 
 #include 
@@ -50,3 +53,5 @@ class NotStoppedError : public 
llvm::ErrorInfo {
 };
 
 } // namespace lldb_dap
+
+#endif // LLDB_TOOLS_LLDB_DAP_DAPERROR_H
\ No newline at end of file
diff --git a/lldb/tools/lldb-dap/ProgressEvent.h 
b/lldb/tools/lldb-dap/ProgressEvent.h
index d1b9b9dd887cd..55c7bd73f324e 100644
--- a/lldb/tools/lldb-dap/ProgressEvent.h
+++ b/lldb/tools/lldb-dap/ProgressEvent.h
@@ -6,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
+#define LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
+
 #include 
 #include 
 #include 
@@ -13,8 +16,6 @@
 #include 
 #include 
 
-#include "DAPForward.h"
-
 #include "llvm/Support/JSON.h"
 
 namespace lldb_dap {
@@ -129,8 +130,12 @@ class ProgressEventReporter {
 public:
   /// \param[in] report_callback
   /// Function to invoke to report the event to the IDE.
-  ProgressEventReporter(ProgressEventReportCallback report_callback);
+  explicit ProgressEventReporter(ProgressEventReportCallback report_callback);
 
+  ProgressEventReporter(const ProgressEventReporter &) = delete;
+  ProgressEventReporter(ProgressEventReporter &&) = delete;
+  ProgressEventReporter &operator=(const ProgressEventReporter &) = delete;
+  ProgressEventReporter &operator=(ProgressEventReporter &&) = delete;
   ~ProgressEventReporter();
 
   /// Add a new event to the internal queue and report the event if
@@ -156,3 +161,5 @@ class ProgressEventReporter {
 };
 
 } // namespace lldb_dap
+
+#endif // LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
\ No newline at end of file

>From a6d07520c9f97996cba8a5b79f97ca72f5888df3 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Thu, 26 Jun 2025 17:14:05 +0100
Subject: [PATCH 2/2] [lldb-dap] add missing new line

---
 lldb/tools/lldb-dap/DAPError.h  | 2 +-
 lldb/tools/lldb-dap/ProgressEvent.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/tools/lldb-dap/DAPError.h b/lldb/tools/lldb-dap/DAPError.h
index e3ad10806a343..26b1daae59340 100644
--- a/lldb/tools/lldb-dap/DAPError.h
+++ b/lldb/tools/lldb-dap/DAPError.h
@@ -54,4 +54,4 @@ class NotStoppedError : public 
llvm::ErrorInfo {
 
 } // namespace lldb_dap
 
-#endif // LLDB_TOOLS_LLDB_DAP_DAPERROR_H
\ No newline at end of file
+#endif // LLDB_TOOLS_LLDB_DAP_DAPERROR_H
diff --git a/lldb/tools/lldb-dap/ProgressEvent.h 
b/lldb/tools/lldb-dap/ProgressEvent.h
index 55c7bd73f324e..9dfed4c301a8e 100644
--- a/lldb/tools/lldb-dap/ProgressEvent.h
+++ b/lldb/tools/lldb-dap/ProgressEvent.h
@@ -162,4 +162,4 @@ class ProgressEventReporter {
 
 } // namespace lldb_dap
 
-#endif // LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
\ No newline at end of file
+#endif // LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Fix source references (PR #144364)

2025-06-26 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


https://github.com/llvm/llvm-project/pull/144364
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread David Spickett via lldb-commits


@@ -0,0 +1,87 @@
+"""
+Defines a command, fdis, that does filtered disassembly. The command does the
+lldb disassemble command with -b and any other arguments passed in, and
+pipes that through a provided filter program.
+
+The intention is to support disassembly of RISC-V proprietary instructions.
+This is handled with llvm-objdump by piping the output of llvm-objdump through
+a filter program. This script is intended to mimic that workflow.
+"""
+
+import lldb
+import subprocess
+
+filter_program = "crustfilt"
+
+def __lldb_init_module(debugger, dict):
+debugger.HandleCommand(
+'command script add -f filter_disasm.fdis fdis')
+print("Disassembly filter command (fdis) loaded")
+print("Filter program set to %s" % filter_program)
+
+
+def fdis(debugger, args, result, dict):

DavidSpickett wrote:

Oh that's cool.

What I was thinking of means you don't have to format the usage though, it's 
generated by lldb. I'll have a look for it tomorrow.

https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> For RISC-V, llvm-objdump mimics gnu objdump, so this change makes the RISC-V 
> byte encodings match both.

Great, that's standard enough.

> That's one thing I'm trying to avoid - we don't want a filter app for objdump 
> and another for the debugger. That's why I changed how the bytes are 
> displayed, and changed "can't disassemble" from blank to "", which 
> matches llvm-objdump.

Yeah that makes sense, the glue between the tool and the filter may change a 
bit but a portable filter you can take between tools and toolchains is nice.

Which reminds me I didn't ask about the alternatives. I can think of a few, 
with their own positives and negatives:
* Adding a shared object to llvm-mc at runtime with new instructions.
  *  It "just works" (once you learn C++ and Tablegen)
  * Could load support for multiple extensions
  * You can use a prebuilt version of lldb/llvm with it
  * Except you can't because the C++ API may have changed, so you need one 
plugin per major version
  * I think I've heard this idea before and changing the backend structures at 
runtime was considered high difficulty.
* Build an llvm that supports the instructions
  * See above basically
  * Maybe you already have done this to get llvm to generate code
  * Need to build it yourself
  * Can't compose extensions
  * Need to use tools from that build, can't use GDB if you like GDB or 
whatever, has to be the ones in that build
* Write your own custom command that parses the original disassembler output 
format is, but given that it currently prints ``, such a script would 
have to be magic.

Looking at it that way, I think another way to describe this proposal is:
Printing  is zero use to anyone, let's print the encoding at least, 
and if we're going to do that, do it in a way that can be easily parsed and 
read.

And that I definitely agree with.
 
Then you can multiply those pros and cons a bunch if you are a vendor, either 
too public or private customers. You have the effort of telling them no you 
have to use `/tool` not `/tool`  (we used to have a 
switcher that would look at command line options and do this for us, making one 
for lldb would be a lot more annoying).

But now I'm making your argument for you I think. You get the idea.

The only real "gotcha" question I can come up with is, wouldn't a user who is 
interested in custom instructions already have access to a compiler that 
produces them and that compiler is likely to be llvm, so is lldb from that llvm 
not within reach already?

Educate me on that, I don't know how folks approach developing these 
extensions. Maybe code generation is the last thing they do, after they know 
it's worth pursuing. So you've got a lot of hand written assembler and `.inst 
` going on.

> I think that's a good idea. Do you know how to add something to release 
> notes? I've never done it upstream.

LLDB's release notes live in a section of LLVM's - 
https://github.com/llvm/llvm-project/blob/main/llvm/docs/ReleaseNotes.md#changes-to-lldb.

https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread David Spickett via lldb-commits

DavidSpickett wrote:

@JDevlieghere / @jasonmolenda you have been in the RISC-V world lately, what do 
you think to this approach?

https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo][DWARF] Create new low-level dwarf library (PR #145081)

2025-06-26 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`amdgpu-offload-rhel-8-cmake-build-only` running on `rocm-docker-rhel-8` while 
building `bolt,lldb,llvm,utils` at step 4 "annotate".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/204/builds/13571


Here is the relevant piece of the build log for the reference

```
Step 4 (annotate) failure: 
'../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py 
--jobs=32' (failure)
...
   ^~
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-copy’
[4826/7888] Building CXX object 
tools/mlir/test/lib/Dialect/NVGPU/CMakeFiles/MLIRNVGPUTestPasses.dir/TestNVGPUTransforms.cpp.o
[4827/7888] Building CXX object 
tools/mlir/test/lib/Dialect/Tensor/CMakeFiles/MLIRTensorTestPasses.dir/TestTensorTransforms.cpp.o
[4828/7888] Creating library symlink lib/libMLIRPdllLspServerLib.so
[4829/7888] Building CXX object 
tools/mlir/test/lib/Dialect/Test/CMakeFiles/MLIRTestDialect.dir/TestDialect.cpp.o
[4830/7888] Building CXX object 
tools/mlir/test/lib/Dialect/Test/CMakeFiles/MLIRTestDialect.dir/TestOpDefs.cpp.o
[4831/7888] Linking CXX shared library 
lib/libMLIRArithValueBoundsOpInterfaceImpl.so.21.0git
[4832/7888] Linking CXX shared library 
lib/libLLVMDebugInfoLogicalView.so.21.0git
FAILED: lib/libLLVMDebugInfoLogicalView.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition 
-fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual 
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough 
-Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type 
-Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation 
-fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  
-Wl,-z,defs -Wl,-z,nodelete   
-Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/./lib
  -Wl,--gc-sections -shared -Wl,-soname,libLLVMDebugInfoLogicalView.so.21.0git 
-o lib/libLLVMDebugInfoLogicalView.so.21.0git 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVCompare.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVElement.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVLine.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVLocation.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVObject.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVOptions.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVRange.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVScope.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSort.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSourceLanguage.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSupport.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSymbol.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVType.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/LVReaderHandler.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVBinaryReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVCodeViewReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVCodeViewVisitor.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVDWARFReader.cpp.o
  
-Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"
  lib/libLLVMDebugInfoDWARF.so.21.0git  lib/libLLVMDebugInfoPDB.so.21.0git  
lib/libLLVMObject.so.21.0git  lib/libLLVMMC.so.21.0git  
lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMTargetParser.so.21.0git  
lib/libLLVMDebugInfoCodeView.so.21.0git  lib/libLLVMSupport.so.21.0git  
lib/libLLVMDemangle.so.21.0git  
-Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib
 && :
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVDWARFReader.cpp.o:
 In function `bool llvm::function_ref::callback_fn(long, 
llvm::DWARFLocationEntry const&)':
LVDWARFReader.cpp:(.text._ZN4llvm12function_refIFbRKNS_18DWARFLocationEntryEEE11callback_fnIZNS_11logicalview13LVDWARFReader19processLocationListENS_5dwarf9AttributeERKNS_14DWARFFormValueERKNS_8DWARFDieEmbEUlS3_E1_EEblS3_+0x2d3):
 undefined reference to 
`llvm::DWARFExpression::Operation::extract(llvm::DataExtractor, unsigned char, 
unsigned long, std::optional)'
LVDWARFReader.cpp:(.text._ZN4llvm12function_refIFbRKNS_18DWARFLocationEntryEEE11callback_fnIZNS_11logicalview13LVDWARF

[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo][DWARF] Create new low-level dwarf library (PR #145081)

2025-06-26 Thread Jan Patrick Lehr via lldb-commits

jplehr wrote:

> Reverted with 
> [47fa4a6](https://github.com/llvm/llvm-project/commit/47fa4a6385cb4e8964cc6909c3554f6589b66eef)
> 
> Will fix and reapply.

Has this reached `main` by now? I cannot see the revert and the bot is still 
red.

https://github.com/llvm/llvm-project/pull/145081
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (PR #145959)

2025-06-26 Thread via lldb-commits

https://github.com/Sterling-Augustine created 
https://github.com/llvm/llvm-project/pull/145959

…145081)"

This reverts commit cbf781f0bdf2f680abbe784faedeefd6f84c246e.

Breaks a couple of buildbots.

>From 47fa4a6385cb4e8964cc6909c3554f6589b66eef Mon Sep 17 00:00:00 2001
From: Sterling Augustine 
Date: Thu, 26 Jun 2025 12:03:33 -0700
Subject: [PATCH] Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf
 library (#145081)"

This reverts commit cbf781f0bdf2f680abbe784faedeefd6f84c246e.

Breaks a couple of buildbots.
---
 bolt/include/bolt/Core/DIEBuilder.h   |   2 +-
 bolt/lib/Core/CMakeLists.txt  |   1 -
 bolt/lib/Core/DIEBuilder.cpp  |   2 +-
 bolt/lib/Core/DebugNames.cpp  |   2 +-
 bolt/lib/Rewrite/CMakeLists.txt   |   1 -
 bolt/lib/Rewrite/DWARFRewriter.cpp|   2 +-
 lldb/source/Expression/DWARFExpression.cpp|   5 +-
 lldb/source/Symbol/UnwindPlan.cpp |   6 +-
 .../Symbol/PostfixExpressionTest.cpp  |   5 +-
 .../PdbFPOProgramToDWARFExpressionTests.cpp   |   5 +-
 llvm/include/llvm/DWARFLinker/AddressesMap.h  |   2 +-
 .../llvm/DWARFLinker/Classic/DWARFLinker.h|   2 +-
 .../llvm/DWARFLinker/DWARFLinkerBase.h|   2 +-
 .../llvm/DebugInfo/DWARF/DWARFCFIPrinter.h|   2 +-
 .../DWARF/{LowLevel => }/DWARFCFIProgram.h| 150 +
 .../llvm/DebugInfo/DWARF/DWARFDataExtractor.h |   2 +-
 .../{LowLevel => }/DWARFDataExtractorSimple.h |   0
 .../llvm/DebugInfo/DWARF/DWARFDebugFrame.h|   4 +-
 .../DWARF/{LowLevel => }/DWARFExpression.h|  63 +-
 .../DebugInfo/DWARF/DWARFExpressionPrinter.h  |  66 ---
 .../llvm/DebugInfo/DWARF/DWARFVerifier.h  |   2 +-
 llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt|   1 -
 llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp|   2 +-
 llvm/lib/DWARFLinker/Classic/CMakeLists.txt   |   1 -
 llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp  |   2 +-
 .../Classic/DWARFLinkerCompileUnit.cpp|   2 +-
 llvm/lib/DebugInfo/DWARF/CMakeLists.txt   |   6 +-
 llvm/lib/DebugInfo/DWARF/DWARFCFIPrinter.cpp  |   6 +-
 .../DWARF/{LowLevel => }/DWARFCFIProgram.cpp  | 148 -
 llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp  |   7 +-
 llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp|   5 +-
 llvm/lib/DebugInfo/DWARF/DWARFDie.cpp |   5 +-
 llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp  | 538 ++
 .../DWARF/DWARFExpressionPrinter.cpp  | 311 --
 llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp|   2 +-
 llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp|   2 +-
 .../DebugInfo/DWARF/LowLevel/CMakeLists.txt   |  14 -
 .../DWARF/LowLevel/DWARFExpression.cpp| 253 
 .../LogicalView/Readers/LVDWARFReader.cpp |   6 +-
 llvm/lib/ProfileData/CMakeLists.txt   |   1 -
 llvm/lib/ProfileData/InstrProfCorrelator.cpp  |   2 +-
 llvm/tools/dsymutil/CMakeLists.txt|   1 -
 llvm/tools/dsymutil/DwarfLinkerForBinary.cpp  |   2 +-
 llvm/tools/llvm-dwarfdump/CMakeLists.txt  |   1 -
 llvm/tools/llvm-dwarfdump/Statistics.cpp  |   2 +-
 llvm/tools/llvm-dwarfutil/CMakeLists.txt  |   1 -
 llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp |   2 +-
 llvm/tools/llvm-objdump/CMakeLists.txt|   1 -
 llvm/tools/llvm-objdump/SourcePrinter.cpp |   5 +-
 llvm/unittests/DebugInfo/DWARF/CMakeLists.txt |   1 -
 .../DWARFExpressionCompactPrinterTest.cpp |   5 +-
 .../DWARF/DWARFExpressionCopyBytesTest.cpp|   2 +-
 .../llvm-project-overlay/bolt/BUILD.bazel |   2 -
 .../llvm-project-overlay/llvm/BUILD.bazel |  24 -
 54 files changed, 800 insertions(+), 889 deletions(-)
 rename llvm/include/llvm/DebugInfo/DWARF/{LowLevel => }/DWARFCFIProgram.h (50%)
 rename llvm/include/llvm/DebugInfo/DWARF/{LowLevel => 
}/DWARFDataExtractorSimple.h (100%)
 rename llvm/include/llvm/DebugInfo/DWARF/{LowLevel => }/DWARFExpression.h (67%)
 delete mode 100644 llvm/include/llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h
 rename llvm/lib/DebugInfo/DWARF/{LowLevel => }/DWARFCFIProgram.cpp (60%)
 create mode 100644 llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
 delete mode 100644 llvm/lib/DebugInfo/DWARF/DWARFExpressionPrinter.cpp
 delete mode 100644 llvm/lib/DebugInfo/DWARF/LowLevel/CMakeLists.txt
 delete mode 100644 llvm/lib/DebugInfo/DWARF/LowLevel/DWARFExpression.cpp

diff --git a/bolt/include/bolt/Core/DIEBuilder.h 
b/bolt/include/bolt/Core/DIEBuilder.h
index e4a4fc6b2f258..32e455ad3030a 100644
--- a/bolt/include/bolt/Core/DIEBuilder.h
+++ b/bolt/include/bolt/Core/DIEBuilder.h
@@ -20,8 +20,8 @@
 #include "llvm/CodeGen/DIE.h"
 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
 #include "llvm/DebugInfo/DWARF/DWARFDie.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
 #include "llvm/DebugInfo/DWARF/DWARFUnit.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
 #include "llvm/Support/Allocator.h"
 
 #include 
diff --git a/bolt/lib/Core/CMakeLists.txt b/bolt/lib/Core/CMakeLists.txt
index fc72dc023c590..8c1f5d0

[Lldb-commits] [lldb] [llvm] Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (PR #145959)

2025-06-26 Thread via lldb-commits

llvmbot wrote:



@llvm/pr-subscribers-pgo

@llvm/pr-subscribers-lldb

Author: None (Sterling-Augustine)


Changes

…145081)"

This reverts commit cbf781f0bdf2f680abbe784faedeefd6f84c246e.

Breaks a couple of buildbots.

---

Patch is 96.13 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/145959.diff


54 Files Affected:

- (modified) bolt/include/bolt/Core/DIEBuilder.h (+1-1) 
- (modified) bolt/lib/Core/CMakeLists.txt (-1) 
- (modified) bolt/lib/Core/DIEBuilder.cpp (+1-1) 
- (modified) bolt/lib/Core/DebugNames.cpp (+1-1) 
- (modified) bolt/lib/Rewrite/CMakeLists.txt (-1) 
- (modified) bolt/lib/Rewrite/DWARFRewriter.cpp (+1-1) 
- (modified) lldb/source/Expression/DWARFExpression.cpp (+2-3) 
- (modified) lldb/source/Symbol/UnwindPlan.cpp (+3-3) 
- (modified) lldb/unittests/Symbol/PostfixExpressionTest.cpp (+2-3) 
- (modified) 
lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp 
(+2-3) 
- (modified) llvm/include/llvm/DWARFLinker/AddressesMap.h (+1-1) 
- (modified) llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h (+1-1) 
- (modified) llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h (+1-1) 
- (renamed) llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h (+4-146) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h (+1-1) 
- (renamed) llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractorSimple.h () 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h (+2-2) 
- (renamed) llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h (+62-1) 
- (removed) llvm/include/llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h (-66) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h (+1-1) 
- (modified) llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt (-1) 
- (modified) llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (+1-1) 
- (modified) llvm/lib/DWARFLinker/Classic/CMakeLists.txt (-1) 
- (modified) llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp (+1-1) 
- (modified) llvm/lib/DWARFLinker/Classic/DWARFLinkerCompileUnit.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/CMakeLists.txt (+2-4) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFCFIPrinter.cpp (+3-3) 
- (renamed) llvm/lib/DebugInfo/DWARF/DWARFCFIProgram.cpp (+146-2) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp (+3-4) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp (+2-3) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDie.cpp (+2-3) 
- (added) llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp (+538) 
- (removed) llvm/lib/DebugInfo/DWARF/DWARFExpressionPrinter.cpp (-311) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp (+1-1) 
- (removed) llvm/lib/DebugInfo/DWARF/LowLevel/CMakeLists.txt (-14) 
- (removed) llvm/lib/DebugInfo/DWARF/LowLevel/DWARFExpression.cpp (-253) 
- (modified) llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp (+3-3) 
- (modified) llvm/lib/ProfileData/CMakeLists.txt (-1) 
- (modified) llvm/lib/ProfileData/InstrProfCorrelator.cpp (+1-1) 
- (modified) llvm/tools/dsymutil/CMakeLists.txt (-1) 
- (modified) llvm/tools/dsymutil/DwarfLinkerForBinary.cpp (+1-1) 
- (modified) llvm/tools/llvm-dwarfdump/CMakeLists.txt (-1) 
- (modified) llvm/tools/llvm-dwarfdump/Statistics.cpp (+1-1) 
- (modified) llvm/tools/llvm-dwarfutil/CMakeLists.txt (-1) 
- (modified) llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp (+1-1) 
- (modified) llvm/tools/llvm-objdump/CMakeLists.txt (-1) 
- (modified) llvm/tools/llvm-objdump/SourcePrinter.cpp (+2-3) 
- (modified) llvm/unittests/DebugInfo/DWARF/CMakeLists.txt (-1) 
- (modified) 
llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp (+2-3) 
- (modified) llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp 
(+1-1) 
- (modified) utils/bazel/llvm-project-overlay/bolt/BUILD.bazel (-2) 
- (modified) utils/bazel/llvm-project-overlay/llvm/BUILD.bazel (-24) 


``diff
diff --git a/bolt/include/bolt/Core/DIEBuilder.h 
b/bolt/include/bolt/Core/DIEBuilder.h
index e4a4fc6b2f258..32e455ad3030a 100644
--- a/bolt/include/bolt/Core/DIEBuilder.h
+++ b/bolt/include/bolt/Core/DIEBuilder.h
@@ -20,8 +20,8 @@
 #include "llvm/CodeGen/DIE.h"
 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
 #include "llvm/DebugInfo/DWARF/DWARFDie.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
 #include "llvm/DebugInfo/DWARF/DWARFUnit.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
 #include "llvm/Support/Allocator.h"
 
 #include 
diff --git a/bolt/lib/Core/CMakeLists.txt b/bolt/lib/Core/CMakeLists.txt
index fc72dc023c590..8c1f5d0bb37b5 100644
--- a/bolt/lib/Core/CMakeLists.txt
+++ b/bolt/lib/Core/CMakeLists.txt
@@ -1,6 +1,5 @@
 set(LLVM_LINK_COMPONENTS
   DebugInfoDWARF
-  DebugInfoDWARFLowLevel
   Demangle
   MC
   MCDisassembler
diff --git a/bolt/lib/Core/DIEBuilder.cpp b/bolt/lib/Core/DIEBuilder.cpp
index b041dc5ea1cce..d36dbb3459249 100644
--- a/bolt/lib/Core/DIEBuil

[Lldb-commits] [lldb] [llvm] Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (PR #145959)

2025-06-26 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- 
llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp 
bolt/include/bolt/Core/DIEBuilder.h bolt/lib/Core/DIEBuilder.cpp 
bolt/lib/Core/DebugNames.cpp bolt/lib/Rewrite/DWARFRewriter.cpp 
lldb/source/Expression/DWARFExpression.cpp lldb/source/Symbol/UnwindPlan.cpp 
lldb/unittests/Symbol/PostfixExpressionTest.cpp 
lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp 
llvm/include/llvm/DWARFLinker/AddressesMap.h 
llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h 
llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h 
llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h 
llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h 
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h 
llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h 
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp 
llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp 
llvm/lib/DWARFLinker/Classic/DWARFLinkerCompileUnit.cpp 
llvm/lib/DebugInfo/DWARF/DWARFCFIPrinter.cpp 
llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp 
llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp 
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp 
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp 
llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp 
llvm/lib/ProfileData/InstrProfCorrelator.cpp 
llvm/tools/dsymutil/DwarfLinkerForBinary.cpp 
llvm/tools/llvm-dwarfdump/Statistics.cpp 
llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp 
llvm/tools/llvm-objdump/SourcePrinter.cpp 
llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp 
llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp 
llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h 
llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractorSimple.h 
llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h 
llvm/lib/DebugInfo/DWARF/DWARFCFIProgram.cpp
``





View the diff from clang-format here.


``diff
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h 
b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
index ea414278c..ec8fb97c1 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
@@ -65,7 +65,7 @@ public:
 
 /// Description of the encoding of one expression Op.
 struct Description {
-  DwarfVersion Version; ///< Dwarf version where the Op was introduced.
+  DwarfVersion Version; ///< Dwarf version where the Op was introduced.
   SmallVector Op; ///< Encoding for Op operands.
 
   template 
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp 
b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
index 8255e013a..5203b25f2 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -214,8 +214,8 @@ bool DWARFExpression::Operation::extract(DataExtractor Data,
 Operands[Operand] = Data.getULEB128(&Offset);
 break;
   case 3: // global as uint32
- Operands[Operand] = Data.getU32(&Offset);
- break;
+Operands[Operand] = Data.getU32(&Offset);
+break;
   default:
 return false; // Unknown Wasm location
   }
@@ -354,7 +354,8 @@ bool DWARFExpressionPrinter::printOp(const 
DWARFExpression::Operation *Op,
   case 4:
 OS << format(" 0x%" PRIx64, Op->Operands[Operand]);
 break;
-  default: assert(false);
+  default:
+assert(false);
   }
 } else if (Size == DWARFExpression::Operation::SizeBlock) {
   uint64_t Offset = Op->Operands[Operand];

``




https://github.com/llvm/llvm-project/pull/145959
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (PR #145959)

2025-06-26 Thread via lldb-commits

https://github.com/Sterling-Augustine closed 
https://github.com/llvm/llvm-project/pull/145959
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][scripts] Fix bugs in framework fix script (PR #145961)

2025-06-26 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Chelsea Cassanova (chelcassanova)


Changes

The script used to fix up LLDB's header for use in the macOS framework 
contained 2 bugs that this commit addreses:

1. The output contents were appended to the output file multiple times instead 
of only being written once.
2. The script was not considering LLDB includes that were *not* from the SB API.

This commit addresses and fixes both of these bugs and updates the 
corresponding test to match.

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


3 Files Affected:

- (modified) lldb/scripts/framework-header-fix.py (+2-2) 
- (modified) lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h (+1) 
- (modified) lldb/test/Shell/Scripts/TestFrameworkFixScript.test (+1) 


``diff
diff --git a/lldb/scripts/framework-header-fix.py 
b/lldb/scripts/framework-header-fix.py
index 9528fdb7e30bd..883c56d3dddc3 100755
--- a/lldb/scripts/framework-header-fix.py
+++ b/lldb/scripts/framework-header-fix.py
@@ -20,7 +20,7 @@
 
 # Main header regexes
 INCLUDE_FILENAME_REGEX = re.compile(
-r'#include "lldb/API/(?P.*){0,1}"'
+r'#include "lldb/(API/){0,1}(?P.*){0,1}"'
 )
 
 # RPC header regexes
@@ -70,7 +70,7 @@ def modify_main_includes(input_file_path, output_file_path):
 r"#include ",
 file_buffer,
 )
-output_file.write(file_buffer)
+output_file.write(file_buffer)
 
 
 def remove_guards(output_file_path, unifdef_path, unifdef_guards):
diff --git a/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h 
b/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
index fecc69687cd74..a15dd9d2a942e 100644
--- a/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
+++ b/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
@@ -6,6 +6,7 @@
 // e.g. #include "lldb/API/SBDefines.h" -> #include 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBModule.h"
+#include "lldb/lldb-types.h"
 
 // Any include guards specified at the command line must be removed.
 #ifndef SWIG
diff --git a/lldb/test/Shell/Scripts/TestFrameworkFixScript.test 
b/lldb/test/Shell/Scripts/TestFrameworkFixScript.test
index e90c3bdfc5adb..5c48b796efda4 100644
--- a/lldb/test/Shell/Scripts/TestFrameworkFixScript.test
+++ b/lldb/test/Shell/Scripts/TestFrameworkFixScript.test
@@ -9,3 +9,4 @@ RUN: cat %t/Outputs/SBAddress.h | FileCheck %s
 # e.g. #include "lldb/API/SBDefines.h" -> #include 
 CHECK: #include 
 CHECK: #include 
+CHECK: #include 

``




https://github.com/llvm/llvm-project/pull/145961
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo][DWARF] Create new low-level dwarf library (PR #145081)

2025-06-26 Thread via lldb-commits

Sterling-Augustine wrote:

I think it is there now.

https://github.com/llvm/llvm-project/pull/145081
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][scripts] Fix bugs in framework fix script (PR #145961)

2025-06-26 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova created 
https://github.com/llvm/llvm-project/pull/145961

The script used to fix up LLDB's header for use in the macOS framework 
contained 2 bugs that this commit addreses:

1. The output contents were appended to the output file multiple times instead 
of only being written once.
2. The script was not considering LLDB includes that were *not* from the SB API.

This commit addresses and fixes both of these bugs and updates the 
corresponding test to match.

>From d45694a96a6fc02538c8c7ec57e5465db6070e89 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Thu, 26 Jun 2025 13:05:56 -0700
Subject: [PATCH] [lldb][scripts] Fix bugs in framework fix script

The script used to fix up LLDB's header for use in the macOS framework
contained 2 bugs that this commit addresss:

1. The output contents were appended to the output file multiple times
   instead of only being written once.
2. The script was not considering LLDB includes that were *not* from the
   SB API.

This commit address and fixes both of these bugs and updates the
corresponding test to match.
---
 lldb/scripts/framework-header-fix.py| 4 ++--
 lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h | 1 +
 lldb/test/Shell/Scripts/TestFrameworkFixScript.test | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/scripts/framework-header-fix.py 
b/lldb/scripts/framework-header-fix.py
index 9528fdb7e30bd..883c56d3dddc3 100755
--- a/lldb/scripts/framework-header-fix.py
+++ b/lldb/scripts/framework-header-fix.py
@@ -20,7 +20,7 @@
 
 # Main header regexes
 INCLUDE_FILENAME_REGEX = re.compile(
-r'#include "lldb/API/(?P.*){0,1}"'
+r'#include "lldb/(API/){0,1}(?P.*){0,1}"'
 )
 
 # RPC header regexes
@@ -70,7 +70,7 @@ def modify_main_includes(input_file_path, output_file_path):
 r"#include ",
 file_buffer,
 )
-output_file.write(file_buffer)
+output_file.write(file_buffer)
 
 
 def remove_guards(output_file_path, unifdef_path, unifdef_guards):
diff --git a/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h 
b/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
index fecc69687cd74..a15dd9d2a942e 100644
--- a/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
+++ b/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
@@ -6,6 +6,7 @@
 // e.g. #include "lldb/API/SBDefines.h" -> #include 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBModule.h"
+#include "lldb/lldb-types.h"
 
 // Any include guards specified at the command line must be removed.
 #ifndef SWIG
diff --git a/lldb/test/Shell/Scripts/TestFrameworkFixScript.test 
b/lldb/test/Shell/Scripts/TestFrameworkFixScript.test
index e90c3bdfc5adb..5c48b796efda4 100644
--- a/lldb/test/Shell/Scripts/TestFrameworkFixScript.test
+++ b/lldb/test/Shell/Scripts/TestFrameworkFixScript.test
@@ -9,3 +9,4 @@ RUN: cat %t/Outputs/SBAddress.h | FileCheck %s
 # e.g. #include "lldb/API/SBDefines.h" -> #include 
 CHECK: #include 
 CHECK: #include 
+CHECK: #include 

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][scripts] Fix bugs in framework fix script (PR #145961)

2025-06-26 Thread Alex Langford via lldb-commits

https://github.com/bulbazord approved this pull request.


https://github.com/llvm/llvm-project/pull/145961
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][scripts] Fix bugs in framework fix script (PR #145961)

2025-06-26 Thread Alex Langford via lldb-commits


@@ -20,7 +20,7 @@
 
 # Main header regexes
 INCLUDE_FILENAME_REGEX = re.compile(
-r'#include "lldb/API/(?P.*){0,1}"'
+r'#include "lldb/(API/){0,1}(?P.*){0,1}"'

bulbazord wrote:

I'm not an expert on regex but would it make sense to use `?` here instead of 
`{0,1}`?

https://github.com/llvm/llvm-project/pull/145961
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo][DWARF] Create new low-level dwarf library (PR #145081)

2025-06-26 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`amdgpu-offload-rhel-9-cmake-build-only` running on `rocm-docker-rhel-9` while 
building `bolt,lldb,llvm,utils` at step 4 "annotate".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/205/builds/13548


Here is the relevant piece of the build log for the reference

```
Step 4 (annotate) failure: 
'../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py 
--jobs=32' (failure)
...
[5201/7888] Creating library symlink lib/libMLIRMemRefDialect.so
[5202/7888] Creating library symlink lib/libLLVMDWP.so
[5203/7888] Creating library symlink lib/libLLVMDebugInfoGSYM.so
[5204/7888] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAMDGPU.cpp.o
[5205/7888] Creating library symlink lib/libLLVMTextAPIBinaryReader.so
[5206/7888] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaConsumer.cpp.o
[5207/7888] Linking CXX shared library lib/libMLIRReduceLib.so.21.0git
[5208/7888] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaChecking.cpp.o
[5209/7888] Creating library symlink lib/libMLIRReduceLib.so
[5210/7888] Linking CXX shared library 
lib/libLLVMDebugInfoLogicalView.so.21.0git
FAILED: lib/libLLVMDebugInfoLogicalView.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition 
-fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual 
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough 
-Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move 
-Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor 
-Wsuggest-override -Wno-comment -Wno-misleading-indentation 
-Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections 
-fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   
-Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/./lib
  -Wl,--gc-sections -shared -Wl,-soname,libLLVMDebugInfoLogicalView.so.21.0git 
-o lib/libLLVMDebugInfoLogicalView.so.21.0git 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVCompare.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVElement.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVLine.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVLocation.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVObject.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVOptions.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVRange.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVScope.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSort.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSourceLanguage.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSupport.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSymbol.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVType.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/LVReaderHandler.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVBinaryReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVCodeViewReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVCodeViewVisitor.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVDWARFReader.cpp.o
  
-Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"
  lib/libLLVMDebugInfoDWARF.so.21.0git  lib/libLLVMDebugInfoPDB.so.21.0git  
lib/libLLVMObject.so.21.0git  lib/libLLVMMC.so.21.0git  
lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMTargetParser.so.21.0git  
lib/libLLVMDebugInfoCodeView.so.21.0git  lib/libLLVMSupport.so.21.0git  
lib/libLLVMDemangle.so.21.0git  
-Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib
 && :
/usr/bin/ld: 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVDWARFReader.cpp.o:
 in function `bool llvm::function_ref::callback_fn(long, 
llvm::DWARFLocationEntry const&)':
LVDWARFReader.cpp:(.text._ZN4llvm12function_refIFbRKNS_18DWARFLocationEntryEEE11callback_fnIZNS_11logicalview13LVDWARFReader19processLocationListENS_5dwarf9AttributeERKNS_14DWARFFormValueERKNS_8DWARFDieEmbEUlS3_E1_EEblS3_+0x2e1):
 undefined reference to 
`llvm::DWARFExpression::Operation::extract(llvm::DataExtractor, unsigned char, 
unsigned long, std::optional)'
/usr/bin/ld: 
LVDWARFReader.cpp:(.text._ZN4llvm12function_refIFbRKNS_18DWARFLocationEntryEEE

[Lldb-commits] [lldb] [lldb][scripts] Fix bugs in framework fix script (PR #145961)

2025-06-26 Thread Chelsea Cassanova via lldb-commits


@@ -20,7 +20,7 @@
 
 # Main header regexes
 INCLUDE_FILENAME_REGEX = re.compile(
-r'#include "lldb/API/(?P.*){0,1}"'
+r'#include "lldb/(API/){0,1}(?P.*){0,1}"'

chelcassanova wrote:

Could be worth updating all other instances of `{0,1}`

https://github.com/llvm/llvm-project/pull/145961
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][scripts] Fix bugs in framework fix script (PR #145961)

2025-06-26 Thread Chelsea Cassanova via lldb-commits


@@ -20,7 +20,7 @@
 
 # Main header regexes
 INCLUDE_FILENAME_REGEX = re.compile(
-r'#include "lldb/API/(?P.*){0,1}"'
+r'#include "lldb/(API/){0,1}(?P.*){0,1}"'

chelcassanova wrote:

Such that we have `r'#include "lldb/(API/)?(?P.*){0,1}"'` 
instead of `r'#include "lldb/(API/){0,1}(?P.*){0,1}"'`. I 
just tried it and the test still works, updating the patch.

https://github.com/llvm/llvm-project/pull/145961
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][scripts] Fix bugs in framework fix script (PR #145961)

2025-06-26 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova updated 
https://github.com/llvm/llvm-project/pull/145961

>From 7382a6a7e5636515c4882136d54c8133d77aa31d Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Thu, 26 Jun 2025 13:05:56 -0700
Subject: [PATCH] [lldb][scripts] Fix bugs in framework fix script

The script used to fix up LLDB's header for use in the macOS framework
contained 2 bugs that this commit addresss:

1. The output contents were appended to the output file multiple times
   instead of only being written once.
2. The script was not considering LLDB includes that were *not* from the
   SB API.

This commit address and fixes both of these bugs and updates the
corresponding test to match.
---
 lldb/scripts/framework-header-fix.py| 4 ++--
 lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h | 1 +
 lldb/test/Shell/Scripts/TestFrameworkFixScript.test | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/scripts/framework-header-fix.py 
b/lldb/scripts/framework-header-fix.py
index 9528fdb7e30bd..d8c38511f19af 100755
--- a/lldb/scripts/framework-header-fix.py
+++ b/lldb/scripts/framework-header-fix.py
@@ -20,7 +20,7 @@
 
 # Main header regexes
 INCLUDE_FILENAME_REGEX = re.compile(
-r'#include "lldb/API/(?P.*){0,1}"'
+r'#include "lldb/(API/)?(?P.*){0,1}"'
 )
 
 # RPC header regexes
@@ -70,7 +70,7 @@ def modify_main_includes(input_file_path, output_file_path):
 r"#include ",
 file_buffer,
 )
-output_file.write(file_buffer)
+output_file.write(file_buffer)
 
 
 def remove_guards(output_file_path, unifdef_path, unifdef_guards):
diff --git a/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h 
b/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
index fecc69687cd74..a15dd9d2a942e 100644
--- a/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
+++ b/lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
@@ -6,6 +6,7 @@
 // e.g. #include "lldb/API/SBDefines.h" -> #include 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBModule.h"
+#include "lldb/lldb-types.h"
 
 // Any include guards specified at the command line must be removed.
 #ifndef SWIG
diff --git a/lldb/test/Shell/Scripts/TestFrameworkFixScript.test 
b/lldb/test/Shell/Scripts/TestFrameworkFixScript.test
index e90c3bdfc5adb..5c48b796efda4 100644
--- a/lldb/test/Shell/Scripts/TestFrameworkFixScript.test
+++ b/lldb/test/Shell/Scripts/TestFrameworkFixScript.test
@@ -9,3 +9,4 @@ RUN: cat %t/Outputs/SBAddress.h | FileCheck %s
 # e.g. #include "lldb/API/SBDefines.h" -> #include 
 CHECK: #include 
 CHECK: #include 
+CHECK: #include 

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo][DWARF] Create new low-level dwarf library (PR #145081)

2025-06-26 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`amdgpu-offload-ubuntu-22-cmake-build-only` running on `rocm-docker-ubu-22` 
while building `bolt,lldb,llvm,utils` at step 4 "annotate".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/203/builds/14758


Here is the relevant piece of the build log for the reference

```
Step 4 (annotate) failure: 
'../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py 
--jobs=32' (failure)
...
[5243/7888] Creating library symlink lib/libLLVMTextAPIBinaryReader.so
[5244/7888] Linking CXX shared library lib/libLLVMDWP.so.21.0git
[5245/7888] Linking CXX shared library lib/libMLIRCAPINVGPU.so.21.0git
[5246/7888] Creating library symlink lib/libLLVMDWP.so
[5247/7888] Creating library symlink lib/libMLIRCAPINVGPU.so
[5248/7888] Creating library symlink lib/libLLVMDebugInfoGSYM.so
[5249/7888] Linking CXX shared library 
lib/libMLIRFuncMeshShardingExtensions.so.21.0git
[5250/7888] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCUDA.cpp.o
[5251/7888] Linking CXX shared library lib/libMLIRControlFlowToSCF.so.21.0git
[5252/7888] Linking CXX shared library 
lib/libLLVMDebugInfoLogicalView.so.21.0git
FAILED: lib/libLLVMDebugInfoLogicalView.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition 
-fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual 
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough 
-Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move 
-Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor 
-Wsuggest-override -Wno-comment -Wno-misleading-indentation 
-Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections 
-fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   
-Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/./lib
  -Wl,--gc-sections -shared -Wl,-soname,libLLVMDebugInfoLogicalView.so.21.0git 
-o lib/libLLVMDebugInfoLogicalView.so.21.0git 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVCompare.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVElement.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVLine.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVLocation.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVObject.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVOptions.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVRange.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVScope.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSort.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSourceLanguage.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSupport.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSymbol.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVType.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/LVReaderHandler.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVBinaryReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVCodeViewReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVCodeViewVisitor.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVDWARFReader.cpp.o
  
-Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"
  lib/libLLVMDebugInfoDWARF.so.21.0git  lib/libLLVMDebugInfoPDB.so.21.0git  
lib/libLLVMObject.so.21.0git  lib/libLLVMMC.so.21.0git  
lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMTargetParser.so.21.0git  
lib/libLLVMDebugInfoCodeView.so.21.0git  lib/libLLVMSupport.so.21.0git  
lib/libLLVMDemangle.so.21.0git  
-Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib
 && :
/usr/bin/ld: 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVDWARFReader.cpp.o:
 in function `bool llvm::function_ref::callback_fn(long, 
llvm::DWARFLocationEntry const&)':
LVDWARFReader.cpp:(.text._ZN4llvm12function_refIFbRKNS_18DWARFLocationEntryEEE11callback_fnIZNS_11logicalview13LVDWARFReader19processLocationListENS_5dwarf9AttributeERKNS_14DWARFFormValueERKNS_8DWARFDieEmbEUlS3_E1_EEblS3_+0x311):
 undefined reference to 
`llvm::DWARFExpression::Operation::extract(llvm::DataExtractor, unsigned char, 
unsigned long, std::optional)'
/usr/bin/ld: 
LVDWARFReader.cpp:(.text._ZN4llvm12function_refIFbRKNS_18DWARFLocationEntryEEE11callback_fnIZNS_11logical

[Lldb-commits] [lldb] [LLDB][NFC] Refactor code extracting timestamp from StructuredData (PR #145954)

2025-06-26 Thread Alex Langford via lldb-commits


@@ -148,23 +161,14 @@ void TelemetryManager::DispatchClientTelemetry(
 LLDB_LOG(GetLog(LLDBLog::Object),
  "Cannot determine client_data from client-telemetry entry");
 
-  int64_t start_time;
-  if (dict->GetValueForKeyAsInteger("start_time", start_time)) {
-client_info.start_time +=
-std::chrono::nanoseconds(static_cast(start_time));
-  } else {
-LLDB_LOG(GetLog(LLDBLog::Object),
- "Cannot determine start-time from client-telemetry entry");
-  }
+  auto start_time = GetAsNanosec(dict, "start_time");
+  if (start_time.has_value())
+client_info.start_time += start_time.value();

bulbazord wrote:

```suggestion
  if (auto maybe_start_time = GetAsNanosec(dict, "start_time"))
  client_info.start_time += *maybe_start_time;
```

https://github.com/llvm/llvm-project/pull/145954
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][NFC] Refactor code extracting timestamp from StructuredData (PR #145954)

2025-06-26 Thread Alex Langford via lldb-commits


@@ -148,23 +161,14 @@ void TelemetryManager::DispatchClientTelemetry(
 LLDB_LOG(GetLog(LLDBLog::Object),
  "Cannot determine client_data from client-telemetry entry");
 
-  int64_t start_time;
-  if (dict->GetValueForKeyAsInteger("start_time", start_time)) {
-client_info.start_time +=
-std::chrono::nanoseconds(static_cast(start_time));
-  } else {
-LLDB_LOG(GetLog(LLDBLog::Object),
- "Cannot determine start-time from client-telemetry entry");
-  }
+  auto start_time = GetAsNanosec(dict, "start_time");
+  if (start_time.has_value())
+client_info.start_time += start_time.value();
 
-  int64_t end_time;
-  if (dict->GetValueForKeyAsInteger("end_time", end_time)) {
+  auto end_time = GetAsNanosec(dict, "end_time");
+  if (end_time.has_value()) {
 SteadyTimePoint epoch;
-client_info.end_time =
-epoch + std::chrono::nanoseconds(static_cast(end_time));
-  } else {
-LLDB_LOG(GetLog(LLDBLog::Object),
- "Cannot determine end-time from client-telemetry entry");
+client_info.end_time = epoch + end_time.value();

bulbazord wrote:

Same suggestion here.

https://github.com/llvm/llvm-project/pull/145954
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (PR #145959)

2025-06-26 Thread David Blaikie via lldb-commits

dwblaikie wrote:

FYI: per https://llvm.org/docs/CodeReview.html#code-review-workflow - please 
don't commit a PR without approval, once it's sent for review. If the intent 
wasn't to precommit review the PR, it should be created with the 
`skip-precommit-approval` tag.

https://github.com/llvm/llvm-project/pull/145959
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)

2025-06-26 Thread via lldb-commits

https://github.com/Nerixyz updated 
https://github.com/llvm/llvm-project/pull/143177

>From 66bc2addbbd229e88b3434f771211638cd80b867 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Wed, 18 Jun 2025 21:49:16 +0200
Subject: [PATCH] [LLDB] Add type summaries for MSVC STL strings

---
 .../lldb/DataFormatters/StringPrinter.h   |  14 ++
 lldb/packages/Python/lldbsuite/test/dotest.py |  41 +
 .../Python/lldbsuite/test/test_categories.py  |   1 +
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  | 139 +
 .../Plugins/Language/CPlusPlus/LibStdcpp.cpp  | 127 ++--
 .../Plugins/Language/CPlusPlus/LibStdcpp.h|   4 +-
 .../Plugins/Language/CPlusPlus/MsvcStl.cpp| 143 ++
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |  35 +
 .../msvcstl/string/Makefile   |   3 +
 .../string/TestDataFormatterMsvcStlString.py  | 118 +++
 .../msvcstl/string/main.cpp   |  40 +
 .../msvcstl/u8string/Makefile |   4 +
 .../TestDataFormatterMsvcStlU8String.py   |  31 
 .../msvcstl/u8string/main.cpp |  14 ++
 15 files changed, 570 insertions(+), 145 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStl.cpp
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/Makefile
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/TestDataFormatterMsvcStlString.py
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/main.cpp
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/Makefile
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/TestDataFormatterMsvcStlU8String.py
 create mode 100644 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/main.cpp

diff --git a/lldb/include/lldb/DataFormatters/StringPrinter.h 
b/lldb/include/lldb/DataFormatters/StringPrinter.h
index 4169f53e63f38..1f5bfa45996f2 100644
--- a/lldb/include/lldb/DataFormatters/StringPrinter.h
+++ b/lldb/include/lldb/DataFormatters/StringPrinter.h
@@ -152,6 +152,20 @@ class StringPrinter {
   template 
   static bool
   ReadBufferAndDumpToStream(const ReadBufferAndDumpToStreamOptions &options);
+
+  template 
+  static constexpr uint64_t ElementByteSize() {
+switch (element_type) {
+case StringElementType::ASCII:
+case StringElementType::UTF8:
+  return 1;
+case StringElementType::UTF16:
+  return 2;
+case StringElementType::UTF32:
+  return 3;
+}
+return 0;
+  }
 };
 
 } // namespace formatters
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py 
b/lldb/packages/Python/lldbsuite/test/dotest.py
index d7f274ac4f60e..90c8e32afa507 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -831,6 +831,46 @@ def checkLibstdcxxSupport():
 configuration.skip_categories.append("libstdcxx")
 
 
+def canRunMsvcStlTests():
+from lldbsuite.test import lldbplatformutil
+
+platform = lldbplatformutil.getPlatform()
+if platform != "windows":
+return False, f"Don't know how to build with MSVC's STL on {platform}"
+
+with tempfile.NamedTemporaryFile() as f:
+cmd = [configuration.compiler, "-xc++", "-o", f.name, "-E", "-"]
+p = subprocess.Popen(
+cmd,
+stdin=subprocess.PIPE,
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE,
+universal_newlines=True,
+)
+_, stderr = p.communicate(
+"""
+#include 
+#ifndef _MSVC_STL_VERSION
+#error _MSVC_STL_VERSION not defined
+#endif
+"""
+)
+if not p.returncode:
+return True, "Compiling with MSVC STL"
+return (False, f"Not compiling with MSVC STL: {stderr}")
+
+
+def checkMsvcStlSupport():
+result, reason = canRunMsvcStlTests()
+if result:
+return  # msvcstl supported
+if "msvcstl" in configuration.categories_list:
+return  # msvcstl category explicitly requested, let it run.
+if configuration.verbose:
+print(f"msvcstl tests will not be run because: {reason}")
+configuration.skip_categories.append("msvcstl")
+
+
 def canRunWatchpointTests():
 from lldbsuite.test import lldbplatformutil
 
@@ -1044,6 +1084,7 @@ def run_suite():
 
 checkLibcxxSupport()
 checkLibstdcxxSupport()
+checkMsvcStlSupport()
 checkWatchpointSupport()
 checkDebugInfoSupport()
 checkDebugServerSupport()
diff --git a/lldb/packages/Python/lldbsuite/test/test_categories.py 
b/lldb/packages/Python/lldbsuite/test/test_categories.py
index b585f695adeab..1f6e8a

[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo][DWARF] Create new low-level dwarf library (PR #145081)

2025-06-26 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `sanitizer-x86_64-linux` 
running on `sanitizer-buildbot1` while building `bolt,lldb,llvm,utils` at step 
2 "annotate".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/66/builds/15857


Here is the relevant piece of the build log for the reference

```
Step 2 (annotate) failure: 'python 
../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'
 (failure)
...
+ diff -u expected.new undefined.new
+_ZN4llvm15DWARFExpression9Operation7extractENS_13DataExtractorEhyNSt20__InternalSymbolizer8optionalINS_5dwarf11DwarfFormatEEE
 U
+_ZN4llvm5dwarf10CFIProgram15getOperandTypesEv U
+_ZNK4llvm5dwarf10CFIProgram11Instruction18getOperandAsSignedERKS1_j U
+_ZNK4llvm5dwarf10CFIProgram11Instruction20getOperandAsUnsignedERKS1_j U
+_ZNK4llvm5dwarf10CFIProgram15callFrameStringEj U
+ echo 'Failed: unexpected symbols'
+ exit 1
Failed: unexpected symbols
[3126/3241] Building CXX object 
compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.x86_64.dir/asan_interceptors.cpp.o
FAILED: 
compiler-rt/lib/sanitizer_common/symbolizer/RTSanitizerCommonSymbolizerInternal.i386.o
 
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/lib/sanitizer_common/symbolizer/RTSanitizerCommonSymbolizerInternal.i386.o
 
cd 
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/lib/sanitizer_common/symbolizer/RTSanitizerCommonSymbolizerInternal.i386
 && FLAGS=-m32 
CLANG=/home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang 
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
 
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/lib/sanitizer_common/symbolizer/RTSanitizerCommonSymbolizerInternal.i386.o
ninja: build stopped: subcommand failed.
FAILED: runtimes/runtimes-stamps/runtimes-build 
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-stamps/runtimes-build
 
cd /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins && 
/usr/bin/cmake --build .
ninja: build stopped: subcommand failed.

How to reproduce locally: 
https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild


@@@STEP_FAILURE@@@

@@@STEP_FAILURE@@@

@@@STEP_FAILURE@@@
@@@BUILD_STEP test compiler-rt symbolizer@@@
ninja: Entering directory `build_default'
[0/5] Performing build step for 'builtins'
ninja: no work to do.
[1/5] No install step for 'builtins'
[3/5] Completed 'builtins'
[3/5] Performing configure step for 'runtimes'
Not searching for unused variables given on the command line.
loading initial cache file 
/home/b/sanitizer-x86_64-linux/build/build_default/projects/runtimes/tmp/runtimes-cache-Release.cmake
-- Performing bootstrapping runtimes build.
-- Building with -fPIC
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Using libunwind testing configuration: 
/home/b/sanitizer-x86_64-linux/build/llvm-project/libunwind/test/configs/llvm-libunwind-shared.cfg.in
-- Failed to locate sphinx-build executable (missing: SPHINX_EXECUTABLE) 
-- Using libc++abi testing configuration: 
/home/b/sanitizer-x86_64-linux/build/llvm-project/libcxxabi/test/configs/llvm-libc++abi-shared.cfg.in
-- Using libc++ testing configuration: 
/home/b/sanitizer-x86_64-linux/build/llvm-project/libcxx/test/configs/llvm-libc++-shared.cfg.in
-- Clang-tidy tests are disabled since the Clang development package has no 
clangTidy target.
-- Compiler-RT supported architectures: x86_64;i386
-- Generated Sanitizer SUPPORTED_TOOLS list on "Linux" is 
"asan;lsan;hwasan;msan;tsan;ubsan"
-- sanitizer_common tests on "Linux" will run against 
"asan;lsan;hwasan;msan;tsan;ubsan"
-- check-shadowcallstack does nothing.
-- Configuring done (2.2s)
-- Generating done (1.0s)
Step 8 (build compiler-rt symbolizer) failure: build compiler-rt symbolizer 
(failure)
...
+ diff -u expected.new undefined.new
+_ZN4llvm15DWARFExpression9Operation7extractENS_13DataExtractorEhyNSt20__InternalSymbolizer8optionalINS_5dwarf11DwarfFormatEEE
 U
+_ZN4llvm5dwarf10CFIProgram15getOperandTypesEv U
+_ZNK4llvm5dwarf10CFIProgram11Instruction18getOperandAsSignedERKS1_j U
+_ZNK4llvm5dwarf10CFIProgram11Instruction20getOperandAsUnsignedERKS1_j U
+_ZNK4llvm5dwarf10CFIProgram15callFrameStringEj U
+ echo 'Failed: unexpected symbols'
+ exit 1
Failed: unexpected symbols
[3126/3241] Building CXX object 
compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.x86_64.dir/asan_interceptors.cpp.o
FAILED: 
compiler-rt/lib/sanitizer_common/symbolizer/RTSanitizerCommonSymbolizerInternal.i386.o
 
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/lib/sanitizer_common/symbolizer/RTSanitizerCommonSymbolizerInternal.i386.o
 
cd 
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/lib/sanitizer_common/symbolizer/RTSanitizerCo

[Lldb-commits] [lldb] [LLDB][NFC] Refactor code extracting timestamp from StructuredData (PR #145954)

2025-06-26 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Vy Nguyen (oontvoo)


Changes



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


1 Files Affected:

- (modified) lldb/source/Core/Telemetry.cpp (+19-15) 


``diff
diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp
index 6434b11a63ad4..464c1d4071a73 100644
--- a/lldb/source/Core/Telemetry.cpp
+++ b/lldb/source/Core/Telemetry.cpp
@@ -119,6 +119,19 @@ llvm::Error TelemetryManager::preDispatch(TelemetryInfo 
*entry) {
   return llvm::Error::success();
 }
 
+// Helper for extracting time field from a Dictionary.
+static std::optional
+GetAsNanosec(StructuredData::Dictionary *dict, llvm::StringRef key) {
+  auto value = dict->GetValueForKey(key);
+  if (!value->IsValid()) {
+LLDB_LOG(GetLog(LLDBLog::Object),
+ "Cannot determine {0} from client-telemetry entry", key);
+return std::nullopt;
+  }
+
+  return std::chrono::nanoseconds(value->GetUnsignedIntegerValue(0));
+}
+
 void TelemetryManager::DispatchClientTelemetry(
 const lldb_private::StructuredDataImpl &entry, Debugger *debugger) {
   if (!m_config->enable_client_telemetry)
@@ -148,23 +161,14 @@ void TelemetryManager::DispatchClientTelemetry(
 LLDB_LOG(GetLog(LLDBLog::Object),
  "Cannot determine client_data from client-telemetry entry");
 
-  int64_t start_time;
-  if (dict->GetValueForKeyAsInteger("start_time", start_time)) {
-client_info.start_time +=
-std::chrono::nanoseconds(static_cast(start_time));
-  } else {
-LLDB_LOG(GetLog(LLDBLog::Object),
- "Cannot determine start-time from client-telemetry entry");
-  }
+  auto start_time = GetAsNanosec(dict, "start_time");
+  if (start_time.has_value())
+client_info.start_time += start_time.value();
 
-  int64_t end_time;
-  if (dict->GetValueForKeyAsInteger("end_time", end_time)) {
+  auto end_time = GetAsNanosec(dict, "end_time");
+  if (end_time.has_value()) {
 SteadyTimePoint epoch;
-client_info.end_time =
-epoch + std::chrono::nanoseconds(static_cast(end_time));
-  } else {
-LLDB_LOG(GetLog(LLDBLog::Object),
- "Cannot determine end-time from client-telemetry entry");
+client_info.end_time = epoch + end_time.value();
   }
 
   llvm::StringRef error_msg;

``




https://github.com/llvm/llvm-project/pull/145954
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][NFC] Refactor code extracting timestamp from StructuredData (PR #145954)

2025-06-26 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo created 
https://github.com/llvm/llvm-project/pull/145954

None

>From f4092ed5fda4214bfd2c72f288a6c686315bdc3b Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Thu, 26 Jun 2025 15:18:44 -0400
Subject: [PATCH] [LLDB][NFC] Refactor code extracting timestamp from
 StructuredData

---
 lldb/source/Core/Telemetry.cpp | 34 +++---
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp
index 6434b11a63ad4..464c1d4071a73 100644
--- a/lldb/source/Core/Telemetry.cpp
+++ b/lldb/source/Core/Telemetry.cpp
@@ -119,6 +119,19 @@ llvm::Error TelemetryManager::preDispatch(TelemetryInfo 
*entry) {
   return llvm::Error::success();
 }
 
+// Helper for extracting time field from a Dictionary.
+static std::optional
+GetAsNanosec(StructuredData::Dictionary *dict, llvm::StringRef key) {
+  auto value = dict->GetValueForKey(key);
+  if (!value->IsValid()) {
+LLDB_LOG(GetLog(LLDBLog::Object),
+ "Cannot determine {0} from client-telemetry entry", key);
+return std::nullopt;
+  }
+
+  return std::chrono::nanoseconds(value->GetUnsignedIntegerValue(0));
+}
+
 void TelemetryManager::DispatchClientTelemetry(
 const lldb_private::StructuredDataImpl &entry, Debugger *debugger) {
   if (!m_config->enable_client_telemetry)
@@ -148,23 +161,14 @@ void TelemetryManager::DispatchClientTelemetry(
 LLDB_LOG(GetLog(LLDBLog::Object),
  "Cannot determine client_data from client-telemetry entry");
 
-  int64_t start_time;
-  if (dict->GetValueForKeyAsInteger("start_time", start_time)) {
-client_info.start_time +=
-std::chrono::nanoseconds(static_cast(start_time));
-  } else {
-LLDB_LOG(GetLog(LLDBLog::Object),
- "Cannot determine start-time from client-telemetry entry");
-  }
+  auto start_time = GetAsNanosec(dict, "start_time");
+  if (start_time.has_value())
+client_info.start_time += start_time.value();
 
-  int64_t end_time;
-  if (dict->GetValueForKeyAsInteger("end_time", end_time)) {
+  auto end_time = GetAsNanosec(dict, "end_time");
+  if (end_time.has_value()) {
 SteadyTimePoint epoch;
-client_info.end_time =
-epoch + std::chrono::nanoseconds(static_cast(end_time));
-  } else {
-LLDB_LOG(GetLog(LLDBLog::Object),
- "Cannot determine end-time from client-telemetry entry");
+client_info.end_time = epoch + end_time.value();
   }
 
   llvm::StringRef error_msg;

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo][DWARF] Create new low-level dwarf library (PR #145081)

2025-06-26 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`clang-ppc64le-linux-multistage` running on `ppc64le-clang-multistage-test` 
while building `bolt,lldb,llvm,utils` at step 4 "build stage 1".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/76/builds/10780


Here is the relevant piece of the build log for the reference

```
Step 4 (build stage 1) failure: 'ninja' (failure)
...
[5468/6440] Linking CXX executable bin/llvm-sim
[5469/6440] Linking CXX executable bin/llvm-tli-checker
[5470/6440] Creating library symlink lib/libLLVMTarget.so
[5471/6440] Building CXX object 
lib/Target/RISCV/TargetInfo/CMakeFiles/LLVMRISCVInfo.dir/RISCVTargetInfo.cpp.o
[5472/6440] Building CXX object 
lib/Target/RISCV/MCTargetDesc/CMakeFiles/LLVMRISCVDesc.dir/RISCVMCAsmInfo.cpp.o
[5473/6440] Building CXX object 
lib/Target/RISCV/CMakeFiles/LLVMRISCVCodeGen.dir/RISCVConstantPoolValue.cpp.o
[5474/6440] Creating library symlink lib/libLLVMBitWriter.so
[5475/6440] Building CXX object 
lib/Target/RISCV/CMakeFiles/LLVMRISCVCodeGen.dir/RISCVSelectionDAGInfo.cpp.o
[5476/6440] Linking CXX shared library lib/libLLVMSandboxIR.so.21.0git
[5477/6440] Linking CXX shared library 
lib/libLLVMDebugInfoLogicalView.so.21.0git
FAILED: lib/libLLVMDebugInfoLogicalView.so.21.0git 
: && /usr/lib64/ccache/c++ -fPIC -fPIC -fno-semantic-interposition 
-fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual 
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough 
-Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type 
-Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation 
-fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  
-Wl,-z,defs -Wl,-z,nodelete   
-Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./lib
  -Wl,--gc-sections -shared -Wl,-soname,libLLVMDebugInfoLogicalView.so.21.0git 
-o lib/libLLVMDebugInfoLogicalView.so.21.0git 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVCompare.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVElement.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVLine.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVLocation.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVObject.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVOptions.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVRange.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVScope.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSort.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSourceLanguage.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSupport.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVSymbol.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Core/LVType.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/LVReaderHandler.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVBinaryReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVCodeViewReader.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVCodeViewVisitor.cpp.o
 
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVDWARFReader.cpp.o
  
-Wl,-rpath,"\$ORIGIN/../lib:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib:"
  lib/libLLVMDebugInfoDWARF.so.21.0git  lib/libLLVMDebugInfoPDB.so.21.0git  
lib/libLLVMObject.so.21.0git  lib/libLLVMMC.so.21.0git  
lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMTargetParser.so.21.0git  
lib/libLLVMDebugInfoCodeView.so.21.0git  lib/libLLVMSupport.so.21.0git  
lib/libLLVMDemangle.so.21.0git  
-Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib
 && :
lib/DebugInfo/LogicalView/CMakeFiles/LLVMDebugInfoLogicalView.dir/Readers/LVDWARFReader.cpp.o:
 In function `bool llvm::function_ref::callback_fn(long, 
llvm::DWARFLocationEntry const&)':
LVDWARFReader.cpp:(.text._ZN4llvm12function_refIFbRKNS_18DWARFLocationEntryEEE11callback_fnIZNS_11logicalview13LVDWARFReader19processLocationListENS_5dwarf9AttributeERKNS_14DWARFFormValueERKNS_8DWARFDieEmbEUlS3_E1_EEblS3_+0x354):
 undefined reference to 
`llvm::DWARFExpression::Operation::extract(llvm::DataExtractor, unsigned char, 
unsigned long, std::optional)'
LVDWARFReader.cpp:(.text._ZN4llvm12function_refIFbRKNS_18DWARFLocati

[Lldb-commits] [lldb] [lldb][darwin] force BuiltinHeadersInSystemModules to be always false (PR #144913)

2025-06-26 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

> It's not _just_ `BuiltinHeadersInSystemModules` either. There are lots of 
> things that the driver toolchain does that you shouldn't be skipping.

We should definitely _also_ find a way to factor that into a function LLDB can 
call.

https://github.com/llvm/llvm-project/pull/144913
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread Sam Elliott via lldb-commits

lenary wrote:

To also respond to something earlier in the thread, where there is a little 
complexity:

> The missing part is knowing how to split up that encoding value isn't it. For 
> AArch64 you'd just print it because we only have 32-bit, Intel you would roll 
> dice to randomly decide what to do and RISC-V we have these 2/3 formats.

One "weird" bit of the approach is that we actually still rely on LLVM's 
MC-layer to understand the length of the instruction. RISC-V currently has only 
2 ratified lengths (16 and 32-bit), but describes an encoding scheme for longer 
instructions which both GNU objdump and LLVM's MC-layer understand when 
disassembling. RISC-V does not, at the moment, have a maximum length of 
instruction, but our callback only implements the scheme up to 176-bit long 
instructions. On the assembler side, we can only assemble up to 64-bit 
instructions, so we ensure our teams keep to this lower limit.

There are two relevant callbacks on MC's `MCDisassembler` interface:
- `MCDisassembler::getInstruction` which is the main interface, and interprets 
the `uint64_t &Size` whether it decodes an instruction or not. This is the only 
callback RISC-V implements.
- `MCDisassembler::suggestBytesToSkip`, which the Arm/AArch64 backends use for 
realigning the disassembly flow. We maybe should implement this given we know 
the instruction alignment in RISC-V is either 2 or 4, but we don't at the 
moment.



https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits

https://github.com/tedwoodward edited 
https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits


@@ -0,0 +1,87 @@
+"""
+Defines a command, fdis, that does filtered disassembly. The command does the
+lldb disassemble command with -b and any other arguments passed in, and
+pipes that through a provided filter program.
+
+The intention is to support disassembly of RISC-V proprietary instructions.
+This is handled with llvm-objdump by piping the output of llvm-objdump through
+a filter program. This script is intended to mimic that workflow.
+"""
+
+import lldb
+import subprocess
+
+filter_program = "crustfilt"
+
+def __lldb_init_module(debugger, dict):
+debugger.HandleCommand(
+'command script add -f filter_disasm.fdis fdis')
+print("Disassembly filter command (fdis) loaded")
+print("Filter program set to %s" % filter_program)
+
+
+def fdis(debugger, args, result, dict):

tedwoodward wrote:

The triple-quote text at the start does that.

(lldb) command script import 
/local/mnt/workspace/ted/my_upstream/llvm-project/lldb/examples/python/filter_disasm.py
Disassembly filter command (fdis) loaded
Filter program set to crustfilt
(lldb) help fdis
For more information run 'help fdis'  Expects 'raw' input (see 'help
raw-input'.)

Syntax: fdis

  Call the built in disassembler, then pass its output to a filter program
  to add in disassembly for hidden opcodes.
  Except for get and set, use the fdis command like the disassemble command.
  By default, the filter program is crustfilt, from
  https://github.com/quic/crustfilt . This can be changed by changing
  the global variable filter_program.

  Usage:
fdis [[get] [set ] []]

Choose one of the following:
get
Gets the current filter program

set 
Sets the current filter program. This can be an executable, which
will be found on PATH, or an absolute path.


If the first argument is not get or set, the args will be passed
to the disassemble command as is.


https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits

https://github.com/tedwoodward edited 
https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits

https://github.com/tedwoodward edited 
https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits


@@ -0,0 +1,87 @@
+"""
+Defines a command, fdis, that does filtered disassembly. The command does the
+lldb disassemble command with -b and any other arguments passed in, and
+pipes that through a provided filter program.
+
+The intention is to support disassembly of RISC-V proprietary instructions.
+This is handled with llvm-objdump by piping the output of llvm-objdump through
+a filter program. This script is intended to mimic that workflow.
+"""
+
+import lldb
+import subprocess
+
+filter_program = "crustfilt"
+
+def __lldb_init_module(debugger, dict):
+debugger.HandleCommand(
+'command script add -f filter_disasm.fdis fdis')
+print("Disassembly filter command (fdis) loaded")
+print("Filter program set to %s" % filter_program)
+
+
+def fdis(debugger, args, result, dict):

tedwoodward wrote:

The triple-quote text at the start of the function definition does that.

```
(lldb) command script import /local/mnt/workspace/ted/my_upstream/llvm-project/l
ldb/examples/python/filter_disasm.py
Disassembly filter command (fdis) loaded
Filter program set to crustfilt
(lldb) help fdis
For more information run 'help fdis'  Expects 'raw' input (see 'help
raw-input'.)

Syntax: fdis

  Call the built in disassembler, then pass its output to a filter program
  to add in disassembly for hidden opcodes.
  Except for get and set, use the fdis command like the disassemble command.
  By default, the filter program is crustfilt, from
  https://github.com/quic/crustfilt . This can be changed by changing
  the global variable filter_program.

  Usage:
fdis [[get] [set ] []]

Choose one of the following:
get
Gets the current filter program

set 
Sets the current filter program. This can be an executable, which
will be found on PATH, or an absolute path.


If the first argument is not get or set, the args will be passed
to the disassemble command as is.
```

https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits


@@ -0,0 +1,87 @@
+"""
+Defines a command, fdis, that does filtered disassembly. The command does the
+lldb disassemble command with -b and any other arguments passed in, and
+pipes that through a provided filter program.
+
+The intention is to support disassembly of RISC-V proprietary instructions.
+This is handled with llvm-objdump by piping the output of llvm-objdump through
+a filter program. This script is intended to mimic that workflow.
+"""
+
+import lldb
+import subprocess
+
+filter_program = "crustfilt"
+
+def __lldb_init_module(debugger, dict):
+debugger.HandleCommand(
+'command script add -f filter_disasm.fdis fdis')
+print("Disassembly filter command (fdis) loaded")
+print("Filter program set to %s" % filter_program)
+
+
+def fdis(debugger, args, result, dict):
+"""
+  Call the built in disassembler, then pass its output to a filter program
+  to add in disassembly for hidden opcodes.
+  Except for get and set, use the fdis command like the disassemble command.
+  By default, the filter program is crustfilt, from
+  https://github.com/quic/crustfilt . This can be changed by changing
+  the global variable filter_program.
+
+  Usage:
+fdis [[get] [set ] []]
+
+Choose one of the following:
+get
+Gets the current filter program
+
+set 
+Sets the current filter program. This can be an executable, which
+will be found on PATH, or an absolute path.
+
+
+If the first argument is not get or set, the args will be passed
+to the disassemble command as is.
+
+"""
+
+global filter_program
+args_list = args.split(' ')
+result.Clear()
+
+if len(args_list) == 1 and args_list[0] == 'get':
+result.PutCString(filter_program)
+result.SetStatus(lldb.eReturnStatusSuccessFinishResult)
+return
+
+if len(args_list) == 2 and args_list[0] == 'set':
+filter_program = args_list[1]
+result.PutCString("Filter program set to %s" % filter_program)
+result.SetStatus(lldb.eReturnStatusSuccessFinishResult)
+return
+
+res = lldb.SBCommandReturnObject()
+debugger.GetCommandInterpreter().HandleCommand('disassemble -b ' + args, 
res)
+if (len(res.GetError()) > 0):
+result.SetError(res.GetError())
+result.SetStatus(lldb.eReturnStatusFailed)
+return
+output = res.GetOutput()
+
+try:
+proc = subprocess.run([filter_program], capture_output=True, 
text=True, input=output)
+except (subprocess.SubprocessError, OSError) as e:
+result.PutCString("Error occurred. Original disassembly:\n\n" + output)
+result.SetError(str(e))
+result.SetStatus(lldb.eReturnStatusFailed)
+return
+
+print(proc.stderr)
+if proc.stderr:
+pass
+#result.SetError(proc.stderr)
+#result.SetStatus(lldb.eReturnStatusFailed)

tedwoodward wrote:

I'm not sure the presence of data on stderr means a failure. I'll look into 
error handling more.

https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits

tedwoodward wrote:

> Few more things:
> 
> * Assuming this were to land, there needs to be a release note for it.
> * What solutions exist for people using GDB, and are they along the same 
> lines?

I think that's a good idea. Do you know how to add something to release notes? 
I've never done it upstream.

> * What solutions exist for people using GDB, and are they along the same 
> lines?

I don't know what people are doing with GDB. Possibly nothing yet, since this 
is pretty new.

https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Fix source references (PR #144364)

2025-06-26 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper closed 
https://github.com/llvm/llvm-project/pull/144364
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Document MCP support in LLDB (PR #145935)

2025-06-26 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/145935

Document how to use MCP support in LLDB. I expect this to change significantly 
as the feature matures. For now it covers configuring the server and two 
example clients.

>From 2b6a7e22481761b244e98dff00f905cf32a7d696 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 26 Jun 2025 10:31:09 -0700
Subject: [PATCH] [lldb] Document MCP support in LLDB

---
 lldb/docs/index.rst  |  1 +
 lldb/docs/use/mcp.md | 68 
 2 files changed, 69 insertions(+)
 create mode 100644 lldb/docs/use/mcp.md

diff --git a/lldb/docs/index.rst b/lldb/docs/index.rst
index 1ffdb08a1ca2c..d49d0d8d5a733 100644
--- a/lldb/docs/index.rst
+++ b/lldb/docs/index.rst
@@ -135,6 +135,7 @@ interesting areas to contribute to lldb.
use/ondemand
use/aarch64-linux
use/symbolfilejson
+   use/mcp
use/troubleshooting
use/links
Man Page 
diff --git a/lldb/docs/use/mcp.md b/lldb/docs/use/mcp.md
new file mode 100644
index 0..a89740545e5f4
--- /dev/null
+++ b/lldb/docs/use/mcp.md
@@ -0,0 +1,68 @@
+# Model Context Protocol (MCP)
+
+LLDB supports for the [Model Context Protocol][1] (MCP). This structured,
+machine-friendly protocol allows AI models to access and interact with external
+tools, such as the debugger. Using MCP, an AI agent can execute LLDB commands
+to control the debugger: set breakpoints, inspect memory, step through code.
+This can range from helping you run a specific command you can't immediately
+remember to a fully agent-driven debugging experiences
+
+## MCP Server
+
+To start the MCP server in LLDB, use the `protocol-server start` command.
+Specify `MCP` as the protocol and provide a URI to listen on. For example, to
+start listening for local TCP connections on port `5`, use the following
+command:
+
+```
+(lldb) protocol-server start MCP listen://localhost:5
+MCP server started with connection listeners: connection://[::1]:5, 
connection://[127.0.0.1]:5
+```
+
+The server will automatically stop when exiting LLDB, or it can be stopped
+explicitly with the `protocol-server stop` command.
+
+```
+(lldb) protocol-server stop MCP
+```
+
+## MCP Client
+
+MCP uses standard input/output (stdio) for communication between client and
+server. The exact configuration depends on the client, but most applications
+allow you to specify an MCP server as a binary and arguments. This means that
+you need to use something like `netcat` to connect to LLDB's MCP server and
+forward communication over stdio over the network connection.
+
+Configuration example for [Claude Code][2]:
+
+```
+{
+  "mcpServers": {
+"tool": {
+  "command": "/usr/bin/nc",
+  "args": ["localhost", "5"]
+}
+  }
+}
+```
+
+Configuration example for [Visual Studio Code][3]:
+
+```
+{
+  "mcp": {
+"servers": {
+  "lldb": {
+"type": "stdio",
+"command": "/usr/bin/nc",
+"args": ["localhost", "5"]
+  }
+}
+  }
+}
+```
+
+[1]: https://modelcontextprotocol.io
+[2]: https://modelcontextprotocol.io/quickstart/user
+[3]: https://code.visualstudio.com/docs/copilot/chat/mcp-servers

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Document MCP support in LLDB (PR #145935)

2025-06-26 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Document how to use MCP support in LLDB. I expect this to change significantly 
as the feature matures. For now it covers configuring the server and two 
example clients.

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


2 Files Affected:

- (modified) lldb/docs/index.rst (+1) 
- (added) lldb/docs/use/mcp.md (+68) 


``diff
diff --git a/lldb/docs/index.rst b/lldb/docs/index.rst
index 1ffdb08a1ca2c..d49d0d8d5a733 100644
--- a/lldb/docs/index.rst
+++ b/lldb/docs/index.rst
@@ -135,6 +135,7 @@ interesting areas to contribute to lldb.
use/ondemand
use/aarch64-linux
use/symbolfilejson
+   use/mcp
use/troubleshooting
use/links
Man Page 
diff --git a/lldb/docs/use/mcp.md b/lldb/docs/use/mcp.md
new file mode 100644
index 0..a89740545e5f4
--- /dev/null
+++ b/lldb/docs/use/mcp.md
@@ -0,0 +1,68 @@
+# Model Context Protocol (MCP)
+
+LLDB supports for the [Model Context Protocol][1] (MCP). This structured,
+machine-friendly protocol allows AI models to access and interact with external
+tools, such as the debugger. Using MCP, an AI agent can execute LLDB commands
+to control the debugger: set breakpoints, inspect memory, step through code.
+This can range from helping you run a specific command you can't immediately
+remember to a fully agent-driven debugging experiences
+
+## MCP Server
+
+To start the MCP server in LLDB, use the `protocol-server start` command.
+Specify `MCP` as the protocol and provide a URI to listen on. For example, to
+start listening for local TCP connections on port `5`, use the following
+command:
+
+```
+(lldb) protocol-server start MCP listen://localhost:5
+MCP server started with connection listeners: connection://[::1]:5, 
connection://[127.0.0.1]:5
+```
+
+The server will automatically stop when exiting LLDB, or it can be stopped
+explicitly with the `protocol-server stop` command.
+
+```
+(lldb) protocol-server stop MCP
+```
+
+## MCP Client
+
+MCP uses standard input/output (stdio) for communication between client and
+server. The exact configuration depends on the client, but most applications
+allow you to specify an MCP server as a binary and arguments. This means that
+you need to use something like `netcat` to connect to LLDB's MCP server and
+forward communication over stdio over the network connection.
+
+Configuration example for [Claude Code][2]:
+
+```
+{
+  "mcpServers": {
+"tool": {
+  "command": "/usr/bin/nc",
+  "args": ["localhost", "5"]
+}
+  }
+}
+```
+
+Configuration example for [Visual Studio Code][3]:
+
+```
+{
+  "mcp": {
+"servers": {
+  "lldb": {
+"type": "stdio",
+"command": "/usr/bin/nc",
+"args": ["localhost", "5"]
+  }
+}
+  }
+}
+```
+
+[1]: https://modelcontextprotocol.io
+[2]: https://modelcontextprotocol.io/quickstart/user
+[3]: https://code.visualstudio.com/docs/copilot/chat/mcp-servers

``




https://github.com/llvm/llvm-project/pull/145935
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] make PlatformAndroid/AdbClient::GetSyncService threadsafe (PR #145382)

2025-06-26 Thread via lldb-commits

jeffreytan81 wrote:

@cs01, can you get a more symbolicated stacktrace for the crash with debug info 
and line info? 
>From the current callstack, it seems to be a life time use after free issue? 
>Like the `SyncService` is trying to access underlying `m_conn` object while it 
>is destroyed? 
If so, is changing to use `shared_ptr< SyncService>` (with proper thread-safe 
protection) fixing the issue instead of creating the object for each access? 


https://github.com/llvm/llvm-project/pull/145382
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Reland "[lldb][target] Add progress report for wait-attaching to proc… (PR #145111)

2025-06-26 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova closed 
https://github.com/llvm/llvm-project/pull/145111
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] e880cf7 - Reland "[lldb][target] Add progress report for wait-attaching to proc… (#145111)

2025-06-26 Thread via lldb-commits

Author: Chelsea Cassanova
Date: 2025-06-26T10:45:11-07:00
New Revision: e880cf74217d8b925f923185994dc8fe6f69a551

URL: 
https://github.com/llvm/llvm-project/commit/e880cf74217d8b925f923185994dc8fe6f69a551
DIFF: 
https://github.com/llvm/llvm-project/commit/e880cf74217d8b925f923185994dc8fe6f69a551.diff

LOG: Reland "[lldb][target] Add progress report for wait-attaching to proc… 
(#145111)

…ess" (#144810)

This relands commit e0933ab5ae4856c4aa188a5ea16716b3a8d0840b. The
original commit was causing the test TestCreateAfterAttach.py to fail on
ARM Ubuntu bots. It's possible that this could've been happening because
the test for wait-attach progress reporting is waiting on a process
named "a.out" which could be too generic as multiple other tests (when
run in parallel on the bots) could also be using processes named
"a.out". This commit changes the wait-attach progress report test to
wait on a unique process name.

Original PR description:

This commit adds a progress report when wait-attaching to a process as
well as a test for this.

Original PR link: https://github.com/llvm/llvm-project/pull/144768

Added: 


Modified: 
lldb/source/Target/Target.cpp
lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py

Removed: 




diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 45a9e1196a049..8f8d2ef21cc5f 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3546,6 +3546,7 @@ llvm::Expected Target::GetTraceOrCreate() {
 }
 
 Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) {
+  Progress attach_progress("Waiting to attach to process");
   m_stats.SetLaunchOrAttachTime();
   auto state = eStateInvalid;
   auto process_sp = GetProcessSP();

diff  --git 
a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py 
b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
index 9af53845ca1b7..583e187cb6d3a 100644
--- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
+++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
@@ -16,6 +16,28 @@ def setUp(self):
 self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress
 )
 
+def test_wait_attach_progress_reporting(self):
+"""Test that progress reports for wait attaching work as intended."""
+target = self.dbg.CreateTarget(None)
+
+# The waiting to attach progress message will get emitted upon
+# trying to attach, but it's not going to be the event picked
+# up by checking with fetch_next_event, so go through all emitted
+# progress events and check that the waiting to attach one was emitted 
at all.
+target.AttachToProcessWithName(
+self.listener,
+"wait-attach-progress-report",
+False,
+lldb.SBError(),
+)
+event = lldb.SBEvent()
+events = []
+while self.listener.GetNextEventForBroadcaster(self.broadcaster, 
event):
+progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event)
+message = 
progress_data.GetValueForKey("message").GetStringValue(100)
+events.append(message)
+self.assertTrue("Waiting to attach to process" in events)
+
 def test_dwarf_symbol_loading_progress_report(self):
 """Test that we are able to fetch dwarf symbol loading progress 
events"""
 self.build()



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Extract debug server location code (PR #145706)

2025-06-26 Thread Yuval Deutscher via lldb-commits

https://github.com/yuvald-sweet-security edited 
https://github.com/llvm/llvm-project/pull/145706
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Darwin] revert change to lang_opts.BuiltinHeadersInSystemModules (PR #145864)

2025-06-26 Thread Charles Zablit via lldb-commits

https://github.com/charles-zablit created 
https://github.com/llvm/llvm-project/pull/145864

Revert the changes made in the following PRs as they are causing bot failures:

- https://github.com/llvm/llvm-project/pull/145744
- https://github.com/llvm/llvm-project/pull/144913

>From a540d68b0a882f0f05b0e78cf67457cdf462e51d Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Thu, 26 Jun 2025 11:03:44 +0100
Subject: [PATCH 1/2] Revert "[lldb][NFC] remove the
 ResolveSDKPathFromDebugInfo method (#145744)"

This reverts commit 7381d816f31c2c2c46653c58220a88f632768b5e.
---
 lldb/include/lldb/Target/Platform.h   | 16 ++
 .../Platform/MacOSX/PlatformDarwin.cpp| 57 ++-
 .../Plugins/Platform/MacOSX/PlatformDarwin.h  |  3 +
 .../SymbolFile/DWARF/XcodeSDKModuleTests.cpp  |  6 ++
 4 files changed, 56 insertions(+), 26 deletions(-)

diff --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index 1a05bdf54332f..35ffdabf907e7 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -458,6 +458,22 @@ class Platform : public PluginInterface {
   LLVM_PRETTY_FUNCTION, GetName()));
   }
 
+  /// Returns the full path of the most appropriate SDK for the
+  /// specified 'module'. This function gets this path by parsing
+  /// debug-info (see \ref `GetSDKPathFromDebugInfo`).
+  ///
+  /// \param[in] module Module whose debug-info to parse for
+  ///   which SDK it was compiled against.
+  ///
+  /// \returns If successful, returns the full path to an
+  ///  Xcode SDK.
+  virtual llvm::Expected
+  ResolveSDKPathFromDebugInfo(Module &module) {
+return llvm::createStringError(
+llvm::formatv("{0} not implemented for '{1}' platform.",
+  LLVM_PRETTY_FUNCTION, GetName()));
+  }
+
   /// Search CU for the SDK path the CUs was compiled against.
   ///
   /// \param[in] unit The CU
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 461e9dcb7847f..262a7dc731713 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1130,33 +1130,13 @@ void 
PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
 
   if (target) {
 if (ModuleSP exe_module_sp = target->GetExecutableModule()) {
-  SymbolFile *sym_file = exe_module_sp->GetSymbolFile();
-  if (!sym_file)
-return;
-
-  XcodeSDK merged_sdk;
-  for (unsigned i = 0; i < sym_file->GetNumCompileUnits(); ++i) {
-if (auto cu_sp = sym_file->GetCompileUnitAtIndex(i)) {
-  auto cu_sdk = sym_file->ParseXcodeSDK(*cu_sp);
-  merged_sdk.Merge(cu_sdk);
-}
-  }
-
-  // TODO: The result of this loop is almost equivalent to deriving the SDK
-  // from the target triple, which would be a lot cheaper.
-
-  if (FileSystem::Instance().Exists(merged_sdk.GetSysroot())) {
-sysroot_spec = merged_sdk.GetSysroot();
+  auto path_or_err = ResolveSDKPathFromDebugInfo(*exe_module_sp);
+  if (path_or_err) {
+sysroot_spec = FileSpec(*path_or_err);
   } else {
-auto path_or_err =
-HostInfo::GetSDKRoot(HostInfo::SDKOptions{merged_sdk});
-if (path_or_err) {
-  sysroot_spec = FileSpec(*path_or_err);
-} else {
-  LLDB_LOG_ERROR(GetLog(LLDBLog::Types | LLDBLog::Host),
- path_or_err.takeError(),
- "Failed to resolve SDK path: {0}");
-}
+LLDB_LOG_ERROR(GetLog(LLDBLog::Types | LLDBLog::Host),
+   path_or_err.takeError(),
+   "Failed to resolve SDK path: {0}");
   }
 }
   }
@@ -1404,6 +1384,31 @@ PlatformDarwin::GetSDKPathFromDebugInfo(Module &module) {
   return std::pair{std::move(merged_sdk), found_mismatch};
 }
 
+llvm::Expected
+PlatformDarwin::ResolveSDKPathFromDebugInfo(Module &module) {
+  auto sdk_or_err = GetSDKPathFromDebugInfo(module);
+  if (!sdk_or_err)
+return llvm::createStringError(
+llvm::inconvertibleErrorCode(),
+llvm::formatv("Failed to parse SDK path from debug-info: {0}",
+  llvm::toString(sdk_or_err.takeError(;
+
+  auto [sdk, _] = std::move(*sdk_or_err);
+
+  if (FileSystem::Instance().Exists(sdk.GetSysroot()))
+return sdk.GetSysroot().GetPath();
+
+  auto path_or_err = HostInfo::GetSDKRoot(HostInfo::SDKOptions{sdk});
+  if (!path_or_err)
+return llvm::createStringError(
+llvm::inconvertibleErrorCode(),
+llvm::formatv("Error while searching for SDK (XcodeSDK '{0}'): {1}",
+  sdk.GetString(),
+  llvm::toString(path_or_err.takeError(;
+
+  return path_or_err->str();
+}
+
 llvm::Expected
 PlatformDarwin::GetSDKPathFromDebugInfo(CompileUnit &unit) {
   ModuleSP module_sp = unit.CalculateSymbolContextModu

[Lldb-commits] [lldb] [lldb][Darwin] revert change to lang_opts.BuiltinHeadersInSystemModules (PR #145864)

2025-06-26 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)


Changes

Revert the changes made in the following PRs as they are causing bot failures:

- https://github.com/llvm/llvm-project/pull/145744
- https://github.com/llvm/llvm-project/pull/144913

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


7 Files Affected:

- (modified) lldb/include/lldb/Target/Platform.h (+16) 
- (modified) lldb/include/lldb/Utility/XcodeSDK.h (+13) 
- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (+50-1) 
- (modified) lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (+31-26) 
- (modified) lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h (+3) 
- (modified) lldb/source/Utility/XcodeSDK.cpp (+21) 
- (modified) lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp (+6) 


``diff
diff --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index 1a05bdf54332f..35ffdabf907e7 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -458,6 +458,22 @@ class Platform : public PluginInterface {
   LLVM_PRETTY_FUNCTION, GetName()));
   }
 
+  /// Returns the full path of the most appropriate SDK for the
+  /// specified 'module'. This function gets this path by parsing
+  /// debug-info (see \ref `GetSDKPathFromDebugInfo`).
+  ///
+  /// \param[in] module Module whose debug-info to parse for
+  ///   which SDK it was compiled against.
+  ///
+  /// \returns If successful, returns the full path to an
+  ///  Xcode SDK.
+  virtual llvm::Expected
+  ResolveSDKPathFromDebugInfo(Module &module) {
+return llvm::createStringError(
+llvm::formatv("{0} not implemented for '{1}' platform.",
+  LLVM_PRETTY_FUNCTION, GetName()));
+  }
+
   /// Search CU for the SDK path the CUs was compiled against.
   ///
   /// \param[in] unit The CU
diff --git a/lldb/include/lldb/Utility/XcodeSDK.h 
b/lldb/include/lldb/Utility/XcodeSDK.h
index a1a0ec415b90e..ceb8abb8c502d 100644
--- a/lldb/include/lldb/Utility/XcodeSDK.h
+++ b/lldb/include/lldb/Utility/XcodeSDK.h
@@ -93,6 +93,19 @@ class XcodeSDK {
   static bool SDKSupportsModules(Type type, llvm::VersionTuple version);
   static bool SDKSupportsModules(Type desired_type, const FileSpec &sdk_path);
 
+  /// Returns true if the SDK for the specified triple supports
+  /// builtin modules in system headers.
+  ///
+  /// NOTE: should be kept in sync with sdkSupportsBuiltinModules in
+  /// Toolchains/Darwin.cpp
+  ///
+  /// FIXME: this function will be removed once LLDB's ClangExpressionParser
+  /// constructs the compiler instance through the driver/toolchain. See \ref
+  /// SetupImportStdModuleLangOpts
+  ///
+  static bool SDKSupportsBuiltinModules(const llvm::Triple &target_triple,
+llvm::VersionTuple sdk_version);
+
   /// Return the canonical SDK name, such as "macosx" for the macOS SDK.
   static std::string GetCanonicalName(Info info);
   /// Return the best-matching SDK type for a specific triple.
diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index ffc76e6e93498..7aa9cae5a5614 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -319,6 +319,49 @@ class ClangDiagnosticManagerAdapter : public 
clang::DiagnosticConsumer {
   StringRef m_filename;
 };
 
+/// Returns true if the SDK for the specified triple supports
+/// builtin modules in system headers. This is used to decide
+/// whether to pass -fbuiltin-headers-in-system-modules to
+/// the compiler instance when compiling the `std` module.
+static llvm::Expected
+sdkSupportsBuiltinModules(lldb_private::Target &target) {
+  auto arch_spec = target.GetArchitecture();
+  auto const &triple = arch_spec.GetTriple();
+  auto module_sp = target.GetExecutableModule();
+  if (!module_sp)
+return llvm::createStringError("Executable module not found.");
+
+  // Get SDK path that the target was compiled against.
+  auto platform_sp = target.GetPlatform();
+  if (!platform_sp)
+return llvm::createStringError("No Platform plugin found on target.");
+
+  auto sdk_or_err = platform_sp->GetSDKPathFromDebugInfo(*module_sp);
+  if (!sdk_or_err)
+return sdk_or_err.takeError();
+
+  // Use the SDK path from debug-info to find a local matching SDK directory.
+  auto sdk_path_or_err =
+  HostInfo::GetSDKRoot(HostInfo::SDKOptions{std::move(sdk_or_err->first)});
+  if (!sdk_path_or_err)
+return sdk_path_or_err.takeError();
+
+  auto VFS = FileSystem::Instance().GetVirtualFileSystem();
+  if (!VFS)
+return llvm::createStringError("No virtual filesystem available.");
+
+  // Extract SDK version from the /path/to/some.sdk/SDKSettings.json
+  auto parsed_or_err = c

[Lldb-commits] [lldb] [lldb][darwin] force BuiltinHeadersInSystemModules to be always false (PR #144913)

2025-06-26 Thread Charles Zablit via lldb-commits

charles-zablit wrote:

> Looks like this does break all the modules tests: 
> https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/as-lldb-cmake/28395/execution/node/106/log/
> ...
> Could we revert for now to unblock bots?

Just opened a revert PR for this commit and a child commit.

https://github.com/llvm/llvm-project/pull/144913
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][darwin] force BuiltinHeadersInSystemModules to be always false (PR #144913)

2025-06-26 Thread Michael Buch via lldb-commits

Michael137 wrote:

Looks like this does break all the modules tests: 
https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/as-lldb-cmake/28395/execution/node/106/log/
```
09:51:43  
09:51:43  Failed Tests (19):
09:51:43lldb-api :: 
commands/expression/import-std-module/array/TestArrayFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/basic/TestImportStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py
09:51:43lldb-api :: 
commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/list/TestListFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py
09:51:43lldb-api :: 
commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py
09:51:43lldb-api :: 
commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py
09:51:43lldb-api :: 
commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py
09:51:43  
09:51:43  
```

Could we revert for now to unblock bots?

https://github.com/llvm/llvm-project/pull/144913
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Implement WebAssembly debugging (PR #77949)

2025-06-26 Thread Quentin Michaud via lldb-commits

mh4ck-Thales wrote:

This PR hasn't moved in months now, are we missing something? It would be nice 
to have this merged so we can build upon this to bring more interest and 
support from the Wasm community and push for an implementation of lldb servers 
in various Wasm runtimes.

https://github.com/llvm/llvm-project/pull/77949
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Implement WebAssembly debugging (PR #77949)

2025-06-26 Thread David Spickett via lldb-commits

DavidSpickett wrote:

It's been a while, so it's missing a clear summary of:
* Which features this PR enables for WASM
* Which runtimes or debug servers this can be used with
* Which features might be enabled in future
* Which features are simply not applicable
* What the plans are for testing this going forward
* Who is going to test this and how will we (the LLDB community) know that it 
works, or does not work.

All these things have been stated somewhere in the comments, but it needs to be 
put together into one comment so we can all get up to speed again.

And, if we were to accept this, a version of that will have to go into the 
release notes so users know what to expect. As you say, there is a good amount 
of interest in this feature.

My biggest concern here is that we're taking on a whole new architecture with 
very little testing. Now that might be ok given that you can't enable all 
features at once, so early patches will have to have minimal testing. That's 
why I'm asking for some sort of roadmap, even if it has to be vague and will 
likely be derailed at some point.

Given that there exists a qemu-user platform that I think people have used to 
run API tests against qemu-user, I think you could get the test suite running 
for WASM using that (it's name qemu-user but you can put other simulators ).
```
(lldb) settings set platform.plugin.qemu-user.
Available completions:
platform.plugin.qemu-user.architecture 
platform.plugin.qemu-user.emulator-args
platform.plugin.qemu-user.emulator-env-vars
platform.plugin.qemu-user.emulator-path
platform.plugin.qemu-user.target-env-vars 
```
Or a binfmt_misc setup might work.

You're going to have many many failures but that's expected. If it can at least 
be run, then we'd have a baseline to improve from and set expectations for 
contributors.

https://github.com/llvm/llvm-project/pull/77949
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Implement WebAssembly debugging (PR #77949)

2025-06-26 Thread David Spickett via lldb-commits

DavidSpickett wrote:

For the code:
* It was agreed to move DW_OP_WASM_location handling into a separate PR. I 
don't think this got done, though we do have a few mentions of it in LLDB right 
now.
* We will not add a top level `wasm` command as you can use `process connect`. 
If this PR is accepted in that form, then someone can figure out why the 
architecture detection is not working.
* There are some stray clang-format changes and it needs rebasing and so on, 
the usual stuff.

@paolosevMSFT do you have any interest in continuing this PR, or would you be 
ok with someone continuing it on your behalf?

https://github.com/llvm/llvm-project/pull/77949
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett commented:

So if I understand correctly, the newline acts like `\n` and `\r`. `\n` moves 
the cursor down one line and `\r` moves it to the start of that line.

You're undoing the `\n` by moving up one row, and the `\r` by restoring the 
column position.

https://github.com/llvm/llvm-project/pull/145823
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread David Spickett via lldb-commits


@@ -102,20 +103,36 @@ void Statusline::UpdateScrollWindow(ScrollWindowMode 
mode) {
   const unsigned scroll_height =
   (mode == DisableStatusline) ? m_terminal_height : m_terminal_height - 1;
 
+  CursorPosition cursor_position = m_debugger.GetIOHandlerCursorPosition();

DavidSpickett wrote:

Move this into the if, I know it has to be done before the newline, but it can 
still be closer to point of use.

https://github.com/llvm/llvm-project/pull/145823
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread David Spickett via lldb-commits


@@ -398,6 +397,20 @@ int Editline::GetLineIndexForLocation(CursorLocation 
location, int cursor_row) {
   return line;
 }
 
+CursorPosition Editline::GetCursorPosition() {
+  if (!m_editline)
+return {};
+
+  const LineInfoW *info = el_wline(m_editline);
+  if (!info)
+return {};
+
+  const size_t editline_cursor_col =
+  (int)((info->cursor - info->buffer) + GetPromptWidth()) + 1;

DavidSpickett wrote:

You're going to static cast this later, so could you make the type here 
unsigned to begin with?

https://github.com/llvm/llvm-project/pull/145823
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett edited 
https://github.com/llvm/llvm-project/pull/145823
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread David Spickett via lldb-commits

DavidSpickett wrote:

And how exactly does this fix 
https://github.com/llvm/llvm-project/issues/134064?

As in, what steps are happening with this PR compared to before.

https://github.com/llvm/llvm-project/pull/145823
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread David Spickett via lldb-commits


@@ -122,22 +122,21 @@ static int GetOperation(HistoryOperation op) {
   //  - The H_FIRST returns the most recent entry in the history.
   //
   // The naming of the enum entries match the semantic meaning.
-  switch(op) {
-case HistoryOperation::Oldest:
-  return H_LAST;
-case HistoryOperation::Older:
-  return H_NEXT;
-case HistoryOperation::Current:
-  return H_CURR;
-case HistoryOperation::Newer:
-  return H_PREV;
-case HistoryOperation::Newest:
-  return H_FIRST;
+  switch (op) {
+  case HistoryOperation::Oldest:
+return H_LAST;
+  case HistoryOperation::Older:
+return H_NEXT;
+  case HistoryOperation::Current:
+return H_CURR;
+  case HistoryOperation::Newer:
+return H_PREV;
+  case HistoryOperation::Newest:
+return H_FIRST;

DavidSpickett wrote:

Some stray clang-format changes here and below.

https://github.com/llvm/llvm-project/pull/145823
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Darwin] revert change to lang_opts.BuiltinHeadersInSystemModules (PR #145864)

2025-06-26 Thread Michael Buch via lldb-commits

https://github.com/Michael137 closed 
https://github.com/llvm/llvm-project/pull/145864
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)

2025-06-26 Thread David Spickett via lldb-commits


@@ -299,6 +299,8 @@ def parseOptionsAndInitTestdirs():
 configuration.libcxx_library_dir = args.libcxx_library_dir
 configuration.cmake_build_type = args.cmake_build_type.lower()
 
+configuration.target_triple = args.target_triple
+

DavidSpickett wrote:

I will check tomorrow whether with the current content of the PR, the tests 
would run on the bot.

https://github.com/llvm/llvm-project/pull/143177
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits

tedwoodward wrote:


> Is there a reason we couldn't handle this the same way for all targets?

The llvm disassembler returns the size, and sets the Opcode (class 
instantiation) to a certain type -  8 bit, 16 bit, 16 bit thumb, 32 bit, 64 
bit, bytes. For RISC-V, it's set to bytes, which means it prints out 1 byte at 
a time.  I didn't want to add a type, because "bytes" works well for RISC-V, 
except when it comes to print them out.



> I think you need to expand the comments in this formatting code to say both:
> 
> * This is mimicking the objdump format and -
> * It is doing so because this is easier to read / substitute / whatever
>
> Then I don't have to go look at what objdump does to figure out the goals of 
> this code.

Sure, I'll do that.
 
> How standard are these ways of printing the byte encodings? Is it recommended 
> / used by the spec, gnu objdump and llvm objdump? That's the ideal.

For RISC-V, llvm-objdump mimics gnu objdump, so this change makes the RISC-V 
byte encodings match both.

> If it's non-standard my worry would be you doing this to fit one filtering 
> application and another coming along and wanting it in a different format.

That's one thing I'm trying to avoid - we don't want a filter app for objdump 
and another for the debugger. That's why I changed how the bytes are displayed, 
and changed "can't disassemble" from blank to `""`, which matches 
llvm-objdump.

> Also this needs tests.
> 
> * See if we have tests for `-b`, if not, write some for something that is not 
> RISC-V. Easy way to check is to mess up the formatting and see what fails.
> * Add some `-b` for RISC-V specifically, with all the different formats
> * Add tests for the filtering script that use another script that pretends to 
> be a filtering program. As this script is less of a demo, more of a real 
> feature for your customers at least.

Will do.

https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)

2025-06-26 Thread David Spickett via lldb-commits


@@ -299,6 +299,8 @@ def parseOptionsAndInitTestdirs():
 configuration.libcxx_library_dir = args.libcxx_library_dir
 configuration.cmake_build_type = args.cmake_build_type.lower()
 
+configuration.target_triple = args.target_triple
+

DavidSpickett wrote:

Linaro's Windows on Arm bot uses clang-cl and the target triple is set to 
`aarch64-pc-windows-msvc`. I can test things there if that would help.

https://github.com/llvm/llvm-project/pull/143177
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/145823

>From 6dc1ff8270e603def516bae230a5fe7108645978 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 26 Jun 2025 08:33:07 -0700
Subject: [PATCH] [lldb] Correctly restore the cursor column after resizing the
 statusline

This PR ensures we correctly restore the cursor column after resizing
the statusline. To ensure we have space for the statusline, we have to
emit a newline to move up everything on screen. The newline causes the
cursor to move to the start of the next line, which needs to be undone.

Normally, we would use escape codes to save & restore the cursor
position, but that doesn't work here, as the cursor position may have
(purposely) changed. Instead, we move the cursor up one line using an
escape code, but we weren't restoring the column.

Interestingly, Editline was able to recover from this issue through the
LineInfo struct which contains the buffer and the cursor location, which
allows us to compute the column. This PR addresses the bug by relying on
the active IOHandler to report its cursor position and if available, use
that to restore the cursor column position.

Fixes #134064
---
 lldb/include/lldb/Core/Debugger.h|  2 ++
 lldb/include/lldb/Core/IOHandler.h   |  7 ++
 lldb/include/lldb/Host/Editline.h|  3 +++
 lldb/include/lldb/Host/Terminal.h|  5 +
 lldb/source/Core/Debugger.cpp|  8 +++
 lldb/source/Core/IOHandler.cpp   |  8 +++
 lldb/source/Core/Statusline.cpp  | 33 +---
 lldb/source/Host/common/Editline.cpp | 14 
 8 files changed, 72 insertions(+), 8 deletions(-)

diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 2087ef2a11562..46f70024fd65b 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -133,6 +133,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   void SetAsyncExecution(bool async);
 
+  CursorPosition GetIOHandlerCursorPosition();
+
   lldb::FileSP GetInputFileSP() { return m_input_file_sp; }
   File &GetInputFile() { return *m_input_file_sp; }
 
diff --git a/lldb/include/lldb/Core/IOHandler.h 
b/lldb/include/lldb/Core/IOHandler.h
index 2fb3d7a7c9cc3..9d17e3a45846a 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -10,6 +10,7 @@
 #define LLDB_CORE_IOHANDLER_H
 
 #include "lldb/Host/Config.h"
+#include "lldb/Host/Terminal.h"
 #include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/Flags.h"
 #include "lldb/Utility/Predicate.h"
@@ -113,6 +114,10 @@ class IOHandler {
 
   virtual const char *GetHelpPrologue() { return nullptr; }
 
+  virtual CursorPosition GetCursorPosition() const {
+return {std::nullopt, std::nullopt};
+  }
+
   int GetInputFD();
 
   int GetOutputFD();
@@ -404,6 +409,8 @@ class IOHandlerEditline : public IOHandler {
 
   void PrintAsync(const char *s, size_t len, bool is_stdout) override;
 
+  virtual CursorPosition GetCursorPosition() const override;
+
 private:
 #if LLDB_ENABLE_LIBEDIT
   bool IsInputCompleteCallback(Editline *editline, StringList &lines);
diff --git a/lldb/include/lldb/Host/Editline.h 
b/lldb/include/lldb/Host/Editline.h
index c202a76758e13..5672212421687 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -35,6 +35,7 @@
 #include 
 
 #include "lldb/Host/StreamFile.h"
+#include "lldb/Host/Terminal.h"
 #include "lldb/lldb-private.h"
 
 #if !defined(_WIN32) && !defined(__ANDROID__)
@@ -267,6 +268,8 @@ class Editline {
 
   size_t GetTerminalHeight() { return m_terminal_height; }
 
+  CursorPosition GetCursorPosition();
+
 private:
   /// Sets the lowest line number for multi-line editing sessions.  A value of
   /// zero suppresses line number printing in the prompt.
diff --git a/lldb/include/lldb/Host/Terminal.h 
b/lldb/include/lldb/Host/Terminal.h
index da0d05e8bd265..787f97e66d267 100644
--- a/lldb/include/lldb/Host/Terminal.h
+++ b/lldb/include/lldb/Host/Terminal.h
@@ -169,6 +169,11 @@ class TerminalState {
   lldb::pid_t m_process_group = -1;   ///< Cached process group 
information.
 };
 
+struct CursorPosition {
+  std::optional cols;
+  std::optional rows;
+};
+
 } // namespace lldb_private
 
 #endif // LLDB_HOST_TERMINAL_H
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 445baf1f63785..bee2a6ac60396 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1240,6 +1240,14 @@ void Debugger::DispatchInputEndOfFile() {
 reader_sp->GotEOF();
 }
 
+CursorPosition Debugger::GetIOHandlerCursorPosition() {
+  std::lock_guard guard(m_io_handler_stack.GetMutex());
+  IOHandlerSP reader_sp(m_io_handler_stack.Top());
+  if (reader_sp)
+return reader_sp->GetCursorPosition();
+  return {std::nullopt, std::nullopt};
+}
+
 void Debugger::ClearIOHandlers() {
   // The bottom input reader should be the main debugger input read

[Lldb-commits] [lldb] [NFC][lldb-dap] Add missing header guard for DAPError and ProgressEvent. (PR #145915)

2025-06-26 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


https://github.com/llvm/llvm-project/pull/145915
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [NFC][lldb-dap] Add missing header guard for DAPError and ProgressEvent. (PR #145915)

2025-06-26 Thread Jonas Devlieghere via lldb-commits


@@ -156,3 +161,5 @@ class ProgressEventReporter {
 };
 
 } // namespace lldb_dap
+
+#endif // LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H

JDevlieghere wrote:

Missing newline

https://github.com/llvm/llvm-project/pull/145915
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] aeea062 - [lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (#145872)

2025-06-26 Thread via lldb-commits

Author: Michael Buch
Date: 2025-06-26T17:10:12+01:00
New Revision: aeea062dd43e164889f35c24b98cb1994ead50cb

URL: 
https://github.com/llvm/llvm-project/commit/aeea062dd43e164889f35c24b98cb1994ead50cb
DIFF: 
https://github.com/llvm/llvm-project/commit/aeea062dd43e164889f35c24b98cb1994ead50cb.diff

LOG: [lldb][DataFormatter] Unwrap reference type when formatting 
std::unordered_map (#145872)

Desugar any potential references/typedefs before checking
`isStdTemplate`. Previously, the typename might've been:
```
const std::unordered_map<...> &
```
for references. This patch gets the pointee type before grabbing the
canonical type. `GetNonReferenceType` will unwrap typedefs too, so we
should always end up with a non-reference before we get to
`GetCanonicalType`.

https://github.com/llvm/llvm-project/issues/145847

Added: 


Modified: 
lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
index ffc33395830bb..501fd0945b82c 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
@@ -113,8 +113,10 @@ CompilerType 
lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
   // wraps a std::pair. Peel away the internal wrapper type - whose structure 
is
   // of no value to users, to expose the std::pair. This matches the structure
   // returned by the std::map synthetic provider.
-  if (isUnorderedMap(
-  m_backend.GetCompilerType().GetCanonicalType().GetTypeName())) {
+  if (isUnorderedMap(m_backend.GetCompilerType()
+ .GetNonReferenceType()
+ .GetCanonicalType()
+ .GetTypeName())) {
 std::string name;
 CompilerType field_type =
 element_type.GetFieldAtIndex(0, name, nullptr, nullptr, nullptr);

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
index c021a46a17b51..2b1bd676a5b34 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
@@ -9,6 +9,22 @@
 
 
 class LibcxxUnorderedMapDataFormatterTestCase(TestBase):
+def check_reference(self, var_name: str, expected_type: str):
+self.expect_var_path(
+var_name,
+summary="size=1",
+type=expected_type,
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Hello"'),
+ValueCheck(name="second", summary='"World"'),
+],
+),
+],
+)
+
 @add_test_categories(["libc++"])
 def test_iterator_formatters(self):
 """Test that std::unordered_map related structures are formatted 
correctly when printed.
@@ -64,3 +80,20 @@ def test_iterator_formatters(self):
 ValueCheck(name="second", summary='"Qux"'),
 ],
 )
+
+lldbutil.continue_to_breakpoint(process, bkpt)
+
+# Test references to std::unordered_map
+self.check_reference("ref1", "const StringMapT &")
+self.check_reference("ref2", "StringMapT &")
+self.check_reference("ref3", "StringMapTRef")
+self.check_reference("ref4", "const StringMapT &")
+self.check_reference("ref5", "const StringMapT &&")
+self.check_reference("ref6", "StringMapT &&")
+
+# FIXME: we're getting this wrong.
+self.expect_var_path(
+"ref7",
+summary="size=0",
+type="const StringMapT *const &",
+)

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp
index adcea69629770..c581fded1ec5f 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp
@@ -3,6 +3,14 @@
 #include 
 
 using StringMapT = std::unordered_map;
+using StringMapTRef = const StringMapT &;
+
+static void ch

[Lldb-commits] [lldb] d83457e - [NFC][lldb-dap] Add missing header guard for DAPError and ProgressEvent. (#145915)

2025-06-26 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-06-26T17:42:33+01:00
New Revision: d83457eb83d817e773ed6740a6f0c92180ca585e

URL: 
https://github.com/llvm/llvm-project/commit/d83457eb83d817e773ed6740a6f0c92180ca585e
DIFF: 
https://github.com/llvm/llvm-project/commit/d83457eb83d817e773ed6740a6f0c92180ca585e.diff

LOG: [NFC][lldb-dap] Add missing header guard for DAPError and ProgressEvent. 
(#145915)

Delete the copy, move constructor and assignment for ProgressEventReporter.

Added: 


Modified: 
lldb/tools/lldb-dap/DAPError.h
lldb/tools/lldb-dap/ProgressEvent.h

Removed: 




diff  --git a/lldb/tools/lldb-dap/DAPError.h b/lldb/tools/lldb-dap/DAPError.h
index e18614fe71935..26b1daae59340 100644
--- a/lldb/tools/lldb-dap/DAPError.h
+++ b/lldb/tools/lldb-dap/DAPError.h
@@ -6,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_TOOLS_LLDB_DAP_DAPERROR_H
+#define LLDB_TOOLS_LLDB_DAP_DAPERROR_H
+
 #include "llvm/Support/Error.h"
 #include 
 #include 
@@ -50,3 +53,5 @@ class NotStoppedError : public 
llvm::ErrorInfo {
 };
 
 } // namespace lldb_dap
+
+#endif // LLDB_TOOLS_LLDB_DAP_DAPERROR_H

diff  --git a/lldb/tools/lldb-dap/ProgressEvent.h 
b/lldb/tools/lldb-dap/ProgressEvent.h
index d1b9b9dd887cd..9dfed4c301a8e 100644
--- a/lldb/tools/lldb-dap/ProgressEvent.h
+++ b/lldb/tools/lldb-dap/ProgressEvent.h
@@ -6,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
+#define LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
+
 #include 
 #include 
 #include 
@@ -13,8 +16,6 @@
 #include 
 #include 
 
-#include "DAPForward.h"
-
 #include "llvm/Support/JSON.h"
 
 namespace lldb_dap {
@@ -129,8 +130,12 @@ class ProgressEventReporter {
 public:
   /// \param[in] report_callback
   /// Function to invoke to report the event to the IDE.
-  ProgressEventReporter(ProgressEventReportCallback report_callback);
+  explicit ProgressEventReporter(ProgressEventReportCallback report_callback);
 
+  ProgressEventReporter(const ProgressEventReporter &) = delete;
+  ProgressEventReporter(ProgressEventReporter &&) = delete;
+  ProgressEventReporter &operator=(const ProgressEventReporter &) = delete;
+  ProgressEventReporter &operator=(ProgressEventReporter &&) = delete;
   ~ProgressEventReporter();
 
   /// Add a new event to the internal queue and report the event if
@@ -156,3 +161,5 @@ class ProgressEventReporter {
 };
 
 } // namespace lldb_dap
+
+#endif // LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett approved this pull request.

I am confused which bits are handled by editline the library and which are 
handled by our code that interacts with editline, but I always have been so 
that shouldn't block this :)

LGTM

https://github.com/llvm/llvm-project/pull/145823
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][darwin] force BuiltinHeadersInSystemModules to be always false (PR #144913)

2025-06-26 Thread Ian Anderson via lldb-commits

ian-twilightcoder wrote:

It's not _just_ `BuiltinHeadersInSystemModules` either. There are lots of 
things that the driver toolchain does that you shouldn't be skipping.

https://github.com/llvm/llvm-project/pull/144913
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Just doing some googling, mostly people talk about modifying the binutils in 
the gnu toolchain for custom instructions and rebuilding it.

[This](https://www.ashling.com/wp-content/uploads/PR_CUSTOM_INST_17-FEB-2022.pdf)
 refers to some XML file, but I can't tell if they're talking about an upstream 
patch, or their own product based on GDB:
> we have recently worked on a GDB patch to allow these custom instruction 
> mnemonics
> to be defined in an XML file which GDB can read and use to display the 
> instruction (and parameters) in a
> human-readable format.

Might be my search skills, but I only see references to XML for target 
descriptions in upstream GDB.

Anyway, that's another approach that I guess would require each tool to add an 
option to load that file. Rather than your proposal which wraps the filter 
around the tool (kind of, the custom command is still inside of lldb from the 
user's perspective).

https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [NFC][lldb-dap] Add missing header guard for DAPError and ProgressEvent. (PR #145915)

2025-06-26 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper closed 
https://github.com/llvm/llvm-project/pull/145915
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Ok I get what we're doing now but...

> This PR uses the active IOHandler (i.e. Editline) to get the cursor position 
> before we emit the newline and then uses an ANSI escape code to move the 
> cursor back to its original column. I was curious why, depending on the 
> timing, Editline was able to recover from this and this is how Editline does 
> it.

This PR uses the active IOHanlder (which is Editline), but you're saying that 
prior to this PR, Editline was sometimes able to recover. So we were using 
Editline all along? Confused as to what is Editline the library and what is our 
Editline code.

Do you mean that it's now all done in the same place and that keeps the timing 
correct?

https://github.com/llvm/llvm-project/pull/145823
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Default transcript dumping in "statistics dump" to false (PR #145436)

2025-06-26 Thread via lldb-commits

https://github.com/jeffreytan81 approved this pull request.


https://github.com/llvm/llvm-project/pull/145436
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 5c310d1 - Default transcript dumping in "statistics dump" to false (#145436)

2025-06-26 Thread via lldb-commits

Author: qxy11
Date: 2025-06-26T10:16:05-07:00
New Revision: 5c310d1ef0188d609b1d2837d403d2b3f2eeb609

URL: 
https://github.com/llvm/llvm-project/commit/5c310d1ef0188d609b1d2837d403d2b3f2eeb609
DIFF: 
https://github.com/llvm/llvm-project/commit/5c310d1ef0188d609b1d2837d403d2b3f2eeb609.diff

LOG: Default transcript dumping in "statistics dump" to false (#145436)

### Summary
Currently, if the setting `interpreter.save-transcript` is enabled,
whenever we call "statistics dump", it'll default to reporting a huge
list of transcripts which can be a bit noisy. This is because the
current check `GetIncludeTranscript` returns `!GetSummaryOnly()` by
default if no specific transcript-setting option is given in the
statistics dump command (ie. `statistics dump --transcripts=false` or
`statistics dump --transcripts=true`). Then when
`interpreter.save-transcript` is enabled, this saves a list of
transcripts, and the transcript list ends up getting logged by default.

These changes default the option to log transcripts in the `statistics
dump` command to "false". This can still be enabled via the
`--transcripts` option if users want to see a transcript. Since
`interpreter.save-transcript` is false by default, the main delta is
that if `interpreter.save-transcript` is true and summary mode is false,
we now disable saving the transcript.

This also adds a warning to 'statistics dump --transcript=true' when
interpreter.save-transcript is disabled, which should help users
understand
why transcript data is empty.

### Testing

 Manual testing
Tested with `settings set interpreter.save-transcript true` enabled at
startup on a toy hello-world program:
```
(lldb) settings set interpreter.save-transcript true
(lldb) target create "/home/qxy11/hello-world/a.out"
Current executable set to '/home/qxy11/hello-world/a.out' (x86_64).
(lldb) statistics dump
{
  /* no transcript */
}
(lldb) statistics dump --transcript=true
{
"transcript": [
{
  "command": "statistics dump",
  "commandArguments": "",
  "commandName": "statistics dump",
  "durationInSeconds": 0.0019652,
  "error": "",
  "output": "{...
},
{
  "command": "statistics dump --transcript=true",
  "commandArguments": "--transcript=true",
  "commandName": "statistics dump",
  "timestampInEpochSeconds": 1750720021
}
  ]
}
```
Without `settings set interpreter.save-transcript true`:
```
(lldb) target create "/home/qxy11/hello-world/a.out"
Current executable set to '/home/qxy11/hello-world/a.out' (x86_64).
(lldb) statistics dump
{
  /* no transcript */
}
(lldb) statistics dump --transcript=true
{
  /* no transcript */
}
warning: transcript requested but none was saved. Enable with 'settings set 
interpreter.save-transcript true'
```

 Unit tests
Changed unit tests to account for new expected default behavior to
`false`, and added a couple new tests around expected behavior with
`--transcript=true`.
```
lldb-dotest -p TestStats 
~/llvm-sand/external/llvm-project/lldb/test/API/commands/statistics/basic/
```

Added: 


Modified: 
lldb/include/lldb/API/SBStatisticsOptions.h
lldb/include/lldb/Target/Statistics.h
lldb/source/Commands/CommandObjectStats.cpp
lldb/source/Commands/Options.td
lldb/test/API/commands/statistics/basic/TestStats.py

Removed: 




diff  --git a/lldb/include/lldb/API/SBStatisticsOptions.h 
b/lldb/include/lldb/API/SBStatisticsOptions.h
index 74bea03eff9c9..bfff9dc926432 100644
--- a/lldb/include/lldb/API/SBStatisticsOptions.h
+++ b/lldb/include/lldb/API/SBStatisticsOptions.h
@@ -57,8 +57,7 @@ class LLDB_API SBStatisticsOptions {
   /// a JSON array with all commands the user and/or scripts executed during a
   /// debug session.
   ///
-  /// Defaults to true, unless the `SummaryOnly` mode is enabled, in which case
-  /// this is turned off unless specified.
+  /// Defaults to false.
   void SetIncludeTranscript(bool b);
   bool GetIncludeTranscript() const;
 

diff  --git a/lldb/include/lldb/Target/Statistics.h 
b/lldb/include/lldb/Target/Statistics.h
index 42f03798c219e..55dff8861a9ab 100644
--- a/lldb/include/lldb/Target/Statistics.h
+++ b/lldb/include/lldb/Target/Statistics.h
@@ -191,11 +191,7 @@ struct StatisticsOptions {
 
   void SetIncludeTranscript(bool value) { m_include_transcript = value; }
   bool GetIncludeTranscript() const {
-if (m_include_transcript.has_value())
-  return m_include_transcript.value();
-// `m_include_transcript` has no value set, so return a value based on
-// `m_summary_only`.
-return !GetSummaryOnly();
+return m_include_transcript.value_or(false);
   }
 
   void SetIncludePlugins(bool value) { m_include_plugins = value; }

diff  --git a/lldb/source/Commands/CommandObjectStats.cpp 
b/lldb/source/Commands/CommandObjectStats.cpp
index b77c44bdf5d09..08283ef9d1699 100644
--- a/lldb/source/Commands/CommandObjectStats.cpp
+++ b/lldb

[Lldb-commits] [lldb] Default transcript dumping in "statistics dump" to false (PR #145436)

2025-06-26 Thread via lldb-commits

jeffreytan81 wrote:

@qxy11, have you requested merge permission yet? If not, I can merge for you, 
but you probably want to ask for you own merge access.

https://github.com/llvm/llvm-project/pull/145436
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Default transcript dumping in "statistics dump" to false (PR #145436)

2025-06-26 Thread via lldb-commits

https://github.com/jeffreytan81 closed 
https://github.com/llvm/llvm-project/pull/145436
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 0b8a656 - [lldb-dap] Fix source references (#144364)

2025-06-26 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-06-26T18:22:47+01:00
New Revision: 0b8a656ba110884e40e9ec79c936139eb6fce0b6

URL: 
https://github.com/llvm/llvm-project/commit/0b8a656ba110884e40e9ec79c936139eb6fce0b6
DIFF: 
https://github.com/llvm/llvm-project/commit/0b8a656ba110884e40e9ec79c936139eb6fce0b6.diff

LOG: [lldb-dap] Fix source references (#144364)

The
[protocol](https://microsoft.github.io/debug-adapter-protocol//specification.html#Types_Source)
expects that `sourceReference` be less than `(2^31)-1`, but we currently
represent memory address as source reference, this can be truncated
either when sending through json or by the client. Instead, generate new
source references based on the memory address.

Make the `ResolveSource` function return an optional source.

Added: 


Modified: 

lldb/test/API/tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py
lldb/tools/lldb-dap/Breakpoint.cpp
lldb/tools/lldb-dap/DAP.cpp
lldb/tools/lldb-dap/DAP.h
lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
lldb/tools/lldb-dap/Handler/SourceRequestHandler.cpp
lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp
lldb/tools/lldb-dap/JSONUtils.cpp
lldb/tools/lldb-dap/JSONUtils.h
lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
lldb/tools/lldb-dap/Protocol/ProtocolTypes.h
lldb/tools/lldb-dap/ProtocolUtils.cpp
lldb/tools/lldb-dap/ProtocolUtils.h
lldb/tools/lldb-dap/SourceBreakpoint.cpp

Removed: 




diff  --git 
a/lldb/test/API/tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py
 
b/lldb/test/API/tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py
index 8bccc2bcf4156..674bfe4199b4a 100644
--- 
a/lldb/test/API/tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py
+++ 
b/lldb/test/API/tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py
@@ -67,19 +67,19 @@ def test_break_on_invalid_source_reference(self):
 "Invalid sourceReference.",
 )
 
-# Verify that setting a breakpoint on a source reference without a 
symbol also fails
+# Verify that setting a breakpoint on a source reference that is not 
created fails
 response = self.dap_server.request_setBreakpoints(
-Source(source_reference=0), [1]
+Source(source_reference=200), [1]
 )
 self.assertIsNotNone(response)
 breakpoints = response["body"]["breakpoints"]
 self.assertEqual(len(breakpoints), 1)
-breakpoint = breakpoints[0]
+break_point = breakpoints[0]
 self.assertFalse(
-breakpoint["verified"], "Expected breakpoint to not be verified"
+break_point["verified"], "Expected breakpoint to not be verified"
 )
-self.assertIn("message", breakpoint, "Expected message to be present")
+self.assertIn("message", break_point, "Expected message to be present")
 self.assertEqual(
-breakpoint["message"],
-"Breakpoints in assembly without a valid symbol are not supported 
yet.",
+break_point["message"],
+"Invalid sourceReference.",
 )

diff  --git a/lldb/tools/lldb-dap/Breakpoint.cpp 
b/lldb/tools/lldb-dap/Breakpoint.cpp
index ef5646c4c3d16..b4e593eb83d27 100644
--- a/lldb/tools/lldb-dap/Breakpoint.cpp
+++ b/lldb/tools/lldb-dap/Breakpoint.cpp
@@ -64,8 +64,8 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() {
 "0x" + llvm::utohexstr(bp_addr.GetLoadAddress(m_bp.GetTarget()));
 breakpoint.instructionReference = formatted_addr;
 
-auto source = CreateSource(bp_addr, m_dap.target);
-if (!IsAssemblySource(source)) {
+std::optional source = m_dap.ResolveSource(bp_addr);
+if (source && !IsAssemblySource(*source)) {
   auto line_entry = bp_addr.GetLineEntry();
   const auto line = line_entry.GetLine();
   if (line != LLDB_INVALID_LINE_NUMBER)

diff  --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index c171b55951cb5..cd97458bd4aa8 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -497,6 +497,27 @@ DAP::SendFormattedOutput(OutputType o, const char *format, 
...) {
   o, llvm::StringRef(buffer, std::min(actual_length, 
sizeof(buffer;
 }
 
+int32_t DAP::CreateSourceReference(lldb::addr_t address) {
+  std::lock_guard guard(m_source_references_mutex);
+  auto iter = llvm::find(m_source_references, address);
+  if (iter != m_source_references.end())
+return std::distance(m_source_references.begin(), iter) + 1;
+
+  m_source_references.emplace_back(address);
+  return static_cast(m_source_references.size());
+}
+
+std::optional DAP::GetSourceReferenceAddress(int32_t reference) {
+  std::lock_guard guard(m_source_references_mutex);
+  if (reference <= LLDB_DAP_I

[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits

tedwoodward wrote:


> The only real "gotcha" question I can come up with is, wouldn't a user who is 
> interested in custom instructions already have access to a compiler that 
> produces them and that compiler is likely to be llvm, so is lldb from that 
> llvm not within reach already?
> 
> Educate me on that, I don't know how folks approach developing these 
> extensions. Maybe code generation is the last thing they do, after they know 
> it's worth pursuing. So you've got a lot of hand written assembler and `.inst 
> ` going on.

This particular PR has to do with Qualcomm's push to be more open source. We 
don't want to provide custom toolchains for things with good upstream support. 
That's why we're pushing a bunch of our former downstream code upstream; Polly 
vectorizer changes, LLVM vectorizer changes, etc. It's made upstream clang 
performance much closer to downstream clang performance. We got the Xqci guys 
to open source their extension definition so we could upstream the TD files for 
it.

But...not everyone wants to upstream their extensions, and some people don't 
want to build a custom toolchain for every little extension. So they decided to 
use the .insn assembler directive (supported for at least 5 years, according to 
a quick google search), and a filter program to pipe objdump output through.

> LLDB's release notes live in a section of LLVM's - 
> https://github.com/llvm/llvm-project/blob/main/llvm/docs/ReleaseNotes.md#changes-to-lldb.

Thank you!

https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] cbf781f - [NFC][DebugInfo][DWARF] Create new low-level dwarf library (#145081)

2025-06-26 Thread via lldb-commits

Author: Sterling-Augustine
Date: 2025-06-26T11:23:46-07:00
New Revision: cbf781f0bdf2f680abbe784faedeefd6f84c246e

URL: 
https://github.com/llvm/llvm-project/commit/cbf781f0bdf2f680abbe784faedeefd6f84c246e
DIFF: 
https://github.com/llvm/llvm-project/commit/cbf781f0bdf2f680abbe784faedeefd6f84c246e.diff

LOG: [NFC][DebugInfo][DWARF] Create new low-level dwarf library (#145081)

This is the culmination of a series of changes described in [1].

Although somewhat large by line count, it is almost entirely mechanical,
creating a new library in DebugInfo/DWARF/LowLevel. This new library has
very minimal dependencies, allowing it to be used from more places than
the normal DebugInfo/DWARF library--in particular from MC.

I am happy to put it in another location, or to structure it differently
if that makes sense. Some have suggested in BinaryFormat, but it is not
a great fit there. But if that makes more sense to the reviewers, I can
do that.
 
Another possibility would be to use pass-through headers to allow
clients who don't care to depend only on DebugInfo/DWARF. This would be
a much less invasive change, and perhaps easier for clients. But also a
system that hides details.

Either way, I'm open.

1.
https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2

Added: 
llvm/include/llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h
llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h
llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h
llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h
llvm/lib/DebugInfo/DWARF/DWARFExpressionPrinter.cpp
llvm/lib/DebugInfo/DWARF/LowLevel/CMakeLists.txt
llvm/lib/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.cpp
llvm/lib/DebugInfo/DWARF/LowLevel/DWARFExpression.cpp

Modified: 
bolt/include/bolt/Core/DIEBuilder.h
bolt/lib/Core/CMakeLists.txt
bolt/lib/Core/DIEBuilder.cpp
bolt/lib/Core/DebugNames.cpp
bolt/lib/Rewrite/CMakeLists.txt
bolt/lib/Rewrite/DWARFRewriter.cpp
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Symbol/UnwindPlan.cpp
lldb/unittests/Symbol/PostfixExpressionTest.cpp
lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
llvm/include/llvm/DWARFLinker/AddressesMap.h
llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/DWARFLinker/Classic/CMakeLists.txt
llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
llvm/lib/DWARFLinker/Classic/DWARFLinkerCompileUnit.cpp
llvm/lib/DebugInfo/DWARF/CMakeLists.txt
llvm/lib/DebugInfo/DWARF/DWARFCFIPrinter.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
llvm/lib/ProfileData/CMakeLists.txt
llvm/lib/ProfileData/InstrProfCorrelator.cpp
llvm/tools/dsymutil/CMakeLists.txt
llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
llvm/tools/llvm-dwarfdump/CMakeLists.txt
llvm/tools/llvm-dwarfdump/Statistics.cpp
llvm/tools/llvm-dwarfutil/CMakeLists.txt
llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
llvm/tools/llvm-objdump/CMakeLists.txt
llvm/tools/llvm-objdump/SourcePrinter.cpp
llvm/unittests/DebugInfo/DWARF/CMakeLists.txt
llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp
llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
utils/bazel/llvm-project-overlay/bolt/BUILD.bazel
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel

Removed: 
llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractorSimple.h
llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
llvm/lib/DebugInfo/DWARF/DWARFCFIProgram.cpp
llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp



diff  --git a/bolt/include/bolt/Core/DIEBuilder.h 
b/bolt/include/bolt/Core/DIEBuilder.h
index 32e455ad3030a..e4a4fc6b2f258 100644
--- a/bolt/include/bolt/Core/DIEBuilder.h
+++ b/bolt/include/bolt/Core/DIEBuilder.h
@@ -20,8 +20,8 @@
 #include "llvm/CodeGen/DIE.h"
 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
 #include "llvm/DebugInfo/DWARF/DWARFDie.h"
-#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
 #include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
 #include "llvm/Support/Allocator.h"
 
 #include 

diff  --git

[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo][DWARF] Create new low-level dwarf library (PR #145081)

2025-06-26 Thread via lldb-commits

https://github.com/Sterling-Augustine closed 
https://github.com/llvm/llvm-project/pull/145081
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 9ae41f0 - [lldb][Darwin] revert change to lang_opts.BuiltinHeadersInSystemModules (#145864)

2025-06-26 Thread via lldb-commits

Author: Charles Zablit
Date: 2025-06-26T11:56:50+01:00
New Revision: 9ae41f017d8e6264ded66e2e476efb1dc2a280a1

URL: 
https://github.com/llvm/llvm-project/commit/9ae41f017d8e6264ded66e2e476efb1dc2a280a1
DIFF: 
https://github.com/llvm/llvm-project/commit/9ae41f017d8e6264ded66e2e476efb1dc2a280a1.diff

LOG: [lldb][Darwin] revert change to lang_opts.BuiltinHeadersInSystemModules 
(#145864)

Revert the changes made in the following PRs as they are causing bot
failures:

- https://github.com/llvm/llvm-project/pull/145744
- https://github.com/llvm/llvm-project/pull/144913

Added: 


Modified: 
lldb/include/lldb/Target/Platform.h
lldb/include/lldb/Utility/XcodeSDK.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/source/Utility/XcodeSDK.cpp
lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index 1a05bdf54332f..35ffdabf907e7 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -458,6 +458,22 @@ class Platform : public PluginInterface {
   LLVM_PRETTY_FUNCTION, GetName()));
   }
 
+  /// Returns the full path of the most appropriate SDK for the
+  /// specified 'module'. This function gets this path by parsing
+  /// debug-info (see \ref `GetSDKPathFromDebugInfo`).
+  ///
+  /// \param[in] module Module whose debug-info to parse for
+  ///   which SDK it was compiled against.
+  ///
+  /// \returns If successful, returns the full path to an
+  ///  Xcode SDK.
+  virtual llvm::Expected
+  ResolveSDKPathFromDebugInfo(Module &module) {
+return llvm::createStringError(
+llvm::formatv("{0} not implemented for '{1}' platform.",
+  LLVM_PRETTY_FUNCTION, GetName()));
+  }
+
   /// Search CU for the SDK path the CUs was compiled against.
   ///
   /// \param[in] unit The CU

diff  --git a/lldb/include/lldb/Utility/XcodeSDK.h 
b/lldb/include/lldb/Utility/XcodeSDK.h
index a1a0ec415b90e..ceb8abb8c502d 100644
--- a/lldb/include/lldb/Utility/XcodeSDK.h
+++ b/lldb/include/lldb/Utility/XcodeSDK.h
@@ -93,6 +93,19 @@ class XcodeSDK {
   static bool SDKSupportsModules(Type type, llvm::VersionTuple version);
   static bool SDKSupportsModules(Type desired_type, const FileSpec &sdk_path);
 
+  /// Returns true if the SDK for the specified triple supports
+  /// builtin modules in system headers.
+  ///
+  /// NOTE: should be kept in sync with sdkSupportsBuiltinModules in
+  /// Toolchains/Darwin.cpp
+  ///
+  /// FIXME: this function will be removed once LLDB's ClangExpressionParser
+  /// constructs the compiler instance through the driver/toolchain. See \ref
+  /// SetupImportStdModuleLangOpts
+  ///
+  static bool SDKSupportsBuiltinModules(const llvm::Triple &target_triple,
+llvm::VersionTuple sdk_version);
+
   /// Return the canonical SDK name, such as "macosx" for the macOS SDK.
   static std::string GetCanonicalName(Info info);
   /// Return the best-matching SDK type for a specific triple.

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index ffc76e6e93498..7aa9cae5a5614 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -319,6 +319,49 @@ class ClangDiagnosticManagerAdapter : public 
clang::DiagnosticConsumer {
   StringRef m_filename;
 };
 
+/// Returns true if the SDK for the specified triple supports
+/// builtin modules in system headers. This is used to decide
+/// whether to pass -fbuiltin-headers-in-system-modules to
+/// the compiler instance when compiling the `std` module.
+static llvm::Expected
+sdkSupportsBuiltinModules(lldb_private::Target &target) {
+  auto arch_spec = target.GetArchitecture();
+  auto const &triple = arch_spec.GetTriple();
+  auto module_sp = target.GetExecutableModule();
+  if (!module_sp)
+return llvm::createStringError("Executable module not found.");
+
+  // Get SDK path that the target was compiled against.
+  auto platform_sp = target.GetPlatform();
+  if (!platform_sp)
+return llvm::createStringError("No Platform plugin found on target.");
+
+  auto sdk_or_err = platform_sp->GetSDKPathFromDebugInfo(*module_sp);
+  if (!sdk_or_err)
+return sdk_or_err.takeError();
+
+  // Use the SDK path from debug-info to find a local matching SDK directory.
+  auto sdk_path_or_err =
+  HostInfo::GetSDKRoot(HostInfo::SDKOptions{std::move(sdk_or_err->first)});
+  if (!sdk_path_or_err)
+return sdk_path_or_err.takeError();
+
+  auto VFS = FileSystem::Instance().GetVirtua

[Lldb-commits] [lldb] [lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (PR #145872)

2025-06-26 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

Desugar any potential references/typedefs before checking `isStdTemplate`. 
Previously, the typename might've been:
```
const std::unordered_map<...> &
```
for references. This patch gets the pointee type before grabbing the canonical 
type. `GetNonReferenceType` will unwrap typedefs too, so we should always end 
up with a non-reference before we get to `GetCanonicalType`.

https://github.com/llvm/llvm-project/issues/145847

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


3 Files Affected:

- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
(+4-2) 
- (modified) 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
 (+128) 
- (modified) 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp
 (+13) 


``diff
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
index ffc33395830bb..501fd0945b82c 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
@@ -113,8 +113,10 @@ CompilerType 
lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
   // wraps a std::pair. Peel away the internal wrapper type - whose structure 
is
   // of no value to users, to expose the std::pair. This matches the structure
   // returned by the std::map synthetic provider.
-  if (isUnorderedMap(
-  m_backend.GetCompilerType().GetCanonicalType().GetTypeName())) {
+  if (isUnorderedMap(m_backend.GetCompilerType()
+ .GetNonReferenceType()
+ .GetCanonicalType()
+ .GetTypeName())) {
 std::string name;
 CompilerType field_type =
 element_type.GetFieldAtIndex(0, name, nullptr, nullptr, nullptr);
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
index c021a46a17b51..3b412996c6cb4 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
@@ -64,3 +64,131 @@ def test_iterator_formatters(self):
 ValueCheck(name="second", summary='"Qux"'),
 ],
 )
+
+lldbutil.continue_to_breakpoint(process, bkpt)
+
+# Test references to std::unordered_map
+self.expect_var_path(
+"ref1",
+summary="size=2",
+type="const StringMapT &",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref2",
+summary="size=2",
+type="StringMapT &",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref3",
+summary="size=2",
+type="StringMapTRef",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],

[Lldb-commits] [lldb] [lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (PR #145872)

2025-06-26 Thread Pavel Labath via lldb-commits

https://github.com/labath approved this pull request.


https://github.com/llvm/llvm-project/pull/145872
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (PR #145872)

2025-06-26 Thread Pavel Labath via lldb-commits


@@ -64,3 +64,131 @@ def test_iterator_formatters(self):
 ValueCheck(name="second", summary='"Qux"'),
 ],
 )
+
+lldbutil.continue_to_breakpoint(process, bkpt)
+
+# Test references to std::unordered_map
+self.expect_var_path(

labath wrote:

Given that this is just for testing reference resolution, I'd consider making 
all of the maps have the same content (or even be references to the same 
object) so that this can be checked with a for loop. (The type will be 
different, but maybe we don't have to check that since that doesn't come from 
the data formatter?)

https://github.com/llvm/llvm-project/pull/145872
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (PR #145872)

2025-06-26 Thread Pavel Labath via lldb-commits


@@ -64,3 +64,131 @@ def test_iterator_formatters(self):
 ValueCheck(name="second", summary='"Qux"'),
 ],
 )
+
+lldbutil.continue_to_breakpoint(process, bkpt)
+
+# Test references to std::unordered_map
+self.expect_var_path(
+"ref1",
+summary="size=2",
+type="const StringMapT &",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref2",
+summary="size=2",
+type="StringMapT &",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref3",
+summary="size=2",
+type="StringMapTRef",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref4",
+summary="size=2",
+type="const StringMapT &",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+ValueCheck(
+name="[1]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref5",
+summary="size=1",
+type="const StringMapT &&",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Foo"'),
+ValueCheck(name="second", summary='"Bar"'),
+],
+),
+],
+)
+
+self.expect_var_path(
+"ref6",
+summary="size=1",
+type="StringMapT &&",
+children=[
+ValueCheck(
+name="[0]",
+children=[
+ValueCheck(name="first", summary='"Baz"'),
+ValueCheck(name="second", summary='"Qux"'),
+],
+),
+],
+)
+
+# FIXME: we're getting this wrong.

labath wrote:

ha!

https://github.com/llvm/llvm-project/pull/145872
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] b77114b - [lldb] Remove child_process_inherit argument from Pipe (#145516)

2025-06-26 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-06-26T13:51:14+02:00
New Revision: b77114b723eb68563a0900846df5bd1b454edc2f

URL: 
https://github.com/llvm/llvm-project/commit/b77114b723eb68563a0900846df5bd1b454edc2f
DIFF: 
https://github.com/llvm/llvm-project/commit/b77114b723eb68563a0900846df5bd1b454edc2f.diff

LOG: [lldb] Remove child_process_inherit argument from Pipe (#145516)

It's not necessary on posix platforms as of #126935 and it's ignored on
windows as of #138896. For both platforms, we have a better way of
inheriting FDs/HANDLEs.

Added: 


Modified: 
lldb/include/lldb/Host/PipeBase.h
lldb/include/lldb/Host/posix/PipePosix.h
lldb/include/lldb/Host/windows/PipeWindows.h
lldb/source/Host/common/Socket.cpp
lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
lldb/source/Host/posix/MainLoopPosix.cpp
lldb/source/Host/posix/PipePosix.cpp
lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
lldb/source/Host/windows/PipeWindows.cpp
lldb/source/Interpreter/ScriptInterpreter.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/source/Target/Process.cpp
lldb/tools/lldb-server/lldb-gdbserver.cpp
lldb/unittests/Core/CommunicationTest.cpp
lldb/unittests/Host/HostTest.cpp
lldb/unittests/Host/PipeTest.cpp
lldb/unittests/Host/SocketTest.cpp
lldb/unittests/TestingSupport/Host/PipeTestUtilities.h

Removed: 




diff  --git a/lldb/include/lldb/Host/PipeBase.h 
b/lldb/include/lldb/Host/PipeBase.h
index ed8df6bf1e511..6a37f3f2445b0 100644
--- a/lldb/include/lldb/Host/PipeBase.h
+++ b/lldb/include/lldb/Host/PipeBase.h
@@ -21,18 +21,14 @@ class PipeBase {
 public:
   virtual ~PipeBase();
 
-  virtual Status CreateNew(bool child_process_inherit) = 0;
-  virtual Status CreateNew(llvm::StringRef name,
-   bool child_process_inherit) = 0;
+  virtual Status CreateNew() = 0;
+  virtual Status CreateNew(llvm::StringRef name) = 0;
   virtual Status CreateWithUniqueName(llvm::StringRef prefix,
-  bool child_process_inherit,
   llvm::SmallVectorImpl &name) = 0;
 
-  virtual Status OpenAsReader(llvm::StringRef name,
-  bool child_process_inherit) = 0;
+  virtual Status OpenAsReader(llvm::StringRef name) = 0;
 
   virtual llvm::Error OpenAsWriter(llvm::StringRef name,
-   bool child_process_inherit,
const Timeout &timeout) = 0;
 
   virtual bool CanRead() const = 0;

diff  --git a/lldb/include/lldb/Host/posix/PipePosix.h 
b/lldb/include/lldb/Host/posix/PipePosix.h
index effd33fba7eb0..0bec2061f3164 100644
--- a/lldb/include/lldb/Host/posix/PipePosix.h
+++ b/lldb/include/lldb/Host/posix/PipePosix.h
@@ -32,14 +32,12 @@ class PipePosix : public PipeBase {
 
   ~PipePosix() override;
 
-  Status CreateNew(bool child_process_inherit) override;
-  Status CreateNew(llvm::StringRef name, bool child_process_inherit) override;
+  Status CreateNew() override;
+  Status CreateNew(llvm::StringRef name) override;
   Status CreateWithUniqueName(llvm::StringRef prefix,
-  bool child_process_inherit,
   llvm::SmallVectorImpl &name) override;
-  Status OpenAsReader(llvm::StringRef name,
-  bool child_process_inherit) override;
-  llvm::Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit,
+  Status OpenAsReader(llvm::StringRef name) override;
+  llvm::Error OpenAsWriter(llvm::StringRef name,
const Timeout &timeout) override;
 
   bool CanRead() const override;

diff  --git a/lldb/include/lldb/Host/windows/PipeWindows.h 
b/lldb/include/lldb/Host/windows/PipeWindows.h
index 9cf591a2d4629..a8bd3cecb9afe 100644
--- a/lldb/include/lldb/Host/windows/PipeWindows.h
+++ b/lldb/include/lldb/Host/windows/PipeWindows.h
@@ -29,16 +29,14 @@ class PipeWindows : public PipeBase {
   ~PipeWindows() override;
 
   // Create an unnamed pipe.
-  Status CreateNew(bool child_process_inherit) override;
+  Status CreateNew() override;
 
   // Create a named pipe.
-  Status CreateNew(llvm::StringRef name, bool child_process_inherit) override;
+  Status CreateNew(llvm::StringRef name) override;
   Status CreateWithUniqueName(llvm::StringRef prefix,
-  bool child_process_inherit,
   llvm::SmallVectorImpl &name) override;
-  Status OpenAsReader(llvm::StringRef name,
-  bool child_process_inherit) override;
-  llvm::Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit,
+  Status OpenAsReader(llvm::StringRef name) override;
+  llvm::Error OpenAsWriter(llvm::StringRef name,
const Timeout &timeout) override;
 
   bool CanRead() const override;
@@ -72,8 +70,7 @@ class PipeWindows : public Pi

[Lldb-commits] [lldb] [lldb] Remove child_process_inherit argument from Pipe (PR #145516)

2025-06-26 Thread Pavel Labath via lldb-commits

https://github.com/labath closed 
https://github.com/llvm/llvm-project/pull/145516
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Extract debug server location code (PR #145706)

2025-06-26 Thread Pavel Labath via lldb-commits

labath wrote:

> Thanks, and sorry for not getting back to the Mac issue I said I'd debug, 
> I've been preoccupied lately.

That's okay, no worries.

> To make sure I understand, this change hoists the logic that discovers the 
> location of lldb-server (the function `GetDebugserverPath`) out of the 
> unified logic of launching a debug server and up to `ProcessGDBRemote`, 
> allowing lldb-server platform mode to supply itself as the debug server path, 
> whereas other use cases that go through `ProcessGDBRemote` still get the old 
> location-discovery logic, right? (which use cases are those? launching a 
> debug server from `lldb` itself?)

That's completely correct. There are two exactly two use cases for launching 
lldb-gdb-server, one from (lib)lldb, and one from lldb-server-platform. This 
lets each implement discovery on its own (among other things).

https://github.com/llvm/llvm-project/pull/145706
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [NFC][lldb-dap] Add missing header guard for DAPError and ProgressEvent. (PR #145915)

2025-06-26 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)


Changes

delete the copy, move constructor and assignment for ProgressEventReporter.

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


2 Files Affected:

- (modified) lldb/tools/lldb-dap/DAPError.h (+5) 
- (modified) lldb/tools/lldb-dap/ProgressEvent.h (+10-3) 


``diff
diff --git a/lldb/tools/lldb-dap/DAPError.h b/lldb/tools/lldb-dap/DAPError.h
index e18614fe71935..e3ad10806a343 100644
--- a/lldb/tools/lldb-dap/DAPError.h
+++ b/lldb/tools/lldb-dap/DAPError.h
@@ -6,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_TOOLS_LLDB_DAP_DAPERROR_H
+#define LLDB_TOOLS_LLDB_DAP_DAPERROR_H
+
 #include "llvm/Support/Error.h"
 #include 
 #include 
@@ -50,3 +53,5 @@ class NotStoppedError : public 
llvm::ErrorInfo {
 };
 
 } // namespace lldb_dap
+
+#endif // LLDB_TOOLS_LLDB_DAP_DAPERROR_H
\ No newline at end of file
diff --git a/lldb/tools/lldb-dap/ProgressEvent.h 
b/lldb/tools/lldb-dap/ProgressEvent.h
index d1b9b9dd887cd..55c7bd73f324e 100644
--- a/lldb/tools/lldb-dap/ProgressEvent.h
+++ b/lldb/tools/lldb-dap/ProgressEvent.h
@@ -6,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
+#define LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
+
 #include 
 #include 
 #include 
@@ -13,8 +16,6 @@
 #include 
 #include 
 
-#include "DAPForward.h"
-
 #include "llvm/Support/JSON.h"
 
 namespace lldb_dap {
@@ -129,8 +130,12 @@ class ProgressEventReporter {
 public:
   /// \param[in] report_callback
   /// Function to invoke to report the event to the IDE.
-  ProgressEventReporter(ProgressEventReportCallback report_callback);
+  explicit ProgressEventReporter(ProgressEventReportCallback report_callback);
 
+  ProgressEventReporter(const ProgressEventReporter &) = delete;
+  ProgressEventReporter(ProgressEventReporter &&) = delete;
+  ProgressEventReporter &operator=(const ProgressEventReporter &) = delete;
+  ProgressEventReporter &operator=(ProgressEventReporter &&) = delete;
   ~ProgressEventReporter();
 
   /// Add a new event to the internal queue and report the event if
@@ -156,3 +161,5 @@ class ProgressEventReporter {
 };
 
 } // namespace lldb_dap
+
+#endif // LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
\ No newline at end of file

``




https://github.com/llvm/llvm-project/pull/145915
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [NFC][lldb-dap] Add missing header guard for DAPError and ProgressEvent. (PR #145915)

2025-06-26 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper created 
https://github.com/llvm/llvm-project/pull/145915

delete the copy, move constructor and assignment for ProgressEventReporter.

>From fbfc26bd78b815334af4beb786ac8276f782b370 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Thu, 26 Jun 2025 16:07:28 +0100
Subject: [PATCH] [NFC][lldb-dap] add missing header guard.

delete the copy, move construction and assignment.
---
 lldb/tools/lldb-dap/DAPError.h  |  5 +
 lldb/tools/lldb-dap/ProgressEvent.h | 13 ++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lldb/tools/lldb-dap/DAPError.h b/lldb/tools/lldb-dap/DAPError.h
index e18614fe71935..e3ad10806a343 100644
--- a/lldb/tools/lldb-dap/DAPError.h
+++ b/lldb/tools/lldb-dap/DAPError.h
@@ -6,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_TOOLS_LLDB_DAP_DAPERROR_H
+#define LLDB_TOOLS_LLDB_DAP_DAPERROR_H
+
 #include "llvm/Support/Error.h"
 #include 
 #include 
@@ -50,3 +53,5 @@ class NotStoppedError : public 
llvm::ErrorInfo {
 };
 
 } // namespace lldb_dap
+
+#endif // LLDB_TOOLS_LLDB_DAP_DAPERROR_H
\ No newline at end of file
diff --git a/lldb/tools/lldb-dap/ProgressEvent.h 
b/lldb/tools/lldb-dap/ProgressEvent.h
index d1b9b9dd887cd..55c7bd73f324e 100644
--- a/lldb/tools/lldb-dap/ProgressEvent.h
+++ b/lldb/tools/lldb-dap/ProgressEvent.h
@@ -6,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
+#define LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
+
 #include 
 #include 
 #include 
@@ -13,8 +16,6 @@
 #include 
 #include 
 
-#include "DAPForward.h"
-
 #include "llvm/Support/JSON.h"
 
 namespace lldb_dap {
@@ -129,8 +130,12 @@ class ProgressEventReporter {
 public:
   /// \param[in] report_callback
   /// Function to invoke to report the event to the IDE.
-  ProgressEventReporter(ProgressEventReportCallback report_callback);
+  explicit ProgressEventReporter(ProgressEventReportCallback report_callback);
 
+  ProgressEventReporter(const ProgressEventReporter &) = delete;
+  ProgressEventReporter(ProgressEventReporter &&) = delete;
+  ProgressEventReporter &operator=(const ProgressEventReporter &) = delete;
+  ProgressEventReporter &operator=(ProgressEventReporter &&) = delete;
   ~ProgressEventReporter();
 
   /// Add a new event to the internal queue and report the event if
@@ -156,3 +161,5 @@ class ProgressEventReporter {
 };
 
 } // namespace lldb_dap
+
+#endif // LLDB_TOOLS_LLDB_DAP_PROGRESS_EVENT_H
\ No newline at end of file

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)

2025-06-26 Thread via lldb-commits

https://github.com/tedwoodward deleted 
https://github.com/llvm/llvm-project/pull/145793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Correctly restore the cursor column after resizing the statusline (PR #145823)

2025-06-26 Thread Jonas Devlieghere via lldb-commits


@@ -398,6 +397,20 @@ int Editline::GetLineIndexForLocation(CursorLocation 
location, int cursor_row) {
   return line;
 }
 
+CursorPosition Editline::GetCursorPosition() {
+  if (!m_editline)
+return {};
+
+  const LineInfoW *info = el_wline(m_editline);
+  if (!info)
+return {};
+
+  const size_t editline_cursor_col =
+  (int)((info->cursor - info->buffer) + GetPromptWidth()) + 1;

JDevlieghere wrote:

The static cast is to appease the printf-format specifier. Storing the position 
as a `size_t` seems more canonical, but I also can't imagine a terminal that 
exceeds `UINT32_MAX`

https://github.com/llvm/llvm-project/pull/145823
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


  1   2   >