[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)

2025-07-22 Thread Michael Buch via lldb-commits


@@ -1784,6 +1787,17 @@ static void 
LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_summary_flags,
   MsvcStlStringSummaryProvider,
   "MSVC STL std::u32string summary provider"));
+
+  stl_summary_flags.SetDontShowChildren(false);

Michael137 wrote:

Yea, I wondered if for summaries that can't be formatted without children this 
would then fall back to showing the children. But yea maybe not. Either way, 
not something you have to deal with here

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


[Lldb-commits] [lldb] [lldb][rpc] Use Clang attributes to keep track of pointer plus len (PR #148981)

2025-07-22 Thread David Spickett via lldb-commits


@@ -69,6 +69,7 @@ class LLDB_API SBData {
 
   const char *GetString(lldb::SBError &error, lldb::offset_t offset);
 
+  [[clang::annotate("lldb-rpc-gen pointer plus len")]]

DavidSpickett wrote:

> This commit changes this by using the Clang annotation attribute to annotate 
> every method that uses a pointer plus length directly in the SB API, and 
> checks that a given method has this attribute when determining if a method 
> has a pointer plus length.

Which means that if we do switch to this and make the macro emit nothing when 
not clang, all non-clang builds of lldb-rpc are totally broken?

And if this is an extra layer of checking, it could in fact make things worse. 
The majority of our builds are done with clang, so you could have something 
that works with clang but not anything else. At least with the hardcoded list, 
anyone using any compiler has to update it.

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

https://github.com/satyajanga updated 
https://github.com/llvm/llvm-project/pull/150149

>From f4c7789bb5994f1df81294c054ddc74b397e6e3f Mon Sep 17 00:00:00 2001
From: satya janga 
Date: Tue, 22 Jul 2025 17:57:30 -0700
Subject: [PATCH] Zero extend APInt when piece size is bigger than the bitwidth

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:


Differential Revision: https://phabricator.intern.facebook.com/D78791142
---
 lldb/source/Expression/DWARFExpression.cpp | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 52891fcefd68b..a709574e96f98 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -1978,7 +1978,12 @@ llvm::Expected DWARFExpression::Evaluate(
 // grows to the nearest host integer type.
 llvm::APInt fail_value(1, 0, false);
 llvm::APInt ap_int = scalar.UInt128(fail_value);
-assert(ap_int.getBitWidth() >= bit_size);
+// We have seen a case where we have expression like:
+//  DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x28
+// here we are assuming the compiler was trying to zero
+// extend the value that we should append to the buffer.
+if (ap_int.getBitWidth() < bit_size)
+  ap_int.zext(bit_size);
 llvm::ArrayRef buf{ap_int.getRawData(),
  ap_int.getNumWords()};
 curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf));

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

https://github.com/satyajanga updated 
https://github.com/llvm/llvm-project/pull/150149

>From 766882f582904685fa5c216bbe88d1a0588c97aa Mon Sep 17 00:00:00 2001
From: satya janga 
Date: Tue, 22 Jul 2025 17:57:30 -0700
Subject: [PATCH] Zero extend APInt when piece size is bigger than the bitwidth

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: https://phabricator.intern.facebook.com/D78791142
---
 lldb/source/Expression/DWARFExpression.cpp|  7 ++-
 .../Expression/DWARFExpressionTest.cpp| 20 +++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 52891fcefd68b..a709574e96f98 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -1978,7 +1978,12 @@ llvm::Expected DWARFExpression::Evaluate(
 // grows to the nearest host integer type.
 llvm::APInt fail_value(1, 0, false);
 llvm::APInt ap_int = scalar.UInt128(fail_value);
-assert(ap_int.getBitWidth() >= bit_size);
+// We have seen a case where we have expression like:
+//  DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x28
+// here we are assuming the compiler was trying to zero
+// extend the value that we should append to the buffer.
+if (ap_int.getBitWidth() < bit_size)
+  ap_int.zext(bit_size);
 llvm::ArrayRef buf{ap_int.getRawData(),
  ap_int.getNumWords()};
 curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf));
diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp 
b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index fdc9bfae1876c..b2bafca5dd25b 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -358,6 +358,26 @@ TEST(DWARFExpression, DW_OP_piece) {
   llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
 
+TEST(DWARFExpression, DW_OP_piece_host_address) {
+  llvm::ArrayRef expr = {DW_OP_lit2, DW_OP_stack_value, DW_OP_piece,
+  40};
+  DataExtractor extractor(expr.data(), expr.size(), lldb::eByteOrderLittle, 4);
+
+  // This tests if ap_int is extended to the right width.
+  // expect 40*8 = 320 bits size.
+  llvm::Expected result =
+  DWARFExpression::Evaluate(nullptr, nullptr, nullptr, extractor, nullptr,
+lldb::eRegisterKindLLDB, nullptr, nullptr);
+  ASSERT_THAT_EXPECTED(result, llvm::Succeeded());
+  ASSERT_EQ(result->GetValueType(), Value::ValueType::HostAddress);
+  ASSERT_EQ(result->GetBuffer().GetByteSize(), 40);
+  const uint8_t *data = result->GetBuffer().GetBytes();
+  ASSERT_EQ(data[0], 2);
+  for (int i = 1; i < 40; i++) {
+ASSERT_EQ(data[i], 0);
+  }
+}
+
 TEST(DWARFExpression, DW_OP_implicit_value) {
   unsigned char bytes = 4;
 

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

https://github.com/satyajanga updated 
https://github.com/llvm/llvm-project/pull/150149

>From 0431e9a3404b45e95e737ecbcf92f222527a51cc Mon Sep 17 00:00:00 2001
From: satya janga 
Date: Tue, 22 Jul 2025 17:57:30 -0700
Subject: [PATCH] Zero extend APInt when piece size is bigger than the bitwidth

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: https://phabricator.intern.facebook.com/D78791142
---
 lldb/source/Expression/DWARFExpression.cpp|  7 ++-
 .../Expression/DWARFExpressionTest.cpp| 20 +++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 52891fcefd68b..c00795b97467b 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -1978,7 +1978,12 @@ llvm::Expected DWARFExpression::Evaluate(
 // grows to the nearest host integer type.
 llvm::APInt fail_value(1, 0, false);
 llvm::APInt ap_int = scalar.UInt128(fail_value);
-assert(ap_int.getBitWidth() >= bit_size);
+// We have seen a case where we have expression like:
+//  DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x28
+// here we are assuming the compiler was trying to zero
+// extend the value that we should append to the buffer.
+if (ap_int.getBitWidth() < bit_size)
+  ap_int = ap_int.zext(bit_size);
 llvm::ArrayRef buf{ap_int.getRawData(),
  ap_int.getNumWords()};
 curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf));
diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp 
b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index fdc9bfae1876c..b2bafca5dd25b 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -358,6 +358,26 @@ TEST(DWARFExpression, DW_OP_piece) {
   llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
 
+TEST(DWARFExpression, DW_OP_piece_host_address) {
+  llvm::ArrayRef expr = {DW_OP_lit2, DW_OP_stack_value, DW_OP_piece,
+  40};
+  DataExtractor extractor(expr.data(), expr.size(), lldb::eByteOrderLittle, 4);
+
+  // This tests if ap_int is extended to the right width.
+  // expect 40*8 = 320 bits size.
+  llvm::Expected result =
+  DWARFExpression::Evaluate(nullptr, nullptr, nullptr, extractor, nullptr,
+lldb::eRegisterKindLLDB, nullptr, nullptr);
+  ASSERT_THAT_EXPECTED(result, llvm::Succeeded());
+  ASSERT_EQ(result->GetValueType(), Value::ValueType::HostAddress);
+  ASSERT_EQ(result->GetBuffer().GetByteSize(), 40);
+  const uint8_t *data = result->GetBuffer().GetBytes();
+  ASSERT_EQ(data[0], 2);
+  for (int i = 1; i < 40; i++) {
+ASSERT_EQ(data[i], 0);
+  }
+}
+
 TEST(DWARFExpression, DW_OP_implicit_value) {
   unsigned char bytes = 4;
 

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

https://github.com/satyajanga updated 
https://github.com/llvm/llvm-project/pull/150149

>From 3cec63f6fab532765a3a9188988b957391e9c9eb Mon Sep 17 00:00:00 2001
From: satya janga 
Date: Tue, 22 Jul 2025 17:57:30 -0700
Subject: [PATCH] Zero extend APInt when piece size is bigger than the bitwidth

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: https://phabricator.intern.facebook.com/D78791142
---
 lldb/source/Expression/DWARFExpression.cpp|  7 ++-
 .../Expression/DWARFExpressionTest.cpp| 21 +++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 52891fcefd68b..c00795b97467b 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -1978,7 +1978,12 @@ llvm::Expected DWARFExpression::Evaluate(
 // grows to the nearest host integer type.
 llvm::APInt fail_value(1, 0, false);
 llvm::APInt ap_int = scalar.UInt128(fail_value);
-assert(ap_int.getBitWidth() >= bit_size);
+// We have seen a case where we have expression like:
+//  DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x28
+// here we are assuming the compiler was trying to zero
+// extend the value that we should append to the buffer.
+if (ap_int.getBitWidth() < bit_size)
+  ap_int = ap_int.zext(bit_size);
 llvm::ArrayRef buf{ap_int.getRawData(),
  ap_int.getNumWords()};
 curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf));
diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp 
b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index fdc9bfae1876c..86c3b56e320fd 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -358,6 +358,27 @@ TEST(DWARFExpression, DW_OP_piece) {
   llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
 
+TEST(DWARFExpression, DW_OP_piece_host_address) {
+  static const uint8_t expr_data[] = {DW_OP_lit2, DW_OP_stack_value,
+  DW_OP_piece, 40};
+  llvm::ArrayRef expr(expr_data, sizeof(expr_data));
+  DataExtractor extractor(expr.data(), expr.size(), lldb::eByteOrderLittle, 4);
+
+  // This tests if ap_int is extended to the right width.
+  // expect 40*8 = 320 bits size.
+  llvm::Expected result =
+  DWARFExpression::Evaluate(nullptr, nullptr, nullptr, extractor, nullptr,
+lldb::eRegisterKindDWARF, nullptr, nullptr);
+  ASSERT_THAT_EXPECTED(result, llvm::Succeeded());
+  ASSERT_EQ(result->GetValueType(), Value::ValueType::HostAddress);
+  ASSERT_EQ(result->GetBuffer().GetByteSize(), 40ul);
+  const uint8_t *data = result->GetBuffer().GetBytes();
+  ASSERT_EQ(data[0], 2);
+  for (int i = 1; i < 40; i++) {
+ASSERT_EQ(data[i], 0);
+  }
+}
+
 TEST(DWARFExpression, DW_OP_implicit_value) {
   unsigned char bytes = 4;
 

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

https://github.com/satyajanga created 
https://github.com/llvm/llvm-project/pull/150149

None

>From 1807c11e5f9de38a89073cf4846423bf7a8eb09e Mon Sep 17 00:00:00 2001
From: satya janga 
Date: Tue, 22 Jul 2025 17:57:30 -0700
Subject: [PATCH] Zero extend APInt when piece size is bigger than the bitwidth

---
 lldb/source/Expression/DWARFExpression.cpp | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 52891fcefd68b..a709574e96f98 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -1978,7 +1978,12 @@ llvm::Expected DWARFExpression::Evaluate(
 // grows to the nearest host integer type.
 llvm::APInt fail_value(1, 0, false);
 llvm::APInt ap_int = scalar.UInt128(fail_value);
-assert(ap_int.getBitWidth() >= bit_size);
+// We have seen a case where we have expression like:
+//  DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x28
+// here we are assuming the compiler was trying to zero
+// extend the value that we should append to the buffer.
+if (ap_int.getBitWidth() < bit_size)
+  ap_int.zext(bit_size);
 llvm::ArrayRef buf{ap_int.getRawData(),
  ap_int.getNumWords()};
 curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf));

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


[Lldb-commits] [lldb] [lldb] refactor PlatformAndroid (PR #145382)

2025-07-22 Thread Su Shi via lldb-commits


@@ -0,0 +1,162 @@
+//===-- AdbClientUtils.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 "lldb/Utility/Connection.h"
+#include "AdbClientUtils.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/Timeout.h"
+#include 
+#include 
+#include 

metacpp wrote:

May consider following Google C++ style on order of includes:
https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes


```suggestion
#include "AdbClientUtils.h"

#include 
#include 
#include 

#include "lldb/Utility/Connection.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Timeout.h"
```

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


[Lldb-commits] [lldb] [lldb] refactor PlatformAndroid (PR #145382)

2025-07-22 Thread Su Shi via lldb-commits

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


[Lldb-commits] [lldb] [lldb] refactor PlatformAndroid (PR #145382)

2025-07-22 Thread Su Shi via lldb-commits


@@ -0,0 +1,162 @@
+//===-- AdbClientUtils.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 "lldb/Utility/Connection.h"
+#include "AdbClientUtils.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/Timeout.h"
+#include 
+#include 
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::platform_android;
+using namespace std::chrono;
+
+namespace lldb_private {
+namespace platform_android {
+namespace adb_client_utils {
+

metacpp wrote:

```suggestion

using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::platform_android;
using namespace std::chrono;

```

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


[Lldb-commits] [lldb] [lldb] refactor PlatformAndroid (PR #145382)

2025-07-22 Thread Su Shi via lldb-commits


@@ -0,0 +1,162 @@
+//===-- AdbClientUtils.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 "lldb/Utility/Connection.h"
+#include "AdbClientUtils.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/Timeout.h"
+#include 
+#include 
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::platform_android;
+using namespace std::chrono;

metacpp wrote:

```suggestion
```

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


[Lldb-commits] [lldb] [lldb] refactor PlatformAndroid (PR #145382)

2025-07-22 Thread Su Shi via lldb-commits


@@ -0,0 +1,162 @@
+//===-- AdbClientUtils.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 "lldb/Utility/Connection.h"
+#include "AdbClientUtils.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/Timeout.h"
+#include 
+#include 
+#include 
+
+using namespace lldb;

metacpp wrote:

```suggestion
```

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


[Lldb-commits] [lldb] [lldb] account for registers being host endian when casting values (PR #150011)

2025-07-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

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

Follow up to https://github.com/llvm/llvm-project/pull/148836
which fixed some of this issue but not all of it. 

Our Value/ValueObject system does not store the endian directly
in the values. Instead it assumes that the endian of the result
of a cast can be assumed to be the target's endian, or the host
but only as a fallback. It assumes the place it is copying from
is also that endian.

This breaks down when you have register values. These are always
host endian and continue to be when cast. Casting them to big 
endian when on a little endian host breaks certain calls like
GetValueAsUnsigned.

To fix this, check the context of the value. If it has a register
context, always treat it as host endian and make the result host
endian.

I had an alternative where I passed an "is_register" flag into
all calls to this, but it felt like a layering violation and changed
many more lines.

This solution isn't much more robust, but it works for all the test
cases I know of. Perhaps you can create a register value without
a RegisterInfo backing it, but I don't know of a way myself.

For testing, I had to add a minimal program file for each arch
so that there is a type system to support the casting. This is
generated from YAML since we only need the machine and endian
to be set.

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


3 Files Affected:

- (modified) lldb/source/Core/Value.cpp (+4-1) 
- (modified) lldb/source/Expression/Materializer.cpp (+11-14) 
- (added) lldb/test/API/commands/expression/TestRegisterExpressionEndian.py 
(+128) 


``diff
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index c91b3f852f986..ff37c87f5dd6a 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -496,7 +496,10 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, 
DataExtractor &data,
 if (exe_ctx) {
   Target *target = exe_ctx->GetTargetPtr();
   if (target) {
-data.SetByteOrder(target->GetArchitecture().GetByteOrder());
+// Registers are always stored in host endian.
+data.SetByteOrder(m_context_type == ContextType::RegisterInfo
+  ? endian::InlHostByteOrder()
+  : target->GetArchitecture().GetByteOrder());
 
data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
 break;
   }
diff --git a/lldb/source/Expression/Materializer.cpp 
b/lldb/source/Expression/Materializer.cpp
index 17ea1596806d0..8fc3df1360824 100644
--- a/lldb/source/Expression/Materializer.cpp
+++ b/lldb/source/Expression/Materializer.cpp
@@ -1376,29 +1376,26 @@ class EntityRegister : public Materializer::Entity {
   return;
 }
 
-DataExtractor register_data;
-
-if (!reg_value.GetData(register_data)) {
-  err = Status::FromErrorStringWithFormat(
-  "couldn't get the data for register %s", m_register_info.name);
-  return;
-}
-
-if (register_data.GetByteSize() != m_register_info.byte_size) {
+if (reg_value.GetByteSize() != m_register_info.byte_size) {
   err = Status::FromErrorStringWithFormat(
   "data for register %s had size %llu but we expected %llu",
-  m_register_info.name, (unsigned long 
long)register_data.GetByteSize(),
+  m_register_info.name, (unsigned long long)reg_value.GetByteSize(),
   (unsigned long long)m_register_info.byte_size);
   return;
 }
 
-m_register_contents = std::make_shared(
-register_data.GetDataStart(), register_data.GetByteSize());
+lldb_private::DataBufferHeap buf(reg_value.GetByteSize(), 0);
+reg_value.GetAsMemoryData(m_register_info, buf.GetBytes(),
+  buf.GetByteSize(), map.GetByteOrder(), err);
+if (!err.Success())
+  return;
+
+m_register_contents = std::make_shared(buf);
 
 Status write_error;
 
-map.WriteMemory(load_addr, register_data.GetDataStart(),
-register_data.GetByteSize(), write_error);
+map.WriteMemory(load_addr, buf.GetBytes(), reg_value.GetByteSize(),
+write_error);
 
 if (!write_error.Success()) {
   err = Status::FromErrorStringWithFormat(
diff --git a/lldb/test/API/commands/expression/TestRegisterExpressionEndian.py 
b/lldb/test/API/commands/expression/TestRegisterExpressionEndian.py
new file mode 100644
index 0..d6de8731385b6
--- /dev/null
+++ b/lldb/test/API/commands/expression/TestRegisterExpressionEndian.py
@@ -0,0 +1,128 @@
+""" Check that registers written to memory for expression evaluation are
+written using the target's endian not the host's.
+"""
+
+from enum import Enum
+from textwrap import dedent
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test.gdbclientutils impo

[Lldb-commits] [lldb] [lldb] account for registers being host endian when casting values (PR #150011)

2025-07-22 Thread David Spickett via lldb-commits

DavidSpickett wrote:

First commit is https://github.com/llvm/llvm-project/pull/148836, please review 
the second onward.

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


[Lldb-commits] [lldb] [lldb] account for registers being host endian when casting values (PR #150011)

2025-07-22 Thread David Spickett via lldb-commits

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

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

Follow up to https://github.com/llvm/llvm-project/pull/148836
which fixed some of this issue but not all of it. 

Our Value/ValueObject system does not store the endian directly
in the values. Instead it assumes that the endian of the result
of a cast can be assumed to be the target's endian, or the host
but only as a fallback. It assumes the place it is copying from
is also that endian.

This breaks down when you have register values. These are always
host endian and continue to be when cast. Casting them to big 
endian when on a little endian host breaks certain calls like
GetValueAsUnsigned.

To fix this, check the context of the value. If it has a register
context, always treat it as host endian and make the result host
endian.

I had an alternative where I passed an "is_register" flag into
all calls to this, but it felt like a layering violation and changed
many more lines.

This solution isn't much more robust, but it works for all the test
cases I know of. Perhaps you can create a register value without
a RegisterInfo backing it, but I don't know of a way myself.

For testing, I had to add a minimal program file for each arch
so that there is a type system to support the casting. This is
generated from YAML since we only need the machine and endian
to be set.

>From 8bd469e89162bb08ec1b643227564906a548cc47 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Mon, 14 Jul 2025 14:24:14 +
Subject: [PATCH 1/2] [lldb] Convert registers values into target endian for
 expressions

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

Where it was reported that reading the PC using "register read" had
different results to an expression "$pc".

This was happening because registers are treated in lldb as pure
"values" that don't really have an endian. We have to store them
somewhere on the host of course, so the endian becomes host endian.

When you want to use a register as a value in an expression you're
pretending that it's a variable in memory. In target memory.
Therefore we must convert the register value to that endian
before use.

The test I have added is based on the one used for XML register
flags. Where I fake an AArch64 little endian and an s390x big
endian target. I set up the data in such a way the pc value
should print the same for both, either with register read or
an expression.

I considered just adding a live process test that checks the
two are the same but with on one doing cross endian testing,
I doubt it would have ever caught this bug.

Simulating this means most of the time, little endian hosts
will test little to little and little to big. In the minority
of cases with a big endian host, they'll check the reverse.
Covering all the combinations.
---
 lldb/source/Expression/Materializer.cpp   | 25 +++---
 .../TestRegisterExpressionEndian.py   | 86 +++
 2 files changed, 97 insertions(+), 14 deletions(-)
 create mode 100644 
lldb/test/API/commands/expression/TestRegisterExpressionEndian.py

diff --git a/lldb/source/Expression/Materializer.cpp 
b/lldb/source/Expression/Materializer.cpp
index 17ea1596806d0..8fc3df1360824 100644
--- a/lldb/source/Expression/Materializer.cpp
+++ b/lldb/source/Expression/Materializer.cpp
@@ -1376,29 +1376,26 @@ class EntityRegister : public Materializer::Entity {
   return;
 }
 
-DataExtractor register_data;
-
-if (!reg_value.GetData(register_data)) {
-  err = Status::FromErrorStringWithFormat(
-  "couldn't get the data for register %s", m_register_info.name);
-  return;
-}
-
-if (register_data.GetByteSize() != m_register_info.byte_size) {
+if (reg_value.GetByteSize() != m_register_info.byte_size) {
   err = Status::FromErrorStringWithFormat(
   "data for register %s had size %llu but we expected %llu",
-  m_register_info.name, (unsigned long 
long)register_data.GetByteSize(),
+  m_register_info.name, (unsigned long long)reg_value.GetByteSize(),
   (unsigned long long)m_register_info.byte_size);
   return;
 }
 
-m_register_contents = std::make_shared(
-register_data.GetDataStart(), register_data.GetByteSize());
+lldb_private::DataBufferHeap buf(reg_value.GetByteSize(), 0);
+reg_value.GetAsMemoryData(m_register_info, buf.GetBytes(),
+  buf.GetByteSize(), map.GetByteOrder(), err);
+if (!err.Success())
+  return;
+
+m_register_contents = std::make_shared(buf);
 
 Status write_error;
 
-map.WriteMemory(load_addr, register_data.GetDataStart(),
-register_data.GetByteSize(), write_error);
+map.WriteMemory(load_addr, buf.GetBytes(), reg_value.GetByteSize(),
+write_error);
 
 if (!write_error.Success()) {
   err = Status::FromErrorStringWithFormat(
diff --git a/lldb/test/API/command

[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits

https://github.com/award999 updated 
https://github.com/llvm/llvm-project/pull/146884

>From 53e2d9d5290b45d54c364f5b0dc04f5905d49cf9 Mon Sep 17 00:00:00 2001
From: Adam Ward 
Date: Thu, 3 Jul 2025 09:13:41 -0400
Subject: [PATCH] Logging setup for lldb-dap extension

- Add `winston` dependency (MIT license) to handle logging setup
- Have an `OutputChannel` to log user facing information, errors, warnings
- Write a verose log under the provided `logUri` to capture further diagnostics
- Introduce `verboseLogging` setting to increase `OutputChannel` verbosity and 
write DAP session logs

Issue: #146880
---
 lldb/tools/lldb-dap/package-lock.json | 242 +-
 lldb/tools/lldb-dap/package.json  |   9 +-
 .../lldb-dap/src-ts/debug-adapter-factory.ts  |  37 ++-
 .../src-ts/debug-configuration-provider.ts|  11 +-
 .../lldb-dap/src-ts/debug-session-tracker.ts  |  13 +-
 lldb/tools/lldb-dap/src-ts/extension.ts   |  21 +-
 lldb/tools/lldb-dap/src-ts/logger.ts  |  88 +++
 7 files changed, 404 insertions(+), 17 deletions(-)
 create mode 100644 lldb/tools/lldb-dap/src-ts/logger.ts

diff --git a/lldb/tools/lldb-dap/package-lock.json 
b/lldb/tools/lldb-dap/package-lock.json
index af90a9573aee6..f9f071ae7e41a 100644
--- a/lldb/tools/lldb-dap/package-lock.json
+++ b/lldb/tools/lldb-dap/package-lock.json
@@ -15,7 +15,9 @@
 "@vscode/vsce": "^3.2.2",
 "prettier": "^3.4.2",
 "prettier-plugin-curly": "^0.3.1",
-"typescript": "^5.7.3"
+"typescript": "^5.7.3",
+"winston": "^3.17.0",
+"winston-transport": "^4.9.0"
   },
   "engines": {
 "vscode": "^1.75.0"
@@ -318,6 +320,28 @@
 "node": ">=6.9.0"
   }
 },
+"node_modules/@colors/colors": {
+  "version": "1.6.0",
+  "resolved": 
"https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz";,
+  "integrity": 
"sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==",
+  "dev": true,
+  "license": "MIT",
+  "engines": {
+"node": ">=0.1.90"
+  }
+},
+"node_modules/@dabh/diagnostics": {
+  "version": "2.0.3",
+  "resolved": 
"https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz";,
+  "integrity": 
"sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"colorspace": "1.1.x",
+"enabled": "2.0.x",
+"kuler": "^2.0.0"
+  }
+},
 "node_modules/@isaacs/cliui": {
   "version": "8.0.2",
   "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz";,
@@ -399,6 +423,13 @@
 "undici-types": "~5.26.4"
   }
 },
+"node_modules/@types/triple-beam": {
+  "version": "1.3.5",
+  "resolved": 
"https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz";,
+  "integrity": 
"sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==",
+  "dev": true,
+  "license": "MIT"
+},
 "node_modules/@types/vscode": {
   "version": "1.75.0",
   "resolved": 
"https://registry.npmjs.org/@types/vscode/-/vscode-1.75.0.tgz";,
@@ -642,6 +673,13 @@
   "dev": true,
   "license": "Python-2.0"
 },
+"node_modules/async": {
+  "version": "3.2.6",
+  "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz";,
+  "integrity": 
"sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
+  "dev": true,
+  "license": "MIT"
+},
 "node_modules/asynckit": {
   "version": "0.4.0",
   "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz";,
@@ -858,6 +896,17 @@
 "node": ">=16"
   }
 },
+"node_modules/color": {
+  "version": "3.2.1",
+  "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz";,
+  "integrity": 
"sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"color-convert": "^1.9.3",
+"color-string": "^1.6.0"
+  }
+},
 "node_modules/color-convert": {
   "version": "1.9.3",
   "resolved": 
"https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz";,
@@ -873,6 +922,28 @@
   "integrity": 
"sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
   "dev": true
 },
+"node_modules/color-string": {
+  "version": "1.9.1",
+  "resolved": 
"https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz";,
+  "integrity": 
"sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"color-name": "^1.0.0",
+"simple-swizzle"

[Lldb-commits] [lldb] f78c4ce - [LLDB] Add formatters for MSVC STL std::atomic (#149801)

2025-07-22 Thread via lldb-commits

Author: nerix
Date: 2025-07-22T12:34:26+01:00
New Revision: f78c4ce55bc4c47625d0e780f38522938920e329

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

LOG: [LLDB] Add formatters for MSVC STL std::atomic (#149801)

Adds synthetic children and a summary provider for `std::atomic` on
MSVC's STL. This currently only supports DWARF because it relies on the
template argument. Once there are PDB tests, this will probably use the
return type of some method like `value()` because template types aren't
available there.

Towards #24834.

Added: 
lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp

Modified: 
lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index e1dd5bf84d7eb..1eaa6fe0e56dd 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -34,6 +34,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   LibStdcppTuple.cpp
   LibStdcppUniquePointer.cpp
   MsvcStl.cpp
+  MsvcStlAtomic.cpp
   MsvcStlSmartPointer.cpp
   MsvcStlTuple.cpp
   MsvcStlVariant.cpp

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 481fe6106849c..1a101cefe11e4 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1780,6 +1780,9 @@ static void 
LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   .SetDontShowValue(false)
   .SetShowMembersOneLiner(false)
   .SetHideItemNames(false);
+  SyntheticChildren::Flags stl_synth_flags;
+  stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(
+  false);
 
   using StringElementType = StringPrinter::StringElementType;
 
@@ -1801,6 +1804,16 @@ static void 
LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_summary_flags,
   MsvcStlStringSummaryProvider,
   "MSVC STL std::u32string summary provider"));
+
+  stl_summary_flags.SetDontShowChildren(false);
+
+  AddCXXSynthetic(cpp_category_sp, MsvcStlAtomicSyntheticFrontEndCreator,
+  "MSVC STL std::atomic synthetic children",
+  "^std::atomic<.+>$", stl_synth_flags, true);
+
+  AddCXXSummary(cpp_category_sp, MsvcStlAtomicSummaryProvider,
+"MSVC STL std::atomic summary provider", "^std::atomic<.+>$",
+stl_summary_flags, true);
 }
 
 static void LoadSystemFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h 
b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
index 9058d2e579adb..fd1b476d8a6b5 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
@@ -79,6 +79,13 @@ SyntheticChildrenFrontEnd *
 MsvcStlVariantSyntheticFrontEndCreator(CXXSyntheticChildren *,
lldb::ValueObjectSP valobj_sp);
 
+// MSVC STL std::atomic<>
+bool MsvcStlAtomicSummaryProvider(ValueObject &valobj, Stream &stream,
+  const TypeSummaryOptions &options);
+SyntheticChildrenFrontEnd *
+MsvcStlAtomicSyntheticFrontEndCreator(CXXSyntheticChildren *,
+  lldb::ValueObjectSP valobj_sp);
+
 } // namespace formatters
 } // namespace lldb_private
 

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
new file mode 100644
index 0..3ec324577ac76
--- /dev/null
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
@@ -0,0 +1,102 @@
+//===-- MsvcStlAtomic.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 "MsvcStl.h"
+
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+
+namespace lldb_private {
+namespace formatters {
+
+class MsvcStlAtomicSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlAtomicSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  llvm::Expected CalculateNumChildren() overrid

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)

2025-07-22 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] d544005 - [lldb-dap] Allow returning multiple breakpoints in "stopped" event (#149133)

2025-07-22 Thread via lldb-commits

Author: Stephen Tozer
Date: 2025-07-22T12:43:08+01:00
New Revision: d54400559bb6181566030d5f99c6716ea2b2f0a9

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

LOG: [lldb-dap] Allow returning multiple breakpoints in "stopped" event 
(#149133)

Currently, the "stopped" event returned when a breakpoint is hit will
always return only the ID of first breakpoint returned from
`GetStopReasonDataAtIndex`. This is slightly different from the
behaviour in `lldb`, where multiple breakpoints can exist at a single
instruction address and all are returned as part of the stop reason when
that address is hit.

This patch allows all multiple hit breakpoints to be returned in the
"stopped" event, both in the hitBreakpointIds field and in the
description, using the same formatting as lldb e.g. "breakpoint 1.1
2.1". I'm not aware of any effect this will have on debugger plugins; as
far as I can tell, it makes no difference within the VS Code UI - this
just fixes a minor issue encountered while writing an `lldb-dap` backend
for Dexter.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
lldb/test/API/tools/lldb-dap/breakpoint/main.cpp
lldb/tools/lldb-dap/JSONUtils.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index d823126e3e2fd..1567462839748 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -173,6 +173,28 @@ def verify_breakpoint_hit(self, breakpoint_ids, 
timeout=DEFAULT_TIMEOUT):
 return
 self.assertTrue(False, f"breakpoint not hit, 
stopped_events={stopped_events}")
 
+def verify_all_breakpoints_hit(self, breakpoint_ids, 
timeout=DEFAULT_TIMEOUT):
+"""Wait for the process we are debugging to stop, and verify we hit
+all of the breakpoint locations in the "breakpoint_ids" array.
+"breakpoint_ids" should be a list of int breakpoint IDs ([1, 2])."""
+stopped_events = self.dap_server.wait_for_stopped(timeout)
+for stopped_event in stopped_events:
+if "body" in stopped_event:
+body = stopped_event["body"]
+if "reason" not in body:
+continue
+if (
+body["reason"] != "breakpoint"
+and body["reason"] != "instruction breakpoint"
+):
+continue
+if "hitBreakpointIds" not in body:
+continue
+hit_bps = body["hitBreakpointIds"]
+if all(breakpoint_id in hit_bps for breakpoint_id in 
breakpoint_ids):
+return
+self.assertTrue(False, f"breakpoints not hit, 
stopped_events={stopped_events}")
+
 def verify_stop_exception_info(self, expected_description, 
timeout=DEFAULT_TIMEOUT):
 """Wait for the process we are debugging to stop, and verify the stop
 reason is 'exception' and that the description matches

diff  --git a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py 
b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
index 831edd6494c1e..2e860ff5d5e17 100644
--- a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
+++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
@@ -398,3 +398,26 @@ def test_column_breakpoints(self):
 self.stepIn()
 func_name = self.get_stackFrames()[0]["name"]
 self.assertEqual(func_name, "a::fourteen(int)")
+
+@skipIfWindows
+def test_hit_multiple_breakpoints(self):
+"""Test that if we hit multiple breakpoints at the same address, they
+all appear in the stop reason."""
+breakpoint_lines = [
+line_number("main.cpp", "// break non-breakpointable line"),
+line_number("main.cpp", "// before loop"),
+]
+
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program)
+
+# Set a pair of breakpoints that will both resolve to the same address.
+breakpoint_ids = [
+int(bp_id)
+for bp_id in self.set_source_breakpoints(self.main_path, 
breakpoint_lines)
+]
+self.assertEqual(len(breakpoint_ids), 2, "expected two breakpoints")
+self.dap_server.request_continue()
+print(breakpoint_ids)
+# Verify we hit both of the breakpoints we just set
+self.verify_all_breakpoints_hit(breakpoint_ids)

diff  --git a/lldb/test/API/tools/lldb-dap/breakpoi

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL map-like types (PR #148385)

2025-07-22 Thread via lldb-commits

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

>From 4a4fba10e509facb73ff71c628656f27ad1bfd85 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Sat, 12 Jul 2025 18:44:51 +0200
Subject: [PATCH] [LLDB] Add formatters for MSVC STL map-like types

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  56 ++-
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |  11 +
 .../Language/CPlusPlus/MsvcStlTree.cpp| 407 ++
 .../generic/map/TestDataFormatterStdMap.py|  11 +-
 .../data-formatter-stl/generic/map/main.cpp   |   2 +
 .../TestDataFormatterGenericMultiMap.py   |  18 +-
 .../TestDataFormatterGenericMultiSet.py   |  32 +-
 .../set/TestDataFormatterGenericSet.py|  33 +-
 .../data-formatter-stl/generic/set/main.cpp   |   2 +-
 10 files changed, 528 insertions(+), 45 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlTree.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index ab9d991fd48f7..c10aa7482594c 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -36,6 +36,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   MsvcStl.cpp
   MsvcStlAtomic.cpp
   MsvcStlSmartPointer.cpp
+  MsvcStlTree.cpp
   MsvcStlTuple.cpp
   MsvcStlUnordered.cpp
   MsvcStlVariant.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 80dc4609f9b66..16afe2e8fc0a5 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1409,7 +1409,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?map<.+> >(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::map<.+> >(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
@@ -1419,17 +1419,17 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?set<.+> >(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::set<.+> >(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?multimap<.+> >(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::multimap<.+> >(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?multiset<.+> >(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::multiset<.+> >(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
@@ -1462,15 +1462,15 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "libstdc++ std::__debug::vector summary provider",
 "^std::__debug::vector<.+>(( )?&)?$", stl_summary_flags, true);
 
-  AddCXXSummary(
-  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
-  "libstdc++ std::map summary provider",
-  "^std::(__debug::)?map<.+> >(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp,
+lldb_private::formatters::ContainerSizeSummaryProvider,
+"libstdc++ std::map summary provider",
+"^std::__debug::map<.+> >(( )?&)?$", stl_summary_flags, true);
 
-  AddCXXSummary(
-  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
-  "libstdc++ std::set summary provider",
-  "^std::(__debug::)?set<.+> >(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp,
+lldb_private::formatters::ContainerSizeSummaryProvider,
+"libstdc++ std::set summary provider",
+"^std::__debug::set<.+> >(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(
   cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
@@ -1480,12 +1480,12 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSummary(
   cpp_category_sp, l

[Lldb-commits] [lldb] [LLDB][NativePDB] Allow type lookup in namespaces (PR #149876)

2025-07-22 Thread via lldb-commits

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

>From fa3c96b19ba174904036b031015a073cfd759c76 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Mon, 21 Jul 2025 20:32:58 +0200
Subject: [PATCH 1/3] [LLDB][NativePDB] Allow type lookup in namespaces

---
 .../NativePDB/SymbolFileNativePDB.cpp |  58 -
 .../NativePDB/SymbolFileNativePDB.h   |   4 +
 lldb/source/Symbol/Type.cpp   |   8 +-
 .../Inputs/namespace-access.lldbinit  |  18 +++
 .../SymbolFile/NativePDB/namespace-access.cpp | 114 ++
 5 files changed, 196 insertions(+), 6 deletions(-)
 create mode 100644 
lldb/test/Shell/SymbolFile/NativePDB/Inputs/namespace-access.lldbinit
 create mode 100644 lldb/test/Shell/SymbolFile/NativePDB/namespace-access.cpp

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 20d8c1acf9c42..5141632649dd5 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1630,6 +1630,53 @@ size_t SymbolFileNativePDB::ParseSymbolArrayInScope(
   return count;
 }
 
+void SymbolFileNativePDB::CacheTypeNames() {
+  if (!m_type_base_names.IsEmpty())
+return;
+
+  LazyRandomTypeCollection &types = m_index->tpi().typeCollection();
+  for (auto ti = types.getFirst(); ti; ti = types.getNext(*ti)) {
+CVType cvt = types.getType(*ti);
+llvm::StringRef name;
+// We are only interested in records, unions, and enums.
+// We aren't interested in forward references as we'll visit the actual
+// type later anyway.
+switch (cvt.kind()) {
+case LF_STRUCTURE:
+case LF_CLASS: {
+  ClassRecord cr;
+  llvm::cantFail(TypeDeserializer::deserializeAs(cvt, cr));
+  if (cr.isForwardRef())
+continue;
+  name = cr.Name;
+} break;
+case LF_UNION: {
+  UnionRecord ur;
+  llvm::cantFail(TypeDeserializer::deserializeAs(cvt, ur));
+  if (ur.isForwardRef())
+continue;
+  name = ur.Name;
+} break;
+case LF_ENUM: {
+  EnumRecord er;
+  llvm::cantFail(TypeDeserializer::deserializeAs(cvt, er));
+  if (er.isForwardRef())
+continue;
+  name = er.Name;
+} break;
+default:
+  continue;
+}
+if (name.empty())
+  continue;
+
+auto base_name = MSVCUndecoratedNameParser::DropScope(name);
+m_type_base_names.Append(ConstString(base_name), ti->getIndex());
+  }
+
+  m_type_base_names.Sort();
+}
+
 void SymbolFileNativePDB::DumpClangAST(Stream &s, llvm::StringRef filter) {
   auto ts_or_err = GetTypeSystemForLanguage(eLanguageTypeC_plus_plus);
   if (!ts_or_err)
@@ -1720,11 +1767,14 @@ void SymbolFileNativePDB::FindTypes(const 
lldb_private::TypeQuery &query,
 
   std::lock_guard guard(GetModuleMutex());
 
-  std::vector matches =
-  m_index->tpi().findRecordsByName(query.GetTypeBasename().GetStringRef());
+  // We can't query for the basename or full name because the type might reside
+  // in an anonymous namespace. Cache the basenames first.
+  CacheTypeNames();
+  std::vector matches;
+  m_type_base_names.GetValues(query.GetTypeBasename(), matches);
 
-  for (TypeIndex type_idx : matches) {
-TypeSP type_sp = GetOrCreateType(type_idx);
+  for (uint32_t match_idx : matches) {
+TypeSP type_sp = GetOrCreateType(TypeIndex(match_idx));
 if (!type_sp)
   continue;
 
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index 9891313f11d0b..457b301c4a486 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -258,6 +258,8 @@ class SymbolFileNativePDB : public SymbolFileCommon {
 
   void ParseInlineSite(PdbCompilandSymId inline_site_id, Address func_addr);
 
+  void CacheTypeNames();
+
   llvm::BumpPtrAllocator m_allocator;
 
   lldb::addr_t m_obj_load_address = 0;
@@ -278,6 +280,8 @@ class SymbolFileNativePDB : public SymbolFileCommon {
   llvm::DenseMap> m_inline_sites;
   llvm::DenseMap
   m_parent_types;
+
+  lldb_private::UniqueCStringMap m_type_base_names;
 };
 
 } // namespace npdb
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 0a886e56100a1..ddb22d611140b 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -134,7 +134,9 @@ bool TypeQuery::ContextMatches(
 if (ctx == ctx_end)
   return false; // Pattern too long.
 
-if (ctx->kind == CompilerContextKind::Namespace && ctx->name.IsEmpty()) {
+if ((ctx->kind & CompilerContextKind::Namespace) ==
+CompilerContextKind::Namespace &&
+ctx->name.IsEmpty()) {
   // We're matching an anonymous namespace. These are optional, so we check
   // if the pattern expects an anonymous namespace.
   if (pat->name

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)

2025-07-22 Thread via lldb-commits

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

>From 54b41743cfaf96d0c4f1a1ec292ea217a9da37ee Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Fri, 18 Jul 2025 16:08:04 +0200
Subject: [PATCH 1/2] [LLDB] Add formatters for MSVC STL unordered containers

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |  1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  | 28 ++--
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |  6 ++
 .../Language/CPlusPlus/MsvcStlUnordered.cpp   | 69 +++
 .../TestDataFormatterGenericUnordered.py  | 18 +++--
 5 files changed, 111 insertions(+), 11 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlUnordered.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 1eaa6fe0e56dd..d4ad135d439b2 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -39,6 +39,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   MsvcStlTuple.cpp
   MsvcStlVariant.cpp
   MsvcStlVector.cpp
+  MsvcStlUnordered.cpp
   MSVCUndecoratedNameParser.cpp
 
   LINK_COMPONENTS
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 1a101cefe11e4..80dc4609f9b66 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1434,8 +1434,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
-  eFormatterMatchRegex,
+  "^std::__debug::unordered_(multi)?(map|set)<.+> >$", 
eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
@@ -1490,8 +1489,8 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::ContainerSizeSummaryProvider,
-"libstdc++ std unordered container summary provider",
-"^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
+"libstdc++ debug std unordered container summary provider",
+"^std::__debug::unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
 
   AddCXXSummary(
@@ -1660,6 +1659,19 @@ static bool GenericVariantSummaryProvider(ValueObject 
&valobj, Stream &stream,
   return LibStdcppVariantSummaryProvider(valobj, stream, options);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericUnorderedSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+ ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  if (IsMsvcStlUnordered(*valobj_sp))
+return MsvcStlUnorderedSyntheticFrontEndCreator(children, valobj_sp);
+  return new ScriptedSyntheticChildren::FrontEnd(
+  "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider",
+  *valobj_sp);
+}
+
 /// Load formatters that are formatting types from more than one STL
 static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   if (!cpp_category_sp)
@@ -1727,6 +1739,10 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSynthetic(cpp_category_sp, GenericVariantSyntheticFrontEndCreator,
   "std::variant synthetic children", "^std::variant<.*>$",
   stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericUnorderedSyntheticFrontEndCreator,
+  "std::unordered container synthetic children",
+  "^std::unordered_(multi)?(map|set)<.+> ?>$", stl_synth_flags,
+  true);
 
   SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
   stl_deref_flags.SetFrontEndWantsDereference();
@@ -1766,6 +1782,10 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSummary(cpp_category_sp, GenericVariantSummaryProvider,
 "MSVC STL/libstdc++ std::variant summary provider",
 "^std::variant<.*>$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstdc++ std unordered container summary provider",
+"^std::unordered_(multi)?(map|set)<.+> ?>$", stl_summary_flags,
+true);
 }
 
 static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h 
b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
index fd1b476d8a6b5..e2a015a537868 100644
--- a/lldb/sourc

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)

2025-07-22 Thread via lldb-commits

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

>From 54b41743cfaf96d0c4f1a1ec292ea217a9da37ee Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Fri, 18 Jul 2025 16:08:04 +0200
Subject: [PATCH 1/3] [LLDB] Add formatters for MSVC STL unordered containers

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |  1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  | 28 ++--
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |  6 ++
 .../Language/CPlusPlus/MsvcStlUnordered.cpp   | 69 +++
 .../TestDataFormatterGenericUnordered.py  | 18 +++--
 5 files changed, 111 insertions(+), 11 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlUnordered.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 1eaa6fe0e56dd..d4ad135d439b2 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -39,6 +39,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   MsvcStlTuple.cpp
   MsvcStlVariant.cpp
   MsvcStlVector.cpp
+  MsvcStlUnordered.cpp
   MSVCUndecoratedNameParser.cpp
 
   LINK_COMPONENTS
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 1a101cefe11e4..80dc4609f9b66 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1434,8 +1434,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
-  eFormatterMatchRegex,
+  "^std::__debug::unordered_(multi)?(map|set)<.+> >$", 
eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
@@ -1490,8 +1489,8 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::ContainerSizeSummaryProvider,
-"libstdc++ std unordered container summary provider",
-"^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
+"libstdc++ debug std unordered container summary provider",
+"^std::__debug::unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
 
   AddCXXSummary(
@@ -1660,6 +1659,19 @@ static bool GenericVariantSummaryProvider(ValueObject 
&valobj, Stream &stream,
   return LibStdcppVariantSummaryProvider(valobj, stream, options);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericUnorderedSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+ ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  if (IsMsvcStlUnordered(*valobj_sp))
+return MsvcStlUnorderedSyntheticFrontEndCreator(children, valobj_sp);
+  return new ScriptedSyntheticChildren::FrontEnd(
+  "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider",
+  *valobj_sp);
+}
+
 /// Load formatters that are formatting types from more than one STL
 static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   if (!cpp_category_sp)
@@ -1727,6 +1739,10 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSynthetic(cpp_category_sp, GenericVariantSyntheticFrontEndCreator,
   "std::variant synthetic children", "^std::variant<.*>$",
   stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericUnorderedSyntheticFrontEndCreator,
+  "std::unordered container synthetic children",
+  "^std::unordered_(multi)?(map|set)<.+> ?>$", stl_synth_flags,
+  true);
 
   SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
   stl_deref_flags.SetFrontEndWantsDereference();
@@ -1766,6 +1782,10 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSummary(cpp_category_sp, GenericVariantSummaryProvider,
 "MSVC STL/libstdc++ std::variant summary provider",
 "^std::variant<.*>$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstdc++ std unordered container summary provider",
+"^std::unordered_(multi)?(map|set)<.+> ?>$", stl_summary_flags,
+true);
 }
 
 static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h 
b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
index fd1b476d8a6b5..e2a015a537868 100644
--- a/lldb/sourc

[Lldb-commits] [lldb] [LLDB][NativePDB] Allow type lookup in namespaces (PR #149876)

2025-07-22 Thread Michael Buch via lldb-commits


@@ -0,0 +1,18 @@
+b main
+r
+
+type lookup S
+type lookup ::S
+type lookup Outer::S
+type lookup Outer::Inner1::S
+type lookup Inner1::S
+type lookup Outer::Inner1::Inner2::S
+type lookup Inner2::S
+type lookup Outer::Inner2::S
+type lookup Outer::A
+type lookup A
+type lookup ::A
+expr sizeof(S)
+expr sizeof(A)
+
+quit

Michael137 wrote:

Lets put these commands into the test file itself. You can use `split-file` for 
this. For example: 
https://github.com/llvm/llvm-project/blob/81651e9fd0a744423fc0435f199ef79fb3a91f02/lldb/test/Shell/Settings/TestFrameFormatFunctionScopeObjC.test#L4


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


[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)

2025-07-22 Thread via lldb-commits

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

>From 31193b5e76e238a030efb121edd47481db68a2cc Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Mon, 21 Jul 2025 13:36:44 +0200
Subject: [PATCH 1/2] [LLDB] Add formatters for MSVC STL std::atomic

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  14 +++
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   7 ++
 .../Language/CPlusPlus/MsvcStlAtomic.cpp  | 102 ++
 .../atomic/TestDataFormatterStdAtomic.py  |   6 ++
 5 files changed, 130 insertions(+)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index e1dd5bf84d7eb..1eaa6fe0e56dd 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -34,6 +34,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   LibStdcppTuple.cpp
   LibStdcppUniquePointer.cpp
   MsvcStl.cpp
+  MsvcStlAtomic.cpp
   MsvcStlSmartPointer.cpp
   MsvcStlTuple.cpp
   MsvcStlVariant.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 481fe6106849c..9d93f610fb0d8 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1780,6 +1780,9 @@ static void 
LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   .SetDontShowValue(false)
   .SetShowMembersOneLiner(false)
   .SetHideItemNames(false);
+  SyntheticChildren::Flags stl_synth_flags;
+  stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(
+  false);
 
   using StringElementType = StringPrinter::StringElementType;
 
@@ -1801,6 +1804,17 @@ static void 
LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_summary_flags,
   MsvcStlStringSummaryProvider,
   "MSVC STL std::u32string summary provider"));
+
+  stl_summary_flags.SetDontShowChildren(false);
+  stl_summary_flags.SetSkipPointers(false);
+
+  AddCXXSynthetic(cpp_category_sp, MsvcStlAtomicSyntheticFrontEndCreator,
+  "MSVC STL std::atomic synthetic children",
+  "^std::atomic<.+>$", stl_synth_flags, true);
+
+  AddCXXSummary(cpp_category_sp, MsvcStlAtomicSummaryProvider,
+"MSVC STL std::atomic summary provider", "^std::atomic<.+>$",
+stl_summary_flags, true);
 }
 
 static void LoadSystemFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h 
b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
index 9058d2e579adb..fd1b476d8a6b5 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
@@ -79,6 +79,13 @@ SyntheticChildrenFrontEnd *
 MsvcStlVariantSyntheticFrontEndCreator(CXXSyntheticChildren *,
lldb::ValueObjectSP valobj_sp);
 
+// MSVC STL std::atomic<>
+bool MsvcStlAtomicSummaryProvider(ValueObject &valobj, Stream &stream,
+  const TypeSummaryOptions &options);
+SyntheticChildrenFrontEnd *
+MsvcStlAtomicSyntheticFrontEndCreator(CXXSyntheticChildren *,
+  lldb::ValueObjectSP valobj_sp);
+
 } // namespace formatters
 } // namespace lldb_private
 
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
new file mode 100644
index 0..3ec324577ac76
--- /dev/null
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
@@ -0,0 +1,102 @@
+//===-- MsvcStlAtomic.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 "MsvcStl.h"
+
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+
+namespace lldb_private {
+namespace formatters {
+
+class MsvcStlAtomicSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlAtomicSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  llvm::Expected CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
+
+  lldb::ChildCacheState Update() override;
+
+  llvm::Expected GetIndexOfChildWithName(ConstString name) override;
+
+private:
+  ValueObject *m_storage = nullptr;
+  CompilerType m_element_type;
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+lldb_private::formatters::MsvcStlAtomicSyntheticFrontEnd::
+MsvcStlAtomicSy

[Lldb-commits] [lldb] 287b944 - [LLDB] Add formatters for MSVC STL unordered containers (#149519)

2025-07-22 Thread via lldb-commits

Author: nerix
Date: 2025-07-22T14:16:50+01:00
New Revision: 287b9447cc128d2218d148062d545a8633e37a4b

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

LOG: [LLDB] Add formatters for MSVC STL unordered containers (#149519)

Adds formatters for MSVC STL's unordered containers. This one is
relatively simple, because it can reuse the `std::list` synthetic
children. The unordered containers (aka
[`_Hash`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/xhash#L327))
contain a
[`_List`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/xhash#L2012)
which contains all elements (and is used for iterating through the
container).

Towards https://github.com/llvm/llvm-project/issues/24834.

Added: 
lldb/source/Plugins/Language/CPlusPlus/MsvcStlUnordered.cpp

Modified: 
lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 1eaa6fe0e56dd..ab9d991fd48f7 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -37,6 +37,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   MsvcStlAtomic.cpp
   MsvcStlSmartPointer.cpp
   MsvcStlTuple.cpp
+  MsvcStlUnordered.cpp
   MsvcStlVariant.cpp
   MsvcStlVector.cpp
   MSVCUndecoratedNameParser.cpp

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 1a101cefe11e4..80dc4609f9b66 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1434,8 +1434,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
-  eFormatterMatchRegex,
+  "^std::__debug::unordered_(multi)?(map|set)<.+> >$", 
eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
@@ -1490,8 +1489,8 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::ContainerSizeSummaryProvider,
-"libstdc++ std unordered container summary provider",
-"^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
+"libstdc++ debug std unordered container summary provider",
+"^std::__debug::unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
 
   AddCXXSummary(
@@ -1660,6 +1659,19 @@ static bool GenericVariantSummaryProvider(ValueObject 
&valobj, Stream &stream,
   return LibStdcppVariantSummaryProvider(valobj, stream, options);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericUnorderedSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+ ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  if (IsMsvcStlUnordered(*valobj_sp))
+return MsvcStlUnorderedSyntheticFrontEndCreator(children, valobj_sp);
+  return new ScriptedSyntheticChildren::FrontEnd(
+  "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider",
+  *valobj_sp);
+}
+
 /// Load formatters that are formatting types from more than one STL
 static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   if (!cpp_category_sp)
@@ -1727,6 +1739,10 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSynthetic(cpp_category_sp, GenericVariantSyntheticFrontEndCreator,
   "std::variant synthetic children", "^std::variant<.*>$",
   stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericUnorderedSyntheticFrontEndCreator,
+  "std::unordered container synthetic children",
+  "^std::unordered_(multi)?(map|set)<.+> ?>$", stl_synth_flags,
+  true);
 
   SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
   stl_deref_flags.SetFrontEndWantsDereference();
@@ -1766,6 +1782,10 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSumma

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)

2025-07-22 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [clang] [libcxxabi] [lldb] [llvm] [DRAFT] [lldb][Expression] Add structor variant to LLDB's function call labels (PR #149827)

2025-07-22 Thread Michael Buch via lldb-commits

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

>From fd6b6e8a3168fc233635e783773554ac980edb46 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 15 Nov 2024 01:59:36 +
Subject: [PATCH 1/6] [lldb][Expression] Encode Module and DIE UIDs into
 function AsmLabels

---
 lldb/include/lldb/Core/Module.h   |  4 +-
 lldb/include/lldb/Expression/Expression.h | 25 ++
 lldb/include/lldb/Symbol/SymbolFile.h | 14 
 lldb/include/lldb/Symbol/TypeSystem.h | 16 
 lldb/source/Core/Module.cpp   | 19 -
 lldb/source/Expression/Expression.cpp | 16 
 lldb/source/Expression/IRExecutionUnit.cpp| 74 +
 .../Clang/ClangExpressionDeclMap.cpp  |  2 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 43 ++
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 41 ++
 .../SymbolFile/DWARF/SymbolFileDWARF.h|  3 +
 .../SymbolFile/NativePDB/PdbAstBuilder.cpp|  6 +-
 .../NativePDB/UdtRecordCompleter.cpp  |  5 +-
 .../Plugins/SymbolFile/PDB/PDBASTParser.cpp   |  7 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  | 81 +--
 .../TypeSystem/Clang/TypeSystemClang.h| 11 ++-
 lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +--
 17 files changed, 335 insertions(+), 44 deletions(-)

diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 8bb55c95773bc..3991a12997541 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions {
 ///
 /// The module will parse more detailed information as more queries are made.
 class Module : public std::enable_shared_from_this,
-   public SymbolContextScope {
+   public SymbolContextScope,
+   public UserID {
 public:
   class LookupInfo;
   // Static functions that can track the lifetime of module objects. This is
@@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this,
   // using the "--global" (-g for short).
   static size_t GetNumberAllocatedModules();
 
+  static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid);
   static Module *GetAllocatedModuleAtIndex(size_t idx);
 
   static std::recursive_mutex &GetAllocationModuleCollectionMutex();
diff --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 8de9364436ccf..f32878c9bf876 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -96,6 +96,31 @@ class Expression {
  ///invalid.
 };
 
+/// Holds parsed information about a function call label that
+/// LLDB attaches as an AsmLabel to function AST nodes it parses
+/// from debug-info.
+///
+/// The format being:
+///
+///   :::
+///
+/// The label string needs to stay valid for the entire lifetime
+/// of this object.
+struct FunctionCallLabel {
+  llvm::StringRef m_lookup_name;
+  lldb::user_id_t m_module_id;
+
+  /// Mostly for debuggability.
+  lldb::user_id_t m_die_id;
+};
+
+/// LLDB attaches this prefix to mangled names of functions that it get called
+/// from JITted expressions.
+inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func";
+
+bool consumeFunctionCallLabelPrefix(llvm::StringRef &name);
+bool hasFunctionCallLabelPrefix(llvm::StringRef name);
+
 } // namespace lldb_private
 
 #endif // LLDB_EXPRESSION_EXPRESSION_H
diff --git a/lldb/include/lldb/Symbol/SymbolFile.h 
b/lldb/include/lldb/Symbol/SymbolFile.h
index e95f95553c17c..6aca276fc85b6 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -18,6 +18,7 @@
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/SourceModule.h"
+#include "lldb/Symbol/SymbolContext.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Symbol/TypeList.h"
 #include "lldb/Symbol/TypeSystem.h"
@@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface {
   GetMangledNamesForFunction(const std::string &scope_qualified_name,
  std::vector &mangled_names);
 
+  /// Resolves the function DIE identified by \c lookup_name within
+  /// this SymbolFile.
+  ///
+  /// \param[in,out] sc_list The resolved functions will be appended to this
+  /// list.
+  ///
+  /// \param[in] lookup_name The UID of the function DIE to resolve.
+  ///
+  virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list,
+ llvm::StringRef lookup_name) {
+return llvm::createStringError("Not implemented");
+  }
+
   virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope,
 lldb::TypeClass type_mask,
 lldb_private::TypeList &type_list) = 0;
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index cb1f0130b548d..742c09251ea2f 100644

[Lldb-commits] [lldb] [lldb][SBType] GetBasicType to unwrap canonical type (PR #149112)

2025-07-22 Thread Adrian Prantl via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Eliminate namespace lldb_private::dwarf (NFC) (PR #150073)

2025-07-22 Thread Jonas Devlieghere via lldb-commits

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

Eliminate the `lldb_private::dwarf` namespace, in favor of using `llvm::dwarf` 
directly. The latter is shorter, and this avoids ambiguity in the ABI plugins 
that define a `dwarf` namespace inside an anonymous namespace.

>From 51ac10094225d37681da37b56834e8a12cf81e92 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Tue, 22 Jul 2025 10:49:15 -0700
Subject: [PATCH] [lldb] Eliminate namespace lldb_private::dwarf (NFC)

Eliminate the `lldb_private::dwarf` namespace, in favor of using
`llvm::dwarf` directly. The latter is shorter, and this avoids ambiguity
in the ABI plugins that define a `dwarf` namespace inside an anonymous
namespace.
---
 lldb/include/lldb/Core/dwarf.h   |  6 --
 lldb/source/Expression/DWARFExpression.cpp   |  2 +-
 .../Plugins/SymbolFile/CTF/SymbolFileCTF.cpp |  2 +-
 .../Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp | 10 +-
 .../Plugins/SymbolFile/DWARF/DWARFASTParser.cpp  |  2 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp |  2 +-
 .../Plugins/SymbolFile/DWARF/DWARFAttribute.cpp  |  2 +-
 .../source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp |  2 +-
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp  |  2 +-
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.cpp |  2 +-
 .../Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp |  2 +-
 .../SymbolFile/DWARF/DWARFDeclContext.cpp|  2 +-
 .../Plugins/SymbolFile/DWARF/DWARFFormValue.cpp  | 16 
 .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp   |  2 +-
 .../SymbolFile/DWARF/DebugNamesDWARFIndex.cpp|  8 
 .../SymbolFile/DWARF/ManualDWARFIndex.cpp|  2 +-
 .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp |  2 +-
 .../SymbolFile/DWARF/UniqueDWARFASTType.cpp  |  2 +-
 .../PDB/PDBLocationToDWARFExpression.cpp |  2 +-
 .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp |  2 +-
 lldb/source/Symbol/DWARFCallFrameInfo.cpp|  2 +-
 lldb/source/Symbol/PostfixExpression.cpp |  2 +-
 .../unittests/Expression/DWARFExpressionTest.cpp |  2 +-
 .../SymbolFile/DWARF/DWARF64UnitTest.cpp |  2 +-
 .../DWARF/DWARFASTParserClangTests.cpp   |  2 +-
 lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp |  2 +-
 .../SymbolFile/DWARF/SymbolFileDWARFTests.cpp|  2 +-
 27 files changed, 40 insertions(+), 46 deletions(-)

diff --git a/lldb/include/lldb/Core/dwarf.h b/lldb/include/lldb/Core/dwarf.h
index 4de5c8f24db02..0663ec04e77fa 100644
--- a/lldb/include/lldb/Core/dwarf.h
+++ b/lldb/include/lldb/Core/dwarf.h
@@ -14,12 +14,6 @@
 // Get the DWARF constant definitions from llvm
 #include "llvm/BinaryFormat/Dwarf.h"
 
-namespace lldb_private {
-namespace dwarf {
-  using namespace llvm::dwarf;
-}
-}
-
 typedef llvm::dwarf::Attribute dw_attr_t;
 typedef llvm::dwarf::Form dw_form_t;
 typedef llvm::dwarf::Tag dw_tag_t;
diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 52891fcefd68b..79bc6c87fa9c5 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -41,8 +41,8 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace lldb_private::dwarf;
 using namespace lldb_private::plugin::dwarf;
+using namespace llvm::dwarf;
 
 // DWARFExpression constructor
 DWARFExpression::DWARFExpression() : m_data() {}
diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp 
b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index f4d032388a883..81c6731cafcd1 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -848,7 +848,7 @@ static DWARFExpression CreateDWARFExpression(ModuleSP 
module_sp,
   uint32_t byte_size = architecture.GetDataByteSize();
 
   StreamBuffer<32> stream(Stream::eBinary, address_size, byte_order);
-  stream.PutHex8(lldb_private::dwarf::DW_OP_addr);
+  stream.PutHex8(llvm::dwarf::DW_OP_addr);
   stream.PutMaxHex64(symbol.GetFileAddress(), address_size, byte_order);
 
   DataBufferSP buffer =
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index a00127b8e5580..4bfbb4d81f5da 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -15,10 +15,10 @@
 #include "lldb/Symbol/Function.h"
 #include "llvm/Support/DJB.h"
 
-using namespace lldb_private;
 using namespace lldb;
-using namespace lldb_private::dwarf;
+using namespace lldb_private;
 using namespace lldb_private::plugin::dwarf;
+using namespace llvm::dwarf;
 
 std::unique_ptr AppleDWARFIndex::Create(
 Module &module, DWARFDataExtractor apple_names,
@@ -80,7 +80,7 @@ static bool
 EntryHasMatchingQualhash(const llvm::AppleAcceleratorTable::Entry &entry,
  uint32_t expected_hash) {
   std::optional form_value =
-  entry.lookup(dw

[Lldb-commits] [lldb] [lldb] Eliminate namespace lldb_private::dwarf (NFC) (PR #150073)

2025-07-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Eliminate the `lldb_private::dwarf` namespace, in favor of using `llvm::dwarf` 
directly. The latter is shorter, and this avoids ambiguity in the ABI plugins 
that define a `dwarf` namespace inside an anonymous namespace.

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


27 Files Affected:

- (modified) lldb/include/lldb/Core/dwarf.h (-6) 
- (modified) lldb/source/Expression/DWARFExpression.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp (+5-5) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (+8-8) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
(+4-4) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp (+1-1) 
- (modified) 
lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp (+1-1) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+1-1) 
- (modified) lldb/source/Symbol/DWARFCallFrameInfo.cpp (+1-1) 
- (modified) lldb/source/Symbol/PostfixExpression.cpp (+1-1) 
- (modified) lldb/unittests/Expression/DWARFExpressionTest.cpp (+1-1) 
- (modified) lldb/unittests/SymbolFile/DWARF/DWARF64UnitTest.cpp (+1-1) 
- (modified) lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp 
(+1-1) 
- (modified) lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp (+1-1) 
- (modified) lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp (+1-1) 


``diff
diff --git a/lldb/include/lldb/Core/dwarf.h b/lldb/include/lldb/Core/dwarf.h
index 4de5c8f24db02..0663ec04e77fa 100644
--- a/lldb/include/lldb/Core/dwarf.h
+++ b/lldb/include/lldb/Core/dwarf.h
@@ -14,12 +14,6 @@
 // Get the DWARF constant definitions from llvm
 #include "llvm/BinaryFormat/Dwarf.h"
 
-namespace lldb_private {
-namespace dwarf {
-  using namespace llvm::dwarf;
-}
-}
-
 typedef llvm::dwarf::Attribute dw_attr_t;
 typedef llvm::dwarf::Form dw_form_t;
 typedef llvm::dwarf::Tag dw_tag_t;
diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 52891fcefd68b..79bc6c87fa9c5 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -41,8 +41,8 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace lldb_private::dwarf;
 using namespace lldb_private::plugin::dwarf;
+using namespace llvm::dwarf;
 
 // DWARFExpression constructor
 DWARFExpression::DWARFExpression() : m_data() {}
diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp 
b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index f4d032388a883..81c6731cafcd1 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -848,7 +848,7 @@ static DWARFExpression CreateDWARFExpression(ModuleSP 
module_sp,
   uint32_t byte_size = architecture.GetDataByteSize();
 
   StreamBuffer<32> stream(Stream::eBinary, address_size, byte_order);
-  stream.PutHex8(lldb_private::dwarf::DW_OP_addr);
+  stream.PutHex8(llvm::dwarf::DW_OP_addr);
   stream.PutMaxHex64(symbol.GetFileAddress(), address_size, byte_order);
 
   DataBufferSP buffer =
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index a00127b8e5580..4bfbb4d81f5da 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -15,10 +15,10 @@
 #include "lldb/Symbol/Function.h"
 #include "llvm/Support/DJB.h"
 
-using namespace lldb_private;
 using namespace lldb;
-using namespace lldb_private::dwarf;
+using namespace lldb_private;
 using namespace lldb_private::plugin::dwarf;
+using namespace llvm::dwarf;
 
 std::unique_ptr AppleDWARFIndex::Create(
 Module &module, DWARFDataExtractor apple_names,
@@ -80,7 +80,7 @@ static bool
 EntryHasMatchingQualhash(const llvm::AppleAcceleratorTable::Entry &entry,
  uint32_t expect

[Lldb-commits] [lldb] [lldb] Eliminate namespace lldb_private::dwarf (NFC) (PR #150073)

2025-07-22 Thread Adrian Prantl via lldb-commits

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


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


[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits

https://github.com/award999 updated 
https://github.com/llvm/llvm-project/pull/146884

>From 53e2d9d5290b45d54c364f5b0dc04f5905d49cf9 Mon Sep 17 00:00:00 2001
From: Adam Ward 
Date: Thu, 3 Jul 2025 09:13:41 -0400
Subject: [PATCH 1/3] Logging setup for lldb-dap extension

- Add `winston` dependency (MIT license) to handle logging setup
- Have an `OutputChannel` to log user facing information, errors, warnings
- Write a verose log under the provided `logUri` to capture further diagnostics
- Introduce `verboseLogging` setting to increase `OutputChannel` verbosity and 
write DAP session logs

Issue: #146880
---
 lldb/tools/lldb-dap/package-lock.json | 242 +-
 lldb/tools/lldb-dap/package.json  |   9 +-
 .../lldb-dap/src-ts/debug-adapter-factory.ts  |  37 ++-
 .../src-ts/debug-configuration-provider.ts|  11 +-
 .../lldb-dap/src-ts/debug-session-tracker.ts  |  13 +-
 lldb/tools/lldb-dap/src-ts/extension.ts   |  21 +-
 lldb/tools/lldb-dap/src-ts/logger.ts  |  88 +++
 7 files changed, 404 insertions(+), 17 deletions(-)
 create mode 100644 lldb/tools/lldb-dap/src-ts/logger.ts

diff --git a/lldb/tools/lldb-dap/package-lock.json 
b/lldb/tools/lldb-dap/package-lock.json
index af90a9573aee6..f9f071ae7e41a 100644
--- a/lldb/tools/lldb-dap/package-lock.json
+++ b/lldb/tools/lldb-dap/package-lock.json
@@ -15,7 +15,9 @@
 "@vscode/vsce": "^3.2.2",
 "prettier": "^3.4.2",
 "prettier-plugin-curly": "^0.3.1",
-"typescript": "^5.7.3"
+"typescript": "^5.7.3",
+"winston": "^3.17.0",
+"winston-transport": "^4.9.0"
   },
   "engines": {
 "vscode": "^1.75.0"
@@ -318,6 +320,28 @@
 "node": ">=6.9.0"
   }
 },
+"node_modules/@colors/colors": {
+  "version": "1.6.0",
+  "resolved": 
"https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz";,
+  "integrity": 
"sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==",
+  "dev": true,
+  "license": "MIT",
+  "engines": {
+"node": ">=0.1.90"
+  }
+},
+"node_modules/@dabh/diagnostics": {
+  "version": "2.0.3",
+  "resolved": 
"https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz";,
+  "integrity": 
"sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"colorspace": "1.1.x",
+"enabled": "2.0.x",
+"kuler": "^2.0.0"
+  }
+},
 "node_modules/@isaacs/cliui": {
   "version": "8.0.2",
   "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz";,
@@ -399,6 +423,13 @@
 "undici-types": "~5.26.4"
   }
 },
+"node_modules/@types/triple-beam": {
+  "version": "1.3.5",
+  "resolved": 
"https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz";,
+  "integrity": 
"sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==",
+  "dev": true,
+  "license": "MIT"
+},
 "node_modules/@types/vscode": {
   "version": "1.75.0",
   "resolved": 
"https://registry.npmjs.org/@types/vscode/-/vscode-1.75.0.tgz";,
@@ -642,6 +673,13 @@
   "dev": true,
   "license": "Python-2.0"
 },
+"node_modules/async": {
+  "version": "3.2.6",
+  "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz";,
+  "integrity": 
"sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
+  "dev": true,
+  "license": "MIT"
+},
 "node_modules/asynckit": {
   "version": "0.4.0",
   "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz";,
@@ -858,6 +896,17 @@
 "node": ">=16"
   }
 },
+"node_modules/color": {
+  "version": "3.2.1",
+  "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz";,
+  "integrity": 
"sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"color-convert": "^1.9.3",
+"color-string": "^1.6.0"
+  }
+},
 "node_modules/color-convert": {
   "version": "1.9.3",
   "resolved": 
"https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz";,
@@ -873,6 +922,28 @@
   "integrity": 
"sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
   "dev": true
 },
+"node_modules/color-string": {
+  "version": "1.9.1",
+  "resolved": 
"https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz";,
+  "integrity": 
"sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"color-name": "^1.0.0",
+"simple-swiz

[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits


@@ -156,16 +157,34 @@ async function getDAPArguments(
 .get("arguments", []);
 }
 
+/**
+ * Formats the given date as a string in the form "MMdd".
+ *
+ * @param date The date to format as a string.
+ * @returns The formatted date.
+ */
+function formatDate(date: Date): string {
+const year = date.getFullYear().toString().padStart(4, "0");
+const month = (date.getMonth() + 1).toString().padStart(2, "0");
+const day = date.getDate().toString().padStart(2, "0");
+const hour = date.getHours().toString().padStart(2, "0");
+const minute = date.getMinutes().toString().padStart(2, "0");
+const seconds = date.getSeconds().toString().padStart(2, "0");
+return year + month + day + hour + minute + seconds;

award999 wrote:

Done

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


[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits

https://github.com/award999 updated 
https://github.com/llvm/llvm-project/pull/146884

>From 53e2d9d5290b45d54c364f5b0dc04f5905d49cf9 Mon Sep 17 00:00:00 2001
From: Adam Ward 
Date: Thu, 3 Jul 2025 09:13:41 -0400
Subject: [PATCH 1/4] Logging setup for lldb-dap extension

- Add `winston` dependency (MIT license) to handle logging setup
- Have an `OutputChannel` to log user facing information, errors, warnings
- Write a verose log under the provided `logUri` to capture further diagnostics
- Introduce `verboseLogging` setting to increase `OutputChannel` verbosity and 
write DAP session logs

Issue: #146880
---
 lldb/tools/lldb-dap/package-lock.json | 242 +-
 lldb/tools/lldb-dap/package.json  |   9 +-
 .../lldb-dap/src-ts/debug-adapter-factory.ts  |  37 ++-
 .../src-ts/debug-configuration-provider.ts|  11 +-
 .../lldb-dap/src-ts/debug-session-tracker.ts  |  13 +-
 lldb/tools/lldb-dap/src-ts/extension.ts   |  21 +-
 lldb/tools/lldb-dap/src-ts/logger.ts  |  88 +++
 7 files changed, 404 insertions(+), 17 deletions(-)
 create mode 100644 lldb/tools/lldb-dap/src-ts/logger.ts

diff --git a/lldb/tools/lldb-dap/package-lock.json 
b/lldb/tools/lldb-dap/package-lock.json
index af90a9573aee6..f9f071ae7e41a 100644
--- a/lldb/tools/lldb-dap/package-lock.json
+++ b/lldb/tools/lldb-dap/package-lock.json
@@ -15,7 +15,9 @@
 "@vscode/vsce": "^3.2.2",
 "prettier": "^3.4.2",
 "prettier-plugin-curly": "^0.3.1",
-"typescript": "^5.7.3"
+"typescript": "^5.7.3",
+"winston": "^3.17.0",
+"winston-transport": "^4.9.0"
   },
   "engines": {
 "vscode": "^1.75.0"
@@ -318,6 +320,28 @@
 "node": ">=6.9.0"
   }
 },
+"node_modules/@colors/colors": {
+  "version": "1.6.0",
+  "resolved": 
"https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz";,
+  "integrity": 
"sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==",
+  "dev": true,
+  "license": "MIT",
+  "engines": {
+"node": ">=0.1.90"
+  }
+},
+"node_modules/@dabh/diagnostics": {
+  "version": "2.0.3",
+  "resolved": 
"https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz";,
+  "integrity": 
"sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"colorspace": "1.1.x",
+"enabled": "2.0.x",
+"kuler": "^2.0.0"
+  }
+},
 "node_modules/@isaacs/cliui": {
   "version": "8.0.2",
   "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz";,
@@ -399,6 +423,13 @@
 "undici-types": "~5.26.4"
   }
 },
+"node_modules/@types/triple-beam": {
+  "version": "1.3.5",
+  "resolved": 
"https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz";,
+  "integrity": 
"sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==",
+  "dev": true,
+  "license": "MIT"
+},
 "node_modules/@types/vscode": {
   "version": "1.75.0",
   "resolved": 
"https://registry.npmjs.org/@types/vscode/-/vscode-1.75.0.tgz";,
@@ -642,6 +673,13 @@
   "dev": true,
   "license": "Python-2.0"
 },
+"node_modules/async": {
+  "version": "3.2.6",
+  "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz";,
+  "integrity": 
"sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
+  "dev": true,
+  "license": "MIT"
+},
 "node_modules/asynckit": {
   "version": "0.4.0",
   "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz";,
@@ -858,6 +896,17 @@
 "node": ">=16"
   }
 },
+"node_modules/color": {
+  "version": "3.2.1",
+  "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz";,
+  "integrity": 
"sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"color-convert": "^1.9.3",
+"color-string": "^1.6.0"
+  }
+},
 "node_modules/color-convert": {
   "version": "1.9.3",
   "resolved": 
"https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz";,
@@ -873,6 +922,28 @@
   "integrity": 
"sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
   "dev": true
 },
+"node_modules/color-string": {
+  "version": "1.9.1",
+  "resolved": 
"https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz";,
+  "integrity": 
"sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"color-name": "^1.0.0",
+"simple-swiz

[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits


@@ -0,0 +1,88 @@
+import * as vscode from "vscode";
+import * as winston from "winston";
+import * as Transport from "winston-transport";
+
+class OutputChannelTransport extends Transport {
+constructor(private readonly ouptutChannel: vscode.OutputChannel) {
+super();
+}
+
+public log(info: any, next: () => void): void {
+this.ouptutChannel.appendLine(info[Symbol.for('message')]);
+next();
+}
+}
+
+export class Logger implements vscode.Disposable {
+private disposables: vscode.Disposable[] = [];
+private logger: winston.Logger;
+
+constructor(public readonly logFilePath: (name: string) => string, 
ouptutChannel: vscode.OutputChannel) {
+const ouptutChannelTransport = new 
OutputChannelTransport(ouptutChannel);
+ouptutChannelTransport.level = this.outputChannelLevel();
+this.logger = winston.createLogger({
+transports: [
+new winston.transports.File({ filename: 
logFilePath("lldb-dap-extension.log"), level: "debug" }), // File logging at 
the 'debug' level
+ouptutChannelTransport
+],
+format: winston.format.combine(
+winston.format.errors({ stack: true }),
+winston.format.timestamp({ format: "-MM-DD HH:mm:ss" }),
+winston.format.printf(msg => `[${msg.timestamp}][${msg.level}] 
${msg.message} ${msg.stack ? msg.stack : ''}`),
+),
+});
+if (process.env.NODE_ENV !== 'production') {
+this.logger.add(new winston.transports.Console({
+level: "error"
+}));
+}
+this.disposables.push(
+{
+dispose: () => this.logger.close()
+},
+vscode.workspace.onDidChangeConfiguration(e => {
+if (e.affectsConfiguration("lldb-dap.verboseLogging")) {
+ouptutChannelTransport.level = this.outputChannelLevel();
+}
+})
+);
+}
+
+debug(message: any) {
+this.logger.debug(this.normalizeMessage(message));
+}
+
+info(message: any) {
+this.logger.info(this.normalizeMessage(message));
+}
+
+warn(message: any) {
+this.logger.warn(this.normalizeMessage(message));
+}
+
+error(message: any) {
+if (message instanceof Error) {
+this.logger.error(message);
+return;
+}
+this.logger.error(this.normalizeMessage(message));
+}
+
+private normalizeMessage(message: any) {
+if (typeof message === "string") {
+return message;
+} else if (typeof message === "object") {

award999 wrote:

Yes if it is a proper JSON object, if there are cycles there is an error. Ended 
up changing it up to stringify in try-block and fallback relying on toString

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


[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits

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


[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (award999)


Changes

- Add `winston` dependency (MIT license) to handle logging setup
- Have an `OutputChannel` to log user facing information, errors, warnings
- Write a verose log under the provided `logUri` to capture further diagnostics
- Introduce `verboseLogging` setting to increase `OutputChannel` verbosity and 
write DAP session logs

Issue: #146880

---

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


7 Files Affected:

- (modified) lldb/tools/lldb-dap/package-lock.json (+235-7) 
- (modified) lldb/tools/lldb-dap/package.json (+8-1) 
- (modified) lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts (+35-1) 
- (modified) lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts (+8-1) 
- (modified) lldb/tools/lldb-dap/src-ts/debug-session-tracker.ts (+12-1) 
- (modified) lldb/tools/lldb-dap/src-ts/extension.ts (+15-6) 
- (added) lldb/tools/lldb-dap/src-ts/logger.ts (+90) 


``diff
diff --git a/lldb/tools/lldb-dap/package-lock.json 
b/lldb/tools/lldb-dap/package-lock.json
index af90a9573aee6..f9f071ae7e41a 100644
--- a/lldb/tools/lldb-dap/package-lock.json
+++ b/lldb/tools/lldb-dap/package-lock.json
@@ -15,7 +15,9 @@
 "@vscode/vsce": "^3.2.2",
 "prettier": "^3.4.2",
 "prettier-plugin-curly": "^0.3.1",
-"typescript": "^5.7.3"
+"typescript": "^5.7.3",
+"winston": "^3.17.0",
+"winston-transport": "^4.9.0"
   },
   "engines": {
 "vscode": "^1.75.0"
@@ -318,6 +320,28 @@
 "node": ">=6.9.0"
   }
 },
+"node_modules/@colors/colors": {
+  "version": "1.6.0",
+  "resolved": 
"https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz";,
+  "integrity": 
"sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==",
+  "dev": true,
+  "license": "MIT",
+  "engines": {
+"node": ">=0.1.90"
+  }
+},
+"node_modules/@dabh/diagnostics": {
+  "version": "2.0.3",
+  "resolved": 
"https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz";,
+  "integrity": 
"sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"colorspace": "1.1.x",
+"enabled": "2.0.x",
+"kuler": "^2.0.0"
+  }
+},
 "node_modules/@isaacs/cliui": {
   "version": "8.0.2",
   "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz";,
@@ -399,6 +423,13 @@
 "undici-types": "~5.26.4"
   }
 },
+"node_modules/@types/triple-beam": {
+  "version": "1.3.5",
+  "resolved": 
"https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz";,
+  "integrity": 
"sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==",
+  "dev": true,
+  "license": "MIT"
+},
 "node_modules/@types/vscode": {
   "version": "1.75.0",
   "resolved": 
"https://registry.npmjs.org/@types/vscode/-/vscode-1.75.0.tgz";,
@@ -642,6 +673,13 @@
   "dev": true,
   "license": "Python-2.0"
 },
+"node_modules/async": {
+  "version": "3.2.6",
+  "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz";,
+  "integrity": 
"sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
+  "dev": true,
+  "license": "MIT"
+},
 "node_modules/asynckit": {
   "version": "0.4.0",
   "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz";,
@@ -858,6 +896,17 @@
 "node": ">=16"
   }
 },
+"node_modules/color": {
+  "version": "3.2.1",
+  "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz";,
+  "integrity": 
"sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"color-convert": "^1.9.3",
+"color-string": "^1.6.0"
+  }
+},
 "node_modules/color-convert": {
   "version": "1.9.3",
   "resolved": 
"https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz";,
@@ -873,6 +922,28 @@
   "integrity": 
"sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
   "dev": true
 },
+"node_modules/color-string": {
+  "version": "1.9.1",
+  "resolved": 
"https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz";,
+  "integrity": 
"sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
+  "dev": true,
+  "license": "MIT",
+  "dependencies": {
+"color-name": "^1.0.0",
+"simple-swizzle": "^0.2.2"
+  }
+},
+"node_modules/colorspace": {
+  "version": "1.1.4",
+

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)

2025-07-22 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-aarch64-windows` 
running on `linaro-armv8-windows-msvc-05` while building `lldb` at step 6 
"test".

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


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

```
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: 
functionalities/ptrauth_diagnostics/BRAA_error/TestPtrauthBRAADiagnostic.py 
(590 of 2280)
UNSUPPORTED: lldb-api :: 
functionalities/ptrauth_diagnostics/LDRAA_error/TestPtrauthLDRAADiagnostic.py 
(591 of 2280)
UNSUPPORTED: lldb-api :: 
functionalities/ptrauth_diagnostics/brkC47x_code/TestPtrauthBRKc47xDiagnostic.py
 (592 of 2280)
UNSUPPORTED: lldb-api :: 
functionalities/ptrauth_diagnostics/brkC47x_x16_invalid/TestPtrauthBRKc47xX16Invalid.py
 (593 of 2280)
PASS: lldb-api :: functionalities/rerun/TestRerun.py (594 of 2280)
UNSUPPORTED: lldb-api :: functionalities/rerun_and_expr/TestRerunAndExpr.py 
(595 of 2280)
UNSUPPORTED: lldb-api :: 
functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py (596 of 2280)
PASS: lldb-api :: functionalities/return-value/TestReturnValue.py (597 of 2280)
PASS: lldb-api :: functionalities/recursion/TestValueObjectRecursion.py (598 of 
2280)
PASS: lldb-api :: 
functionalities/reverse-execution/TestReverseContinueBreakpoints.py (599 of 
2280)
FAIL: lldb-api :: 
functionalities/reverse-execution/TestReverseContinueWatchpoints.py (600 of 
2280)
 TEST 'lldb-api :: 
functionalities/reverse-execution/TestReverseContinueWatchpoints.py' FAILED 

Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env 
LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include 
--env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin 
--arch aarch64 --build-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api
 --clang-module-cache-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api
 --executable 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make 
C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --cmake-build-type 
Release --skip-category=watchpoint 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\functionalities\reverse-execution
 -p TestReverseContinueWatchpoints.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 
287b9447cc128d2218d148062d545a8633e37a4b)
  clang revision 287b9447cc128d2218d148062d545a8633e37a4b
  llvm revision 287b9447cc128d2218d148062d545a8633e37a4b

Watchpoint 1 hit:
old value: 2
new value: 1

Watchpoint 1 hit:
old value: 1
new value: 2
Skipping the following test categories: ['watchpoint', 'libc++', 'libstdcxx', 
'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']

An exception happened when receiving the response from the gdb server. Closing 
the client...


--
Command Output (stderr):
--
lldb-server exiting...

PASS: LLDB 
(C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: 
test_reverse_continue_skip_watchpoint 
(TestReverseContinueWatchpoints.TestReverseContinueWatchpoints.test_reverse_continue_skip_watchpoint)

lldb-server exiting...

PASS: LLDB 
(C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: 
test_reverse_continue_skip_watchpoint_async 
(TestReverseContinueWatchpoints.TestReverseContinueWatchpoints.test_reverse_continue_skip_watchpoint_async)

lldb-server exiting...


```



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


[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)

2025-07-22 Thread via lldb-commits

Nerixyz wrote:

Failure looks unrelated.

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


[Lldb-commits] [lldb] [lldb-dap] persistent assembly breakpoints (PR #148061)

2025-07-22 Thread via lldb-commits

jimingham wrote:

This is fine from my perspective.  You should get somebody who's more familiar 
with it to sign off on the DAP part.  You don't need to do it for this PR, but 
it would be nice to expose the "instruction count" to the command line as well.

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


[Lldb-commits] [clang] [libcxxabi] [lldb] [llvm] [DRAFT] [lldb][Expression] Add structor variant to LLDB's function call labels (PR #149827)

2025-07-22 Thread Michael Buch via lldb-commits

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

>From fd6b6e8a3168fc233635e783773554ac980edb46 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 15 Nov 2024 01:59:36 +
Subject: [PATCH 1/6] [lldb][Expression] Encode Module and DIE UIDs into
 function AsmLabels

---
 lldb/include/lldb/Core/Module.h   |  4 +-
 lldb/include/lldb/Expression/Expression.h | 25 ++
 lldb/include/lldb/Symbol/SymbolFile.h | 14 
 lldb/include/lldb/Symbol/TypeSystem.h | 16 
 lldb/source/Core/Module.cpp   | 19 -
 lldb/source/Expression/Expression.cpp | 16 
 lldb/source/Expression/IRExecutionUnit.cpp| 74 +
 .../Clang/ClangExpressionDeclMap.cpp  |  2 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 43 ++
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 41 ++
 .../SymbolFile/DWARF/SymbolFileDWARF.h|  3 +
 .../SymbolFile/NativePDB/PdbAstBuilder.cpp|  6 +-
 .../NativePDB/UdtRecordCompleter.cpp  |  5 +-
 .../Plugins/SymbolFile/PDB/PDBASTParser.cpp   |  7 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  | 81 +--
 .../TypeSystem/Clang/TypeSystemClang.h| 11 ++-
 lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +--
 17 files changed, 335 insertions(+), 44 deletions(-)

diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 8bb55c95773bc..3991a12997541 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions {
 ///
 /// The module will parse more detailed information as more queries are made.
 class Module : public std::enable_shared_from_this,
-   public SymbolContextScope {
+   public SymbolContextScope,
+   public UserID {
 public:
   class LookupInfo;
   // Static functions that can track the lifetime of module objects. This is
@@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this,
   // using the "--global" (-g for short).
   static size_t GetNumberAllocatedModules();
 
+  static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid);
   static Module *GetAllocatedModuleAtIndex(size_t idx);
 
   static std::recursive_mutex &GetAllocationModuleCollectionMutex();
diff --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 8de9364436ccf..f32878c9bf876 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -96,6 +96,31 @@ class Expression {
  ///invalid.
 };
 
+/// Holds parsed information about a function call label that
+/// LLDB attaches as an AsmLabel to function AST nodes it parses
+/// from debug-info.
+///
+/// The format being:
+///
+///   :::
+///
+/// The label string needs to stay valid for the entire lifetime
+/// of this object.
+struct FunctionCallLabel {
+  llvm::StringRef m_lookup_name;
+  lldb::user_id_t m_module_id;
+
+  /// Mostly for debuggability.
+  lldb::user_id_t m_die_id;
+};
+
+/// LLDB attaches this prefix to mangled names of functions that it get called
+/// from JITted expressions.
+inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func";
+
+bool consumeFunctionCallLabelPrefix(llvm::StringRef &name);
+bool hasFunctionCallLabelPrefix(llvm::StringRef name);
+
 } // namespace lldb_private
 
 #endif // LLDB_EXPRESSION_EXPRESSION_H
diff --git a/lldb/include/lldb/Symbol/SymbolFile.h 
b/lldb/include/lldb/Symbol/SymbolFile.h
index e95f95553c17c..6aca276fc85b6 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -18,6 +18,7 @@
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/SourceModule.h"
+#include "lldb/Symbol/SymbolContext.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Symbol/TypeList.h"
 #include "lldb/Symbol/TypeSystem.h"
@@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface {
   GetMangledNamesForFunction(const std::string &scope_qualified_name,
  std::vector &mangled_names);
 
+  /// Resolves the function DIE identified by \c lookup_name within
+  /// this SymbolFile.
+  ///
+  /// \param[in,out] sc_list The resolved functions will be appended to this
+  /// list.
+  ///
+  /// \param[in] lookup_name The UID of the function DIE to resolve.
+  ///
+  virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list,
+ llvm::StringRef lookup_name) {
+return llvm::createStringError("Not implemented");
+  }
+
   virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope,
 lldb::TypeClass type_mask,
 lldb_private::TypeList &type_list) = 0;
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index cb1f0130b548d..742c09251ea2f 100644

[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits

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


[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits


@@ -156,16 +157,34 @@ async function getDAPArguments(
 .get("arguments", []);
 }
 
+/**
+ * Formats the given date as a string in the form "MMdd".

rbenegal wrote:

In case there is another patch: I think this should be MMddTHHMMSS?

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


[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits

https://github.com/rbenegal commented:

Looks good to me, thanks for this!

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


[Lldb-commits] [lldb] [LLDB] Update SBMemoryRegionInfo doc strings to document len and str (PR #149903)

2025-07-22 Thread via lldb-commits

https://github.com/barsolo2000 updated 
https://github.com/llvm/llvm-project/pull/149903

>From e9fdc0a001823db1df26158845301aec94cd2b8a Mon Sep 17 00:00:00 2001
From: Bar Soloveychik 
Date: Mon, 21 Jul 2025 13:29:58 -0700
Subject: [PATCH 1/8] added documenatation on GetDescription

---
 .../interface/SBMemoryRegionInfoDocstrings.i  | 52 ---
 1 file changed, 32 insertions(+), 20 deletions(-)

diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i 
b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
index d7c68baf100e2..dd578f53c828c 100644
--- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
+++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
@@ -1,31 +1,43 @@
-%feature("docstring",
-"API clients can get information about memory regions in processes."
-) lldb::SBMemoryRegionInfo;
+% feature("docstring",
+  "API clients can get information about memory regions in processes.")
+lldb::SBMemoryRegionInfo;
 
 %feature("docstring", "
 Returns whether this memory region has a list of modified (dirty)
 pages available or not.  When calling GetNumDirtyPages(), you will
-have 0 returned for both \"dirty page list is not known\" and 
+have 0 returned for both \"dirty page list is not known\" and
 \"empty dirty page list\" (that is, no modified pages in this
 memory region).  You must use this method to disambiguate."
 ) lldb::SBMemoryRegionInfo::HasDirtyMemoryPageList;
 
-%feature("docstring", "
-Return the number of dirty (modified) memory pages in this
-memory region, if available.  You must use the 
-SBMemoryRegionInfo::HasDirtyMemoryPageList() method to
-determine if a dirty memory list is available; it will depend
-on the target system can provide this information."
-) lldb::SBMemoryRegionInfo::GetNumDirtyPages;
+% feature(
+  "docstring",
+  "
+  Return the number of dirty(modified) memory pages in this memory region,
+  if available.You must use the 
SBMemoryRegionInfo::HasDirtyMemoryPageList()
+  method to determine if a dirty memory list is available;
+  it will depend on the target system can provide this information."
+  ) lldb::SBMemoryRegionInfo::GetNumDirtyPages;
 
-%feature("docstring", "
-Return the address of a modified, or dirty, page of memory.
-If the provided index is out of range, or this memory region 
-does not have dirty page information, LLDB_INVALID_ADDRESS 
-is returned."
-) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex;
+% feature("docstring",
+  "
+  Return the address of a modified,
+  or dirty, page of memory.If the provided index is out of range,
+  or this memory region does not have dirty page information,
+  LLDB_INVALID_ADDRESS is returned."
+  ) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex;
+
+% feature("docstring", "
+   Return the size of pages in this memory region .0 will 
be
+   returned if this information was unavailable."
+  ) lldb::SBMemoryRegionInfo::GetPageSize();
 
 %feature("docstring", "
-Return the size of pages in this memory region.  0 will be returned
-if this information was unavailable."
-) lldb::SBMemoryRegionInfo::GetPageSize();
+takes a SBStream parameter 'description' where it will write the 
output to.
+it formats the memory region information into a string with Memory 
region info
+[Hex start - Hex End) and premission flags R/W/X
+returns a boolean value indicating success or failure
+
+alternative to using this method to find out the size of the memory 
region
+is to use the len() function on the SBMemoryRegionInfo object"
+) lldb::SBMemoryRegionInfo::GetDescription;

>From 17f46d31903ab451a5944d4097ae1ef62bd631cc Mon Sep 17 00:00:00 2001
From: Bar Soloveychik 
Date: Mon, 21 Jul 2025 14:08:01 -0700
Subject: [PATCH 2/8] added doc on str/len overwritten functions

---
 .../interface/SBMemoryRegionInfoDocstrings.i | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i 
b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
index dd578f53c828c..6b7f4a32ed17e 100644
--- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
+++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i
@@ -1,5 +1,8 @@
 % feature("docstring",
-  "API clients can get information about memory regions in processes.")
+  "API clients can get information about memory regions in processes.
+
+  When printed using str(), the memory region info is formatted as:
+'[Hex start - Hex End] RWX' ")
 lldb::SBMemoryRegionInfo;
 
 %feature("docstring", "
@@ -34,10 +37,11 @@
 
 %feature("docstring", "
 takes a SBStream parameter 'description' where it will 

[Lldb-commits] [lldb] Logging setup for lldb-dap extension (PR #146884)

2025-07-22 Thread via lldb-commits


@@ -156,16 +157,34 @@ async function getDAPArguments(
 .get("arguments", []);
 }
 
+/**
+ * Formats the given date as a string in the form "MMdd".

award999 wrote:

Done

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


[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::deque (PR #150097)

2025-07-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: nerix (Nerixyz)


Changes

This PR adds synthetic children for std::deque from MSVC's STL.

Similar to libstdc++ and libc++, the elements are in a `T**`, so we need to 
"subscript" twice. The [NatVis for 
deque](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/debugger/STL.natvis#L1103-L1112)
 uses `_EEN_DS` which contains the block size. We can't access this, but we can 
access the [constexpr 
`_Block_size`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/deque#L641).

Towards #24834.

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


5 Files Affected:

- (modified) lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt (+1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
(+22-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h (+6) 
- (added) lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp (+176) 
- (modified) 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py
 (+21-11) 


``diff
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index ab9d991fd48f7..81ad7afe4e305 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -35,6 +35,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   LibStdcppUniquePointer.cpp
   MsvcStl.cpp
   MsvcStlAtomic.cpp
+  MsvcStlDeque.cpp
   MsvcStlSmartPointer.cpp
   MsvcStlTuple.cpp
   MsvcStlUnordered.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 80dc4609f9b66..c749bf682391a 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1414,7 +1414,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug)?deque<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::deque<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider")));
@@ -1472,10 +1472,9 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   "libstdc++ std::set summary provider",
   "^std::(__debug::)?set<.+> >(( )?&)?$", stl_summary_flags, true);
 
-  AddCXXSummary(
-  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
-  "libstdc++ std::deque summary provider",
-  "^std::(__debug::)?deque<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"libstdc++ debug std::deque summary provider",
+"^std::__debug::?deque<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(
   cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
@@ -1672,6 +1671,18 @@ 
GenericUnorderedSyntheticFrontEndCreator(CXXSyntheticChildren *children,
   *valobj_sp);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericDequeSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+ ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  if (IsMsvcStlDeque(*valobj_sp))
+return MsvcStlDequeSyntheticFrontEndCreator(children, valobj_sp);
+  return new ScriptedSyntheticChildren::FrontEnd(
+  "lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider", *valobj_sp);
+}
+
 /// Load formatters that are formatting types from more than one STL
 static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   if (!cpp_category_sp)
@@ -1743,6 +1754,9 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   "std::unordered container synthetic children",
   "^std::unordered_(multi)?(map|set)<.+> ?>$", stl_synth_flags,
   true);
+  AddCXXSynthetic(cpp_category_sp, GenericDequeSyntheticFrontEndCreator,
+  "std::deque container synthetic children",
+  "^std::deque<.+>(( )?&)?$", stl_synth_flags, true);
 
   SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
   stl_deref_flags.SetFrontEndWantsDereference();
@@ -1786,6 +1800,9 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "MSVC STL/libstdc++ std unordered container summary provider",
 "^std::unordered_(multi)?(map|set)<.+> ?>$", stl_summary_flags,
 true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"M

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::deque (PR #150097)

2025-07-22 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- 
lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp 
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp
index 08467a8ae..c223274c5 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp
@@ -71,8 +71,8 @@ 
lldb_private::formatters::MsvcStlDequeSyntheticFrontEnd::GetChildAtIndex(
   // _EEN_DS = _Block_size
   // _Map[(($i + _Myoff) / _EEN_DS) % _Mapsize][($i + _Myoff) % _EEN_DS]
   size_t first_idx = ((idx + m_offset) / m_block_size) % m_map_size;
-  lldb::addr_t first_address =
-  m_map->GetValueAsUnsigned(0) + first_idx * 
process_sp->GetAddressByteSize();
+  lldb::addr_t first_address = m_map->GetValueAsUnsigned(0) +
+   first_idx * process_sp->GetAddressByteSize();
 
   Status err;
   lldb::addr_t second_base =

``




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


[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::deque (PR #150097)

2025-07-22 Thread via lldb-commits

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

>From 0c9798c6525ba3faa51bb21667796334c6f71a3f Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Tue, 22 Jul 2025 17:52:21 +0200
Subject: [PATCH] [LLDB] Add formatters for MSVC STL std::deque

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  27 ++-
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   6 +
 .../Language/CPlusPlus/MsvcStlDeque.cpp   | 176 ++
 .../deque/TestDataFormatterGenericDeque.py|  32 ++--
 5 files changed, 226 insertions(+), 16 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index ab9d991fd48f7..81ad7afe4e305 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -35,6 +35,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   LibStdcppUniquePointer.cpp
   MsvcStl.cpp
   MsvcStlAtomic.cpp
+  MsvcStlDeque.cpp
   MsvcStlSmartPointer.cpp
   MsvcStlTuple.cpp
   MsvcStlUnordered.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 80dc4609f9b66..c749bf682391a 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1414,7 +1414,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug)?deque<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::deque<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider")));
@@ -1472,10 +1472,9 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   "libstdc++ std::set summary provider",
   "^std::(__debug::)?set<.+> >(( )?&)?$", stl_summary_flags, true);
 
-  AddCXXSummary(
-  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
-  "libstdc++ std::deque summary provider",
-  "^std::(__debug::)?deque<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"libstdc++ debug std::deque summary provider",
+"^std::__debug::?deque<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(
   cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
@@ -1672,6 +1671,18 @@ 
GenericUnorderedSyntheticFrontEndCreator(CXXSyntheticChildren *children,
   *valobj_sp);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericDequeSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+ ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  if (IsMsvcStlDeque(*valobj_sp))
+return MsvcStlDequeSyntheticFrontEndCreator(children, valobj_sp);
+  return new ScriptedSyntheticChildren::FrontEnd(
+  "lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider", *valobj_sp);
+}
+
 /// Load formatters that are formatting types from more than one STL
 static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   if (!cpp_category_sp)
@@ -1743,6 +1754,9 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   "std::unordered container synthetic children",
   "^std::unordered_(multi)?(map|set)<.+> ?>$", stl_synth_flags,
   true);
+  AddCXXSynthetic(cpp_category_sp, GenericDequeSyntheticFrontEndCreator,
+  "std::deque container synthetic children",
+  "^std::deque<.+>(( )?&)?$", stl_synth_flags, true);
 
   SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
   stl_deref_flags.SetFrontEndWantsDereference();
@@ -1786,6 +1800,9 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "MSVC STL/libstdc++ std unordered container summary provider",
 "^std::unordered_(multi)?(map|set)<.+> ?>$", stl_summary_flags,
 true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstd++ std::deque summary provider",
+"^std::deque<.+>(( )?&)?$", stl_summary_flags, true);
 }
 
 static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h 
b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
index e2a015a537868..f93d03d2a6230 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
+++ b/lldb/source/Plugins/Language/CPlusPl

[Lldb-commits] [lldb] 2cb1ecb - [lldb] Eliminate namespace lldb_private::dwarf (NFC) (#150073)

2025-07-22 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2025-07-22T15:51:00-07:00
New Revision: 2cb1ecb94bb4e7f89494e59d25707fd9787ff98a

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

LOG: [lldb] Eliminate namespace lldb_private::dwarf (NFC) (#150073)

Eliminate the `lldb_private::dwarf` namespace, in favor of using
`llvm::dwarf` directly. The latter is shorter, and this avoids ambiguity
in the ABI plugins that define a `dwarf` namespace inside an anonymous
namespace.

Added: 


Modified: 
lldb/include/lldb/Core/dwarf.h
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp
lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Symbol/DWARFCallFrameInfo.cpp
lldb/source/Symbol/PostfixExpression.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp
lldb/unittests/Symbol/TestTypeSystemClang.cpp
lldb/unittests/SymbolFile/DWARF/DWARF64UnitTest.cpp
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp
lldb/unittests/SymbolFile/DWARF/DWARFDebugNamesIndexTest.cpp
lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/dwarf.h b/lldb/include/lldb/Core/dwarf.h
index 4de5c8f24db02..0663ec04e77fa 100644
--- a/lldb/include/lldb/Core/dwarf.h
+++ b/lldb/include/lldb/Core/dwarf.h
@@ -14,12 +14,6 @@
 // Get the DWARF constant definitions from llvm
 #include "llvm/BinaryFormat/Dwarf.h"
 
-namespace lldb_private {
-namespace dwarf {
-  using namespace llvm::dwarf;
-}
-}
-
 typedef llvm::dwarf::Attribute dw_attr_t;
 typedef llvm::dwarf::Form dw_form_t;
 typedef llvm::dwarf::Tag dw_tag_t;

diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 52891fcefd68b..79bc6c87fa9c5 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -41,8 +41,8 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace lldb_private::dwarf;
 using namespace lldb_private::plugin::dwarf;
+using namespace llvm::dwarf;
 
 // DWARFExpression constructor
 DWARFExpression::DWARFExpression() : m_data() {}

diff  --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp 
b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index f4d032388a883..81c6731cafcd1 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -848,7 +848,7 @@ static DWARFExpression CreateDWARFExpression(ModuleSP 
module_sp,
   uint32_t byte_size = architecture.GetDataByteSize();
 
   StreamBuffer<32> stream(Stream::eBinary, address_size, byte_order);
-  stream.PutHex8(lldb_private::dwarf::DW_OP_addr);
+  stream.PutHex8(llvm::dwarf::DW_OP_addr);
   stream.PutMaxHex64(symbol.GetFileAddress(), address_size, byte_order);
 
   DataBufferSP buffer =

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index a00127b8e5580..4bfbb4d81f5da 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -15,10 +15,10 @@
 #include "lldb/Symbol/Function.h"
 #include "llvm/Support/DJB.h"
 
-using namespace lldb_private;
 using namespace lldb;
-using namespace lldb_private::dwarf;
+using namespace lldb_private;
 using namespace lldb_private::plugin::dwarf;
+using namespace llvm::dwarf;
 
 std::unique_ptr AppleDWARFIndex::Create(
 Module &module, DWARFDataExtractor apple_names,
@@ -80,7 +80,7 @@ static bool
 EntryHasMatchingQualhash(const llvm::AppleAcceleratorTable::Entry &entry,
  uint32_t expected_hash) {
   std::optional form_value =
-  entr

[Lldb-commits] [lldb] [lldb] Eliminate namespace lldb_private::dwarf (NFC) (PR #150073)

2025-07-22 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: satyanarayana reddy janga (satyajanga)


Changes

### Summary
We have internally seen cases like this 
`DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x28`
where we have longer op pieces than what Scalar supports (32, 64 or 128 bits). 
In these cases LLDB is currently hitting the assertion 
`assert(ap_int.getBitWidth() >= bit_size);`

 We are extending the generated APInt to the piece size by filling zeros. 


### Test plan

Added a unit to cover this case. 

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


2 Files Affected:

- (modified) lldb/source/Expression/DWARFExpression.cpp (+6-1) 
- (modified) lldb/unittests/Expression/DWARFExpressionTest.cpp (+21) 


``diff
diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 52891fcefd68b..c00795b97467b 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -1978,7 +1978,12 @@ llvm::Expected DWARFExpression::Evaluate(
 // grows to the nearest host integer type.
 llvm::APInt fail_value(1, 0, false);
 llvm::APInt ap_int = scalar.UInt128(fail_value);
-assert(ap_int.getBitWidth() >= bit_size);
+// We have seen a case where we have expression like:
+//  DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x28
+// here we are assuming the compiler was trying to zero
+// extend the value that we should append to the buffer.
+if (ap_int.getBitWidth() < bit_size)
+  ap_int = ap_int.zext(bit_size);
 llvm::ArrayRef buf{ap_int.getRawData(),
  ap_int.getNumWords()};
 curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf));
diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp 
b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index fdc9bfae1876c..86c3b56e320fd 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -358,6 +358,27 @@ TEST(DWARFExpression, DW_OP_piece) {
   llvm::HasValue(GetScalar(16, 0xff00, true)));
 }
 
+TEST(DWARFExpression, DW_OP_piece_host_address) {
+  static const uint8_t expr_data[] = {DW_OP_lit2, DW_OP_stack_value,
+  DW_OP_piece, 40};
+  llvm::ArrayRef expr(expr_data, sizeof(expr_data));
+  DataExtractor extractor(expr.data(), expr.size(), lldb::eByteOrderLittle, 4);
+
+  // This tests if ap_int is extended to the right width.
+  // expect 40*8 = 320 bits size.
+  llvm::Expected result =
+  DWARFExpression::Evaluate(nullptr, nullptr, nullptr, extractor, nullptr,
+lldb::eRegisterKindDWARF, nullptr, nullptr);
+  ASSERT_THAT_EXPECTED(result, llvm::Succeeded());
+  ASSERT_EQ(result->GetValueType(), Value::ValueType::HostAddress);
+  ASSERT_EQ(result->GetBuffer().GetByteSize(), 40ul);
+  const uint8_t *data = result->GetBuffer().GetBytes();
+  ASSERT_EQ(data[0], 2);
+  for (int i = 1; i < 40; i++) {
+ASSERT_EQ(data[i], 0);
+  }
+}
+
 TEST(DWARFExpression, DW_OP_implicit_value) {
   unsigned char bytes = 4;
 

``




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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

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


[Lldb-commits] [lldb] Zero extend APInt when piece size is bigger than the bitwidth (PR #150149)

2025-07-22 Thread satyanarayana reddy janga via lldb-commits

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