[Lldb-commits] [lldb] 76bd5da - [lldb][test] Skip import-std-module tests on Linux for now

2025-05-30 Thread Michael Buch via lldb-commits

Author: Michael Buch
Date: 2025-05-30T11:48:55+01:00
New Revision: 76bd5da3248fd4affedfefec3b2a3e1acbe0a94a

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

LOG: [lldb][test] Skip import-std-module tests on Linux for now

Fixes https://github.com/llvm/llvm-project/issues/137046

Added: 


Modified: 

lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py

lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py

lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py

lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py

lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py

lldb/test/API/commands/expression/import-std-module/iterator/TestIteratorFromStdModule.py

lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py

lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py

lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py

lldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py

lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py

lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py

lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py

lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py

lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py

Removed: 




diff  --git 
a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py
index 13ab6b0c9ac1f..1b21fe374ce5f 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py
@@ -10,6 +10,7 @@
 class TestCase(TestBase):
 @add_test_categories(["libc++"])
 @skipIf(compiler=no_match("clang"))
+@skipUnlessDarwin
 def test(self):
 self.build()
 

diff  --git 
a/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
index 9e2fc17fa10b4..cfc480ae73a19 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py
@@ -10,6 +10,7 @@
 class TestBasicDeque(TestBase):
 @add_test_categories(["libc++"])
 @skipIf(compiler=no_match("clang"))
+@skipUnlessDarwin
 def test(self):
 self.build()
 

diff  --git 
a/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
index 762f06140e27a..06f47e548b00f 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py
@@ -11,6 +11,7 @@ class TestDbgInfoContentDeque(TestBase):
 @add_test_categories(["libc++"])
 @skipIf(compiler=no_match("clang"))
 @skipIf(compiler="clang", compiler_version=["<", "18.0"])
+@skipUnlessDarwin
 def test(self):
 self.build()
 

diff  --git 
a/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
index 9b0ca8c49f003..d69f0acaf0461 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py
@@ -10,6 +10,7 @@
 class TestDbgInfoContentForwardList(TestBase):
 @add_test_categories(["libc++"])
 @skipIf(compiler=no_match("clang"))
+@skipUnlessDarwin
 def test(self):
 

[Lldb-commits] [lldb] [lldb-dap][test] Fix DAP disassemble test (PR #142129)

2025-05-30 Thread Ebuka Ezike via lldb-commits

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

compare the instructions before and after setting breakpoint to make sure they 
are the same. 
Do not use the source location as it is not guaranteed to exist.

>From 4c0bd999e60b7082fb30916c5f20d7ab064e76fe Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Fri, 30 May 2025 12:49:22 +0100
Subject: [PATCH] [lldb-dap][test] Fix DAP disassemble test

compare the instructions before and after setting breakpoint
to make sure they are the same. Do not use the source location as
it is not guaranteed to exist.
---
 .../disassemble/TestDAP_disassemble.py| 36 +++
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py 
b/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
index a8b51864d118b..da7a337de5ea6 100644
--- a/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
+++ b/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
@@ -2,13 +2,9 @@
 Test lldb-dap disassemble request
 """
 
-
-import dap_server
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
+from lldbsuite.test.decorators import skipIfWindows
+from lldbsuite.test.lldbtest import line_number
 import lldbdap_testcase
-import os
 
 
 class TestDAP_disassemble(lldbdap_testcase.DAPTestCaseBase):
@@ -23,15 +19,23 @@ def test_disassemble(self):
 self.set_source_breakpoints(source, [line_number(source, "// 
breakpoint 1")])
 self.continue_to_next_stop()
 
-_, pc_assembly = self.disassemble(frameIndex=0)
-self.assertIn("location", pc_assembly, "Source location missing.")
-self.assertIn("instruction", pc_assembly, "Assembly instruction 
missing.")
+insts_with_bp, pc_with_bp_assembly = self.disassemble(frameIndex=0)
+no_bp = self.set_source_breakpoints(source, [])
+self.assertEqual(len(no_bp), 0, "expect no breakpoints.")
+self.assertIn(
+"instruction", pc_with_bp_assembly, "Assembly instruction missing."
+)
 
-# The calling frame (qsort) is coming from a system library, as a 
result
-# we should not have a source location.
-_, qsort_assembly = self.disassemble(frameIndex=1)
-self.assertNotIn("location", qsort_assembly, "Source location not 
expected.")
-self.assertIn("instruction", pc_assembly, "Assembly instruction 
missing.")
+# the disassembly instructions should be the same even if there is a 
breakpoint;
+insts_no_bp, pc_no_bp_assembly = self.disassemble(frameIndex=0)
+self.assertDictEqual(
+insts_with_bp,
+insts_no_bp,
+"Expects instructions are the same after removing breakpoints.",
+)
+self.assertIn("instruction", pc_no_bp_assembly, "Assembly instruction 
missing.")
+
+self.continue_to_exit()
 
 @skipIfWindows
 def test_disassemble_backwards(self):
@@ -74,3 +78,7 @@ def test_disassemble_backwards(self):
 backwards_instructions,
 f"requested instruction should be preceeded by 
{backwards_instructions} instructions. Actual index: {frame_instruction_index}",
 )
+
+# clear breakpoints
+self.set_source_breakpoints(source, [])
+self.continue_to_exit()

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


[Lldb-commits] [lldb] [lldb] Fix Linux core file tests hanging on Windows (PR #142143)

2025-05-30 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/142143

After https://github.com/llvm/llvm-project/pull/141670, TestLinuxCore.py was 
timing out on our Windows on Arm bot.

Non-Linux core files were ok, as were Linux core files unless it was ppc64le, 
riscv64 or loongarch.

I eventually noticed that it was attempting to create PlatformLinux many times 
before trying PlatformAndroid, PlatformMac etc., which it should never need to 
do.

The tests passed on a Linux host too, to add to the mystery.

Turns out, all I needed to do was mark those architectures as supported in the 
PlatformLinux constructor. If they're not listed there we get stuck here:
```
// Wait for a stopped event since we just posted one above...
printf("waiting for process to stop...\n");
lldb::EventSP event_sp;
StateType state =
WaitForProcessToStop(std::nullopt, &event_sp, true, listener_sp,
 nullptr, true, SelectMostRelevantFrame);
printf("process stopped\n");
```
Waiting for a stop event that never comes, because it appears we try to treat 
the core as a real process?
```
 DynamicLoaderPOSIXDYLD::virtual DynamicLoaderPOSIXDYLD::DidAttach pid 28147 
executable '', load_offset 0x
<...>
 Process::ShouldBroadcastEvent (02ABC43FF4A0) Restarting process from 
state: stopped
 Process::PrivateResume() m_stop_id = 1, public state: unloaded private state: 
stopped
 Process::PrivateResume() got an error "error: elf-core does not support 
resuming processes".
 Process::ShouldBroadcastEvent (02ABC43FF4A0) => new state: stopped, last 
broadcast state: invalid - NO
```
Some actionable feedback here would be nice, but all I care about for now is 
that the tests run again.

I have not added riscv32 as that appears to only be supported for Darwin at the 
moment (I expect someone will get burned by this when it is).

I think debug on these architectures worked if they were also the host arch, if 
someone tried to remote debug them, I think it would have failed.

>From 9058b57895752398b22b4da3d56ab0fca42fb33f Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Fri, 30 May 2025 13:05:57 +
Subject: [PATCH] [lldb] Fix Linux core file tests hanging on Windows

After https://github.com/llvm/llvm-project/pull/141670,
TestLinuxCore.py was timing out on our Windows on Arm bot.

Non-Linux core files were ok, as were Linux core files unless
it was ppc64le, riscv64 or loongarch.

I eventually noticed that it was attempting to create
PlatformLinux many times before trying PlatformAndroid,
PlatformMac etc., which it should never need to do.

The tests passed on a Linux host too, to add to the mystery.

Turns out, all I needed to do was mark those architectures
as supported in the PlatformLinux constructor.

If they're not listed there we get stuck here:
```
// Wait for a stopped event since we just posted one above...
printf("waiting for process to stop...\n");
lldb::EventSP event_sp;
StateType state =
WaitForProcessToStop(std::nullopt, &event_sp, true, listener_sp,
 nullptr, true, SelectMostRelevantFrame);
printf("process stopped\n");
```
Waiting for a stop event that never comes, because it appears we
try to treat the core as a real process?
```
 DynamicLoaderPOSIXDYLD::virtual DynamicLoaderPOSIXDYLD::DidAttach pid 28147 
executable '', load_offset 0x
<...>
 Process::ShouldBroadcastEvent (02ABC43FF4A0) Restarting process from 
state: stopped
 Process::PrivateResume() m_stop_id = 1, public state: unloaded private state: 
stopped
 Process::PrivateResume() got an error "error: elf-core does not support 
resuming processes".
 Process::ShouldBroadcastEvent (02ABC43FF4A0) => new state: stopped, last 
broadcast state: invalid - NO
```

Some sort of actionable feedback here would be nice, but all I care
about for now is that the tests run again.

I have not added riscv32 as that appears to only be supported
for Darwin at the moment (though I expect someone will get
burned by this when it is).

I think debug on these architectures worked if they were also
the host arch, if someone tried to remote debug them, I think
it would fail.
---
 lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp 
b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index dd6490c7141e5..269105208a87a 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -138,7 +138,9 @@ PlatformLinux::PlatformLinux(bool is_host)
 {llvm::Triple::x86_64, llvm::Triple::x86, llvm::Triple::arm,
  llvm::Triple::aarch64, llvm::Triple::mips64, llvm::Triple::mips64,
  llvm::Triple::hexagon, llvm::Triple::mips, llvm::Triple::mips64el,
- llvm::Triple::mipsel, llvm::Triple::msp430, llvm::Triple:

[Lldb-commits] [lldb] 3745e05 - [lldb] Fix Linux core file tests hanging on Windows (#142143)

2025-05-30 Thread via lldb-commits

Author: David Spickett
Date: 2025-05-30T14:14:38+01:00
New Revision: 3745e051be6ff7c2464f775f06a71bee79eaf16f

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

LOG: [lldb] Fix Linux core file tests hanging on Windows (#142143)

After https://github.com/llvm/llvm-project/pull/141670, TestLinuxCore.py
was timing out on our Windows on Arm bot.

Non-Linux core files were ok, as were Linux core files unless it was
ppc64le, riscv64 or loongarch.

I eventually noticed that it was attempting to create PlatformLinux many
times before trying PlatformAndroid, PlatformMac etc., which it should
never need to do.

The tests passed on a Linux host too, to add to the mystery.

Turns out, all I needed to do was mark those architectures as supported
in the PlatformLinux constructor. If they're not listed there we get
stuck here:
```
// Wait for a stopped event since we just posted one above...
printf("waiting for process to stop...\n");
lldb::EventSP event_sp;
StateType state =
WaitForProcessToStop(std::nullopt, &event_sp, true, listener_sp,
 nullptr, true, SelectMostRelevantFrame);
printf("process stopped\n");
```
Waiting for a stop event that never comes, because it appears we try to
treat the core as a real process?
```
 DynamicLoaderPOSIXDYLD::virtual DynamicLoaderPOSIXDYLD::DidAttach pid 28147 
executable '', load_offset 0x
<...>
 Process::ShouldBroadcastEvent (02ABC43FF4A0) Restarting process from 
state: stopped
 Process::PrivateResume() m_stop_id = 1, public state: unloaded private state: 
stopped
 Process::PrivateResume() got an error "error: elf-core does not support 
resuming processes".
 Process::ShouldBroadcastEvent (02ABC43FF4A0) => new state: stopped, last 
broadcast state: invalid - NO
```
Some actionable feedback here would be nice, but all I care about for
now is that the tests run again.

I have not added riscv32 as that appears to only be supported for Darwin
at the moment (I expect someone will get burned by this when it is).

I think debug on these architectures worked if they were also the host
arch, if someone tried to remote debug them, I think it would have
failed.

Added: 


Modified: 
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp 
b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index dd6490c7141e5..269105208a87a 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -138,7 +138,9 @@ PlatformLinux::PlatformLinux(bool is_host)
 {llvm::Triple::x86_64, llvm::Triple::x86, llvm::Triple::arm,
  llvm::Triple::aarch64, llvm::Triple::mips64, llvm::Triple::mips64,
  llvm::Triple::hexagon, llvm::Triple::mips, llvm::Triple::mips64el,
- llvm::Triple::mipsel, llvm::Triple::msp430, llvm::Triple::systemz},
+ llvm::Triple::mipsel, llvm::Triple::msp430, llvm::Triple::systemz,
+ llvm::Triple::loongarch64, llvm::Triple::ppc64le,
+ llvm::Triple::riscv64},
 llvm::Triple::Linux);
   }
 }



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


[Lldb-commits] [lldb] aaa9c19 - [LLDB] Remove redundant check in DemangledNameInfo::hasBasename (#142139)

2025-05-30 Thread via lldb-commits

Author: Charles Zablit
Date: 2025-05-30T14:27:17+01:00
New Revision: aaa9c19328b23319eb1b50789d9478f31dee09b1

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

LOG: [LLDB] Remove redundant check in DemangledNameInfo::hasBasename (#142139)

Added: 


Modified: 
lldb/include/lldb/Core/DemangledNameInfo.h

Removed: 




diff  --git a/lldb/include/lldb/Core/DemangledNameInfo.h 
b/lldb/include/lldb/Core/DemangledNameInfo.h
index ab9bb3e211b66..4b5ba5e42b3b1 100644
--- a/lldb/include/lldb/Core/DemangledNameInfo.h
+++ b/lldb/include/lldb/Core/DemangledNameInfo.h
@@ -71,8 +71,7 @@ struct DemangledNameInfo {
 
   /// Returns \c true if this object holds a valid basename range.
   bool hasBasename() const {
-return BasenameRange.second > BasenameRange.first &&
-   BasenameRange.second > 0;
+return BasenameRange.second > BasenameRange.first;
   }
 };
 



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


[Lldb-commits] [lldb] [LLDB] Avoid crashes when inspecting MSVC STL types (PR #140761)

2025-05-30 Thread via lldb-commits

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

>From 9ee1b6137acc6d74dba6d27aafd2395b7ec87075 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Wed, 21 May 2025 17:32:48 +0200
Subject: [PATCH] [LLDB] Avoid crashes when inspecting MS STL types

---
 .../Language/CPlusPlus/GenericOptional.cpp|  7 ++-
 .../Plugins/Language/CPlusPlus/LibStdcpp.cpp  |  3 +
 .../Shell/Process/Windows/msstl_smoke.cpp | 56 +++
 3 files changed, 63 insertions(+), 3 deletions(-)
 create mode 100644 lldb/test/Shell/Process/Windows/msstl_smoke.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
index b1fdc0fe37763..c041f39022d10 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
@@ -74,9 +74,10 @@ lldb::ChildCacheState GenericOptionalFrontend::Update() {
 
   if (m_stdlib == StdLib::LibCxx)
 engaged_sp = m_backend.GetChildMemberWithName("__engaged_");
-  else if (m_stdlib == StdLib::LibStdcpp)
-engaged_sp = m_backend.GetChildMemberWithName("_M_payload")
- ->GetChildMemberWithName("_M_engaged");
+  else if (m_stdlib == StdLib::LibStdcpp) {
+if (ValueObjectSP payload = m_backend.GetChildMemberWithName("_M_payload"))
+  engaged_sp = payload->GetChildMemberWithName("_M_engaged");
+  }
 
   if (!engaged_sp)
 return lldb::ChildCacheState::eRefetch;
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
index 02113baf64b8c..08cfcd4a26b8e 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -379,6 +379,9 @@ LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() 
{
 
 lldb::ValueObjectSP
 LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
+  if (!m_ptr_obj)
+return nullptr;
+
   if (idx == 0)
 return m_ptr_obj->GetSP();
   if (idx == 1) {
diff --git a/lldb/test/Shell/Process/Windows/msstl_smoke.cpp 
b/lldb/test/Shell/Process/Windows/msstl_smoke.cpp
new file mode 100644
index 0..1dcb9c0093b10
--- /dev/null
+++ b/lldb/test/Shell/Process/Windows/msstl_smoke.cpp
@@ -0,0 +1,56 @@
+// This smoke test ensures that LLDB doesn't crash when formatting types from 
MSVC's STL.
+// FIXME: LLDB currently has no built-in formatters for MSVC's STL (#24834)
+
+// REQUIRES: target-windows
+// RUN: %build --compiler=clang-cl -o %t.exe --std c++20 -- %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "run" 
-o "fr v" -o c | FileCheck %s
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int main() {
+  std::shared_ptr foo;
+  std::weak_ptr weak = foo;
+  std::unique_ptr unique(new int(42));
+  std::optional opt;
+  std::string str = "str";
+  std::string longStr = "string that is long enough such that no SSO can 
happen";
+  std::wstring wStr = L"wstr";
+  std::wstring longWStr = L"string that is long enough such that no SSO can 
happen";
+  std::tuple tuple{1, false, 4.2};
+  std::coroutine_handle<> coroHandle;
+  std::bitset<16> bitset(123);
+
+  std::map map{{1, 2}, {2, 4}, {3, 6}, {4, 8}, {5, 10}};
+  auto mapIt = map.find(3);
+  auto mapItEnd = map.find(9);
+  std::set set{1, 2, 3};
+  std::multimap mMap{{1, 2}, {1, 1}, {2, 4}};
+  std::multiset mSet{1, 2, 3};
+
+  std::variant variant;
+  std::list list{1, 2, 3};
+  std::forward_list fwList{1, 2, 3};
+
+  std::unordered_map uMap{{1, 2}, {2, 4}, {3, 6}};
+  std::unordered_set uSet{1, 2, 4};
+  std::unordered_multimap uMMap{{1, 2}, {1, 1}, {2, 4}};
+  std::unordered_multiset uMSet{1, 1, 2};
+  std::deque deque{1, 2, 3};
+  std::vector vec{1, 2, 3};
+}
+
+// CHECK: Process {{.*}} exited with status = 0 (0x)

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


[Lldb-commits] [lldb] [lldb][SymbolFileDWARF] Fall back to using parent DW_AT_LLVM_include_path for submodules (PR #142044)

2025-05-30 Thread Michael Buch via lldb-commits

Michael137 wrote:

> This test was failing on Windows I think because like many others, we're not 
> making DWARF or we're not retaining it when linking with link.exe. I've 
> skipped it there - 
> [7a66b28](https://github.com/llvm/llvm-project/commit/7a66b28fcafdb7546aedeca1271e66438ad04127).

Thanks!

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


[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread Michael Buch via lldb-commits

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

Depends on https://github.com/llvm/llvm-project/pull/142163

This patch makes the `-ast-dump-filter` Clang option available to the
`target modules dump ast` command. This allows us to selectively dump
parts of the AST by name.

The AST can quickly grow way too large to skim on the console. This will
aid in debugging AST related issues.

Example:
```
(lldb) target modules dump ast --filter func
Dumping clang ast for 48 modules.
Dumping func:
FunctionDecl 0xc4b785008 <>  func 'void (int)' 
extern
|-ParmVarDecl 0xc4b7853d8 <>  x 'int'
`-AsmLabelAttr 0xc4b785358 <> Implicit "_Z4funcIiEvT_"

Dumping func:
FunctionDecl 0xc4b7850b8 <>  func 'void (int)' 
implicit_instantiation extern
|-TemplateArgument type 'int'
| `-BuiltinType 0xc4b85b110 'int'
`-ParmVarDecl 0xc4b7853d8 <>  x 'int'
```

>From 662e07aa9bb6560f37c079ba6f13be17e7885b48 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 30 May 2025 15:44:09 +0100
Subject: [PATCH 1/2] [clang][Frontend] Add overload to ASTPrinter that doesn't
 own output stream

We're planning on using the ASTPrinter in LLDB for AST dumping. But it
currently takes the output stream via `unique_ptr`. In LLDB we don't
have the output stream available in this form and instead it would be
convenient if we could just pass a reference to the stream.

This patch adds that overload.

(cherry picked from commit 9bd15ee7ed44adc836bcd07ff7e856d7a32ba6a9)
---
 clang/include/clang/Frontend/ASTConsumers.h |  5 +
 clang/lib/Frontend/ASTConsumers.cpp | 20 
 2 files changed, 25 insertions(+)

diff --git a/clang/include/clang/Frontend/ASTConsumers.h 
b/clang/include/clang/Frontend/ASTConsumers.h
index 0e068bf5cccb5..890701b6ff188 100644
--- a/clang/include/clang/Frontend/ASTConsumers.h
+++ b/clang/include/clang/Frontend/ASTConsumers.h
@@ -35,6 +35,11 @@ CreateASTDumper(std::unique_ptr OS, StringRef 
FilterString,
 bool DumpDecls, bool Deserialize, bool DumpLookups,
 bool DumpDeclTypes, ASTDumpOutputFormat Format);
 
+std::unique_ptr
+CreateASTDumper(raw_ostream &OS, StringRef FilterString, bool DumpDecls,
+bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+ASTDumpOutputFormat Format);
+
 // AST Decl node lister: prints qualified names of all filterable AST Decl
 // nodes.
 std::unique_ptr CreateASTDeclNodeLister();
diff --git a/clang/lib/Frontend/ASTConsumers.cpp 
b/clang/lib/Frontend/ASTConsumers.cpp
index a6e35452b4fbe..a5ff4d44592d4 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -41,6 +41,13 @@ namespace {
   OutputKind(K), OutputFormat(Format), FilterString(FilterString),
   DumpLookups(DumpLookups), DumpDeclTypes(DumpDeclTypes) {}
 
+ASTPrinter(raw_ostream &Out, Kind K, ASTDumpOutputFormat Format,
+   StringRef FilterString, bool DumpLookups = false,
+   bool DumpDeclTypes = false)
+: Out(Out), OwnedOut(nullptr), OutputKind(K), OutputFormat(Format),
+  FilterString(FilterString), DumpLookups(DumpLookups),
+  DumpDeclTypes(DumpDeclTypes) {}
+
 void HandleTranslationUnit(ASTContext &Context) override {
   TranslationUnitDecl *D = Context.getTranslationUnitDecl();
 
@@ -176,6 +183,19 @@ clang::CreateASTDumper(std::unique_ptr Out, 
StringRef FilterString,
   Format, FilterString, DumpLookups, DumpDeclTypes);
 }
 
+std::unique_ptr
+clang::CreateASTDumper(raw_ostream &Out, StringRef FilterString, bool 
DumpDecls,
+   bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+   ASTDumpOutputFormat Format) {
+  assert((DumpDecls || Deserialize || DumpLookups) && "nothing to dump");
+  return std::make_unique(Out,
+  Deserialize ? ASTPrinter::DumpFull
+  : DumpDecls ? ASTPrinter::Dump
+  : ASTPrinter::None,
+  Format, FilterString, DumpLookups,
+  DumpDeclTypes);
+}
+
 std::unique_ptr clang::CreateASTDeclNodeLister() {
   return std::make_unique(nullptr);
 }

>From 0ba5a4f09caeb54008594adfb3b8efa2a740e5e6 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 30 May 2025 15:46:27 +0100
Subject: [PATCH 2/2] [lldb] Add filter option to AST dump command

This patch makes the `-ast-dump-filter` Clang option available to the
`target modules dump ast` command. This allows us to selectively dump
parts of the AST by name.

The AST can quickly grow way too large to skim on the console. This will
aid in debugging AST related issues.

Example:
```
(lldb) target modules dump ast --filter func
Dumping clang ast for 48 modules.
Dumping func:
FunctionDecl 0xc4b785008 <>  func 'void (int)' 
extern
|-ParmVarDecl 0xc4b7853d8 <>  x 'int'
`-AsmLabelAttr 0xc4b785358 <> Implicit "_

[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Michael Buch (Michael137)


Changes

Depends on https://github.com/llvm/llvm-project/pull/142163

This patch makes the `-ast-dump-filter` Clang option available to the
`target modules dump ast` command. This allows us to selectively dump
parts of the AST by name.

The AST can quickly grow way too large to skim on the console. This will
aid in debugging AST related issues.

Example:
```
(lldb) target modules dump ast --filter func
Dumping clang ast for 48 modules.
Dumping func:
FunctionDecl 0xc4b785008 <>  func 
'void (int)' extern
|-ParmVarDecl 0xc4b7853d8 <>  x 
'int'
`-AsmLabelAttr 0xc4b785358 <> Implicit "_Z4funcIiEvT_"

Dumping func:
FunctionDecl 0xc4b7850b8 <>  
func 'void (int)' implicit_instantiation extern
|-TemplateArgument type 'int'
| `-BuiltinType 0xc4b85b110 'int'
`-ParmVarDecl 0xc4b7853d8 <>  x 
'int'
```

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


19 Files Affected:

- (modified) clang/include/clang/Frontend/ASTConsumers.h (+5) 
- (modified) clang/lib/Frontend/ASTConsumers.cpp (+20) 
- (modified) lldb/include/lldb/Symbol/SymbolFile.h (+1-1) 
- (modified) lldb/include/lldb/Symbol/SymbolFileOnDemand.h (+1-1) 
- (modified) lldb/include/lldb/Symbol/TypeSystem.h (+2-1) 
- (modified) lldb/source/Commands/CommandObjectTarget.cpp (+18-5) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
(+3-3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h 
(+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp (+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
(+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h (+1-1) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+15-5) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h (+2-2) 
- (modified) lldb/source/Symbol/SymbolFileOnDemand.cpp (+3-2) 


``diff
diff --git a/clang/include/clang/Frontend/ASTConsumers.h 
b/clang/include/clang/Frontend/ASTConsumers.h
index 0e068bf5cccb5..890701b6ff188 100644
--- a/clang/include/clang/Frontend/ASTConsumers.h
+++ b/clang/include/clang/Frontend/ASTConsumers.h
@@ -35,6 +35,11 @@ CreateASTDumper(std::unique_ptr OS, StringRef 
FilterString,
 bool DumpDecls, bool Deserialize, bool DumpLookups,
 bool DumpDeclTypes, ASTDumpOutputFormat Format);
 
+std::unique_ptr
+CreateASTDumper(raw_ostream &OS, StringRef FilterString, bool DumpDecls,
+bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+ASTDumpOutputFormat Format);
+
 // AST Decl node lister: prints qualified names of all filterable AST Decl
 // nodes.
 std::unique_ptr CreateASTDeclNodeLister();
diff --git a/clang/lib/Frontend/ASTConsumers.cpp 
b/clang/lib/Frontend/ASTConsumers.cpp
index a6e35452b4fbe..a5ff4d44592d4 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -41,6 +41,13 @@ namespace {
   OutputKind(K), OutputFormat(Format), FilterString(FilterString),
   DumpLookups(DumpLookups), DumpDeclTypes(DumpDeclTypes) {}
 
+ASTPrinter(raw_ostream &Out, Kind K, ASTDumpOutputFormat Format,
+   StringRef FilterString, bool DumpLookups = false,
+   bool DumpDeclTypes = false)
+: Out(Out), OwnedOut(nullptr), OutputKind(K), OutputFormat(Format),
+  FilterString(FilterString), DumpLookups(DumpLookups),
+  DumpDeclTypes(DumpDeclTypes) {}
+
 void HandleTranslationUnit(ASTContext &Context) override {
   TranslationUnitDecl *D = Context.getTranslationUnitDecl();
 
@@ -176,6 +183,19 @@ clang::CreateASTDumper(std::unique_ptr Out, 
StringRef FilterString,
   Format, FilterString, DumpLookups, DumpDeclTypes);
 }
 
+std::unique_ptr
+clang::CreateASTDumper(raw_ostream &Out, StringRef FilterString, bool 
DumpDecls,
+   bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+   ASTDumpOutputFormat Format) {
+  assert((DumpDecls || Deserialize || DumpLookups) && "nothing to dump");
+  return std::make_unique(Out,
+  Deserialize ? ASTPrinter::DumpFull
+  : DumpDecls ? ASTPrinter::Dump
+  : ASTPrinter::None,
+  Format, FilterString, DumpLooku

[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

Depends on https://github.com/llvm/llvm-project/pull/142163

This patch makes the `-ast-dump-filter` Clang option available to the
`target modules dump ast` command. This allows us to selectively dump
parts of the AST by name.

The AST can quickly grow way too large to skim on the console. This will
aid in debugging AST related issues.

Example:
```
(lldb) target modules dump ast --filter func
Dumping clang ast for 48 modules.
Dumping func:
FunctionDecl 0xc4b785008 <>  func 
'void (int)' extern
|-ParmVarDecl 0xc4b7853d8 <>  x 
'int'
`-AsmLabelAttr 0xc4b785358 <> Implicit "_Z4funcIiEvT_"

Dumping func:
FunctionDecl 0xc4b7850b8 <>  
func 'void (int)' implicit_instantiation extern
|-TemplateArgument type 'int'
| `-BuiltinType 0xc4b85b110 'int'
`-ParmVarDecl 0xc4b7853d8 <>  x 
'int'
```

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


19 Files Affected:

- (modified) clang/include/clang/Frontend/ASTConsumers.h (+5) 
- (modified) clang/lib/Frontend/ASTConsumers.cpp (+20) 
- (modified) lldb/include/lldb/Symbol/SymbolFile.h (+1-1) 
- (modified) lldb/include/lldb/Symbol/SymbolFileOnDemand.h (+1-1) 
- (modified) lldb/include/lldb/Symbol/TypeSystem.h (+2-1) 
- (modified) lldb/source/Commands/CommandObjectTarget.cpp (+18-5) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
(+3-3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h 
(+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp (+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
(+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (+2-2) 
- (modified) lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h (+1-1) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+15-5) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h (+2-2) 
- (modified) lldb/source/Symbol/SymbolFileOnDemand.cpp (+3-2) 


``diff
diff --git a/clang/include/clang/Frontend/ASTConsumers.h 
b/clang/include/clang/Frontend/ASTConsumers.h
index 0e068bf5cccb5..890701b6ff188 100644
--- a/clang/include/clang/Frontend/ASTConsumers.h
+++ b/clang/include/clang/Frontend/ASTConsumers.h
@@ -35,6 +35,11 @@ CreateASTDumper(std::unique_ptr OS, StringRef 
FilterString,
 bool DumpDecls, bool Deserialize, bool DumpLookups,
 bool DumpDeclTypes, ASTDumpOutputFormat Format);
 
+std::unique_ptr
+CreateASTDumper(raw_ostream &OS, StringRef FilterString, bool DumpDecls,
+bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+ASTDumpOutputFormat Format);
+
 // AST Decl node lister: prints qualified names of all filterable AST Decl
 // nodes.
 std::unique_ptr CreateASTDeclNodeLister();
diff --git a/clang/lib/Frontend/ASTConsumers.cpp 
b/clang/lib/Frontend/ASTConsumers.cpp
index a6e35452b4fbe..a5ff4d44592d4 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -41,6 +41,13 @@ namespace {
   OutputKind(K), OutputFormat(Format), FilterString(FilterString),
   DumpLookups(DumpLookups), DumpDeclTypes(DumpDeclTypes) {}
 
+ASTPrinter(raw_ostream &Out, Kind K, ASTDumpOutputFormat Format,
+   StringRef FilterString, bool DumpLookups = false,
+   bool DumpDeclTypes = false)
+: Out(Out), OwnedOut(nullptr), OutputKind(K), OutputFormat(Format),
+  FilterString(FilterString), DumpLookups(DumpLookups),
+  DumpDeclTypes(DumpDeclTypes) {}
+
 void HandleTranslationUnit(ASTContext &Context) override {
   TranslationUnitDecl *D = Context.getTranslationUnitDecl();
 
@@ -176,6 +183,19 @@ clang::CreateASTDumper(std::unique_ptr Out, 
StringRef FilterString,
   Format, FilterString, DumpLookups, DumpDeclTypes);
 }
 
+std::unique_ptr
+clang::CreateASTDumper(raw_ostream &Out, StringRef FilterString, bool 
DumpDecls,
+   bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+   ASTDumpOutputFormat Format) {
+  assert((DumpDecls || Deserialize || DumpLookups) && "nothing to dump");
+  return std::make_unique(Out,
+  Deserialize ? ASTPrinter::DumpFull
+  : DumpDecls ? ASTPrinter::Dump
+  : ASTPrinter::None,
+  Format, FilterString, DumpLookup

[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread Michael Buch via lldb-commits


@@ -2235,11 +2235,22 @@ class CommandObjectTargetModulesDumpClangAST
   : CommandObjectTargetModulesModuleAutoComplete(
 interpreter, "target modules dump ast",
 "Dump the clang ast for a given module's symbol file.",
-//"target modules dump ast [ ...]")
-nullptr, eCommandRequiresTarget) {}
+"target modules dump ast [--filter ] [ ...]",
+eCommandRequiresTarget),
+m_filter(LLDB_OPT_SET_1, false, "filter", 'f', 0, eArgTypeName, "TODO",

Michael137 wrote:

Whoops left a TODO in here

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


[Lldb-commits] [lldb] [LLDB] Avoid crashes when inspecting MSVC STL types (PR #140761)

2025-05-30 Thread Michael Buch via lldb-commits

Michael137 wrote:

@Nerixyz do you need us to merge this for you?

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


[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread Michael Buch via lldb-commits


@@ -8511,8 +8512,16 @@ TypeSystemClang::dump(lldb::opaque_compiler_type_t type) 
const {
 }
 #endif
 
-void TypeSystemClang::Dump(llvm::raw_ostream &output) {
-  GetTranslationUnitDecl()->dump(output);
+void TypeSystemClang::Dump(llvm::raw_ostream &output,
+   llvm::StringRef filter_string) {
+  auto consumer =
+  clang::CreateASTDumper(output /*Dump to stdout.*/, filter_string,

Michael137 wrote:

```suggestion
  clang::CreateASTDumper(output, filter_string,
```


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


[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread Michael Buch via lldb-commits


@@ -8511,8 +8512,16 @@ TypeSystemClang::dump(lldb::opaque_compiler_type_t type) 
const {
 }
 #endif
 
-void TypeSystemClang::Dump(llvm::raw_ostream &output) {
-  GetTranslationUnitDecl()->dump(output);
+void TypeSystemClang::Dump(llvm::raw_ostream &output,
+   llvm::StringRef filter_string) {
+  auto consumer =
+  clang::CreateASTDumper(output /*Dump to stdout.*/, filter_string,
+ /*DumpDecls=*/true,
+ /*Deserialize=*/false,
+ /*DumpLookups=*/false,
+ /*DumpDeclTypes=*/false, clang::ADOF_Default);
+  lldbassert(consumer);
+  consumer->HandleTranslationUnit(*m_ast_up);

Michael137 wrote:

should probably assert on m_ast_up too

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


[Lldb-commits] [lldb] [WIP] [lldb] Add fetching of source files used in modules. (PR #141773)

2025-05-30 Thread Frank Ch. Eigler via lldb-commits

fche wrote:

Neat.  So much boilerplate for one new plugin mechanism, just to enable three 
or four lines actually on topic!

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


[Lldb-commits] [lldb] [lldb] Fix Linux core file tests hanging on Windows (PR #142143)

2025-05-30 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

Hey @DavidSpickett thanks for fixing the test.

I think you fixed it the right way, but I wanted to share my understanding of 
how this probably happened

In ProcessElfCore, we check the siginfo status of all the threads

```
  if (!siginfo_signal_found) {
// If we don't have signal from SIGINFO use the signal from each threads
// PRSTATUS note.
if (prstatus_signal_found) {
  for (auto &thread_data : m_thread_data)
thread_data.signo = thread_data.prstatus_sig;
} else if (m_thread_data.size() > 0) {
  // If all else fails force the first thread to be SIGSTOP
  m_thread_data.begin()->signo =
  GetUnixSignals()->GetSignalNumberFromName("SIGSTOP");
}
  }
  ```
  
So in our case, I've changed this behavior, where `siginfo_signal_found` will 
always be set to true if we've extracted any bytes from the PT_NOTE even if we 
can't use them later due to a lack of a platform class. Because we passed the 
siginfo bytes check we never populate the `signo` from the PRSTATUS
  
Then in ThreadElfCore I think we'd fail to calculate stop info because we don't 
have a valid SIGNO.

I think a few fixes here:

Currently, we set the stop reason even for `signo = 0` so you get a confusing 
stopped with signal 0 in LLDB. We should always stop for ThreadElfCore, but 
only make stop info dependent on the actual siginfo.

This same infinite loop also can happen for Minidump, and I haven't had time to 
fix it. I think in general we can wrap all of this into a nice postmortem 
thread and have the postmortem thread know it should always stop, but 
optionally get the signal description. 

CC: @labath 


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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-30 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Sorry, the above failure is a different assumption.

Our disassembly test failure is:
```
==
FAIL: test_disassemble (TestDAP_disassemble.TestDAP_disassemble)
   Tests the 'disassemble' request.
--
Traceback (most recent call last):
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py",
 line 33, in test_disassemble
self.assertNotIn("location", qsort_assembly, "Source location not 
expected.")
AssertionError: 'location' unexpectedly found in {'address': '0xF7B4BF68', 
'column': 7, 'endColumn': 27, 'endLine': 66, 'instruction': 'cmp w0, 
#0x0', 'instructionBytes': '1f 00 00 71', 'line': 64, 'location': {'name': 
'msort.c', 'path': 'stdlib/msort.c'}} : Source location not expected.
Config=aarch64-/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang
--
```
We have the libc debug symbols installed:
```
$ apt list --installed | grep libc6

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libc6-dbg/now 2.35-0ubuntu3.9 arm64 [installed,local]
libc6-dev/now 2.35-0ubuntu3.9 arm64 [installed,local]
libc6/now 2.35-0ubuntu3.9 arm64 [installed,local]
```
Could the test work with a function marked with `nodebug` instead? 
https://clang.llvm.org/docs/AttributeReference.html#nodebug

(perhaps that will still have a source location)

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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-30 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> The memory reference can have a corresponding source location. if there is 
> debuginfo installed on the computer or it is downloaded with debuginfod.

Sounds like the failure we see:
```
FAIL: test_generic_evaluate_expressions (TestDAP_evaluate.TestDAP_evaluate)
--
Traceback (most recent call last):
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py",
 line 228, in test_generic_evaluate_expressions
self.run_test_evaluate_expressions(enableAutoVariableSummaries=False)
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py",
 line 117, in run_test_evaluate_expressions
self.assertEvaluateFailure("list")  # local variable of a_function
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py",
 line 22, in assertEvaluateFailure
self.assertNotIn(
AssertionError: 'result' unexpectedly found in {'memoryReference': 
'0xF7CB3060', 'result': '0x', 'type': 'int *', 
'variablesReference': 7}
Config=aarch64-/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang
```
We have `libdebuginfod` installed:
```
# apt list --installed | grep debug

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

debugedit/now 1:5.0-4build1 arm64 [installed,local]
libdebuginfod-common/now 0.186-1build1 all [installed,local]
libdebuginfod1/now 0.186-1build1 arm64 [installed,local]
```
We don't have httplib installed though and don't see the URLs env var 
(https://documentation.ubuntu.com/server/explanation/debugging/about-debuginfod/index.html).

So we could be getting the location from a dev or debug info package from apt.

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


[Lldb-commits] [lldb] 114192f - Revert "[lldb-dap] Test Gardening, improving DebugCommunication. (#141689)"

2025-05-30 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2025-05-30T08:48:29Z
New Revision: 114192f586f70d1f7ac91da88061e39524c98ca3

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

LOG: Revert "[lldb-dap] Test Gardening, improving DebugCommunication. (#141689)"

This reverts commit 8a49db35f45e56c92522c6079e51553e80c07aec.

Due to failures on Arm and AArch64 Linux:
https://lab.llvm.org/buildbot/#/builders/59/builds/18540
https://lab.llvm.org/buildbot/#/builders/18/builds/16759

  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py",
 line 22, in assertEvaluateFailure
self.assertNotIn(
AssertionError: 'result' unexpectedly found in {'memoryReference': 
'0xF7CB3060', 'result': '0x', 'type': 'int *', 
'variablesReference': 7}

FAIL: test_generic_evaluate_expressions (TestDAP_evaluate.TestDAP_evaluate)
--
Traceback (most recent call last):
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py",
 line 228, in test_generic_evaluate_expressions
self.run_test_evaluate_expressions(enableAutoVariableSummaries=False)
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py",
 line 117, in run_test_evaluate_expressions
self.assertEvaluateFailure("list")  # local variable of a_function
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py",
 line 22, in assertEvaluateFailure
self.assertNotIn(
AssertionError: 'result' unexpectedly found in {'memoryReference': 
'0xF7CB3060', 'result': '0x', 'type': 'int *', 
'variablesReference': 7}
Config=aarch64-/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang

The second one is because our bots have the libc debug info package installed,
the first, no idea.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py
lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
lldb/test/API/tools/lldb-dap/console/TestDAP_redirection_to_console.py
lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 2b18ecc4056f6..4c8c51905e1d0 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -12,106 +12,14 @@
 import sys
 import threading
 import time
-from typing import (
-IO,
-Any,
-Optional,
-Union,
-List,  # required for python 3.8 compatibility
-Dict,  # required for python 3.8 compatibility
-Tuple,  # required for python 3.8 compatibility
-TextIO,
-TypedDict,
-Literal,
-Callable,
-TypeVar,
-cast,
-TYPE_CHECKING,
-)
-
-if TYPE_CHECKING:
-# FIXME: Add mypy and typing_extensions to the requirements.txt once all
-# build bots support the library.
-from typing_extensions import Unpack
+from typing import Any, Optional, Union, BinaryIO, TextIO
 
 ## DAP type references
-
-T = TypeVar("T")
-
-
-class Event(TypedDict):
-type: Literal["event"]
-seq: Literal[0]
-event: str
-body: Optional[dict]
-
-
-class Request(TypedDict):
-type: Literal["request"]
-seq: int
-command: str
-arguments: Optional[dict]
-
-
-class Response(TypedDict):
-type: Literal["response"]
-seq: Literal[0]
-request_seq: int
-success: bool
-command: str
-message: Optional[str]
-body: Optional[dict]
-
-
-class AttachOrLaunchArguments(TypedDict, total=False):
-stopOnEntry: bool
-disableASLR: bool
-disableSTDIO: bool
-enableAutoVariableSummaries: bool
-displayExtendedBacktrace: bool
-enableSyntheticChildDebugging: bool
-initCommands: List[str]
-preRunCommands: List[str]
-postRunCommands: List[str]
-stopCommands: List[str]
-exitCommands: List[str]
-terminateCommands: List[str]
-sourceMap: Union[List[Tuple[str, str]], Dict[str, str]]
-sourcePath: str
-debuggerRoot: str
-commandEscapePrefix: str
-customFrameFormat: str
-customThreadFormat: str
-
-
-class LaunchArguments(AttachOrLaunchArguments, total=False):
-program: str
-args: List[str]
-cwd: str
-env: Dict[str, str]
-shellExpandArguments: bool
-runInTerminal: bool
-launchCommands: List[str]
-
-
-class Attach

[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-30 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Reverted, please take a look and fix. Reproducing should be possible by 
installing the libc debug package, not sure what's going on with the other 
failure. Let me know if you need me to investigate it locally.

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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-30 Thread Ebuka Ezike via lldb-commits

da-viper wrote:

Changing the test for disassemble to not depend on source location.
#142129

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


[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)

2025-05-30 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)

2025-05-30 Thread via lldb-commits

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


[Lldb-commits] [lldb] [LLDB] Avoid crashes when inspecting MSVC STL types (PR #140761)

2025-05-30 Thread via lldb-commits

Nerixyz wrote:

> @Nerixyz do you need us to merge this for you?

Yeah, that would be great!

https://github.com/llvm/llvm-project/pull/140761
___
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] Avoid unnecessary copy in setBreakpoint (PR #142179)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)


Changes



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


1 Files Affected:

- (modified) lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp 
(+1-3) 


``diff
diff --git a/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
index 0ff88f62f8f51..5d336af740c99 100644
--- a/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
@@ -7,8 +7,6 @@
 
//===--===//
 
 #include "DAP.h"
-#include "EventHelper.h"
-#include "JSONUtils.h"
 #include "Protocol/ProtocolRequests.h"
 #include "RequestHandler.h"
 #include 
@@ -22,7 +20,7 @@ namespace lldb_dap {
 llvm::Expected
 SetBreakpointsRequestHandler::Run(
 const protocol::SetBreakpointsArguments &args) const {
-  const auto response_breakpoints =
+  std::vector response_breakpoints =
   dap.SetSourceBreakpoints(args.source, args.breakpoints);
   return protocol::SetBreakpointsResponseBody{std::move(response_breakpoints)};
 }

``




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


[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)

2025-05-30 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)

2025-05-30 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)

2025-05-30 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)

2025-05-30 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb][nfc] Fix missing move operations and constness of methods (PR #142052)

2025-05-30 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Ack. My apt package doesn't install `libxml2-config-version.cmake` so I assume 
CMake is falling back on some standard logic for finding it and that would 
explain why CMake is happy to use 2.12 on my system. 

That said, it seems like this is done intentionally, and this is working around 
that (e.g. the ABI incompatibility you mentioned). That might be fine for how 
we use `libxml2` in lldb but let's make it clear that folks are doing this at 
their own risk. Can you update the description or add a comment with something 
along those lines?

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


[Lldb-commits] [lldb] [lldb] Disable TestConsecutiveBreakpoints.py for Windows x86_64 (PR #142192)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dmitry Vasilyev (slydiman)


Changes

See #138083 for details.

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


1 Files Affected:

- (modified) 
lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
 (+5) 


``diff
diff --git 
a/lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
 
b/lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
index ecea28c6e1f6d..351fae6b27678 100644
--- 
a/lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
+++ 
b/lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
@@ -91,6 +91,11 @@ def test_single_step(self):
 self.finish_test()
 
 @no_debug_info_test
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138083",
+)
 def test_single_step_thread_specific(self):
 """Test that single step stops, even though the second breakpoint is 
not valid."""
 self.prepare_test()

``




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


[Lldb-commits] [lldb] [lldb] Disable TestConsecutiveBreakpoints.py for Windows x86_64 (PR #142192)

2025-05-30 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/142192

See #138083 for details.

>From 99e4418063a869e0d9bdec784e62c5ebcb569510 Mon Sep 17 00:00:00 2001
From: Dmitry Vassiliev 
Date: Fri, 30 May 2025 20:33:49 +0400
Subject: [PATCH] [lldb] Disable TestConsecutiveBreakpoints.py for Windows
 x86_64

See #138083 for details.
---
 .../consecutive_breakpoints/TestConsecutiveBreakpoints.py| 5 +
 1 file changed, 5 insertions(+)

diff --git 
a/lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
 
b/lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
index ecea28c6e1f6d..351fae6b27678 100644
--- 
a/lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
+++ 
b/lldb/test/API/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
@@ -91,6 +91,11 @@ def test_single_step(self):
 self.finish_test()
 
 @no_debug_info_test
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138083",
+)
 def test_single_step_thread_specific(self):
 """Test that single step stops, even though the second breakpoint is 
not valid."""
 self.prepare_test()

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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Fabrice de Gans via lldb-commits

https://github.com/Steelskin updated 
https://github.com/llvm/llvm-project/pull/142183

>From c517ba1aa6c17de47c125468c047366117a9989a Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 09:27:54 -0700
Subject: [PATCH 1/3] [lldb] Add build option to specify the libxml 2 version

The Swift Windows toolchain uses its own static build of libxml 2, which
is more recent than 2.8, resulting in the provided libxml 2 to be
rejected. This change allows to specify a custom version for libxml 2,
while defaulting to 2.8.
---
 lldb/cmake/modules/LLDBConfig.cmake | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index cfd626c9358a1..f25ad1333468c 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,13 +51,15 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
+option(LLDB_LIBXML2_VERSION "Sepcify the version of libxml 2 to use with LLDB" 
"2.8")
+
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)
 add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" 
CursesAndPanel CURSESANDPANEL_FOUND)
 add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in 
LLDB" LibLZMA LIBLZMA_FOUND)
 add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" 
LuaAndSwig LUAANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
-add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
+add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION ${LLDB_LIBXML2_VERSION})
 add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support 
in LLDB" FBSDVMCore FBSDVMCore_FOUND QUIET)
 
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)

>From 95aa2490f58d68e19aa59a275aad0b2a5c0ebe68 Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 10:13:36 -0700
Subject: [PATCH 2/3] Fix string option setting

---
 lldb/cmake/modules/LLDBConfig.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index f25ad1333468c..c73815a3eb970 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,7 +51,7 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
-option(LLDB_LIBXML2_VERSION "Sepcify the version of libxml 2 to use with LLDB" 
"2.8")
+set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING "Sepcify the version of libxml 2 
to use with LLDB")
 
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)

>From ef27a1f1b00474881194b642ee6586531184 Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 11:07:52 -0700
Subject: [PATCH 3/3] Clarify comment and mark variable as advanced

---
 lldb/cmake/modules/LLDBConfig.cmake | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index c73815a3eb970..e8a80292c37db 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,7 +51,10 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
-set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING "Sepcify the version of libxml 2 
to use with LLDB")
+set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING
+  "Sepcify the version of libxml 2 to use with LLDB. This is only meant to be 
overridden for local
+  static builds of libxml 2. Use at your own risk.")
+mark_as_advanced(LLDB_LIBXML2_VERSION)
 
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)

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


[Lldb-commits] [lldb] [lldb][headers] Create script to fix up versioning (PR #141116)

2025-05-30 Thread Alex Langford via lldb-commits


@@ -290,6 +290,45 @@ else()
   endif()
 endif()
 
+# Stage all headers in the include directory in the build dir.

bulbazord wrote:

This looks very similar to some logic in `LLDBFramework.cmake`. Do we need this 
logic in both places or could it only live here?

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


[Lldb-commits] [lldb] [lldb] Remove some dead code in TypeSystemClang (NFC) (PR #142056)

2025-05-30 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread Michael Buch via lldb-commits


@@ -2235,11 +2235,22 @@ class CommandObjectTargetModulesDumpClangAST
   : CommandObjectTargetModulesModuleAutoComplete(
 interpreter, "target modules dump ast",
 "Dump the clang ast for a given module's symbol file.",
-//"target modules dump ast [ ...]")
-nullptr, eCommandRequiresTarget) {}
+"target modules dump ast [--filter ] [ ...]",
+eCommandRequiresTarget),
+m_filter(LLDB_OPT_SET_1, false, "filter", 'f', 0, eArgTypeName, "TODO",
+ /*default_value=*/"") {
+m_option_group.Append(&m_filter, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+m_option_group.Finalize();
+AddSimpleArgumentList(eArgTypeFilename, eArgRepeatStar);

Michael137 wrote:

This is also probably unnecessary 

https://github.com/llvm/llvm-project/pull/142164
___
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] Avoid unnecessary copy in setBreakpoint (PR #142179)

2025-05-30 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)

2025-05-30 Thread via lldb-commits

https://github.com/royitaqi updated 
https://github.com/llvm/llvm-project/pull/139170

>From c7432d04896c1eea67ed6a6d5f4b4c28941e5a90 Mon Sep 17 00:00:00 2001
From: Roy Shi 
Date: Thu, 8 May 2025 07:38:20 -0700
Subject: [PATCH 1/4] [lldb] Do not create SymbolFileDWARFDebugMap for
 non-Mach-O files

---
 .../Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 961c212e2e6dc..f94c756868953 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -10,7 +10,6 @@
 #include "DWARFCompileUnit.h"
 #include "DWARFDebugAranges.h"
 #include "DWARFDebugInfo.h"
-
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/PluginManager.h"
@@ -34,12 +33,12 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ScopedPrinter.h"
-
 #include "lldb/Target/StackFrame.h"
 
 #include "LogChannelDWARF.h"
 #include "SymbolFileDWARF.h"
 #include "lldb/lldb-private-enumerations.h"
+#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
 
 #include 
 #include 
@@ -246,6 +245,8 @@ llvm::StringRef 
SymbolFileDWARFDebugMap::GetPluginDescriptionStatic() {
 }
 
 SymbolFile *SymbolFileDWARFDebugMap::CreateInstance(ObjectFileSP objfile_sp) {
+  if (objfile_sp->GetPluginName() != ObjectFileMachO::GetPluginNameStatic())
+return nullptr;
   return new SymbolFileDWARFDebugMap(std::move(objfile_sp));
 }
 

>From 6c1ce45355ed1f955727e830019e7cafec4b0070 Mon Sep 17 00:00:00 2001
From: Roy Shi 
Date: Thu, 8 May 2025 10:22:25 -0700
Subject: [PATCH 2/4] Add test, but failing

---
 .../unittests/SymbolFile/DWARF/CMakeLists.txt |  1 +
 .../DWARF/SymbolFileDWARFDebugMapTests.cpp| 84 +++
 2 files changed, 85 insertions(+)
 create mode 100644 
lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFDebugMapTests.cpp

diff --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index d5b0be7ea2a28..5aacb24fc5206 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -4,6 +4,7 @@ add_lldb_unittest(SymbolFileDWARFTests
   DWARFDIETest.cpp
   DWARFIndexCachingTest.cpp
   DWARFUnitTest.cpp
+  SymbolFileDWARFDebugMapTests.cpp
   SymbolFileDWARFTests.cpp
   XcodeSDKModuleTests.cpp
 
diff --git a/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFDebugMapTests.cpp 
b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFDebugMapTests.cpp
new file mode 100644
index 0..399510e519521
--- /dev/null
+++ b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFDebugMapTests.cpp
@@ -0,0 +1,84 @@
+//===-- SymbolFileDWARFDebugMapTests.cpp 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
+#include "TestingSupport/TestUtilities.h"
+
+#include "lldb/Core/Module.h"
+#include "llvm/Testing/Support/Error.h"
+
+#include "gtest/gtest.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::plugin::dwarf;
+
+TEST(SymbolFileDWARFDebugMapTests, CreateInstanceReturnNullForNonMachOFile) {
+  // Make sure we don't crash parsing a null unit DIE.
+  const char *yamldata = R"(
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_386
+DWARF:
+  debug_abbrev:
+- Table:
+- Code:0x0001
+  Tag: DW_TAG_compile_unit
+  Children:DW_CHILDREN_no
+  Attributes:
+- Attribute:   DW_AT_addr_base
+  Form:DW_FORM_sec_offset
+  debug_info:
+- Version: 5
+  AddrSize:4
+  UnitType:DW_UT_compile
+  Entries:
+- AbbrCode:0x0001
+  Values:
+- Value:   0x8 # Offset of the first Address past the 
header
+- AbbrCode:0x0
+  debug_addr:
+- Version: 5
+  AddressSize: 4
+  Entries:
+- Address: 0x1234
+- Address: 0x5678
+  debug_line:
+- Length:  42
+  Version: 2
+  PrologueLength:  36
+  MinInstLength:   1
+  DefaultIsStmt:   1
+  LineBase:251
+  LineRange:   14
+  OpcodeBase:  13
+  StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
+  IncludeDirs:
+- '/tmp'
+  Files:
+- Name:main.cpp
+  DirIdx:  1
+  ModTime: 0
+

[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)

2025-05-30 Thread via lldb-commits

royitaqi wrote:

Thanks for the great discussion, @JDevlieghere and @labath. I appreciate it and 
am learning a lot by reading through it.

Re. CMakery and document, sorry that I cannot promise to do this by a timeline, 
because as a CMake noob I will probably need to learn about it first before I 
can understand what exactly needs to be done. With that said, will keep this in 
my mind and learn towards it when I have a chance.

--

Also thanks to @labath for the suggestion about using `Triple` of the 
`ObjectFile`. I have updated the code accordingly.

However, I am having difficulty making a test that I'm adding to pass (see 
`CreateInstanceReturnNonNullForMachOFile` in this patch). See my inline 
comments (that I will add in a second).

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


[Lldb-commits] [lldb] [lldb][lldb-dap] Use the default disassembly flavour if none is provided. (PR #141424)

2025-05-30 Thread Ebuka Ezike via lldb-commits

da-viper wrote:

@JDevlieghere  sorry about that,  I did assume since it was small. will wait 
for the approval hence forth. 

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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Fabrice de Gans via lldb-commits

https://github.com/Steelskin created 
https://github.com/llvm/llvm-project/pull/142183

The Swift Windows toolchain uses its own static build of libxml 2, which is 
more recent than 2.8, resulting in the provided libxml 2 to be rejected. This 
change allows to specify a custom version for libxml 2, while defaulting to 2.8.

>From c517ba1aa6c17de47c125468c047366117a9989a Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 09:27:54 -0700
Subject: [PATCH] [lldb] Add build option to specify the libxml 2 version

The Swift Windows toolchain uses its own static build of libxml 2, which
is more recent than 2.8, resulting in the provided libxml 2 to be
rejected. This change allows to specify a custom version for libxml 2,
while defaulting to 2.8.
---
 lldb/cmake/modules/LLDBConfig.cmake | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index cfd626c9358a1..f25ad1333468c 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,13 +51,15 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
+option(LLDB_LIBXML2_VERSION "Sepcify the version of libxml 2 to use with LLDB" 
"2.8")
+
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)
 add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" 
CursesAndPanel CURSESANDPANEL_FOUND)
 add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in 
LLDB" LibLZMA LIBLZMA_FOUND)
 add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" 
LuaAndSwig LUAANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
-add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
+add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION ${LLDB_LIBXML2_VERSION})
 add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support 
in LLDB" FBSDVMCore FBSDVMCore_FOUND QUIET)
 
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)

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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Fabrice de Gans (Steelskin)


Changes

The Swift Windows toolchain uses its own static build of libxml 2, which is 
more recent than 2.8, resulting in the provided libxml 2 to be rejected. This 
change allows to specify a custom version for libxml 2, while defaulting to 2.8.

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


1 Files Affected:

- (modified) lldb/cmake/modules/LLDBConfig.cmake (+3-1) 


``diff
diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index cfd626c9358a1..f25ad1333468c 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,13 +51,15 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
+option(LLDB_LIBXML2_VERSION "Sepcify the version of libxml 2 to use with LLDB" 
"2.8")
+
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)
 add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" 
CursesAndPanel CURSESANDPANEL_FOUND)
 add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in 
LLDB" LibLZMA LIBLZMA_FOUND)
 add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" 
LuaAndSwig LUAANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
-add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
+add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION ${LLDB_LIBXML2_VERSION})
 add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support 
in LLDB" FBSDVMCore FBSDVMCore_FOUND QUIET)
 
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)

``




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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Fabrice de Gans via lldb-commits

Steelskin wrote:

This is how the version file is configured in libxml2: 
https://github.com/GNOME/libxml2/blob/0740a367a570c40246fe8077c2d172b63693f105/CMakeLists.txt#L596
```cmake
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY ExactVersion
)
```

The problem is the `COMPATIBILITY ExactVersion` part. I have been told there 
are also ABI incompatibilities with different libxml 2 versions for the Swift 
build but I am not familiar with the details.

https://github.com/llvm/llvm-project/pull/142183
___
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] Avoid unnecessary copy in setBreakpoint (PR #142179)

2025-05-30 Thread Ebuka Ezike via lldb-commits

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

None

>From 68b17403353418674681a79e1d41fa57ae848db2 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Fri, 30 May 2025 16:56:18 +0100
Subject: [PATCH] [NFC][lldb-dap] remove unnecessary copy.

---
 lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
index 0ff88f62f8f51..5d336af740c99 100644
--- a/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
@@ -7,8 +7,6 @@
 
//===--===//
 
 #include "DAP.h"
-#include "EventHelper.h"
-#include "JSONUtils.h"
 #include "Protocol/ProtocolRequests.h"
 #include "RequestHandler.h"
 #include 
@@ -22,7 +20,7 @@ namespace lldb_dap {
 llvm::Expected
 SetBreakpointsRequestHandler::Run(
 const protocol::SetBreakpointsArguments &args) const {
-  const auto response_breakpoints =
+  std::vector response_breakpoints =
   dap.SetSourceBreakpoints(args.source, args.breakpoints);
   return protocol::SetBreakpointsResponseBody{std::move(response_breakpoints)};
 }

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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Fabrice de Gans via lldb-commits

https://github.com/Steelskin updated 
https://github.com/llvm/llvm-project/pull/142183

>From c517ba1aa6c17de47c125468c047366117a9989a Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 09:27:54 -0700
Subject: [PATCH 1/2] [lldb] Add build option to specify the libxml 2 version

The Swift Windows toolchain uses its own static build of libxml 2, which
is more recent than 2.8, resulting in the provided libxml 2 to be
rejected. This change allows to specify a custom version for libxml 2,
while defaulting to 2.8.
---
 lldb/cmake/modules/LLDBConfig.cmake | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index cfd626c9358a1..f25ad1333468c 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,13 +51,15 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
+option(LLDB_LIBXML2_VERSION "Sepcify the version of libxml 2 to use with LLDB" 
"2.8")
+
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)
 add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" 
CursesAndPanel CURSESANDPANEL_FOUND)
 add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in 
LLDB" LibLZMA LIBLZMA_FOUND)
 add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" 
LuaAndSwig LUAANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
-add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
+add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION ${LLDB_LIBXML2_VERSION})
 add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support 
in LLDB" FBSDVMCore FBSDVMCore_FOUND QUIET)
 
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)

>From 95aa2490f58d68e19aa59a275aad0b2a5c0ebe68 Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 10:13:36 -0700
Subject: [PATCH 2/2] Fix string option setting

---
 lldb/cmake/modules/LLDBConfig.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index f25ad1333468c..c73815a3eb970 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,7 +51,7 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
-option(LLDB_LIBXML2_VERSION "Sepcify the version of libxml 2 to use with LLDB" 
"2.8")
+set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING "Sepcify the version of libxml 2 
to use with LLDB")
 
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)

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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Could the problem be that the statically linked libxml2 is reporting the wrong 
version or something? We don't pass the `EXACT` flag, which means that CMake 
will find a version that "is compatible" [1]. The latter is intentionally vague 
and I couldn't immediately find the corresponding logic for libxml2. However, 
on my linux machine, CMake happily picks up libxml 2.12.7 with the existing 
logic. 

[1] 
https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-version-selection

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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Alex Langford via lldb-commits


@@ -51,13 +51,18 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
+set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING
+  "Sepcify the version of libxml 2 to use with LLDB. This is only meant to be 
overridden for local

bulbazord wrote:

typo: `Sepcify` -> `Specify`.

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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Fabrice de Gans via lldb-commits

https://github.com/Steelskin updated 
https://github.com/llvm/llvm-project/pull/142183

>From c517ba1aa6c17de47c125468c047366117a9989a Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 09:27:54 -0700
Subject: [PATCH 1/4] [lldb] Add build option to specify the libxml 2 version

The Swift Windows toolchain uses its own static build of libxml 2, which
is more recent than 2.8, resulting in the provided libxml 2 to be
rejected. This change allows to specify a custom version for libxml 2,
while defaulting to 2.8.
---
 lldb/cmake/modules/LLDBConfig.cmake | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index cfd626c9358a1..f25ad1333468c 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,13 +51,15 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
+option(LLDB_LIBXML2_VERSION "Sepcify the version of libxml 2 to use with LLDB" 
"2.8")
+
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)
 add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" 
CursesAndPanel CURSESANDPANEL_FOUND)
 add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in 
LLDB" LibLZMA LIBLZMA_FOUND)
 add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" 
LuaAndSwig LUAANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
-add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
+add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION ${LLDB_LIBXML2_VERSION})
 add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support 
in LLDB" FBSDVMCore FBSDVMCore_FOUND QUIET)
 
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)

>From 95aa2490f58d68e19aa59a275aad0b2a5c0ebe68 Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 10:13:36 -0700
Subject: [PATCH 2/4] Fix string option setting

---
 lldb/cmake/modules/LLDBConfig.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index f25ad1333468c..c73815a3eb970 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,7 +51,7 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
-option(LLDB_LIBXML2_VERSION "Sepcify the version of libxml 2 to use with LLDB" 
"2.8")
+set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING "Sepcify the version of libxml 2 
to use with LLDB")
 
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)

>From ef27a1f1b00474881194b642ee6586531184 Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 11:07:52 -0700
Subject: [PATCH 3/4] Clarify comment and mark variable as advanced

---
 lldb/cmake/modules/LLDBConfig.cmake | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index c73815a3eb970..e8a80292c37db 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -51,7 +51,10 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
-set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING "Sepcify the version of libxml 2 
to use with LLDB")
+set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING
+  "Sepcify the version of libxml 2 to use with LLDB. This is only meant to be 
overridden for local
+  static builds of libxml 2. Use at your own risk.")
+mark_as_advanced(LLDB_LIBXML2_VERSION)
 
 add_optional_dependency(LLDB_ENABLE_SWIG "Enable SWIG to generate LLDB 
bindings" SWIG SWIG_FOUND VERSION 4)
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" 
LibEdit LibEdit_FOUND)

>From d51be3e18093117c04094f175de2d42c3097d86b Mon Sep 17 00:00:00 2001
From: Fabrice de Gans 
Date: Fri, 30 May 2025 11:16:38 -0700
Subject: [PATCH 4/4] fix typo

---
 lldb/cmake/modules/LLDBConfig.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index e8a80292c37db..37b823feb584b 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -52,7 +52,7 @@ macro(add_optional_depe

[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Fabrice de Gans via lldb-commits


@@ -51,13 +51,18 @@ macro(add_optional_dependency variable description package 
found)
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
+set(LLDB_LIBXML2_VERSION "2.8" CACHE STRING
+  "Sepcify the version of libxml 2 to use with LLDB. This is only meant to be 
overridden for local

Steelskin wrote:

Doh, fixed.

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


[Lldb-commits] [lldb] [lldb] Disable TestReverseContinueBreakpoints.py and TestReverseContinueWatchpoints.py for Windows x86_64 (PR #142193)

2025-05-30 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/142193

See #138084 for details.

>From 72e166aa5f1d851cfd0cc972e761536eed14679a Mon Sep 17 00:00:00 2001
From: Dmitry Vassiliev 
Date: Fri, 30 May 2025 22:19:28 +0400
Subject: [PATCH] [lldb] Disable TestReverseContinueBreakpoints.py and
 TestReverseContinueWatchpoints.py for Windows x86_64

See #138084 for details.
---
 .../TestReverseContinueBreakpoints.py  | 10 ++
 .../TestReverseContinueWatchpoints.py  | 10 ++
 2 files changed, 20 insertions(+)

diff --git 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
index 0a5f2d88fb917..53c8cdd4540a2 100644
--- 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
+++ 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
@@ -63,10 +63,20 @@ def reverse_continue_breakpoint_internal(self, async_mode):
 self.assertEqual(threads_now, initial_threads)
 
 @skipIfRemote
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_breakpoint(self):
 self.reverse_continue_skip_breakpoint_internal(async_mode=False)
 
 @skipIfRemote
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_breakpoint_async(self):
 self.reverse_continue_skip_breakpoint_internal(async_mode=True)
 
diff --git 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
index a9e1bec5750e7..38cf5fced4944 100644
--- 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
+++ 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
@@ -64,12 +64,22 @@ def reverse_continue_watchpoint_internal(self, async_mode):
 @skipIfRemote
 # Watchpoints don't work in single-step mode
 @skipIf(macos_version=["<", "15.0"], archs=["arm64"])
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_watchpoint(self):
 self.reverse_continue_skip_watchpoint_internal(async_mode=False)
 
 @skipIfRemote
 # Watchpoints don't work in single-step mode
 @skipIf(macos_version=["<", "15.0"], archs=["arm64"])
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_watchpoint_async(self):
 self.reverse_continue_skip_watchpoint_internal(async_mode=True)
 

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


[Lldb-commits] [lldb] [lldb] Disable TestReverseContinueBreakpoints.py and TestReverseContinueWatchpoints.py for Windows x86_64 (PR #142193)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dmitry Vasilyev (slydiman)


Changes

See #138084 for details.

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


2 Files Affected:

- (modified) 
lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
 (+10) 
- (modified) 
lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
 (+10) 


``diff
diff --git 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
index 0a5f2d88fb917..53c8cdd4540a2 100644
--- 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
+++ 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
@@ -63,10 +63,20 @@ def reverse_continue_breakpoint_internal(self, async_mode):
 self.assertEqual(threads_now, initial_threads)
 
 @skipIfRemote
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_breakpoint(self):
 self.reverse_continue_skip_breakpoint_internal(async_mode=False)
 
 @skipIfRemote
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_breakpoint_async(self):
 self.reverse_continue_skip_breakpoint_internal(async_mode=True)
 
diff --git 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
index a9e1bec5750e7..38cf5fced4944 100644
--- 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
+++ 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
@@ -64,12 +64,22 @@ def reverse_continue_watchpoint_internal(self, async_mode):
 @skipIfRemote
 # Watchpoints don't work in single-step mode
 @skipIf(macos_version=["<", "15.0"], archs=["arm64"])
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_watchpoint(self):
 self.reverse_continue_skip_watchpoint_internal(async_mode=False)
 
 @skipIfRemote
 # Watchpoints don't work in single-step mode
 @skipIf(macos_version=["<", "15.0"], archs=["arm64"])
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_watchpoint_async(self):
 self.reverse_continue_skip_watchpoint_internal(async_mode=True)
 

``




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


[Lldb-commits] [lldb] [lldb] Disable TestReverseContinueBreakpoints.py and TestReverseContinueWatchpoints.py for Windows x86_64 (PR #142193)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-platform-windows

Author: Dmitry Vasilyev (slydiman)


Changes

See #138084 for details.

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


2 Files Affected:

- (modified) 
lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
 (+10) 
- (modified) 
lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
 (+10) 


``diff
diff --git 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
index 0a5f2d88fb917..53c8cdd4540a2 100644
--- 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
+++ 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
@@ -63,10 +63,20 @@ def reverse_continue_breakpoint_internal(self, async_mode):
 self.assertEqual(threads_now, initial_threads)
 
 @skipIfRemote
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_breakpoint(self):
 self.reverse_continue_skip_breakpoint_internal(async_mode=False)
 
 @skipIfRemote
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_breakpoint_async(self):
 self.reverse_continue_skip_breakpoint_internal(async_mode=True)
 
diff --git 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
index a9e1bec5750e7..38cf5fced4944 100644
--- 
a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
+++ 
b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
@@ -64,12 +64,22 @@ def reverse_continue_watchpoint_internal(self, async_mode):
 @skipIfRemote
 # Watchpoints don't work in single-step mode
 @skipIf(macos_version=["<", "15.0"], archs=["arm64"])
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_watchpoint(self):
 self.reverse_continue_skip_watchpoint_internal(async_mode=False)
 
 @skipIfRemote
 # Watchpoints don't work in single-step mode
 @skipIf(macos_version=["<", "15.0"], archs=["arm64"])
+@skipIf(
+oslist=["windows"],
+archs=["x86_64"],
+bugnumber="github.com/llvm/llvm-project/issues/138084",
+)
 def test_reverse_continue_skip_watchpoint_async(self):
 self.reverse_continue_skip_watchpoint_internal(async_mode=True)
 

``




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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Fabrice de Gans via lldb-commits

Steelskin wrote:

> Ack. My apt package doesn't install `libxml2-config-version.cmake` so I 
> assume CMake is falling back on some standard logic for finding it and that 
> would explain why CMake is happy to use 2.12 on my system.
> 
> That said, it seems like this is done intentionally, and this is working 
> around that (e.g. the ABI incompatibility you mentioned). That might be fine 
> for how we use `libxml2` in lldb but let's make it clear that folks are doing 
> this at their own risk. Can you update the description or add a comment with 
> something along those lines?

I updated the comment and marked the new cache variable as advanced.

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


[Lldb-commits] [lldb] [lldb][headers] Create Python script to fix up framework headers (PR #142051)

2025-05-30 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Add build option to specify the libxml 2 version (PR #142183)

2025-05-30 Thread Jonas Devlieghere via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb-dap][test] Fix DAP disassemble test (PR #142129)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)


Changes

compare the instructions before and after setting breakpoint to make sure they 
are the same. 
Do not use the source location as it is not guaranteed to exist.

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


1 Files Affected:

- (modified) lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py 
(+22-14) 


``diff
diff --git a/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py 
b/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
index a8b51864d118b..da7a337de5ea6 100644
--- a/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
+++ b/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
@@ -2,13 +2,9 @@
 Test lldb-dap disassemble request
 """
 
-
-import dap_server
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
+from lldbsuite.test.decorators import skipIfWindows
+from lldbsuite.test.lldbtest import line_number
 import lldbdap_testcase
-import os
 
 
 class TestDAP_disassemble(lldbdap_testcase.DAPTestCaseBase):
@@ -23,15 +19,23 @@ def test_disassemble(self):
 self.set_source_breakpoints(source, [line_number(source, "// 
breakpoint 1")])
 self.continue_to_next_stop()
 
-_, pc_assembly = self.disassemble(frameIndex=0)
-self.assertIn("location", pc_assembly, "Source location missing.")
-self.assertIn("instruction", pc_assembly, "Assembly instruction 
missing.")
+insts_with_bp, pc_with_bp_assembly = self.disassemble(frameIndex=0)
+no_bp = self.set_source_breakpoints(source, [])
+self.assertEqual(len(no_bp), 0, "expect no breakpoints.")
+self.assertIn(
+"instruction", pc_with_bp_assembly, "Assembly instruction missing."
+)
 
-# The calling frame (qsort) is coming from a system library, as a 
result
-# we should not have a source location.
-_, qsort_assembly = self.disassemble(frameIndex=1)
-self.assertNotIn("location", qsort_assembly, "Source location not 
expected.")
-self.assertIn("instruction", pc_assembly, "Assembly instruction 
missing.")
+# the disassembly instructions should be the same even if there is a 
breakpoint;
+insts_no_bp, pc_no_bp_assembly = self.disassemble(frameIndex=0)
+self.assertDictEqual(
+insts_with_bp,
+insts_no_bp,
+"Expects instructions are the same after removing breakpoints.",
+)
+self.assertIn("instruction", pc_no_bp_assembly, "Assembly instruction 
missing.")
+
+self.continue_to_exit()
 
 @skipIfWindows
 def test_disassemble_backwards(self):
@@ -74,3 +78,7 @@ def test_disassemble_backwards(self):
 backwards_instructions,
 f"requested instruction should be preceeded by 
{backwards_instructions} instructions. Actual index: {frame_instruction_index}",
 )
+
+# clear breakpoints
+self.set_source_breakpoints(source, [])
+self.continue_to_exit()

``




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


[Lldb-commits] [lldb] af163a1 - [lldb][lldb-dap] Use the default disassembly flavour if none is provided. (#141424)

2025-05-30 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-05-30T13:13:42+01:00
New Revision: af163a1c7f9d9c24521460a24b1d41a9b4b75ce8

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

LOG: [lldb][lldb-dap] Use the default disassembly flavour if none is provided. 
(#141424)

This is the currently the default for
`SBTarget::ReadInstructions(SBAddress, uint32_t)`. But not for others,
to make it consistent used the user assigned instruction flavour.

Added: 


Modified: 
lldb/source/API/SBTarget.cpp
lldb/source/Commands/CommandObjectDisassemble.cpp
lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp

Removed: 




diff  --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 813e8f2c6ec00..545ffcf5e44e6 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1960,7 +1960,17 @@ lldb::SBInstructionList 
SBTarget::ReadInstructions(lldb::SBAddress base_addr,
   const size_t bytes_read =
   target_sp->ReadMemory(*addr_ptr, data.GetBytes(), data.GetByteSize(),
 error, force_live_memory, &load_addr);
+
   const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
+  if (!flavor_string || flavor_string[0] == '\0') {
+// FIXME - we don't have the mechanism in place to do per-architecture
+// settings.  But since we know that for now we only support flavors on
+// x86 & x86_64,
+const llvm::Triple::ArchType arch =
+target_sp->GetArchitecture().GetTriple().getArch();
+if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
+  flavor_string = target_sp->GetDisassemblyFlavor();
+  }
   sb_instructions.SetDisassembler(Disassembler::DisassembleBytes(
   target_sp->GetArchitecture(), nullptr, flavor_string,
   target_sp->GetDisassemblyCPU(), target_sp->GetDisassemblyFeatures(),
@@ -2017,7 +2027,16 @@ SBTarget::GetInstructionsWithFlavor(lldb::SBAddress 
base_addr,
 if (base_addr.get())
   addr = *base_addr.get();
 
-const bool data_from_file = true;
+constexpr bool data_from_file = true;
+if (!flavor_string || flavor_string[0] == '\0') {
+  // FIXME - we don't have the mechanism in place to do per-architecture
+  // settings.  But since we know that for now we only support flavors on
+  // x86 & x86_64,
+  const llvm::Triple::ArchType arch =
+  target_sp->GetArchitecture().GetTriple().getArch();
+  if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
+flavor_string = target_sp->GetDisassemblyFlavor();
+}
 
 sb_instructions.SetDisassembler(Disassembler::DisassembleBytes(
 target_sp->GetArchitecture(), nullptr, flavor_string,

diff  --git a/lldb/source/Commands/CommandObjectDisassemble.cpp 
b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 5774effb9e9ba..70e687e19ac6d 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -190,7 +190,6 @@ void 
CommandObjectDisassemble::CommandOptions::OptionParsingStarting(
 // architecture.  For now GetDisassemblyFlavor is really only valid for x86
 // (and for the llvm assembler plugin, but I'm papering over that since 
that
 // is the only disassembler plugin we have...
-// This logic is duplicated in `Handler/DisassembleRequestHandler`.
 if (target->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86 ||
 target->GetArchitecture().GetTriple().getArch() ==
 llvm::Triple::x86_64) {

diff  --git a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
index 1d110eac18126..b3da869d18d68 100644
--- a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
@@ -193,21 +193,6 @@ DisassembleRequestHandler::Run(const DisassembleArguments 
&args) const {
 return llvm::make_error(
 "Memory reference not found in the current binary.");
 
-  std::string flavor_string;
-  const auto target_triple = llvm::StringRef(dap.target.GetTriple());
-  // This handles both 32 and 64bit x86 architecture. The logic is duplicated 
in
-  // `CommandObjectDisassemble::CommandOptions::OptionParsingStarting`
-  if (target_triple.starts_with("x86")) {
-const lldb::SBStructuredData flavor =
-dap.debugger.GetSetting("target.x86-disassembly-flavor");
-
-const size_t str_length = flavor.GetStringValue(nullptr, 0);
-if (str_length != 0) {
-  flavor_string.resize(str_length + 1);
-  flavor.GetStringValue(flavor_string.data(), flavor_string.length());
-}
-  }
-
   // Offset (in instructions) to be applied after the byte offset (if any)
   // before disassem

[Lldb-commits] [lldb] [LLDB] Remove redundant check in DemangledNameInfo::hasBasename (PR #142139)

2025-05-30 Thread Charles Zablit via lldb-commits

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

This patch removes a redundant check in DemangledNameInfo::hasBasename.

Since the start and end range are unsigned, if end > start, then end is always 
greater than 0.

>From 738d0058769811d6f760f0a351a43ac1ab984336 Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Fri, 30 May 2025 14:40:57 +0200
Subject: [PATCH] remove redundant check in DemangledNameInfo::hasBasename

---
 lldb/include/lldb/Core/DemangledNameInfo.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lldb/include/lldb/Core/DemangledNameInfo.h 
b/lldb/include/lldb/Core/DemangledNameInfo.h
index ab9bb3e211b66..4b5ba5e42b3b1 100644
--- a/lldb/include/lldb/Core/DemangledNameInfo.h
+++ b/lldb/include/lldb/Core/DemangledNameInfo.h
@@ -71,8 +71,7 @@ struct DemangledNameInfo {
 
   /// Returns \c true if this object holds a valid basename range.
   bool hasBasename() const {
-return BasenameRange.second > BasenameRange.first &&
-   BasenameRange.second > 0;
+return BasenameRange.second > BasenameRange.first;
   }
 };
 

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


[Lldb-commits] [lldb] [LLDB] Remove redundant check in DemangledNameInfo::hasBasename (PR #142139)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)


Changes

This patch removes a redundant check in DemangledNameInfo::hasBasename.

Since the start and end range are unsigned, if end > start, then end is 
always greater than 0.

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


1 Files Affected:

- (modified) lldb/include/lldb/Core/DemangledNameInfo.h (+1-2) 


``diff
diff --git a/lldb/include/lldb/Core/DemangledNameInfo.h 
b/lldb/include/lldb/Core/DemangledNameInfo.h
index ab9bb3e211b66..4b5ba5e42b3b1 100644
--- a/lldb/include/lldb/Core/DemangledNameInfo.h
+++ b/lldb/include/lldb/Core/DemangledNameInfo.h
@@ -71,8 +71,7 @@ struct DemangledNameInfo {
 
   /// Returns \c true if this object holds a valid basename range.
   bool hasBasename() const {
-return BasenameRange.second > BasenameRange.first &&
-   BasenameRange.second > 0;
+return BasenameRange.second > BasenameRange.first;
   }
 };
 

``




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


[Lldb-commits] [lldb] [lldb][lldb-dap] Support breakpoint info bytes (PR #141122)

2025-05-30 Thread Ebuka Ezike via lldb-commits

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

>From 9408d17b1acf308c7a299bdc6c413a3505d1a039 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 21 May 2025 23:26:14 +0100
Subject: [PATCH 01/10] [lldb][lldb-dap] support DataBreakpointBytes capability

---
 .../DataBreakpointInfoRequestHandler.cpp  | 48 ++-
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |  3 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  2 +-
 3 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
index 8cb25d0603449..9b969560d7973 100644
--- a/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
@@ -7,7 +7,6 @@
 
//===--===//
 
 #include "DAP.h"
-#include "EventHelper.h"
 #include "Protocol/ProtocolTypes.h"
 #include "RequestHandler.h"
 #include "lldb/API/SBMemoryRegionInfo.h"
@@ -16,12 +15,59 @@
 
 namespace lldb_dap {
 
+static llvm::Expected
+HandleDataBreakpointBytes(DAP &dap,
+  const protocol::DataBreakpointInfoArguments &args) {
+  llvm::StringRef address = args.name;
+
+  unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+  if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+return llvm::make_error(llvm::formatv("invalid address"),
+  llvm::inconvertibleErrorCode(), false);
+  }
+
+  lldb::SBAddress sb_addr(load_addr, dap.target);
+  if (!sb_addr.IsValid()) {
+return llvm::make_error(
+llvm::formatv("address {:x} does not exist in the debuggee", 
load_addr),
+llvm::inconvertibleErrorCode(), false);
+  }
+
+  const uint32_t byte_size =
+  args.bytes.value_or(dap.target.GetAddressByteSize());
+
+  protocol::DataBreakpointInfoResponseBody response;
+  response.dataId = llvm::formatv("{:x}/{}", load_addr, byte_size);
+
+  lldb::SBMemoryRegionInfo region;
+  lldb::SBError err =
+  dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
+  // Only lldb-server supports "qMemoryRegionInfo". So, don't fail this
+  // request if SBProcess::GetMemoryRegionInfo returns error.
+  if (err.Success() && !(region.IsReadable() || region.IsWritable())) {
+response.description = llvm::formatv(
+"memory region for address {} has no read or write permissions",
+load_addr);
+  } else {
+response.description = llvm::formatv("{} bytes at {:x}", load_addr);
+response.accessTypes = {protocol::eDataBreakpointAccessTypeRead,
+protocol::eDataBreakpointAccessTypeWrite,
+protocol::eDataBreakpointAccessTypeReadWrite};
+  }
+
+  return response;
+}
+
 /// Obtains information on a possible data breakpoint that could be set on an
 /// expression or variable. Clients should only call this request if the
 /// corresponding capability supportsDataBreakpoints is true.
 llvm::Expected
 DataBreakpointInfoRequestHandler::Run(
 const protocol::DataBreakpointInfoArguments &args) const {
+
+  if (args.asAddress.value_or(false))
+return HandleDataBreakpointBytes(dap, args);
+
   protocol::DataBreakpointInfoResponseBody response;
   lldb::SBFrame frame = dap.GetLLDBFrame(args.frameId.value_or(UINT64_MAX));
   lldb::SBValue variable = dap.variables.FindVariable(
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 3a965bcc87a5e..dec68683fee65 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -420,6 +420,9 @@ class DataBreakpointInfoRequestHandler
 public:
   using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "dataBreakpointInfo"; }
+  FeatureSet GetSupportedFeatures() const override {
+return {protocol::eAdapterFeatureDataBreakpointBytes};
+  }
   llvm::Expected
   Run(const protocol::DataBreakpointInfoArguments &args) const override;
 };
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index 7c774e50d6e56..cde441351fc88 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -668,7 +668,7 @@ struct DataBreakpointInfoArguments {
   /// pause on data access anywhere within that range.
   /// Clients may set this property only if the `supportsDataBreakpointBytes`
   /// capability is true.
-  std::optional bytes;
+  std::optional bytes;
 
   /// If `true`, the `name` is a memory address and the debugger should
   /// interpret it as a decimal value, or hex value if it is prefixed with 
`0x`.

>From e407716994a4ed0b054984c21a4824a06adebd7a Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Thu, 22 May 2025 15:18:57 +0100
Subject: [PATCH 02/10] [l

[Lldb-commits] [lldb] 7a66b28 - [lldb][test] Disable DeclFromSubmodule test on Windows

2025-05-30 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2025-05-30T14:15:19Z
New Revision: 7a66b28fcafdb7546aedeca1271e66438ad04127

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

LOG: [lldb][test] Disable DeclFromSubmodule test on Windows

Or more precisely, when linking with link.exe, but Windows
is our closest proxy for that right now.

This test requires the DWARF info to work, on the Windows on Arm
buildbot it fails:
```
AssertionError: Ran command:
"expr func(1, 2)"

Got output:
error: :1:1: use of undeclared identifier 'func'

1 | func(1, 2)

  | ^~~~

Expecting start string: "error: :1:1: 'func' has unknown 
return type" (was not found)
```

Added: 


Modified: 
lldb/test/API/lang/cpp/decl-from-submodule/TestDeclFromSubmodule.py

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/decl-from-submodule/TestDeclFromSubmodule.py 
b/lldb/test/API/lang/cpp/decl-from-submodule/TestDeclFromSubmodule.py
index 2819e59b1a1e5..f200e51c7f794 100644
--- a/lldb/test/API/lang/cpp/decl-from-submodule/TestDeclFromSubmodule.py
+++ b/lldb/test/API/lang/cpp/decl-from-submodule/TestDeclFromSubmodule.py
@@ -9,6 +9,8 @@
 
 
 class DeclFromSubmoduleTestCase(TestBase):
+# Requires DWARF debug info which is not retained when linking with 
link.exe.
+@skipIfWindows
 def test_expr(self):
 self.build()
 lldbutil.run_to_source_breakpoint(self, "return 0", 
lldb.SBFileSpec("main.cpp"))



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


[Lldb-commits] [lldb] [lldb][SymbolFileDWARF] Fall back to using parent DW_AT_LLVM_include_path for submodules (PR #142044)

2025-05-30 Thread David Spickett via lldb-commits

DavidSpickett wrote:

This test was failing on Windows I think because like many others, we're not 
making DWARF or we're not retaining it when linking with link.exe. I've skipped 
it there - 
https://github.com/llvm/llvm-project/commit/7a66b28fcafdb7546aedeca1271e66438ad04127.

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


[Lldb-commits] [lldb] [lldb] Fix Linux core file tests hanging on Windows (PR #142143)

2025-05-30 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix Linux core file tests hanging on Windows (PR #142143)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

After https://github.com/llvm/llvm-project/pull/141670, TestLinuxCore.py was 
timing out on our Windows on Arm bot.

Non-Linux core files were ok, as were Linux core files unless it was ppc64le, 
riscv64 or loongarch.

I eventually noticed that it was attempting to create PlatformLinux many times 
before trying PlatformAndroid, PlatformMac etc., which it should never need to 
do.

The tests passed on a Linux host too, to add to the mystery.

Turns out, all I needed to do was mark those architectures as supported in the 
PlatformLinux constructor. If they're not listed there we get stuck here:
```
// Wait for a stopped event since we just posted one above...
printf("waiting for process to stop...\n");
lldb::EventSP event_sp;
StateType state =
WaitForProcessToStop(std::nullopt, &event_sp, true, listener_sp,
 nullptr, true, SelectMostRelevantFrame);
printf("process stopped\n");
```
Waiting for a stop event that never comes, because it appears we try to treat 
the core as a real process?
```
 DynamicLoaderPOSIXDYLD::virtual DynamicLoaderPOSIXDYLD::DidAttach pid 28147 
executable '', load_offset 0x
<...>
 Process::ShouldBroadcastEvent (02ABC43FF4A0) Restarting process from 
state: stopped
 Process::PrivateResume() m_stop_id = 1, public state: unloaded private state: 
stopped
 Process::PrivateResume() got an error "error: elf-core does not support 
resuming processes".
 Process::ShouldBroadcastEvent (02ABC43FF4A0) => new state: stopped, 
last broadcast state: invalid - NO
```
Some actionable feedback here would be nice, but all I care about for now is 
that the tests run again.

I have not added riscv32 as that appears to only be supported for Darwin at the 
moment (I expect someone will get burned by this when it is).

I think debug on these architectures worked if they were also the host arch, if 
someone tried to remote debug them, I think it would have failed.

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


1 Files Affected:

- (modified) lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp (+3-1) 


``diff
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp 
b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index dd6490c7141e5..269105208a87a 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -138,7 +138,9 @@ PlatformLinux::PlatformLinux(bool is_host)
 {llvm::Triple::x86_64, llvm::Triple::x86, llvm::Triple::arm,
  llvm::Triple::aarch64, llvm::Triple::mips64, llvm::Triple::mips64,
  llvm::Triple::hexagon, llvm::Triple::mips, llvm::Triple::mips64el,
- llvm::Triple::mipsel, llvm::Triple::msp430, llvm::Triple::systemz},
+ llvm::Triple::mipsel, llvm::Triple::msp430, llvm::Triple::systemz,
+ llvm::Triple::loongarch64, llvm::Triple::ppc64le,
+ llvm::Triple::riscv64},
 llvm::Triple::Linux);
   }
 }

``




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


[Lldb-commits] [lldb] [LLDB][Platform Linux] Flip uid and pid in get signal description (PR #142200)

2025-05-30 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond updated 
https://github.com/llvm/llvm-project/pull/142200

>From 05f09fa434c7fa925935337fb44740f1beba52ba Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Fri, 30 May 2025 12:02:02 -0700
Subject: [PATCH 1/2] Flip and add test

---
 .../Plugins/Platform/Linux/PlatformLinux.cpp |   2 +-
 lldb/test/Shell/Register/Core/Inputs/tkill.cpp   |  10 ++
 .../Register/Core/Inputs/x86-64-linux-tkill.core | Bin 0 -> 8048 bytes
 .../Shell/Register/Core/x86-64-linux-tkill.test  |   6 ++
 4 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 lldb/test/Shell/Register/Core/Inputs/tkill.cpp
 create mode 100644 lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core
 create mode 100644 lldb/test/Shell/Register/Core/x86-64-linux-tkill.test

diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp 
b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index cb60caf1cb422..d5e35e392d66f 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -564,7 +564,7 @@ static std::string 
GetDescriptionFromSiginfo(lldb::ValueObjectSP siginfo_sp) {
   }
 
   return linux_signals.GetSignalDescription(signo, code, addr, lower, upper,
-uid, pid);
+pid, uid);
 }
 
 lldb::StopInfoSP PlatformLinux::GetStopInfoFromSiginfo(Thread &thread) {
diff --git a/lldb/test/Shell/Register/Core/Inputs/tkill.cpp 
b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
new file mode 100644
index 0..677bd3e6cf493
--- /dev/null
+++ b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
@@ -0,0 +1,10 @@
+#include 
+#include 
+
+int main() {
+  // Get the current thread ID
+  pid_t tid = syscall(SYS_gettid);
+  // Send a SIGSEGV signal to the current thread
+  syscall(SYS_tkill, tid, SIGSEGV);
+  return 0;
+}
diff --git a/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core 
b/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core
new file mode 100644
index 
..3d1a05a34e7ca001108fd3c45c6f68ba5d379a9a
GIT binary patch
literal 8048
zcmeHMO=w(I6h4iywfNKN!nXdPPf&@3%uHg8?Lv9Bq;X)-N7_hTO(vP3(J>h^6Dfk`
z2`(xkOqUjfSa7KhXrb=nP8Y&JH@eGCbfH0TQ47ZV^L@|vZr?DS(wb7{Lf(1j-22^g
z?zw;8o2*S1j}PqHB`kyTy!@w$_^gOYUk=L<^g-J9@+B#22a-D5Yaiy_Lw&IP?b(@R
zTcc%QgVeY?waL>DRc5apm+)7+PF(2VocJUb=WZQeUO!Z6_K5QhN@U%|4cLkdrB$PR
z2C$3&
z^MIptaV_9l4z3LxWejKH4DYZFf|X>PfJq9@jF>pDo{p0}wuessym!)Z8y)gVf17Jb
z9QtSeDfN0W>$8dRZCyLg%?!pT04eW0_WpF1vjr4*j-QD(a0nrEI*pSgmH4R~x34NUlZqp0;?g~Brvnq*`#lmsU!6R(MWb>QF{RW|qZw&4Ofi9ul-;A9)zY!vP6Wo8@
zO3s=3Dzj&|%hjoai`!kUf+jZy*Z!0Nk$Zzn|3y1=X<4p(nRaqum(x-QXXV@qIV?Eo
zyUZUsDmdp)v_~A&a>}1+C&zR-BXw}XPuQLu5uERH#!n6iPIr)rCdUJ3dz^N1DwiWs
z2M3Dgg`5Z+=YGaR&I1l}h<0)sa1^d_?lE!icIvph8K&?q$KCuC`{!Ma`(>PV=px^k
zbujO*uow!WO55OuBGWaC?Dj&6pr-l)tE4;ydUe0J=J
zGq#SE!gnNv#duZi1hb^OxfHa_2D``as9H()dw
z`z1AKzGQDefBi1{8R#Jcxh|!LuCA+Tw{L@Pop$@xrW-!~tB#y_ak5x^E;qNhl$$Hp
YUsuGZ*bU#W?`L2qGjMWd#{75tU*eM_V*mgE

literal 0
HcmV?d1

diff --git a/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test 
b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
new file mode 100644
index 0..240b1e9f8b2d6
--- /dev/null
+++ b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
@@ -0,0 +1,6 @@
+# XFAIL: system-darwin
+# XFAIL: system-windows
+# RUN: %lldb -b -s %s -c %p/Inputs/x86-64-linux-tkill.test | FileCheck %s
+
+thread list
+# CHECK: * thread #1, name = 'tkill.out', stop reason = SIGSEGV: sent by tkill 
system call (sender pid=649752, uid=2667987)

>From ae1808d7ac878e3537f9ee6679434de0f1eab17b Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Fri, 30 May 2025 12:43:58 -0700
Subject: [PATCH 2/2] Fix shell test

---
 lldb/test/Shell/Register/Core/x86-64-linux-tkill.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test 
b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
index 240b1e9f8b2d6..e6d9f27a1777c 100644
--- a/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
+++ b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
@@ -1,6 +1,6 @@
 # XFAIL: system-darwin
 # XFAIL: system-windows
-# RUN: %lldb -b -s %s -c %p/Inputs/x86-64-linux-tkill.test | FileCheck %s
+# RUN: %lldb -b -s %s -c %p/Inputs/x86-64-linux-tkill.core | FileCheck %s
 
 thread list
-# CHECK: * thread #1, name = 'tkill.out', stop reason = SIGSEGV: sent by tkill 
system call (sender pid=649752, uid=2667987)
+# CHECK: hread #1: tid = 2667987, 0x7f9a265076cd, name = 'tkill.out', stop 
reason = SIGSEGV: sent by tkill system call (sender pid=2667987, uid=649752)

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


[Lldb-commits] [lldb] 9e9626b - [LLDB] Avoid crashes when inspecting MSVC STL types (#140761)

2025-05-30 Thread via lldb-commits

Author: nerix
Date: 2025-05-30T20:43:53+01:00
New Revision: 9e9626b3d5aa56828b71b03d99bf3167fdfeb08d

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

LOG: [LLDB] Avoid crashes when inspecting MSVC STL types (#140761)

When inspecting/printing types from MSVC's STL, LLDB would crash because
it assumes these types were from libstdc++. Specifically,
`std::shared_ptr` and `std::optional` would crash because of a null
pointer dereference. I added a minimal test that tests the types with
C++ helpers for libstdc++ (only tests for crashes).

- Fixes #115216 
- Fixes #120310 

This still has one unresolved discussion: What about MS STL types? This
is https://github.com/llvm/llvm-project/issues/24834, but there was a
bit of discussion in #120310 as well. The main issue is that MSVC's STL
uses the same type names as libstdc++ (i.e. neither uses an inline
namespace like libc++ for some types).

Added: 
lldb/test/Shell/Process/Windows/msstl_smoke.cpp

Modified: 
lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
index b1fdc0fe37763..c041f39022d10 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
@@ -74,9 +74,10 @@ lldb::ChildCacheState GenericOptionalFrontend::Update() {
 
   if (m_stdlib == StdLib::LibCxx)
 engaged_sp = m_backend.GetChildMemberWithName("__engaged_");
-  else if (m_stdlib == StdLib::LibStdcpp)
-engaged_sp = m_backend.GetChildMemberWithName("_M_payload")
- ->GetChildMemberWithName("_M_engaged");
+  else if (m_stdlib == StdLib::LibStdcpp) {
+if (ValueObjectSP payload = m_backend.GetChildMemberWithName("_M_payload"))
+  engaged_sp = payload->GetChildMemberWithName("_M_engaged");
+  }
 
   if (!engaged_sp)
 return lldb::ChildCacheState::eRefetch;

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
index 02113baf64b8c..08cfcd4a26b8e 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -379,6 +379,9 @@ LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() 
{
 
 lldb::ValueObjectSP
 LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
+  if (!m_ptr_obj)
+return nullptr;
+
   if (idx == 0)
 return m_ptr_obj->GetSP();
   if (idx == 1) {

diff  --git a/lldb/test/Shell/Process/Windows/msstl_smoke.cpp 
b/lldb/test/Shell/Process/Windows/msstl_smoke.cpp
new file mode 100644
index 0..1dcb9c0093b10
--- /dev/null
+++ b/lldb/test/Shell/Process/Windows/msstl_smoke.cpp
@@ -0,0 +1,56 @@
+// This smoke test ensures that LLDB doesn't crash when formatting types from 
MSVC's STL.
+// FIXME: LLDB currently has no built-in formatters for MSVC's STL (#24834)
+
+// REQUIRES: target-windows
+// RUN: %build --compiler=clang-cl -o %t.exe --std c++20 -- %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "run" 
-o "fr v" -o c | FileCheck %s
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int main() {
+  std::shared_ptr foo;
+  std::weak_ptr weak = foo;
+  std::unique_ptr unique(new int(42));
+  std::optional opt;
+  std::string str = "str";
+  std::string longStr = "string that is long enough such that no SSO can 
happen";
+  std::wstring wStr = L"wstr";
+  std::wstring longWStr = L"string that is long enough such that no SSO can 
happen";
+  std::tuple tuple{1, false, 4.2};
+  std::coroutine_handle<> coroHandle;
+  std::bitset<16> bitset(123);
+
+  std::map map{{1, 2}, {2, 4}, {3, 6}, {4, 8}, {5, 10}};
+  auto mapIt = map.find(3);
+  auto mapItEnd = map.find(9);
+  std::set set{1, 2, 3};
+  std::multimap mMap{{1, 2}, {1, 1}, {2, 4}};
+  std::multiset mSet{1, 2, 3};
+
+  std::variant variant;
+  std::list list{1, 2, 3};
+  std::forward_list fwList{1, 2, 3};
+
+  std::unordered_map uMap{{1, 2}, {2, 4}, {3, 6}};
+  std::unordered_set uSet{1, 2, 4};
+  std::unordered_multimap uMMap{{1, 2}, {1, 1}, {2, 4}};
+  std::unordered_multiset uMSet{1, 1, 2};
+  std::deque deque{1, 2, 3};
+  std::vector vec{1, 2, 3};
+}
+
+// CHECK: Process {{.*}} exited with status = 0 (0x)



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


[Lldb-commits] [lldb] [LLDB] Avoid crashes when inspecting MSVC STL types (PR #140761)

2025-05-30 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] 03d1f3d - [lldb][nfc] Fix missing move operations and constness of methods (#142052)

2025-05-30 Thread via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2025-05-30T12:46:34-07:00
New Revision: 03d1f3d7e34d3420b8ddafa7e6df0c1d8ad13c41

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

LOG: [lldb][nfc] Fix missing move operations and constness of methods (#142052)

This PR adds the missing move operators for VariableList: this class is
just a wrapper around a vector, so it can use the default move
operations. Subsequent patches will want to return VariableLists from
functions, so the move operation is required (the copy constructors are
deleted).

It also fixes constness for a method in DiagnosticManager returning its
list of diagnostics. Previously, the method always returned a const
list, even though the method was not const itself. Subsequent patches
will make use of the ability to mutate the diagnostics.

Added: 


Modified: 
lldb/include/lldb/Expression/DiagnosticManager.h
lldb/include/lldb/Symbol/VariableList.h

Removed: 




diff  --git a/lldb/include/lldb/Expression/DiagnosticManager.h 
b/lldb/include/lldb/Expression/DiagnosticManager.h
index cc802b6f48334..fc49349d1b7c3 100644
--- a/lldb/include/lldb/Expression/DiagnosticManager.h
+++ b/lldb/include/lldb/Expression/DiagnosticManager.h
@@ -107,7 +107,8 @@ class DiagnosticManager {
 m_fixed_expression.clear();
   }
 
-  const DiagnosticList &Diagnostics() { return m_diagnostics; }
+  const DiagnosticList &Diagnostics() const { return m_diagnostics; }
+  DiagnosticList &Diagnostics() { return m_diagnostics; }
 
   bool HasFixIts() const {
 return llvm::any_of(m_diagnostics,

diff  --git a/lldb/include/lldb/Symbol/VariableList.h 
b/lldb/include/lldb/Symbol/VariableList.h
index fd15f3ae6891f..ead300a815cb9 100644
--- a/lldb/include/lldb/Symbol/VariableList.h
+++ b/lldb/include/lldb/Symbol/VariableList.h
@@ -24,6 +24,9 @@ class VariableList {
   VariableList();
   virtual ~VariableList();
 
+  VariableList(VariableList &&) = default;
+  VariableList &operator=(VariableList &&) = default;
+
   void AddVariable(const lldb::VariableSP &var_sp);
 
   bool AddVariableIfUnique(const lldb::VariableSP &var_sp);



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


[Lldb-commits] [lldb] [lldb][nfc] Fix missing move operations and constness of methods (PR #142052)

2025-05-30 Thread Felipe de Azevedo Piovezan via lldb-commits

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


[Lldb-commits] [lldb] [LLDB][Platform Linux] Flip uid and pid in get signal description (PR #142200)

2025-05-30 Thread David Peixotto via lldb-commits


@@ -0,0 +1,10 @@
+#include 

dmpots wrote:

The location of this test is under the "Register" directory, which looks like 
it is for testing things like `register read`. Since this is not about 
examining registers can we find a more suitable location?

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


[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread Michael Buch via lldb-commits

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

>From 662e07aa9bb6560f37c079ba6f13be17e7885b48 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 30 May 2025 15:44:09 +0100
Subject: [PATCH 1/5] [clang][Frontend] Add overload to ASTPrinter that doesn't
 own output stream

We're planning on using the ASTPrinter in LLDB for AST dumping. But it
currently takes the output stream via `unique_ptr`. In LLDB we don't
have the output stream available in this form and instead it would be
convenient if we could just pass a reference to the stream.

This patch adds that overload.

(cherry picked from commit 9bd15ee7ed44adc836bcd07ff7e856d7a32ba6a9)
---
 clang/include/clang/Frontend/ASTConsumers.h |  5 +
 clang/lib/Frontend/ASTConsumers.cpp | 20 
 2 files changed, 25 insertions(+)

diff --git a/clang/include/clang/Frontend/ASTConsumers.h 
b/clang/include/clang/Frontend/ASTConsumers.h
index 0e068bf5cccb5..890701b6ff188 100644
--- a/clang/include/clang/Frontend/ASTConsumers.h
+++ b/clang/include/clang/Frontend/ASTConsumers.h
@@ -35,6 +35,11 @@ CreateASTDumper(std::unique_ptr OS, StringRef 
FilterString,
 bool DumpDecls, bool Deserialize, bool DumpLookups,
 bool DumpDeclTypes, ASTDumpOutputFormat Format);
 
+std::unique_ptr
+CreateASTDumper(raw_ostream &OS, StringRef FilterString, bool DumpDecls,
+bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+ASTDumpOutputFormat Format);
+
 // AST Decl node lister: prints qualified names of all filterable AST Decl
 // nodes.
 std::unique_ptr CreateASTDeclNodeLister();
diff --git a/clang/lib/Frontend/ASTConsumers.cpp 
b/clang/lib/Frontend/ASTConsumers.cpp
index a6e35452b4fbe..a5ff4d44592d4 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -41,6 +41,13 @@ namespace {
   OutputKind(K), OutputFormat(Format), FilterString(FilterString),
   DumpLookups(DumpLookups), DumpDeclTypes(DumpDeclTypes) {}
 
+ASTPrinter(raw_ostream &Out, Kind K, ASTDumpOutputFormat Format,
+   StringRef FilterString, bool DumpLookups = false,
+   bool DumpDeclTypes = false)
+: Out(Out), OwnedOut(nullptr), OutputKind(K), OutputFormat(Format),
+  FilterString(FilterString), DumpLookups(DumpLookups),
+  DumpDeclTypes(DumpDeclTypes) {}
+
 void HandleTranslationUnit(ASTContext &Context) override {
   TranslationUnitDecl *D = Context.getTranslationUnitDecl();
 
@@ -176,6 +183,19 @@ clang::CreateASTDumper(std::unique_ptr Out, 
StringRef FilterString,
   Format, FilterString, DumpLookups, DumpDeclTypes);
 }
 
+std::unique_ptr
+clang::CreateASTDumper(raw_ostream &Out, StringRef FilterString, bool 
DumpDecls,
+   bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+   ASTDumpOutputFormat Format) {
+  assert((DumpDecls || Deserialize || DumpLookups) && "nothing to dump");
+  return std::make_unique(Out,
+  Deserialize ? ASTPrinter::DumpFull
+  : DumpDecls ? ASTPrinter::Dump
+  : ASTPrinter::None,
+  Format, FilterString, DumpLookups,
+  DumpDeclTypes);
+}
+
 std::unique_ptr clang::CreateASTDeclNodeLister() {
   return std::make_unique(nullptr);
 }

>From 0ba5a4f09caeb54008594adfb3b8efa2a740e5e6 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 30 May 2025 15:46:27 +0100
Subject: [PATCH 2/5] [lldb] Add filter option to AST dump command

This patch makes the `-ast-dump-filter` Clang option available to the
`target modules dump ast` command. This allows us to selectively dump
parts of the AST by name.

The AST can quickly grow way too large to skim on the console. This will
aid in debugging AST related issues.

Example:
```
(lldb) target modules dump ast --filter func
Dumping clang ast for 48 modules.
Dumping func:
FunctionDecl 0xc4b785008 <>  func 'void (int)' 
extern
|-ParmVarDecl 0xc4b7853d8 <>  x 'int'
`-AsmLabelAttr 0xc4b785358 <> Implicit "_Z4funcIiEvT_"

Dumping func:
FunctionDecl 0xc4b7850b8 <>  func 'void (int)' 
implicit_instantiation extern
|-TemplateArgument type 'int'
| `-BuiltinType 0xc4b85b110 'int'
`-ParmVarDecl 0xc4b7853d8 <>  x 'int'
```
---
 lldb/include/lldb/Symbol/SymbolFile.h |  2 +-
 lldb/include/lldb/Symbol/SymbolFileOnDemand.h |  2 +-
 lldb/include/lldb/Symbol/TypeSystem.h |  3 ++-
 lldb/source/Commands/CommandObjectTarget.cpp  | 23 +++
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  4 ++--
 .../SymbolFile/DWARF/SymbolFileDWARF.h|  2 +-
 .../DWARF/SymbolFileDWARFDebugMap.cpp |  6 ++---
 .../DWARF/SymbolFileDWARFDebugMap.h   |  2 +-
 .../SymbolFile/NativePDB/PdbAstBuilder.cpp|  4 ++--
 .../SymbolFile/NativePDB/PdbAstBuilder.h  |  2 +-
 

[Lldb-commits] [lldb] [LLDB][Platform Linux] Flip uid and pid in get signal description (PR #142200)

2025-05-30 Thread David Peixotto via lldb-commits


@@ -0,0 +1,6 @@
+# XFAIL: system-darwin

dmpots wrote:

Why is this expected to fail on darwin and windows? Can we use `REQUIRES` to 
only run it on supported platforms?

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


[Lldb-commits] [lldb] [lldb][headers] Create script to fix up versioning (PR #141116)

2025-05-30 Thread Chelsea Cassanova via lldb-commits


@@ -290,6 +290,45 @@ else()
   endif()
 endif()
 
+# Stage all headers in the include directory in the build dir.

chelcassanova wrote:

The logic of finding all the headers for staging them in a directory should be 
able to live here alone. The idea is that the framework would then use the 
staged headers in `include/lldb` as its own input for when headers 
have to be fixed up for a framework build (see `LLDBFramework.cmake` in this 
patch: https://github.com/llvm/llvm-project/pull/142051/files where the logic 
for finding headers is removed and instead uses the staged headers from the 
build dir)

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


[Lldb-commits] [clang] [lldb] [lldb] Add filter option to AST dump command (PR #142164)

2025-05-30 Thread Michael Buch via lldb-commits

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

>From 662e07aa9bb6560f37c079ba6f13be17e7885b48 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 30 May 2025 15:44:09 +0100
Subject: [PATCH 1/4] [clang][Frontend] Add overload to ASTPrinter that doesn't
 own output stream

We're planning on using the ASTPrinter in LLDB for AST dumping. But it
currently takes the output stream via `unique_ptr`. In LLDB we don't
have the output stream available in this form and instead it would be
convenient if we could just pass a reference to the stream.

This patch adds that overload.

(cherry picked from commit 9bd15ee7ed44adc836bcd07ff7e856d7a32ba6a9)
---
 clang/include/clang/Frontend/ASTConsumers.h |  5 +
 clang/lib/Frontend/ASTConsumers.cpp | 20 
 2 files changed, 25 insertions(+)

diff --git a/clang/include/clang/Frontend/ASTConsumers.h 
b/clang/include/clang/Frontend/ASTConsumers.h
index 0e068bf5cccb5..890701b6ff188 100644
--- a/clang/include/clang/Frontend/ASTConsumers.h
+++ b/clang/include/clang/Frontend/ASTConsumers.h
@@ -35,6 +35,11 @@ CreateASTDumper(std::unique_ptr OS, StringRef 
FilterString,
 bool DumpDecls, bool Deserialize, bool DumpLookups,
 bool DumpDeclTypes, ASTDumpOutputFormat Format);
 
+std::unique_ptr
+CreateASTDumper(raw_ostream &OS, StringRef FilterString, bool DumpDecls,
+bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+ASTDumpOutputFormat Format);
+
 // AST Decl node lister: prints qualified names of all filterable AST Decl
 // nodes.
 std::unique_ptr CreateASTDeclNodeLister();
diff --git a/clang/lib/Frontend/ASTConsumers.cpp 
b/clang/lib/Frontend/ASTConsumers.cpp
index a6e35452b4fbe..a5ff4d44592d4 100644
--- a/clang/lib/Frontend/ASTConsumers.cpp
+++ b/clang/lib/Frontend/ASTConsumers.cpp
@@ -41,6 +41,13 @@ namespace {
   OutputKind(K), OutputFormat(Format), FilterString(FilterString),
   DumpLookups(DumpLookups), DumpDeclTypes(DumpDeclTypes) {}
 
+ASTPrinter(raw_ostream &Out, Kind K, ASTDumpOutputFormat Format,
+   StringRef FilterString, bool DumpLookups = false,
+   bool DumpDeclTypes = false)
+: Out(Out), OwnedOut(nullptr), OutputKind(K), OutputFormat(Format),
+  FilterString(FilterString), DumpLookups(DumpLookups),
+  DumpDeclTypes(DumpDeclTypes) {}
+
 void HandleTranslationUnit(ASTContext &Context) override {
   TranslationUnitDecl *D = Context.getTranslationUnitDecl();
 
@@ -176,6 +183,19 @@ clang::CreateASTDumper(std::unique_ptr Out, 
StringRef FilterString,
   Format, FilterString, DumpLookups, DumpDeclTypes);
 }
 
+std::unique_ptr
+clang::CreateASTDumper(raw_ostream &Out, StringRef FilterString, bool 
DumpDecls,
+   bool Deserialize, bool DumpLookups, bool DumpDeclTypes,
+   ASTDumpOutputFormat Format) {
+  assert((DumpDecls || Deserialize || DumpLookups) && "nothing to dump");
+  return std::make_unique(Out,
+  Deserialize ? ASTPrinter::DumpFull
+  : DumpDecls ? ASTPrinter::Dump
+  : ASTPrinter::None,
+  Format, FilterString, DumpLookups,
+  DumpDeclTypes);
+}
+
 std::unique_ptr clang::CreateASTDeclNodeLister() {
   return std::make_unique(nullptr);
 }

>From 0ba5a4f09caeb54008594adfb3b8efa2a740e5e6 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 30 May 2025 15:46:27 +0100
Subject: [PATCH 2/4] [lldb] Add filter option to AST dump command

This patch makes the `-ast-dump-filter` Clang option available to the
`target modules dump ast` command. This allows us to selectively dump
parts of the AST by name.

The AST can quickly grow way too large to skim on the console. This will
aid in debugging AST related issues.

Example:
```
(lldb) target modules dump ast --filter func
Dumping clang ast for 48 modules.
Dumping func:
FunctionDecl 0xc4b785008 <>  func 'void (int)' 
extern
|-ParmVarDecl 0xc4b7853d8 <>  x 'int'
`-AsmLabelAttr 0xc4b785358 <> Implicit "_Z4funcIiEvT_"

Dumping func:
FunctionDecl 0xc4b7850b8 <>  func 'void (int)' 
implicit_instantiation extern
|-TemplateArgument type 'int'
| `-BuiltinType 0xc4b85b110 'int'
`-ParmVarDecl 0xc4b7853d8 <>  x 'int'
```
---
 lldb/include/lldb/Symbol/SymbolFile.h |  2 +-
 lldb/include/lldb/Symbol/SymbolFileOnDemand.h |  2 +-
 lldb/include/lldb/Symbol/TypeSystem.h |  3 ++-
 lldb/source/Commands/CommandObjectTarget.cpp  | 23 +++
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  4 ++--
 .../SymbolFile/DWARF/SymbolFileDWARF.h|  2 +-
 .../DWARF/SymbolFileDWARFDebugMap.cpp |  6 ++---
 .../DWARF/SymbolFileDWARFDebugMap.h   |  2 +-
 .../SymbolFile/NativePDB/PdbAstBuilder.cpp|  4 ++--
 .../SymbolFile/NativePDB/PdbAstBuilder.h  |  2 +-
 

[Lldb-commits] [lldb] [LLDB][Platform Linux] Flip uid and pid in get signal description (PR #142200)

2025-05-30 Thread Jacob Lalonde via lldb-commits


@@ -0,0 +1,6 @@
+# XFAIL: system-darwin

Jlalond wrote:

Can you give me an example @dmpots? I would want to run this only on Linux

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


[Lldb-commits] [lldb] [LLDB][Platform Linux] Flip uid and pid in get signal description (PR #142200)

2025-05-30 Thread Jacob Lalonde via lldb-commits


@@ -0,0 +1,10 @@
+#include 

Jlalond wrote:

I do think it's weird. Strangely enough all the existing SIGINFO shell tests 
also live in this directory. I think it would lead to more confusion to break 
that, but it's a great refactoring opportunity 

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen updated 
https://github.com/llvm/llvm-project/pull/141426

>From d57cd027fc66447651739fb8141c51d31688 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Wed, 21 May 2025 23:39:56 +0200
Subject: [PATCH 1/7] Reuse creation of Source objects for assembly and normal
 sources

---
 lldb/tools/lldb-dap/Breakpoint.cpp|  14 +-
 .../Handler/DisassembleRequestHandler.cpp |  21 +--
 .../Handler/LocationsRequestHandler.cpp   |  10 +-
 .../Handler/StackTraceRequestHandler.cpp  |   6 +-
 lldb/tools/lldb-dap/JSONUtils.cpp | 123 +-
 lldb/tools/lldb-dap/JSONUtils.h   |  49 ++-
 lldb/tools/lldb-dap/Protocol/ProtocolTypes.h  |   2 +
 7 files changed, 100 insertions(+), 125 deletions(-)

diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp 
b/lldb/tools/lldb-dap/Breakpoint.cpp
index 2d0fd9c9c3954..440d589b912fc 100644
--- a/lldb/tools/lldb-dap/Breakpoint.cpp
+++ b/lldb/tools/lldb-dap/Breakpoint.cpp
@@ -9,12 +9,10 @@
 #include "Breakpoint.h"
 #include "DAP.h"
 #include "JSONUtils.h"
-#include "LLDBUtils.h"
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBBreakpointLocation.h"
 #include "lldb/API/SBLineEntry.h"
 #include "lldb/API/SBMutex.h"
-#include "lldb/lldb-enumerations.h"
 #include "llvm/ADT/StringExtras.h"
 #include 
 #include 
@@ -66,17 +64,15 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() {
 "0x" + llvm::utohexstr(bp_addr.GetLoadAddress(m_bp.GetTarget()));
 breakpoint.instructionReference = formatted_addr;
 
-lldb::StopDisassemblyType stop_disassembly_display =
-GetStopDisassemblyDisplay(m_dap.debugger);
-auto line_entry = bp_addr.GetLineEntry();
-if (!ShouldDisplayAssemblySource(line_entry, stop_disassembly_display)) {
+auto source = CreateSource(bp_addr, m_dap.debugger);
+if (!source.IsAssemblySource()) {
+  auto line_entry = bp_addr.GetLineEntry();
   const auto line = line_entry.GetLine();
   if (line != LLDB_INVALID_LINE_NUMBER)
 breakpoint.line = line;
   const auto column = line_entry.GetColumn();
   if (column != LLDB_INVALID_COLUMN_NUMBER)
 breakpoint.column = column;
-  breakpoint.source = CreateSource(line_entry);
 } else {
   // Assembly breakpoint.
   auto symbol = bp_addr.GetSymbol();
@@ -86,10 +82,10 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() {
 .ReadInstructions(symbol.GetStartAddress(), bp_addr, nullptr)
 .GetSize() +
 1;
-
-breakpoint.source = CreateAssemblySource(m_dap.target, bp_addr);
   }
 }
+
+breakpoint.source = std::move(source);
   }
 
   return breakpoint;
diff --git a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
index 1d110eac18126..49e7c788a7fb3 100644
--- a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
@@ -13,6 +13,7 @@
 #include "Protocol/ProtocolTypes.h"
 #include "RequestHandler.h"
 #include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBInstruction.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/lldb-types.h"
@@ -81,12 +82,15 @@ static lldb::SBAddress 
GetDisassembleStartAddress(lldb::SBTarget target,
   .GetAddress();
 }
 
-static DisassembledInstruction ConvertSBInstructionToDisassembledInstruction(
-lldb::SBTarget &target, lldb::SBInstruction &inst, bool resolve_symbols) {
+static DisassembledInstruction
+ConvertSBInstructionToDisassembledInstruction(lldb::SBDebugger &debugger,
+  lldb::SBInstruction &inst,
+  bool resolve_symbols) {
   if (!inst.IsValid())
 return GetInvalidInstruction();
 
-  auto addr = inst.GetAddress();
+  lldb::SBTarget target = debugger.GetSelectedTarget();
+  lldb::SBAddress addr = inst.GetAddress();
   const auto inst_addr = addr.GetLoadAddress(target);
 
   // FIXME: This is a workaround - this address might come from
@@ -139,15 +143,14 @@ static DisassembledInstruction 
ConvertSBInstructionToDisassembledInstruction(
 
   disassembled_inst.instruction = std::move(instruction);
 
+  auto source = CreateSource(addr, debugger);
   auto line_entry = addr.GetLineEntry();
-  // If the line number is 0 then the entry represents a compiler generated
-  // location.
 
-  if (line_entry.GetStartAddress() == addr && line_entry.IsValid() &&
+  if (!source.IsAssemblySource() && line_entry.IsValid() &&
+  line_entry.GetStartAddress() == addr && line_entry.IsValid() &&
   line_entry.GetFileSpec().IsValid() && line_entry.GetLine() != 0) {
-auto source = CreateSource(line_entry);
-disassembled_inst.location = std::move(source);
 
+disassembled_inst.location = std::move(source);
 const auto line = line_entry.GetLine();
 if (line != 0 && line != LLDB_INVALID_LINE_NUMBER)
   disassembled

[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread Ely Ronnen via lldb-commits


@@ -558,28 +559,30 @@ protocol::Source CreateAssemblySource(const 
lldb::SBTarget &target,
   return source;
 }
 
-bool ShouldDisplayAssemblySource(
-const lldb::SBLineEntry &line_entry,
-lldb::StopDisassemblyType stop_disassembly_display) {
-  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNever)
-return false;
-
-  if (stop_disassembly_display == lldb::eStopDisassemblyTypeAlways)
-return true;
-
-  // A line entry of 0 indicates the line is compiler generated i.e. no source
-  // file is associated with the frame.
-  auto file_spec = line_entry.GetFileSpec();
-  if (!file_spec.IsValid() || line_entry.GetLine() == 0 ||
-  line_entry.GetLine() == LLDB_INVALID_LINE_NUMBER)
-return true;
+protocol::Source CreateSource(const lldb::SBFileSpec &file) {
+  protocol::Source source;
+  if (file.IsValid()) {
+const char *name = file.GetFilename();
+if (name)
+  source.name = name;
+char path[PATH_MAX] = "";
+if (file.GetPath(path, sizeof(path)) &&
+lldb::SBFileSpec::ResolvePath(path, path, PATH_MAX))
+  source.path = path;
+  }
+  return source;
+}
 
-  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNoSource &&
-  !file_spec.Exists()) {
-return true;
+protocol::Source CreateSource(lldb::SBAddress address, lldb::SBTarget &target) 
{
+  lldb::SBDebugger debugger = target.GetDebugger();
+  lldb::StopDisassemblyType stop_disassembly_display =
+  GetStopDisassemblyDisplay(debugger);
+  if (!ShouldDisplayAssemblySource(address, stop_disassembly_display)) {
+lldb::SBLineEntry line_entry = GetLineEntryForAddress(target, address);
+return CreateSource(line_entry.GetFileSpec());
   }
 
-  return false;
+  return CreateAssemblySource(target, address);

eronnen wrote:

:100: 

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread Ely Ronnen via lldb-commits


@@ -139,15 +141,16 @@ static DisassembledInstruction 
ConvertSBInstructionToDisassembledInstruction(
 
   disassembled_inst.instruction = std::move(instruction);
 
-  auto line_entry = addr.GetLineEntry();
+  auto source = CreateSource(addr, target);
+  auto line_entry = GetLineEntryForAddress(target, addr);

eronnen wrote:

I thought they were obvious from the RHS but changed :)

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread Ely Ronnen via lldb-commits


@@ -0,0 +1,17 @@
+//===-- ProtocolUtils.cpp 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Protocol/ProtocolUtils.h"
+
+namespace lldb_dap::protocol {
+
+bool IsAssemblySource(const protocol::Source &source) {
+  return source.sourceReference.value_or(0) != 0;
+}

eronnen wrote:

When creating the source object if there is source code available we set the 
`path`, otherwise we set `sourceReference`, which means we fall back to 
assembly.

According to the spec:

```js
/**
   * The source location of the breakpoints; either `source.path` or
   * `source.sourceReference` must be specified.
   */
 ```  

Also added a comment to the function to make it clearer

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread Ely Ronnen via lldb-commits


@@ -558,28 +559,30 @@ protocol::Source CreateAssemblySource(const 
lldb::SBTarget &target,
   return source;
 }
 
-bool ShouldDisplayAssemblySource(
-const lldb::SBLineEntry &line_entry,
-lldb::StopDisassemblyType stop_disassembly_display) {
-  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNever)
-return false;
-
-  if (stop_disassembly_display == lldb::eStopDisassemblyTypeAlways)
-return true;
-
-  // A line entry of 0 indicates the line is compiler generated i.e. no source
-  // file is associated with the frame.
-  auto file_spec = line_entry.GetFileSpec();
-  if (!file_spec.IsValid() || line_entry.GetLine() == 0 ||
-  line_entry.GetLine() == LLDB_INVALID_LINE_NUMBER)
-return true;
+protocol::Source CreateSource(const lldb::SBFileSpec &file) {

eronnen wrote:

moved :100: 

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


[Lldb-commits] [lldb] [lldb-dap] Synchronously wait for breakpoints resolves in tests (PR #140470)

2025-05-30 Thread John Harrison via lldb-commits

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

LGTM!

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


[Lldb-commits] [lldb] [LLDB][Platform Linux] Flip uid and pid in get signal description (PR #142200)

2025-05-30 Thread Jacob Lalonde via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap][test] Fix DAP disassemble test (PR #142129)

2025-05-30 Thread John Harrison via lldb-commits

https://github.com/ashgti commented:

Can we also move 
https://github.com/llvm/llvm-project/blob/f7e172da4caeab9d92f6e97501b1a2c561e616c1/lldb/test/API/tools/lldb-dap/disassemble/main.c#L9
 to line 11?

That should help us land on a location with a line associated with it.

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


[Lldb-commits] [lldb] [lldb][headers] Create Python script to fix up framework headers (PR #142051)

2025-05-30 Thread Chelsea Cassanova via lldb-commits

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

>From dd86d088d6fb8b7632f310e2011c2031766ebf27 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Wed, 28 May 2025 15:45:45 -0700
Subject: [PATCH] [lldb][headers] Create Python script to fix up framework
 headers

This commit replaces the shell script that fixes up includes for the
LLDB framework with a Python script. This script will also be used when
fixing up includes for the LLDBRPC.framework.
---
 lldb/cmake/modules/LLDBFramework.cmake|  34 +++---
 lldb/scripts/framework-header-fix.py  | 110 ++
 lldb/scripts/framework-header-fix.sh  |  17 ---
 .../Shell/Scripts/Inputs/Main/SBAddress.h |  13 +++
 .../Shell/Scripts/Inputs/RPC/RPCSBAddress.h   |   9 ++
 .../Shell/Scripts/TestFrameworkFixScript.test |  16 +++
 .../Scripts/TestRPCFrameworkFixScript.test|  14 +++
 7 files changed, 177 insertions(+), 36 deletions(-)
 create mode 100755 lldb/scripts/framework-header-fix.py
 delete mode 100755 lldb/scripts/framework-header-fix.sh
 create mode 100644 lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
 create mode 100644 lldb/test/Shell/Scripts/Inputs/RPC/RPCSBAddress.h
 create mode 100644 lldb/test/Shell/Scripts/TestFrameworkFixScript.test
 create mode 100644 lldb/test/Shell/Scripts/TestRPCFrameworkFixScript.test

diff --git a/lldb/cmake/modules/LLDBFramework.cmake 
b/lldb/cmake/modules/LLDBFramework.cmake
index 471aeaaad3c0d..cea178c19050b 100644
--- a/lldb/cmake/modules/LLDBFramework.cmake
+++ b/lldb/cmake/modules/LLDBFramework.cmake
@@ -68,24 +68,16 @@ if(NOT APPLE_EMBEDDED)
   )
 endif()
 
-# At configuration time, collect headers for the framework bundle and copy them
-# into a staging directory. Later we can copy over the entire folder.
-file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
-set(generated_public_headers ${LLDB_OBJ_DIR}/include/lldb/API/SBLanguages.h)
-file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
-file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
-list(REMOVE_ITEM root_public_headers ${root_private_headers})
-
 find_program(unifdef_EXECUTABLE unifdef)
 
-set(lldb_header_staging ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders)
-foreach(header
-${public_headers}
-${generated_public_headers}
-${root_public_headers})
+# All necessary header files will be staged in the include directory in the 
build directory,
+# so just copy the files from there into the framework's staging directory.
+set(lldb_build_dir_header_staging ${CMAKE_BINARY_DIR}/include/lldb)
+set(lldb_framework_header_staging ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders)
+foreach(header ${lldb_build_dir_header_staging})
 
   get_filename_component(basename ${header} NAME)
-  set(staged_header ${lldb_header_staging}/${basename})
+  set(staged_header ${lldb_framework_header_staging}/${basename})
 
   if(unifdef_EXECUTABLE)
 # unifdef returns 0 when the file is unchanged and 1 if something was 
changed.
@@ -107,14 +99,18 @@ endforeach()
 # Wrap output in a target, so lldb-framework can depend on it.
 add_custom_target(liblldb-resource-headers DEPENDS lldb-sbapi-dwarf-enums 
${lldb_staged_headers})
 set_target_properties(liblldb-resource-headers PROPERTIES FOLDER 
"LLDB/Resources")
+
+# We're taking the header files from where they've been staged in the build 
directory's include folder,
+# so create a dependency on the build step that creates that directory.
+add_dependencies(liblldb-resource-headers liblldb-header-staging)
 add_dependencies(liblldb liblldb-resource-headers)
 
-# At build time, copy the staged headers into the framework bundle (and do
-# some post-processing in-place).
+# Take the headers from the staging directory and fix up their includes for 
the framework.
+# Then write them to the output directory.
+# Also, run unifdef to remove any specified guards from the header files.
 add_custom_command(TARGET liblldb POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E copy_directory ${lldb_header_staging} 
$/Headers
-  COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh 
$/Headers ${LLDB_VERSION}
-  COMMENT "LLDB.framework: copy framework headers"
+  COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.py lldb_main 
${lldb_framework_header_staging} $/Headers 
--unifdef_guards=-USWIG
+  COMMENT "LLDB.framework: Fix up and copy framework headers"
 )
 
 # Copy vendor-specific headers from clang (without staging).
diff --git a/lldb/scripts/framework-header-fix.py 
b/lldb/scripts/framework-header-fix.py
new file mode 100755
index 0..0a478a577dc3c
--- /dev/null
+++ b/lldb/scripts/framework-header-fix.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python3
+
+"""
+Usage:  
+
+This script is used when building LLDB.framework or LLDBRPC.framework. For 
each framework, local includes are converted to their respective framework 
includes.
+
+This script is used in 2 ways:
+1. It is used on header files that are c

[Lldb-commits] [lldb] [LLDB][Platform Linux] Flip and add test (PR #142200)

2025-05-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)


Changes

Despite a great review from @labath, I accidentally landed the signal 
with the UID and PID properties flipped. I was actually trying to write tests 
for this feature when I discovered it. 

This fixes that bug, and add a shell test that runs only on Nix systems.

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


3 Files Affected:

- (added) lldb/test/Shell/Register/Core/Inputs/tkill.cpp (+10) 
- (added) lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core () 
- (added) lldb/test/Shell/Register/Core/x86-64-linux-tkill.test (+6) 


``diff
diff --git a/lldb/test/Shell/Register/Core/Inputs/tkill.cpp 
b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
new file mode 100644
index 0..79310c7f26b52
--- /dev/null
+++ b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
@@ -0,0 +1,10 @@
+#include 
+#include 
+
+int main() {
+// Get the current thread ID
+pid_t tid = syscall(SYS_gettid);
+// Send a SIGSEGV signal to the current thread
+syscall(SYS_tkill, tid, SIGSEGV);
+return 0;
+}
diff --git a/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core 
b/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core
new file mode 100644
index 0..3d1a05a34e7ca
Binary files /dev/null and 
b/lldb/test/Shell/Register/Core/Inputs/x86-64-linux-tkill.core differ
diff --git a/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test 
b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
new file mode 100644
index 0..240b1e9f8b2d6
--- /dev/null
+++ b/lldb/test/Shell/Register/Core/x86-64-linux-tkill.test
@@ -0,0 +1,6 @@
+# XFAIL: system-darwin
+# XFAIL: system-windows
+# RUN: %lldb -b -s %s -c %p/Inputs/x86-64-linux-tkill.test | FileCheck %s
+
+thread list
+# CHECK: * thread #1, name = 'tkill.out', stop reason = SIGSEGV: sent by tkill 
system call (sender pid=649752, uid=2667987)

``




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


[Lldb-commits] [lldb] [lldb][headers] Create Python script to fix up framework headers (PR #142051)

2025-05-30 Thread Chelsea Cassanova via lldb-commits

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

>From 4064ae7a71171f0c6d95826aff478ceabf036869 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Wed, 28 May 2025 15:45:45 -0700
Subject: [PATCH] [lldb][headers] Create Python script to fix up framework
 headers

This commit replaces the shell script that fixes up includes for the
LLDB framework with a Python script. This script will also be used when
fixing up includes for the LLDBRPC.framework.
---
 lldb/cmake/modules/LLDBFramework.cmake|  34 +++--
 lldb/scripts/framework-header-fix.py  | 117 ++
 lldb/scripts/framework-header-fix.sh  |  17 ---
 .../Shell/Scripts/Inputs/Main/SBAddress.h |  13 ++
 .../Shell/Scripts/Inputs/RPC/RPCSBAddress.h   |   9 ++
 .../Shell/Scripts/TestFrameworkFixScript.test |  16 +++
 .../Scripts/TestRPCFrameworkFixScript.test|  14 +++
 7 files changed, 184 insertions(+), 36 deletions(-)
 create mode 100755 lldb/scripts/framework-header-fix.py
 delete mode 100755 lldb/scripts/framework-header-fix.sh
 create mode 100644 lldb/test/Shell/Scripts/Inputs/Main/SBAddress.h
 create mode 100644 lldb/test/Shell/Scripts/Inputs/RPC/RPCSBAddress.h
 create mode 100644 lldb/test/Shell/Scripts/TestFrameworkFixScript.test
 create mode 100644 lldb/test/Shell/Scripts/TestRPCFrameworkFixScript.test

diff --git a/lldb/cmake/modules/LLDBFramework.cmake 
b/lldb/cmake/modules/LLDBFramework.cmake
index 471aeaaad3c0d..cea178c19050b 100644
--- a/lldb/cmake/modules/LLDBFramework.cmake
+++ b/lldb/cmake/modules/LLDBFramework.cmake
@@ -68,24 +68,16 @@ if(NOT APPLE_EMBEDDED)
   )
 endif()
 
-# At configuration time, collect headers for the framework bundle and copy them
-# into a staging directory. Later we can copy over the entire folder.
-file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
-set(generated_public_headers ${LLDB_OBJ_DIR}/include/lldb/API/SBLanguages.h)
-file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
-file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
-list(REMOVE_ITEM root_public_headers ${root_private_headers})
-
 find_program(unifdef_EXECUTABLE unifdef)
 
-set(lldb_header_staging ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders)
-foreach(header
-${public_headers}
-${generated_public_headers}
-${root_public_headers})
+# All necessary header files will be staged in the include directory in the 
build directory,
+# so just copy the files from there into the framework's staging directory.
+set(lldb_build_dir_header_staging ${CMAKE_BINARY_DIR}/include/lldb)
+set(lldb_framework_header_staging ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders)
+foreach(header ${lldb_build_dir_header_staging})
 
   get_filename_component(basename ${header} NAME)
-  set(staged_header ${lldb_header_staging}/${basename})
+  set(staged_header ${lldb_framework_header_staging}/${basename})
 
   if(unifdef_EXECUTABLE)
 # unifdef returns 0 when the file is unchanged and 1 if something was 
changed.
@@ -107,14 +99,18 @@ endforeach()
 # Wrap output in a target, so lldb-framework can depend on it.
 add_custom_target(liblldb-resource-headers DEPENDS lldb-sbapi-dwarf-enums 
${lldb_staged_headers})
 set_target_properties(liblldb-resource-headers PROPERTIES FOLDER 
"LLDB/Resources")
+
+# We're taking the header files from where they've been staged in the build 
directory's include folder,
+# so create a dependency on the build step that creates that directory.
+add_dependencies(liblldb-resource-headers liblldb-header-staging)
 add_dependencies(liblldb liblldb-resource-headers)
 
-# At build time, copy the staged headers into the framework bundle (and do
-# some post-processing in-place).
+# Take the headers from the staging directory and fix up their includes for 
the framework.
+# Then write them to the output directory.
+# Also, run unifdef to remove any specified guards from the header files.
 add_custom_command(TARGET liblldb POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E copy_directory ${lldb_header_staging} 
$/Headers
-  COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh 
$/Headers ${LLDB_VERSION}
-  COMMENT "LLDB.framework: copy framework headers"
+  COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.py lldb_main 
${lldb_framework_header_staging} $/Headers 
--unifdef_guards=-USWIG
+  COMMENT "LLDB.framework: Fix up and copy framework headers"
 )
 
 # Copy vendor-specific headers from clang (without staging).
diff --git a/lldb/scripts/framework-header-fix.py 
b/lldb/scripts/framework-header-fix.py
new file mode 100755
index 0..38ee095dda323
--- /dev/null
+++ b/lldb/scripts/framework-header-fix.py
@@ -0,0 +1,117 @@
+#!/usr/bin/env python3
+
+"""
+Usage:  
+
+This script is used when building LLDB.framework or LLDBRPC.framework. For 
each framework, local includes are converted to their respective framework 
includes.
+
+This script is used in 2 ways:
+1. It is used on header files that are cop

[Lldb-commits] [lldb] [LLDB][Platform Linux] Flip and add test (PR #142200)

2025-05-30 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 cpp -- 
lldb/test/Shell/Register/Core/Inputs/tkill.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/test/Shell/Register/Core/Inputs/tkill.cpp 
b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
index 79310c7f2..677bd3e6c 100644
--- a/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
+++ b/lldb/test/Shell/Register/Core/Inputs/tkill.cpp
@@ -1,10 +1,10 @@
-#include 
 #include 
+#include 
 
 int main() {
-// Get the current thread ID
-pid_t tid = syscall(SYS_gettid);
-// Send a SIGSEGV signal to the current thread
-syscall(SYS_tkill, tid, SIGSEGV);
-return 0;
+  // Get the current thread ID
+  pid_t tid = syscall(SYS_gettid);
+  // Send a SIGSEGV signal to the current thread
+  syscall(SYS_tkill, tid, SIGSEGV);
+  return 0;
 }

``




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


[Lldb-commits] [lldb] [lldb-dap] Test Gardening, improving DebugCommunication. (PR #141689)

2025-05-30 Thread John Harrison via lldb-commits

ashgti wrote:

> This PR seemingly made `disableASLR` default to `True` again.

doh... I'll fix this when I make a new attempt at merging this PR in.

> Reverted, please take a look and fix. Reproducing should be possible by 
> installing the libc debug package, not sure what's going on with the other 
> failure. Let me know if you need me to investigate it locally.

Taking a look. I'll rebase this on #142129 and see if that fixes it.

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


[Lldb-commits] [lldb] [lldb][headers] Create Python script to fix up framework headers (PR #142051)

2025-05-30 Thread Jonas Devlieghere via lldb-commits


@@ -0,0 +1,117 @@
+#!/usr/bin/env python3
+
+"""
+Usage:  
+
+This script is used when building LLDB.framework or LLDBRPC.framework. For 
each framework, local includes are converted to their respective framework 
includes.
+
+This script is used in 2 ways:
+1. It is used on header files that are copied into LLDB.framework. For these 
files, local LLDB includes are converted into framework includes, e.g. #include 
"lldb/API/SBDefines.h" -> #include .
+
+2. It is used on header files for LLDBRPC.framework. For these files, includes 
of RPC common files will be converted to framework includes, e.g. #include 
 -> #include . It will also 
change local includes to framework includes, e.g. #include "SBAddress.h" -> 
#include 
+"""
+
+import argparse
+import os
+import re
+
+# Main header regexes
+INCLUDE_FILENAME_REGEX = re.compile(
+r'#include "lldb/API/(?P.*){0,1}"'
+)
+
+# RPC header regexes
+RPC_COMMON_REGEX = re.compile(r"#include 
.*)>")
+RPC_INCLUDE_FILENAME_REGEX = re.compile(r'#include "(?P.*)"')
+
+
+def modify_rpc_includes(input_directory_path, output_directory_path):
+for input_filepath in os.listdir(input_directory_path):
+current_input_file = os.path.join(input_directory_path, input_filepath)
+output_dest = os.path.join(output_directory_path, input_filepath)
+if os.path.isfile(current_input_file):
+with open(current_input_file, "r") as input_file:
+lines = input_file.readlines()
+file_buffer = "".join(lines)
+with open(output_dest, "w") as output_file:
+# Local includes must be changed to RPC framework level 
includes.
+# e.g. #include "SBDefines.h" -> #include 
+# Also, RPC common code includes must change to RPC framework 
level includes.
+# e.g. #include "lldb-rpc/common/RPCPublic.h" -> #include 

+rpc_common_matches = RPC_COMMON_REGEX.finditer(file_buffer)
+rpc_include_filename_matches = 
RPC_INCLUDE_FILENAME_REGEX.finditer(
+file_buffer
+)
+for match in rpc_common_matches:
+file_buffer = re.sub(
+match.group(),
+r"#include ",
+file_buffer,
+)
+for match in rpc_include_filename_matches:
+file_buffer = re.sub(
+match.group(),
+r"#include ",
+file_buffer,
+)
+output_file.write(file_buffer)
+
+
+def modify_main_includes(input_directory_path, output_directory_path):
+for input_filepath in os.listdir(input_directory_path):
+current_input_file = os.path.join(input_directory_path, input_filepath)
+output_dest = os.path.join(output_directory_path, input_filepath)
+if os.path.isfile(current_input_file):
+with open(current_input_file, "r") as input_file:
+lines = input_file.readlines()
+file_buffer = "".join(lines)
+with open(output_dest, "w") as output_file:
+# Local includes must be changed to framework level includes.
+# e.g. #include "lldb/API/SBDefines.h" -> #include 

+regex_matches = INCLUDE_FILENAME_REGEX.finditer(file_buffer)
+for match in regex_matches:
+file_buffer = re.sub(
+match.group(),
+r"#include ",
+file_buffer,
+)
+output_file.write(file_buffer)
+
+
+def remove_guards(output_directory_path, unifdef_guards):
+unifdef_path = shutil.which("unifdef")
+for current_file in os.listdir(output_directory_path):
+current_file = os.path.join(output_directory_path, current_file)
+subprocess_command = (
+[unifdef_path, "-o", current_file] + unifdef_guards + 
[current_file]
+)
+subprocess.run(subprocess_command)
+
+
+def main():
+parser = argparse.ArgumentParser()
+parser.add_argument("framework", choices=["lldb_main", "lldb_rpc"])
+parser.add_argument("input_directory")
+parser.add_argument("output_directory")
+parser.add_argument(
+"--unifdef_guards",
+nargs="*",

JDevlieghere wrote:

If you use `nargs='+'` then you can specify multiple and get a list. That way 
you don't need the splitting. 

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread John Harrison via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread John Harrison via lldb-commits


@@ -0,0 +1,115 @@
+//===-- ProtocolUtils.cpp 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Protocol/ProtocolUtils.h"
+#include "LLDBUtils.h"
+
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBTarget.h"
+
+namespace lldb_dap::protocol {
+
+static bool ShouldDisplayAssemblySource(
+lldb::SBAddress address,
+lldb::StopDisassemblyType stop_disassembly_display) {
+  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNever)
+return false;
+
+  if (stop_disassembly_display == lldb::eStopDisassemblyTypeAlways)
+return true;
+
+  // A line entry of 0 indicates the line is compiler generated i.e. no source
+  // file is associated with the frame.
+  auto line_entry = address.GetLineEntry();
+  auto file_spec = line_entry.GetFileSpec();
+  if (!file_spec.IsValid() || line_entry.GetLine() == 0 ||
+  line_entry.GetLine() == LLDB_INVALID_LINE_NUMBER)
+return true;
+
+  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNoSource &&
+  !file_spec.Exists()) {
+return true;
+  }
+
+  return false;
+}
+
+static protocol::Source CreateAssemblySource(const lldb::SBTarget &target,
+ lldb::SBAddress address) {
+  protocol::Source source;
+
+  auto symbol = address.GetSymbol();
+  std::string name;
+  if (symbol.IsValid()) {
+source.sourceReference = symbol.GetStartAddress().GetLoadAddress(target);
+name = symbol.GetName();
+  } else {
+const auto load_addr = address.GetLoadAddress(target);
+source.sourceReference = load_addr;
+name = GetLoadAddressString(load_addr);
+  }
+
+  lldb::SBModule module = address.GetModule();
+  if (module.IsValid()) {
+lldb::SBFileSpec file_spec = module.GetFileSpec();
+if (file_spec.IsValid()) {
+  std::string path = GetSBFileSpecPath(file_spec);
+  if (!path.empty())
+source.path = path + '`' + name;
+}
+  }
+
+  source.name = std::move(name);
+
+  // Mark the source as deemphasized since users will only be able to view
+  // assembly for these frames.
+  source.presentationHint =
+  protocol::Source::PresentationHint::eSourcePresentationHintDeemphasize;
+
+  return source;
+}
+
+protocol::Source CreateSource(const lldb::SBFileSpec &file) {
+  protocol::Source source;
+  if (file.IsValid()) {
+if (const char *name = file.GetFilename())
+  source.name = name;
+char path[PATH_MAX] = "";
+if (file.GetPath(path, sizeof(path)) &&
+lldb::SBFileSpec::ResolvePath(path, path, PATH_MAX))
+  source.path = path;
+  }
+  return source;
+}
+
+protocol::Source CreateSource(lldb::SBAddress address, lldb::SBTarget &target) 
{

ashgti wrote:

Nit: Can both `address` and `target` by `const &`?

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread John Harrison via lldb-commits


@@ -0,0 +1,115 @@
+//===-- ProtocolUtils.cpp 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Protocol/ProtocolUtils.h"
+#include "LLDBUtils.h"
+
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBTarget.h"
+
+namespace lldb_dap::protocol {
+
+static bool ShouldDisplayAssemblySource(
+lldb::SBAddress address,
+lldb::StopDisassemblyType stop_disassembly_display) {
+  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNever)
+return false;
+
+  if (stop_disassembly_display == lldb::eStopDisassemblyTypeAlways)
+return true;
+
+  // A line entry of 0 indicates the line is compiler generated i.e. no source
+  // file is associated with the frame.
+  auto line_entry = address.GetLineEntry();
+  auto file_spec = line_entry.GetFileSpec();
+  if (!file_spec.IsValid() || line_entry.GetLine() == 0 ||
+  line_entry.GetLine() == LLDB_INVALID_LINE_NUMBER)
+return true;
+
+  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNoSource &&
+  !file_spec.Exists()) {
+return true;
+  }
+
+  return false;
+}
+
+static protocol::Source CreateAssemblySource(const lldb::SBTarget &target,
+ lldb::SBAddress address) {

ashgti wrote:

Nit, can this be a `const &` as well?

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread John Harrison via lldb-commits




ashgti wrote:

I meant should the file be `lldb/tools/lldb-dap/ProtocolUtils.{h,cpp}`

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


[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-30 Thread John Harrison via lldb-commits


@@ -0,0 +1,115 @@
+//===-- ProtocolUtils.cpp 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Protocol/ProtocolUtils.h"
+#include "LLDBUtils.h"
+
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBTarget.h"
+
+namespace lldb_dap::protocol {
+
+static bool ShouldDisplayAssemblySource(
+lldb::SBAddress address,
+lldb::StopDisassemblyType stop_disassembly_display) {
+  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNever)
+return false;
+
+  if (stop_disassembly_display == lldb::eStopDisassemblyTypeAlways)
+return true;
+
+  // A line entry of 0 indicates the line is compiler generated i.e. no source
+  // file is associated with the frame.
+  auto line_entry = address.GetLineEntry();
+  auto file_spec = line_entry.GetFileSpec();
+  if (!file_spec.IsValid() || line_entry.GetLine() == 0 ||
+  line_entry.GetLine() == LLDB_INVALID_LINE_NUMBER)
+return true;
+
+  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNoSource &&
+  !file_spec.Exists()) {
+return true;
+  }
+
+  return false;
+}
+
+static protocol::Source CreateAssemblySource(const lldb::SBTarget &target,
+ lldb::SBAddress address) {
+  protocol::Source source;
+
+  auto symbol = address.GetSymbol();
+  std::string name;
+  if (symbol.IsValid()) {
+source.sourceReference = symbol.GetStartAddress().GetLoadAddress(target);
+name = symbol.GetName();
+  } else {
+const auto load_addr = address.GetLoadAddress(target);
+source.sourceReference = load_addr;
+name = GetLoadAddressString(load_addr);
+  }
+
+  lldb::SBModule module = address.GetModule();
+  if (module.IsValid()) {
+lldb::SBFileSpec file_spec = module.GetFileSpec();
+if (file_spec.IsValid()) {
+  std::string path = GetSBFileSpecPath(file_spec);
+  if (!path.empty())
+source.path = path + '`' + name;
+}
+  }
+
+  source.name = std::move(name);
+
+  // Mark the source as deemphasized since users will only be able to view
+  // assembly for these frames.
+  source.presentationHint =
+  protocol::Source::PresentationHint::eSourcePresentationHintDeemphasize;
+
+  return source;
+}
+
+protocol::Source CreateSource(const lldb::SBFileSpec &file) {
+  protocol::Source source;
+  if (file.IsValid()) {
+if (const char *name = file.GetFilename())
+  source.name = name;
+char path[PATH_MAX] = "";
+if (file.GetPath(path, sizeof(path)) &&
+lldb::SBFileSpec::ResolvePath(path, path, PATH_MAX))
+  source.path = path;
+  }
+  return source;
+}
+
+protocol::Source CreateSource(lldb::SBAddress address, lldb::SBTarget &target) 
{
+  lldb::SBDebugger debugger = target.GetDebugger();
+  lldb::StopDisassemblyType stop_disassembly_display =
+  GetStopDisassemblyDisplay(debugger);
+  if (ShouldDisplayAssemblySource(address, stop_disassembly_display))
+return CreateAssemblySource(target, address);
+
+  lldb::SBLineEntry line_entry = GetLineEntryForAddress(target, address);
+  return CreateSource(line_entry.GetFileSpec());
+}
+
+bool IsAssemblySource(const protocol::Source &source) {
+  // According to the specification, a source must have either `path` or
+  // `sourceReference` specified. We use `path` for sources with known source
+  // code, and `sourceReferences` when falling back to assembly.
+  return source.sourceReference.value_or(0) != 0;
+}
+
+std::string GetLoadAddressString(const lldb::addr_t addr) {
+  std::string result;
+  llvm::raw_string_ostream os(result);
+  os << llvm::format_hex(addr, 18);
+  return result;

ashgti wrote:

Should we use `llvm::utohexstr()`? I think we use that in a few other places.

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


[Lldb-commits] [lldb] [lldb][test] Test all libcxxabi demangler test-cases against TrackingOutputBuffer (PR #137793)

2025-05-30 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.


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


[Lldb-commits] [lldb] [LLDB][Platform Linux] Flip uid and pid in get signal description (PR #142200)

2025-05-30 Thread David Peixotto via lldb-commits


@@ -0,0 +1,10 @@
+#include 

dmpots wrote:

> Strangely enough all the existing SIGINFO shell tests also live in this 
> directory

FWIW, I do see a 
[command-thread-siginfo.test](https://github.com/llvm/llvm-project/blob/main/lldb/test/Shell/Commands/command-thread-siginfo.test)
 that lives outside this directory. 

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


  1   2   >