[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::(forward_)list (PR #148285)

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


@@ -1501,22 +1499,19 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
 
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::ContainerSizeSummaryProvider,
-"libstdc++ std::list summary provider",
-"^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
+  "libstdc++ std::list summary provider",
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", stl_summary_flags, true);

Michael137 wrote:

```suggestion
  "libstdc++ std::list summary provider",
  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", stl_summary_flags, true);
```

Should this say `libstdc++ debug std::list summary provider`? (same for 
`std::forward_list` below)

https://github.com/llvm/llvm-project/pull/148285
___
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::(forward_)list (PR #148285)

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


@@ -1642,19 +1662,34 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   },
   "MSVC STL/libstdc++ std::wstring summary provider"));
 
+  stl_summary_flags.SetDontShowChildren(false);
+  stl_summary_flags.SetSkipPointers(false);
+
   AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator,
   "std::shared_ptr synthetic children",
   "^std::shared_ptr<.+>(( )?&)?$", stl_synth_flags, true);
   AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator,
   "std::weak_ptr synthetic children",
   "^std::weak_ptr<.+>(( )?&)?$", stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericListSyntheticFrontEndCreator,
+  "std::list synthetic children", "^std::list<.+>(( )?&)?$",
+  stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericForwardListSyntheticFrontEndCreator,
+  "std::forward_list synthetic children",
+  "^std::forward_list<.+>(( )?&)?$", stl_synth_flags, true);
 
   AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider,
 "MSVC STL/libstdc++ std::shared_ptr summary provider",
 "^std::shared_ptr<.+>(( )?&)?$", stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider,
 "MSVC STL/libstdc++ std::weak_ptr summary provider",
 "^std::weak_ptr<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstdc++ std::list summary provider",
+"^std::list<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstdc++ std::forward_list summary provider",
+"^std::forward_list<.+>(( )?&)?$", stl_summary_flags, true);

Michael137 wrote:

Can we use the python summary provider for libstdc++ for now? Considering it 
has the capping behaviour? Just so we don't regress anything

https://github.com/llvm/llvm-project/pull/148285
___
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::(forward_)list (PR #148285)

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

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

Modulo my last set of comments, LGTM

https://github.com/llvm/llvm-project/pull/148285
___
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::tuple (PR #148548)

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


@@ -1656,9 +1658,6 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   },
   "MSVC STL/libstdc++ std::wstring summary provider"));
 
-  stl_summary_flags.SetDontShowChildren(false);

Michael137 wrote:

Why did these need moving?

https://github.com/llvm/llvm-project/pull/148548
___
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::vector (PR #147538)

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


@@ -0,0 +1,297 @@
+//===-- MsvcStlVector.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/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+
+namespace lldb_private {
+namespace formatters {
+
+class MsvcStlVectorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlVectorSyntheticFrontEnd(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_start = nullptr;
+  ValueObject *m_finish = nullptr;
+  CompilerType m_element_type;
+  uint32_t m_element_size = 0;
+};
+
+class MsvcStlVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlVectorBoolSyntheticFrontEnd(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:
+  CompilerType m_bool_type;
+  ExecutionContextRef m_exe_ctx_ref;
+  uint64_t m_count = 0;
+  uint64_t m_element_bit_size = 0;
+  lldb::addr_t m_base_data_address = 0;
+  std::map m_children;
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::
+MsvcStlVectorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() {
+  if (valobj_sp)
+Update();
+}
+
+llvm::Expected lldb_private::formatters::
+MsvcStlVectorSyntheticFrontEnd::CalculateNumChildren() {
+  if (!m_start || !m_finish)
+return llvm::createStringError(
+"Failed to determine start/end of vector data.");
+
+  uint64_t start_val = m_start->GetValueAsUnsigned(0);
+  uint64_t finish_val = m_finish->GetValueAsUnsigned(0);
+
+  // A default-initialized empty vector.
+  if (start_val == 0 && finish_val == 0)
+return 0;
+
+  if (start_val == 0)
+return llvm::createStringError("Invalid value for start of vector.");
+
+  if (finish_val == 0)
+return llvm::createStringError("Invalid value for end of vector.");
+
+  if (start_val > finish_val)
+return llvm::createStringError(
+"Start of vector data begins after end pointer.");
+
+  size_t num_children = (finish_val - start_val);
+  if (num_children % m_element_size)
+return llvm::createStringError("Size not multiple of element size.");
+
+  return num_children / m_element_size;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::GetChildAtIndex(
+uint32_t idx) {
+  if (!m_start || !m_finish)
+return lldb::ValueObjectSP();
+
+  uint64_t offset = idx * m_element_size;
+  offset = offset + m_start->GetValueAsUnsigned(0);
+  StreamString name;
+  name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+  return CreateValueObjectFromAddress(name.GetString(), offset,
+  m_backend.GetExecutionContextRef(),
+  m_element_type);
+}
+
+lldb::ChildCacheState
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::Update() {
+  m_start = m_finish = nullptr;
+  ValueObjectSP data_sp(m_backend.GetChildAtNamePath({"_Mypair", "_Myval2"}));
+
+  if (!data_sp)
+return lldb::ChildCacheState::eRefetch;
+
+  m_start = data_sp->GetChildMemberWithName("_Myfirst").get();
+  m_finish = data_sp->GetChildMemberWithName("_Mylast").get();
+  if (!m_start || !m_finish)
+return lldb::ChildCacheState::eRefetch;
+
+  m_element_type = m_start->GetCompilerType().GetPointeeType();
+  llvm::Expected size_or_err = m_element_type.GetByteSize(nullptr);
+  if (size_or_err)
+m_element_size = *size_or_err;
+  else
+LLDB_LOG_ERRORV(GetLog(LLDBLog::DataFormatters), size_or_err.takeError(),
+"{0}");
+
+  return lldb::ChildCacheState::eRefetch;
+}
+
+llvm::Expected lldb_private::formatters::
+MsvcStlVectorSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
+  if (!m_start || !m_finish)
+return llvm::createStringError("Type has no child named '%s'",
+   name.AsCString());
+  auto optional_idx = ExtractIndexFromString(name.GetCString());
+  if (!optional_idx) {
+return llvm::createStringError("Type has no child named '%s'",
+   name.AsCString());
+  }
+  return *optional_idx;
+}
+
+lldb_private::formatters::MsvcStlVectorBoolSyn

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

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


@@ -0,0 +1,297 @@
+//===-- MsvcStlVector.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/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+
+namespace lldb_private {
+namespace formatters {
+
+class MsvcStlVectorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlVectorSyntheticFrontEnd(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_start = nullptr;
+  ValueObject *m_finish = nullptr;
+  CompilerType m_element_type;
+  uint32_t m_element_size = 0;
+};
+
+class MsvcStlVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlVectorBoolSyntheticFrontEnd(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:
+  CompilerType m_bool_type;
+  ExecutionContextRef m_exe_ctx_ref;
+  uint64_t m_count = 0;
+  uint64_t m_element_bit_size = 0;
+  lldb::addr_t m_base_data_address = 0;
+  std::map m_children;
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::
+MsvcStlVectorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() {
+  if (valobj_sp)
+Update();
+}
+
+llvm::Expected lldb_private::formatters::
+MsvcStlVectorSyntheticFrontEnd::CalculateNumChildren() {
+  if (!m_start || !m_finish)
+return llvm::createStringError(
+"Failed to determine start/end of vector data.");
+
+  uint64_t start_val = m_start->GetValueAsUnsigned(0);
+  uint64_t finish_val = m_finish->GetValueAsUnsigned(0);
+
+  // A default-initialized empty vector.
+  if (start_val == 0 && finish_val == 0)
+return 0;
+
+  if (start_val == 0)
+return llvm::createStringError("Invalid value for start of vector.");
+
+  if (finish_val == 0)
+return llvm::createStringError("Invalid value for end of vector.");
+
+  if (start_val > finish_val)
+return llvm::createStringError(
+"Start of vector data begins after end pointer.");
+
+  size_t num_children = (finish_val - start_val);
+  if (num_children % m_element_size)
+return llvm::createStringError("Size not multiple of element size.");
+
+  return num_children / m_element_size;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::GetChildAtIndex(
+uint32_t idx) {
+  if (!m_start || !m_finish)
+return lldb::ValueObjectSP();
+
+  uint64_t offset = idx * m_element_size;
+  offset = offset + m_start->GetValueAsUnsigned(0);
+  StreamString name;
+  name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+  return CreateValueObjectFromAddress(name.GetString(), offset,
+  m_backend.GetExecutionContextRef(),
+  m_element_type);
+}
+
+lldb::ChildCacheState
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::Update() {
+  m_start = m_finish = nullptr;
+  ValueObjectSP data_sp(m_backend.GetChildAtNamePath({"_Mypair", "_Myval2"}));
+
+  if (!data_sp)
+return lldb::ChildCacheState::eRefetch;
+
+  m_start = data_sp->GetChildMemberWithName("_Myfirst").get();
+  m_finish = data_sp->GetChildMemberWithName("_Mylast").get();
+  if (!m_start || !m_finish)
+return lldb::ChildCacheState::eRefetch;
+
+  m_element_type = m_start->GetCompilerType().GetPointeeType();
+  llvm::Expected size_or_err = m_element_type.GetByteSize(nullptr);
+  if (size_or_err)
+m_element_size = *size_or_err;
+  else
+LLDB_LOG_ERRORV(GetLog(LLDBLog::DataFormatters), size_or_err.takeError(),
+"{0}");
+
+  return lldb::ChildCacheState::eRefetch;
+}
+
+llvm::Expected lldb_private::formatters::
+MsvcStlVectorSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
+  if (!m_start || !m_finish)
+return llvm::createStringError("Type has no child named '%s'",
+   name.AsCString());
+  auto optional_idx = ExtractIndexFromString(name.GetCString());
+  if (!optional_idx) {
+return llvm::createStringError("Type has no child named '%s'",
+   name.AsCString());
+  }
+  return *optional_idx;
+}
+
+lldb_private::formatters::MsvcStlVectorBoolSyn

[Lldb-commits] [lldb] [lldb] Document MCP tools & resources (PR #148708)

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


@@ -75,7 +75,69 @@ Configuration example for [Visual Studio 
Code](https://code.visualstudio.com/doc
 }
 ```
 
-### Troubleshooting
+## Tools
+
+Tools are a primitive in the Model Context Protocol that enable servers to
+expose functionality to clients.
+
+LLDB's MCP integration exposes one tool, named `lldb_command` which allows the
+model to run the same commands a user would type in the LLDB command
+interpreter. It takes two arguments:
+
+1. The unique debugger ID as a number.
+2. The command and its arguments as a string.

DavidSpickett wrote:

Add an example of this.

Mainly because "the command and its arguments as a string" can be read "the 
command, and its arguments as a string".

Maybe you can say that `(lldb) foo a b c` becomes ``?

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


[Lldb-commits] [lldb] [lldb] Document MCP tools & resources (PR #148708)

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


@@ -75,7 +75,69 @@ Configuration example for [Visual Studio 
Code](https://code.visualstudio.com/doc
 }
 ```
 
-### Troubleshooting
+## Tools
+
+Tools are a primitive in the Model Context Protocol that enable servers to
+expose functionality to clients.
+
+LLDB's MCP integration exposes one tool, named `lldb_command` which allows the
+model to run the same commands a user would type in the LLDB command
+interpreter. It takes two arguments:
+
+1. The unique debugger ID as a number.

DavidSpickett wrote:

Oh I see, you read the URI? But you need a debugger ID for that too. Hmm.

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


[Lldb-commits] [lldb] [lldb] Document MCP tools & resources (PR #148708)

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


@@ -75,7 +75,69 @@ Configuration example for [Visual Studio 
Code](https://code.visualstudio.com/doc
 }
 ```
 
-### Troubleshooting
+## Tools
+
+Tools are a primitive in the Model Context Protocol that enable servers to
+expose functionality to clients.
+
+LLDB's MCP integration exposes one tool, named `lldb_command` which allows the
+model to run the same commands a user would type in the LLDB command
+interpreter. It takes two arguments:
+
+1. The unique debugger ID as a number.

DavidSpickett wrote:

Is this debugger ID mentioned elsewhere, where do you get this ID from?

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


[Lldb-commits] [lldb] [lldb] Improve setting of program for filtering disassembly (PR #148823)

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

https://github.com/DavidSpickett updated 
https://github.com/llvm/llvm-project/pull/148823

>From ba64d72e000bd14125b202a70bd7d34831e12cc0 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Tue, 15 Jul 2025 10:30:21 +
Subject: [PATCH] [lldb] Improve setting of program for filtering disassembly

This changes the example command added in 
https://github.com/llvm/llvm-project/pull/145793
so that the fdis program does not have to be a single program name.

Doing so also means we can run the test on Windows where the
program needs to be "python.exe script_name".

I've changed "fdis set" to treat the rest of the command as the
program. Then store that as a list to be passed to subprocess.
If we just use a string, Python will think that "python.exe foo"
is the name of an actual program.

This will still break if the paths have spaces in,
but I'm trying to do just enough to fix the test here without
rewriting all the option handling.
---
 lldb/examples/python/filter_disasm.py | 26 ++-
 .../command-disassemble-riscv32-bytes.s   |  5 ++--
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/lldb/examples/python/filter_disasm.py 
b/lldb/examples/python/filter_disasm.py
index de99d4031a7fd..46c9f794b25a2 100644
--- a/lldb/examples/python/filter_disasm.py
+++ b/lldb/examples/python/filter_disasm.py
@@ -11,8 +11,13 @@
 import lldb
 import subprocess
 
-filter_program = "crustfilt"
 
+class Program(list):
+def __str__(self):
+return " ".join(self)
+
+
+filter_program = Program(["crustfilt"])
 
 def __lldb_init_module(debugger, dict):
 debugger.HandleCommand("command script add -f filter_disasm.fdis fdis")
@@ -51,13 +56,20 @@ def fdis(debugger, args, exe_ctx, result, dict):
 result.Clear()
 
 if len(args_list) == 1 and args_list[0] == "get":
-result.PutCString(filter_program)
+result.PutCString(str(filter_program))
 result.SetStatus(lldb.eReturnStatusSuccessFinishResult)
 return
 
-if len(args_list) == 2 and args_list[0] == "set":
-filter_program = args_list[1]
-result.PutCString("Filter program set to %s" % filter_program)
+if args_list[0] == "set":
+# Assume the rest is a program to run and any arguments to be passed to
+# it.
+if len(args_list) <= 1:
+result.PutCString('"set" command requires a program argument')
+result.SetStatus(lldb.eReturnStatusFailed)
+return
+
+filter_program = Program(args_list[1:])
+result.PutCString('Filter program set to "{}"'.format(filter_program))
 result.SetStatus(lldb.eReturnStatusSuccessFinishResult)
 return
 
@@ -70,7 +82,9 @@ def fdis(debugger, args, exe_ctx, result, dict):
 output = res.GetOutput()
 
 try:
-proc = subprocess.run([filter_program], capture_output=True, 
text=True, input=output)
+proc = subprocess.run(
+filter_program, capture_output=True, text=True, input=output
+)
 except (subprocess.SubprocessError, OSError) as e:
 result.PutCString("Error occurred. Original disassembly:\n\n" + output)
 result.SetError(str(e))
diff --git a/lldb/test/Shell/Commands/command-disassemble-riscv32-bytes.s 
b/lldb/test/Shell/Commands/command-disassemble-riscv32-bytes.s
index bd40baf2643a0..78be614e3af15 100644
--- a/lldb/test/Shell/Commands/command-disassemble-riscv32-bytes.s
+++ b/lldb/test/Shell/Commands/command-disassemble-riscv32-bytes.s
@@ -1,6 +1,5 @@
 # REQUIRES: riscv
-# Unsupported until we fix launching the filter program on Windows.
-# UNSUPPORTED: system-windows
+# REQUIRES: python
 
 # This test verifies that disassemble -b prints out the correct bytes and
 # format for standard and unknown riscv instructions of various sizes,
@@ -11,7 +10,7 @@
 
 # RUN: llvm-mc -filetype=obj -mattr=+c --triple=riscv32-unknown-unknown %s -o 
%t
 # RUN: %lldb -b %t "-o" "disassemble -b -n main" | FileCheck %s
-# RUN: %lldb -b %t -o "command script import 
%S/../../../examples/python/filter_disasm.py" -o "fdis set 
%S/Inputs/dis_filt.py" -o "fdis -n main" | FileCheck --check-prefix=FILTER %s
+# RUN: %lldb -b %t -o "command script import 
%S/../../../examples/python/filter_disasm.py" -o "fdis set %python 
%S/Inputs/dis_filt.py" -o "fdis -n main" | FileCheck --check-prefix=FILTER %s
 
 main:
 addi   sp, sp, -0x20   # 16 bit standard instruction

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Extend SourceLocation to 64 bits. (PR #147292)

2025-07-15 Thread Aaron Ballman via lldb-commits

AaronBallman wrote:

Hello all! There was a request to hold a Clang Area Team discussion about this 
topic, which is scheduled for [Thur Jul 17 at 4pm Eastern 
Time](https://www.timeanddate.com/worldclock/converter.html?iso=20250717T20&p1=1440&p2=1241&p3=4747&p4=195).
 Link to the meeting teleconference is: https://meet.google.com/ktv-ifef-bym

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


[Lldb-commits] [lldb] a64bfd8 - [lldb] Fix Disasembler build error on 32-bit systems

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

Author: David Spickett
Date: 2025-07-15T09:54:58Z
New Revision: a64bfd8a5186bc5b967878689509db81b9d1922c

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

LOG: [lldb] Fix Disasembler build error on 32-bit systems

After changes in https://github.com/llvm/llvm-project/pull/145793.

/home/david.spickett/llvm-project/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp:1360:49:
 error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long 
long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned int')
 1360 |   status = m_disasm_up->getInstruction(mc_inst, size, data, pc, 
llvm::nulls());
  | ^~~~
/home/david.spickett/llvm-project/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:135:64:
 note: passing argument to parameter 'Size' here
  135 |   virtual DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size,
  |^
1 error generated.

The type used in the LLVM method we call is uin64_t so use that instead.
It's overkill for what it is, but that's a separate issue if anyone cares.

Also removed the unused form of GetMCInst.

Added: 


Modified: 
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index 564b787594f71..d92e16366f0ac 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -59,10 +59,8 @@ class DisassemblerLLVMC::MCDisasmInstance {
 
   ~MCDisasmInstance() = default;
 
-  uint64_t GetMCInst(const uint8_t *opcode_data, size_t opcode_data_len,
- lldb::addr_t pc, llvm::MCInst &mc_inst) const;
   bool GetMCInst(const uint8_t *opcode_data, size_t opcode_data_len,
- lldb::addr_t pc, llvm::MCInst &mc_inst, size_t &size) const;
+ lldb::addr_t pc, llvm::MCInst &mc_inst, uint64_t &size) const;
   void PrintMCInst(llvm::MCInst &mc_inst, lldb::addr_t pc,
std::string &inst_string, std::string &comments_string);
   void SetStyle(bool use_hex_immed, HexImmediateStyle hex_style);
@@ -531,7 +529,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
   const addr_t pc = m_address.GetFileAddress();
   llvm::MCInst inst;
 
-  size_t inst_size = 0;
+  uint64_t inst_size = 0;
   m_is_valid = mc_disasm_ptr->GetMCInst(opcode_data, opcode_data_len,
 pc, inst, inst_size);
   m_opcode.Clear();
@@ -614,7 +612,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
 const uint8_t *opcode_data = data.GetDataStart();
 const size_t opcode_data_len = data.GetByteSize();
 llvm::MCInst inst;
-size_t inst_size = 0;
+uint64_t inst_size = 0;
 bool valid = mc_disasm_ptr->GetMCInst(opcode_data, opcode_data_len, pc,
   inst, inst_size);
 
@@ -1217,7 +1215,7 @@ class InstructionLLVMC : public lldb_private::Instruction 
{
 const uint8_t *opcode_data = data.GetDataStart();
 const size_t opcode_data_len = data.GetByteSize();
 llvm::MCInst inst;
-size_t inst_size = 0;
+uint64_t inst_size = 0;
 const bool valid = mc_disasm_ptr->GetMCInst(opcode_data, opcode_data_len,
 pc, inst, inst_size);
 if (!valid)
@@ -1353,7 +1351,7 @@ bool DisassemblerLLVMC::MCDisasmInstance::GetMCInst(const 
uint8_t *opcode_data,
 size_t opcode_data_len,
 lldb::addr_t pc,
 llvm::MCInst &mc_inst,
-size_t &size) const {
+uint64_t &size) const {
   llvm::ArrayRef data(opcode_data, opcode_data_len);
   llvm::MCDisassembler::DecodeStatus status;
 



___
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::vector (PR #147538)

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


@@ -0,0 +1,297 @@
+//===-- MsvcStlVector.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/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+
+namespace lldb_private {
+namespace formatters {
+
+class MsvcStlVectorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlVectorSyntheticFrontEnd(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_start = nullptr;
+  ValueObject *m_finish = nullptr;
+  CompilerType m_element_type;
+  uint32_t m_element_size = 0;
+};
+
+class MsvcStlVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlVectorBoolSyntheticFrontEnd(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:
+  CompilerType m_bool_type;
+  ExecutionContextRef m_exe_ctx_ref;
+  uint64_t m_count = 0;
+  uint64_t m_element_bit_size = 0;
+  lldb::addr_t m_base_data_address = 0;
+  std::map m_children;
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::
+MsvcStlVectorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() {
+  if (valobj_sp)
+Update();
+}
+
+llvm::Expected lldb_private::formatters::
+MsvcStlVectorSyntheticFrontEnd::CalculateNumChildren() {
+  if (!m_start || !m_finish)
+return llvm::createStringError(
+"Failed to determine start/end of vector data.");
+
+  uint64_t start_val = m_start->GetValueAsUnsigned(0);
+  uint64_t finish_val = m_finish->GetValueAsUnsigned(0);
+
+  // A default-initialized empty vector.
+  if (start_val == 0 && finish_val == 0)
+return 0;
+
+  if (start_val == 0)
+return llvm::createStringError("Invalid value for start of vector.");
+
+  if (finish_val == 0)
+return llvm::createStringError("Invalid value for end of vector.");
+
+  if (start_val > finish_val)
+return llvm::createStringError(
+"Start of vector data begins after end pointer.");
+
+  size_t num_children = (finish_val - start_val);
+  if (num_children % m_element_size)
+return llvm::createStringError("Size not multiple of element size.");
+
+  return num_children / m_element_size;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::GetChildAtIndex(
+uint32_t idx) {
+  if (!m_start || !m_finish)
+return lldb::ValueObjectSP();
+
+  uint64_t offset = idx * m_element_size;
+  offset = offset + m_start->GetValueAsUnsigned(0);
+  StreamString name;
+  name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+  return CreateValueObjectFromAddress(name.GetString(), offset,
+  m_backend.GetExecutionContextRef(),
+  m_element_type);
+}
+
+lldb::ChildCacheState
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::Update() {
+  m_start = m_finish = nullptr;
+  ValueObjectSP data_sp(m_backend.GetChildAtNamePath({"_Mypair", "_Myval2"}));
+
+  if (!data_sp)
+return lldb::ChildCacheState::eRefetch;
+
+  m_start = data_sp->GetChildMemberWithName("_Myfirst").get();
+  m_finish = data_sp->GetChildMemberWithName("_Mylast").get();
+  if (!m_start || !m_finish)
+return lldb::ChildCacheState::eRefetch;
+
+  m_element_type = m_start->GetCompilerType().GetPointeeType();
+  llvm::Expected size_or_err = m_element_type.GetByteSize(nullptr);
+  if (size_or_err)
+m_element_size = *size_or_err;
+  else
+LLDB_LOG_ERRORV(GetLog(LLDBLog::DataFormatters), size_or_err.takeError(),
+"{0}");
+
+  return lldb::ChildCacheState::eRefetch;
+}
+
+llvm::Expected lldb_private::formatters::
+MsvcStlVectorSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
+  if (!m_start || !m_finish)
+return llvm::createStringError("Type has no child named '%s'",
+   name.AsCString());
+  auto optional_idx = ExtractIndexFromString(name.GetCString());
+  if (!optional_idx) {
+return llvm::createStringError("Type has no child named '%s'",
+   name.AsCString());
+  }
+  return *optional_idx;
+}
+
+lldb_private::formatters::MsvcStlVectorBoolSyn

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

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


@@ -0,0 +1,297 @@
+//===-- MsvcStlVector.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/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+
+namespace lldb_private {
+namespace formatters {
+
+class MsvcStlVectorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlVectorSyntheticFrontEnd(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_start = nullptr;
+  ValueObject *m_finish = nullptr;
+  CompilerType m_element_type;
+  uint32_t m_element_size = 0;
+};
+
+class MsvcStlVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  MsvcStlVectorBoolSyntheticFrontEnd(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:
+  CompilerType m_bool_type;
+  ExecutionContextRef m_exe_ctx_ref;
+  uint64_t m_count = 0;
+  uint64_t m_element_bit_size = 0;
+  lldb::addr_t m_base_data_address = 0;
+  std::map m_children;
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::
+MsvcStlVectorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() {
+  if (valobj_sp)
+Update();
+}
+
+llvm::Expected lldb_private::formatters::
+MsvcStlVectorSyntheticFrontEnd::CalculateNumChildren() {
+  if (!m_start || !m_finish)
+return llvm::createStringError(
+"Failed to determine start/end of vector data.");
+
+  uint64_t start_val = m_start->GetValueAsUnsigned(0);
+  uint64_t finish_val = m_finish->GetValueAsUnsigned(0);
+
+  // A default-initialized empty vector.
+  if (start_val == 0 && finish_val == 0)
+return 0;
+
+  if (start_val == 0)
+return llvm::createStringError("Invalid value for start of vector.");
+
+  if (finish_val == 0)
+return llvm::createStringError("Invalid value for end of vector.");
+
+  if (start_val > finish_val)
+return llvm::createStringError(
+"Start of vector data begins after end pointer.");
+
+  size_t num_children = (finish_val - start_val);
+  if (num_children % m_element_size)
+return llvm::createStringError("Size not multiple of element size.");
+
+  return num_children / m_element_size;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::GetChildAtIndex(
+uint32_t idx) {
+  if (!m_start || !m_finish)
+return lldb::ValueObjectSP();
+
+  uint64_t offset = idx * m_element_size;
+  offset = offset + m_start->GetValueAsUnsigned(0);
+  StreamString name;
+  name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+  return CreateValueObjectFromAddress(name.GetString(), offset,
+  m_backend.GetExecutionContextRef(),
+  m_element_type);
+}
+
+lldb::ChildCacheState
+lldb_private::formatters::MsvcStlVectorSyntheticFrontEnd::Update() {
+  m_start = m_finish = nullptr;
+  ValueObjectSP data_sp(m_backend.GetChildAtNamePath({"_Mypair", "_Myval2"}));
+
+  if (!data_sp)
+return lldb::ChildCacheState::eRefetch;
+
+  m_start = data_sp->GetChildMemberWithName("_Myfirst").get();
+  m_finish = data_sp->GetChildMemberWithName("_Mylast").get();
+  if (!m_start || !m_finish)
+return lldb::ChildCacheState::eRefetch;
+
+  m_element_type = m_start->GetCompilerType().GetPointeeType();
+  llvm::Expected size_or_err = m_element_type.GetByteSize(nullptr);
+  if (size_or_err)
+m_element_size = *size_or_err;
+  else
+LLDB_LOG_ERRORV(GetLog(LLDBLog::DataFormatters), size_or_err.takeError(),
+"{0}");
+
+  return lldb::ChildCacheState::eRefetch;
+}
+
+llvm::Expected lldb_private::formatters::
+MsvcStlVectorSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
+  if (!m_start || !m_finish)
+return llvm::createStringError("Type has no child named '%s'",
+   name.AsCString());
+  auto optional_idx = ExtractIndexFromString(name.GetCString());
+  if (!optional_idx) {
+return llvm::createStringError("Type has no child named '%s'",
+   name.AsCString());
+  }
+  return *optional_idx;
+}
+
+lldb_private::formatters::MsvcStlVectorBoolSyn

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::(forward_)list (PR #148285)

2025-07-15 Thread via lldb-commits

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

>From 104fbb9daa6ea0d4483939662ae08a8d42d77f44 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Fri, 11 Jul 2025 22:06:47 +0200
Subject: [PATCH 1/3] [LLDB] Add formatters for MSVC STL std::(forward_)list

---
 lldb/examples/synthetic/gnu_libstdcpp.py  |   9 -
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   2 +-
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  62 +++-
 .../{LibCxxList.cpp => GenericList.cpp}   | 294 +++---
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   9 +
 .../TestDataFormatterGenericForwardList.py|  33 +-
 .../list/TestDataFormatterGenericList.py  |  35 ++-
 .../loop/TestDataFormatterGenericListLoop.py  |  18 +-
 .../generic/list/loop/main.cpp|   5 -
 9 files changed, 356 insertions(+), 111 deletions(-)
 rename lldb/source/Plugins/Language/CPlusPlus/{LibCxxList.cpp => 
GenericList.cpp} (58%)

diff --git a/lldb/examples/synthetic/gnu_libstdcpp.py 
b/lldb/examples/synthetic/gnu_libstdcpp.py
index 20b9488af5597..e59eb5fa18c02 100644
--- a/lldb/examples/synthetic/gnu_libstdcpp.py
+++ b/lldb/examples/synthetic/gnu_libstdcpp.py
@@ -6,15 +6,6 @@
 # thing for your setup
 
 
-def ForwardListSummaryProvider(valobj, dict):
-list_capping_size = 
valobj.GetTarget().GetMaximumNumberOfChildrenToDisplay()
-text = "size=" + str(valobj.GetNumChildren())
-if valobj.GetNumChildren() > list_capping_size:
-return "(capped) " + text
-else:
-return text
-
-
 def StdOptionalSummaryProvider(valobj, dict):
 has_value = valobj.GetNumChildren() > 0
 # We add wrapping spaces for consistency with the libcxx formatter
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 296159ea28407..c7f12c1255ece 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -14,11 +14,11 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   CxxStringTypes.cpp
   Generic.cpp
   GenericBitset.cpp
+  GenericList.cpp
   GenericOptional.cpp
   LibCxx.cpp
   LibCxxAtomic.cpp
   LibCxxInitializerList.cpp
-  LibCxxList.cpp
   LibCxxMap.cpp
   LibCxxQueue.cpp
   LibCxxRangesRefView.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 9a869f3ea0289..8e5bd014fcd85 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1440,14 +1440,12 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider")));
@@ -1501,22 +1499,19 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
 
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::ContainerSizeSummaryProvider,
-"libstdc++ std::list summary provider",
-"^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
+  "libstdc++ std::list summary provider",
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
 "libstdc++ std::tuple summary provider",
 "^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
 
-  cpp_category_sp->AddTypeSummary(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
-  TypeSummaryImplSP(new ScriptSummaryFormat(
-  stl_summary_flags,
-  "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider")));
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"libstdc++ std::forward_list summary provider",
+"^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$",
+

[Lldb-commits] [lldb] f5c676d - [LLDB] Switch to using DIL as default implementation for 'frame var'. (#147887)

2025-07-15 Thread via lldb-commits

Author: cmtice
Date: 2025-07-15T08:19:10-07:00
New Revision: f5c676d6d95dc63b8dcb43dd2e4dfc913a9c5a50

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

LOG: [LLDB] Switch to using DIL as default implementation for 'frame var'. 
(#147887)

Added: 


Modified: 
lldb/source/Target/TargetProperties.td
lldb/source/ValueObject/DILEval.cpp

lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp
lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
lldb/test/Shell/SymbolFile/DWARF/TestDedupWarnings.test
llvm/docs/ReleaseNotes.md

Removed: 




diff  --git a/lldb/source/Target/TargetProperties.td 
b/lldb/source/Target/TargetProperties.td
index 4aa9e046d6077..656503bb8d228 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -5,8 +5,8 @@ let Definition = "target_experimental" in {
 Global, DefaultTrue,
 Desc<"If true, inject local variables explicitly into the expression text. 
This will fix symbol resolution when there are name collisions between ivars 
and local variables. But it can make expressions run much more slowly.">;
   def UseDIL : Property<"use-DIL", "Boolean">,
-Global, DefaultFalse,
-Desc<"If true, use the alternative DIL implementation for frame variable 
evaluation.">;
+Global, DefaultTrue,
+Desc<"If true, use the DIL implementation for frame variable evaluation.">;
 }
 
 let Definition = "target" in {

diff  --git a/lldb/source/ValueObject/DILEval.cpp 
b/lldb/source/ValueObject/DILEval.cpp
index fd3f9f8724608..6f28434c646cd 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -303,7 +303,7 @@ Interpreter::Visit(const MemberOfNode *node) {
 }
   }
 
-  if (field_obj && field_obj->GetName() == node->GetFieldName()) {
+  if (field_obj) {
 if (m_use_dynamic != lldb::eNoDynamicValues) {
   lldb::ValueObjectSP dynamic_val_sp =
   field_obj->GetDynamicValue(m_use_dynamic);

diff  --git 
a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
index b2ce9602e6a50..8c009aa182d07 100644
--- 
a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
+++ 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
@@ -29,3 +29,17 @@ def test_frame_var(self):
 self.expect_var_path("ns::i", value="1")
 self.expect_var_path("::ns::ns::i", value="2")
 self.expect_var_path("ns::ns::i", value="2")
+
+self.expect_var_path("foo", value="1")
+self.expect_var_path("::(anonymous namespace)::foo", value="13")
+self.expect_var_path("(anonymous namespace)::foo", value="13")
+self.expect_var_path("ns1::(anonymous namespace)::foo", value="5")
+self.expect_var_path(
+"(anonymous namespace)::ns2::(anonymous namespace)::foo",
+value="7",
+)
+self.expect_var_path("::ns1::(anonymous namespace)::foo", value="5")
+self.expect_var_path(
+"::(anonymous namespace)::ns2::(anonymous namespace)::foo",
+value="7",
+)

diff  --git a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp
index 8a5c47a6f364c..10ffa1e54a991 100644
--- a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp
+++ b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp
@@ -10,7 +10,26 @@ int i = 2;
 
 } // namespace ns
 
+namespace {
+int foo = 13;
+}
+
+namespace ns1 {
+namespace {
+int foo = 5;
+}
+} // namespace ns1
+
+namespace {
+namespace ns2 {
+namespace {
+int foo = 7;
+}
+} // namespace ns2
+} // namespace
+
 int main(int argc, char **argv) {
+  int foo = 1;
 
-  return 0; // Set a breakpoint here
+  return foo + ::foo + ns1::foo + ns2::foo; // Set a breakpoint here
 }

diff  --git a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py 
b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
index 0d2774b281710..20a75f4076e42 100644
--- a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
+++ b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
@@ -131,7 +131,7 @@ def run_test_evaluate_expressions(
 self.assertEvaluateFailure("a_function(1)")
 self.assertEvaluateFailure("var2 + struct1.foo")
 self.assertEvaluateFailure("foo_func")
-self.assertEvaluateFailure("foo_var")
+self.assertEvaluate("foo_var", "44")
 
 # Expressions at breakpoint 2, which is an anonymous block
 

[Lldb-commits] [lldb] [llvm] [LLDB] Switch to using DIL as default implementation for 'frame var'. (PR #147887)

2025-07-15 Thread via lldb-commits

https://github.com/cmtice closed 
https://github.com/llvm/llvm-project/pull/147887
___
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::(forward_)list (PR #148285)

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


@@ -1642,19 +1662,34 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   },
   "MSVC STL/libstdc++ std::wstring summary provider"));
 
+  stl_summary_flags.SetDontShowChildren(false);
+  stl_summary_flags.SetSkipPointers(false);
+
   AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator,
   "std::shared_ptr synthetic children",
   "^std::shared_ptr<.+>(( )?&)?$", stl_synth_flags, true);
   AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator,
   "std::weak_ptr synthetic children",
   "^std::weak_ptr<.+>(( )?&)?$", stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericListSyntheticFrontEndCreator,
+  "std::list synthetic children", "^std::list<.+>(( )?&)?$",
+  stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericForwardListSyntheticFrontEndCreator,
+  "std::forward_list synthetic children",
+  "^std::forward_list<.+>(( )?&)?$", stl_synth_flags, true);
 
   AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider,
 "MSVC STL/libstdc++ std::shared_ptr summary provider",
 "^std::shared_ptr<.+>(( )?&)?$", stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider,
 "MSVC STL/libstdc++ std::weak_ptr summary provider",
 "^std::weak_ptr<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstdc++ std::list summary provider",
+"^std::list<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstdc++ std::forward_list summary provider",
+"^std::forward_list<.+>(( )?&)?$", stl_summary_flags, true);

Michael137 wrote:

My suggestion was to keep as much of the libstdc++ formatter as-is so the diff 
is smaller. Yes, the capping mechanism is flawed, which is what Pavel pointed 
out above, but I don't think we should fix that as part of this PR. This is 
purely about introducing MSVC STL formatters.

Could you please split out 
https://github.com/llvm/llvm-project/commit/eb8301bdb83da0d3af0ede7b17ac038739e7b6de
 and use the libstdcpp summary provider for libstdc++ for now (since that's 
what we're already doing)

https://github.com/llvm/llvm-project/pull/148285
___
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-15 Thread Ebuka Ezike via lldb-commits

da-viper wrote:

>From the issue, we can have persistent assembly source breakpoint if it is set 
>from the disassembly view. 

We only create sourceReference and virtual disassembly file if there is no 
source file for that frame. 

we can store the necessary information in the adapter data to recreate an 
instruction break-point and handle it like an instruction break-point. 

Relevant Infographic. 

https://github.com/user-attachments/assets/ce8aec05-7a0e-4bec-bbd8-413d33424515";
 />




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] [lldb] [lldb-dap] Re-land refactor of DebugCommunication. (PR #147787)

2025-07-15 Thread Ebuka Ezike via lldb-commits


@@ -152,25 +189,41 @@ def __init__(
 self.log_file = log_file
 self.send = send
 self.recv = recv
-self.recv_packets: list[Optional[ProtocolMessage]] = []
-self.recv_condition = threading.Condition()
-self.recv_thread = threading.Thread(target=self._read_packet_thread)
-self.process_event_body = None
-self.exit_status: Optional[int] = None
-self.capabilities: dict[str, Any] = {}
-self.progress_events: list[Event] = []
-self.reverse_requests = []
-self.sequence = 1
-self.threads = None
-self.thread_stop_reasons = {}
-self.recv_thread.start()
-self.output_condition = threading.Condition()
-self.output: dict[str, list[str]] = {}
-self.configuration_done_sent = False
-self.initialized = False
-self.frame_scopes = {}
+
+# Packets that have been received and processed but have not yet been
+# requested by a test case.
+self._pending_packets: List[Optional[ProtocolMessage]] = []
+# Received packets that have not yet been processed.
+self._recv_packets: List[Optional[ProtocolMessage]] = []
+# Used as a mutex for _recv_packets and for notify when _recv_packets
+# changes.
+self._recv_condition = threading.Condition()
+self._recv_thread = threading.Thread(target=self._read_packet_thread)
+
+# session state
 self.init_commands = init_commands
-self.resolved_breakpoints = {}
+self.exit_status: Optional[int] = None
+self.capabilities: Optional[Dict] = None

da-viper wrote:

Do not see a need for `self.capablities` to be none as it can be represented by 
an empty dict. 

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


[Lldb-commits] [lldb] [lldb-dap] Re-land refactor of DebugCommunication. (PR #147787)

2025-07-15 Thread Ebuka Ezike via lldb-commits


@@ -1141,15 +1253,22 @@ def request_completions(self, text, frameId=None):
 "type": "request",
 "arguments": args_dict,
 }
-return self.send_recv(command_dict)
-
-def request_modules(self, startModule: int, moduleCount: int):
-return self.send_recv(
-{
-"command": "modules",
-"type": "request",
-"arguments": {"startModule": startModule, "moduleCount": 
moduleCount},
-}
+return self._send_recv(command_dict)
+
+def request_modules(
+self,
+start_module: Optional[int] = None,
+module_count: Optional[int] = None,
+):
+args_dict = {}
+
+if start_module:

da-viper wrote:

```suggestion
if start_module is not None:
```

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


[Lldb-commits] [lldb] [lldb-dap] Re-land refactor of DebugCommunication. (PR #147787)

2025-07-15 Thread Ebuka Ezike via lldb-commits


@@ -188,267 +241,326 @@ def validate_response(cls, command, response):
 )
 
 def _read_packet_thread(self):
-done = False
 try:
-while not done:
+while True:
 packet = read_packet(self.recv, trace_file=self.trace_file)
 # `packet` will be `None` on EOF. We want to pass it down to
 # handle_recv_packet anyway so the main thread can handle 
unexpected
 # termination of lldb-dap and stop waiting for new packets.
-done = not self._handle_recv_packet(packet)
+if not self._handle_recv_packet(packet):
+break
 finally:
 dump_dap_log(self.log_file)
 
-def get_modules(self, startModule: int = 0, moduleCount: int = 0):
-module_list = self.request_modules(startModule, 
moduleCount)["body"]["modules"]
+def get_modules(
+self, start_module: Optional[int] = None, module_count: Optional[int] 
= None
+) -> Dict:
+resp = self.request_modules(start_module, module_count)
+if not resp["success"]:
+raise ValueError(f"request_modules failed: {resp!r}")
 modules = {}
+module_list = resp["body"]["modules"]
 for module in module_list:
 modules[module["name"]] = module
 return modules
 
-def get_output(self, category, timeout=0.0, clear=True):
-self.output_condition.acquire()
-output = None
+def get_output(self, category: str, clear=True) -> str:
+output = ""
 if category in self.output:
-output = self.output[category]
+output = self.output.get(category, "")
 if clear:
 del self.output[category]
-elif timeout != 0.0:
-self.output_condition.wait(timeout)
-if category in self.output:
-output = self.output[category]
-if clear:
-del self.output[category]
-self.output_condition.release()
 return output
 
-def collect_output(self, category, timeout_secs, pattern, clear=True):
-end_time = time.time() + timeout_secs
-collected_output = ""
-while end_time > time.time():
-output = self.get_output(category, timeout=0.25, clear=clear)
-if output:
-collected_output += output
-if pattern is not None and pattern in output:
-break
-return collected_output if collected_output else None
+def collect_output(
+self,
+category: str,
+timeout: float,
+pattern: Optional[str] = None,
+clear=True,
+) -> str:
+"""Collect output from 'output' events.
+Args:
+category: The category to collect.
+timeout: The max duration for collecting output.
+pattern:
+Optional, if set, return once this pattern is detected in the
+collected output.
+Returns:
+The collected output.
+"""
+deadline = time.monotonic() + timeout
+output = self.get_output(category, clear)
+while deadline >= time.monotonic() and (
+pattern is None or pattern not in output
+):
+event = self.wait_for_event(["output"], timeout=deadline - 
time.monotonic())
+if not event:  # Timeout or EOF
+break
+output += self.get_output(category, clear=clear)
+return output
 
 def _enqueue_recv_packet(self, packet: Optional[ProtocolMessage]):
-self.recv_condition.acquire()
-self.recv_packets.append(packet)
-self.recv_condition.notify()
-self.recv_condition.release()
+with self.recv_condition:
+self.recv_packets.append(packet)
+self.recv_condition.notify()
 
 def _handle_recv_packet(self, packet: Optional[ProtocolMessage]) -> bool:
-"""Called by the read thread that is waiting for all incoming packets
-to store the incoming packet in "self.recv_packets" in a thread safe
-way. This function will then signal the "self.recv_condition" to
-indicate a new packet is available. Returns True if the caller
-should keep calling this function for more packets.
+"""Handles an incoming packet.
+
+Called by the read thread that is waiting for all incoming packets
+to store the incoming packet in "self._recv_packets" in a thread safe
+way. This function will then signal the "self._recv_condition" to
+indicate a new packet is available.
+
+Args:
+packet: A new packet to store.
+
+Returns:
+True if the caller should keep calling this function for more
+packets.
 """
-# If EOF, notify the read thread by enqueuing a None.
-if not packet:
-s

[Lldb-commits] [lldb] [lldb-dap] Re-land refactor of DebugCommunication. (PR #147787)

2025-07-15 Thread Ebuka Ezike via lldb-commits


@@ -1141,15 +1253,22 @@ def request_completions(self, text, frameId=None):
 "type": "request",
 "arguments": args_dict,
 }
-return self.send_recv(command_dict)
-
-def request_modules(self, startModule: int, moduleCount: int):
-return self.send_recv(
-{
-"command": "modules",
-"type": "request",
-"arguments": {"startModule": startModule, "moduleCount": 
moduleCount},
-}
+return self._send_recv(command_dict)
+
+def request_modules(
+self,
+start_module: Optional[int] = None,
+module_count: Optional[int] = None,
+):
+args_dict = {}
+
+if start_module:
+args_dict["startModule"] = start_module
+if module_count:

da-viper wrote:

```suggestion
if module_count is not None:
```

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


[Lldb-commits] [lldb] [lldb-dap] Re-land refactor of DebugCommunication. (PR #147787)

2025-07-15 Thread Ebuka Ezike via lldb-commits


@@ -188,267 +241,326 @@ def validate_response(cls, command, response):
 )
 
 def _read_packet_thread(self):
-done = False
 try:
-while not done:
+while True:
 packet = read_packet(self.recv, trace_file=self.trace_file)
 # `packet` will be `None` on EOF. We want to pass it down to
 # handle_recv_packet anyway so the main thread can handle 
unexpected
 # termination of lldb-dap and stop waiting for new packets.
-done = not self._handle_recv_packet(packet)
+if not self._handle_recv_packet(packet):
+break
 finally:
 dump_dap_log(self.log_file)
 
-def get_modules(self, startModule: int = 0, moduleCount: int = 0):
-module_list = self.request_modules(startModule, 
moduleCount)["body"]["modules"]
+def get_modules(
+self, start_module: Optional[int] = None, module_count: Optional[int] 
= None
+) -> Dict:
+resp = self.request_modules(start_module, module_count)
+if not resp["success"]:
+raise ValueError(f"request_modules failed: {resp!r}")
 modules = {}
+module_list = resp["body"]["modules"]
 for module in module_list:
 modules[module["name"]] = module
 return modules
 
-def get_output(self, category, timeout=0.0, clear=True):
-self.output_condition.acquire()
-output = None
+def get_output(self, category: str, clear=True) -> str:
+output = ""
 if category in self.output:
-output = self.output[category]
+output = self.output.get(category, "")
 if clear:
 del self.output[category]
-elif timeout != 0.0:
-self.output_condition.wait(timeout)
-if category in self.output:
-output = self.output[category]
-if clear:
-del self.output[category]
-self.output_condition.release()
 return output
 
-def collect_output(self, category, timeout_secs, pattern, clear=True):
-end_time = time.time() + timeout_secs
-collected_output = ""
-while end_time > time.time():
-output = self.get_output(category, timeout=0.25, clear=clear)
-if output:
-collected_output += output
-if pattern is not None and pattern in output:
-break
-return collected_output if collected_output else None
+def collect_output(
+self,
+category: str,
+timeout: float,
+pattern: Optional[str] = None,
+clear=True,
+) -> str:
+"""Collect output from 'output' events.
+Args:
+category: The category to collect.
+timeout: The max duration for collecting output.
+pattern:
+Optional, if set, return once this pattern is detected in the
+collected output.
+Returns:
+The collected output.
+"""
+deadline = time.monotonic() + timeout
+output = self.get_output(category, clear)
+while deadline >= time.monotonic() and (
+pattern is None or pattern not in output
+):
+event = self.wait_for_event(["output"], timeout=deadline - 
time.monotonic())
+if not event:  # Timeout or EOF
+break
+output += self.get_output(category, clear=clear)
+return output
 
 def _enqueue_recv_packet(self, packet: Optional[ProtocolMessage]):
-self.recv_condition.acquire()
-self.recv_packets.append(packet)
-self.recv_condition.notify()
-self.recv_condition.release()
+with self.recv_condition:
+self.recv_packets.append(packet)
+self.recv_condition.notify()
 
 def _handle_recv_packet(self, packet: Optional[ProtocolMessage]) -> bool:
-"""Called by the read thread that is waiting for all incoming packets
-to store the incoming packet in "self.recv_packets" in a thread safe
-way. This function will then signal the "self.recv_condition" to
-indicate a new packet is available. Returns True if the caller
-should keep calling this function for more packets.
+"""Handles an incoming packet.
+
+Called by the read thread that is waiting for all incoming packets
+to store the incoming packet in "self._recv_packets" in a thread safe
+way. This function will then signal the "self._recv_condition" to
+indicate a new packet is available.
+
+Args:
+packet: A new packet to store.
+
+Returns:
+True if the caller should keep calling this function for more
+packets.
 """
-# If EOF, notify the read thread by enqueuing a None.
-if not packet:
-s

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::(forward_)list (PR #148285)

2025-07-15 Thread via lldb-commits

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


[Lldb-commits] [lldb] Fix a deadlock in ModuleList when starting a standalone lldb client/server (PR #148774)

2025-07-15 Thread via lldb-commits

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

Thanks for catching this.  Keeping the module list locked too long is one of 
the easiest ways to produce deadlocks in lldb at present!

I can't see a reason why the work done when lldb is notified of a new module 
should require that the module list be locked at the point where this module 
was loaded until the notification is complete.  For the most part the 
notification reactions are things like adding breakpoints found in the new 
module, or seeing if it indicates the presence of one of the known runtimes - 
so specific to just the module_sp that was passed in.  It shouldn't need to 
require that no more modules get loaded while it is doing that.

So this looks like a good change to me.  

It would be great to get a test for this.  The test I added does something like 
your repro conditions, but because it was specifically about python files in 
dSYM's it was a macOS only test.  But you might be able to use the running 
parts without the dSYM parts to test this?

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


[Lldb-commits] [lldb] [lldb] Add completions for plugin list/enable/disable (PR #147775)

2025-07-15 Thread David Peixotto via lldb-commits


@@ -1321,10 +1321,11 @@ enum CompletionType {
   eTypeCategoryNameCompletion = (1ul << 24),
   eCustomCompletion = (1ul << 25),
   eThreadIDCompletion = (1ul << 26),
+  eManagedPluginCompletion = (1ul << 27),
   // This last enum element is just for input validation.
   // Add new completions before this element,
   // and then increment eTerminatorCompletion's shift value
-  eTerminatorCompletion = (1ul << 27)
+  eTerminatorCompletion = (1ul << 28)

dmpots wrote:

I will follow up with a separate PR to remove it.

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


[Lldb-commits] [lldb] fccae85 - [lldb] Add completions for plugin list/enable/disable (#147775)

2025-07-15 Thread via lldb-commits

Author: David Peixotto
Date: 2025-07-15T12:44:00-07:00
New Revision: fccae859bc949ba390184614e07234267a734b86

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

LOG: [lldb] Add completions for plugin list/enable/disable (#147775)

This commit adds completion support for the plugin commands. It will try
to complete partial namespaces to the full namespace string. If the
completion input is already a full namespace string then it will add all
the matching plugins in that namespace as completions.

This lets the user complete to the namespace first and then tab-complete
to the next level if desired.

```
(lldb) plugin list a
Available completions:
abi
architecture
(lldb) plugin list ab
(lldb) plugin list abi
(lldb) plugin list abi.
Available completions:
abi.SysV-arm64
abi.ABIMacOSX_arm64
abi.SysV-arm
...
```

Added: 


Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/include/lldb/Interpreter/CommandCompletions.h
lldb/include/lldb/lldb-enumerations.h
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/Commands/CommandCompletions.cpp
lldb/source/Commands/CommandObjectPlugin.cpp
lldb/source/Core/PluginManager.cpp
lldb/test/API/commands/plugin/TestPlugin.py

Removed: 




diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index 5499e99025d8a..369785ceea5a5 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -787,6 +787,9 @@ class PluginManager {
 
   static std::vector GetUnwindAssemblyPluginInfo();
   static bool SetUnwindAssemblyPluginEnabled(llvm::StringRef name, bool 
enable);
+
+  static void AutoCompletePluginName(llvm::StringRef partial_name,
+ CompletionRequest &request);
 };
 
 } // namespace lldb_private

diff  --git a/lldb/include/lldb/Interpreter/CommandCompletions.h 
b/lldb/include/lldb/Interpreter/CommandCompletions.h
index c7292b3b1471a..0c0424cbac6eb 100644
--- a/lldb/include/lldb/Interpreter/CommandCompletions.h
+++ b/lldb/include/lldb/Interpreter/CommandCompletions.h
@@ -123,6 +123,10 @@ class CommandCompletions {
   static void ThreadIDs(CommandInterpreter &interpreter,
 CompletionRequest &request, SearchFilter *searcher);
 
+  static void ManagedPlugins(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
+
   /// This completer works for commands whose only arguments are a command 
path.
   /// It isn't tied to an argument type because it completes not on a single
   /// argument but on the sequence of arguments, so you have to invoke it by

diff  --git a/lldb/include/lldb/lldb-enumerations.h 
b/lldb/include/lldb/lldb-enumerations.h
index 69e8671b6e21b..e021c7a926cf1 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -1321,10 +1321,11 @@ enum CompletionType {
   eTypeCategoryNameCompletion = (1ul << 24),
   eCustomCompletion = (1ul << 25),
   eThreadIDCompletion = (1ul << 26),
+  eManagedPluginCompletion = (1ul << 27),
   // This last enum element is just for input validation.
   // Add new completions before this element,
   // and then increment eTerminatorCompletion's shift value
-  eTerminatorCompletion = (1ul << 27)
+  eTerminatorCompletion = (1ul << 28)
 };
 
 /// Specifies if children need to be re-computed

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index a4ff96e4158ce..63fadb59a82a1 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2268,7 +2268,7 @@ def completions_match(self, command, completions, 
max_completions=-1):
 completions, list(match_strings)[1:], "List of returned completion 
is wrong"
 )
 
-def completions_contain(self, command, completions):
+def completions_contain(self, command, completions, match=True):
 """Checks that the completions for the given command contain the given
 list of completions."""
 interp = self.dbg.GetCommandInterpreter()
@@ -2276,9 +2276,16 @@ def completions_contain(self, command, completions):
 interp.HandleCompletion(command, len(command), 0, -1, match_strings)
 for completion in completions:
 # match_strings is a 1-indexed list, so we have to slice...
-self.assertIn(
-completion, list(match_strings)[1:], "Couldn't find expected 
completion"
-)
+if match:
+self.assertIn(
+completion,
+list(match_strings)[1:],
+  

[Lldb-commits] [lldb] [lldb] Fix plugin test to not rely on enabled targets (PR #148956)

2025-07-15 Thread David Peixotto via lldb-commits

https://github.com/dmpots created 
https://github.com/llvm/llvm-project/pull/148956

The plugins completion test was checking completions for the abi plugins. But 
the available abi plugins will depend on which 
[targets](https://github.com/llvm/llvm-project/blob/42d2ae1034b287eb60563c370dbf52c59b66db20/lldb/source/Plugins/ABI/CMakeLists.txt#L7)
 are enabled in the cmake build configuration.

This PR updates the test to check for the json object file instead which should 
be enabled on all builds.

>From 304d21e3ae6395f5e966424741c036026c193e6d Mon Sep 17 00:00:00 2001
From: David Peixotto 
Date: Tue, 15 Jul 2025 13:43:08 -0700
Subject: [PATCH] [lldb] Fix plugin test to not rely on enabled targets

The plugins completion test was checking completions for the abi
plugins. But the available abi plugins will depend on which 
[targets](https://github.com/llvm/llvm-project/blob/42d2ae1034b287eb60563c370dbf52c59b66db20/lldb/source/Plugins/ABI/CMakeLists.txt#L7)
are enabled in the cmake build configuration.

This PR updates the test to check for the json object file instead which
should be enabled on all builds.
---
 lldb/test/API/commands/plugin/TestPlugin.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lldb/test/API/commands/plugin/TestPlugin.py 
b/lldb/test/API/commands/plugin/TestPlugin.py
index e7de7a3f797f1..bd8ab9604538e 100644
--- a/lldb/test/API/commands/plugin/TestPlugin.py
+++ b/lldb/test/API/commands/plugin/TestPlugin.py
@@ -82,10 +82,10 @@ def test_completions(self):
 )
 
 # A completion for a full namespace should contain the plugins in that 
namespace.
-self.completions_contain("plugin list abi", ["abi.sysv-x86_64"])
-self.completions_contain("plugin list abi.", ["abi.sysv-x86_64"])
-self.completions_contain("plugin list abi.s", ["abi.sysv-x86_64"])
-self.completions_contain("plugin list abi.sysv-x", ["abi.sysv-x86_64"])
+self.completions_contain("plugin list object-file", 
["object-file.JSON"])
+self.completions_contain("plugin list object-file.", 
["object-file.JSON"])
+self.completions_contain("plugin list object-file.J", 
["object-file.JSON"])
+self.completions_contain("plugin list object-file.JS", 
["object-file.JSON"])
 
 # Check for a completion that is a both a complete namespace and a 
prefix of
 # another namespace. It should return the completions for the plugins 
in the completed

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


[Lldb-commits] [lldb] [lldb] Fix plugin test to not rely on enabled targets (PR #148956)

2025-07-15 Thread David Peixotto via lldb-commits

dmpots wrote:

This is to fix a buildbot failure: 
https://lab.llvm.org/buildbot/#/builders/195/builds/11884

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


[Lldb-commits] [lldb] [lldb] Fix plugin test to not rely on enabled targets (PR #148956)

2025-07-15 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Peixotto (dmpots)


Changes

The plugins completion test was checking completions for the abi plugins. But 
the available abi plugins will depend on which 
[targets](https://github.com/llvm/llvm-project/blob/42d2ae1034b287eb60563c370dbf52c59b66db20/lldb/source/Plugins/ABI/CMakeLists.txt#L7)
 are enabled in the cmake build configuration.

This PR updates the test to check for the json object file instead which should 
be enabled on all builds.

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


1 Files Affected:

- (modified) lldb/test/API/commands/plugin/TestPlugin.py (+4-4) 


``diff
diff --git a/lldb/test/API/commands/plugin/TestPlugin.py 
b/lldb/test/API/commands/plugin/TestPlugin.py
index e7de7a3f797f1..bd8ab9604538e 100644
--- a/lldb/test/API/commands/plugin/TestPlugin.py
+++ b/lldb/test/API/commands/plugin/TestPlugin.py
@@ -82,10 +82,10 @@ def test_completions(self):
 )
 
 # A completion for a full namespace should contain the plugins in that 
namespace.
-self.completions_contain("plugin list abi", ["abi.sysv-x86_64"])
-self.completions_contain("plugin list abi.", ["abi.sysv-x86_64"])
-self.completions_contain("plugin list abi.s", ["abi.sysv-x86_64"])
-self.completions_contain("plugin list abi.sysv-x", ["abi.sysv-x86_64"])
+self.completions_contain("plugin list object-file", 
["object-file.JSON"])
+self.completions_contain("plugin list object-file.", 
["object-file.JSON"])
+self.completions_contain("plugin list object-file.J", 
["object-file.JSON"])
+self.completions_contain("plugin list object-file.JS", 
["object-file.JSON"])
 
 # Check for a completion that is a both a complete namespace and a 
prefix of
 # another namespace. It should return the completions for the plugins 
in the completed

``




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


[Lldb-commits] [lldb] [lldb] Add completions for plugin list/enable/disable (PR #147775)

2025-07-15 Thread David Peixotto via lldb-commits

dmpots wrote:

Follow up PR to fix a buildbot failure: #148956

https://github.com/llvm/llvm-project/pull/147775
___
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-15 Thread Chelsea Cassanova via lldb-commits

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

In LLDB RPC, we need to keep track of methods that have a pointer parameter 
followed by a lengtgh parameter as these parameters need some exceptions when 
they're being emitted by lldb-rpc-gen. Previously, we used an exception list to 
keep track of every method that fell under this category using their mangled 
names. This method worked, but manually maintaining an exception list this way 
is unwieldly and can lead to hard-to-track errors for clients that use RPC and 
forget to add a method that they use to said list.

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.

>From 9392a38149a580250cf590a2c05b205c14a0af17 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Tue, 15 Jul 2025 14:29:36 -0500
Subject: [PATCH] [lldb][rpc] Use Clang attributes to keep track of pointer
 plus len

In LLDB RPC, we need to keep track of methods that have a pointer
parameter followed by a lengtgh parameter as these parameters need
some exceptions when they're being emitted by lldb-rpc-gen. Previously,
we used an exception list to keep track of every method that fell under
this category using their mangled names. This method worked, but
manually maintaining an exception list this way is unwieldly and can
lead to hard-to-track errors for clients that use RPC and forget to add
a method that they use to said list.

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.
---
 lldb/include/lldb/API/SBData.h|  56 ++-
 lldb/include/lldb/API/SBDebugger.h|   2 +
 lldb/include/lldb/API/SBFile.h|   2 +
 lldb/include/lldb/API/SBFileSpec.h|   2 +
 lldb/include/lldb/API/SBModule.h  |   1 +
 lldb/include/lldb/API/SBModuleSpec.h  |   1 +
 lldb/include/lldb/API/SBProcess.h |   6 +
 lldb/include/lldb/API/SBStructuredData.h  |   1 +
 lldb/include/lldb/API/SBTarget.h  |  17 +-
 lldb/include/lldb/API/SBThread.h  |   1 +
 .../tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp | 469 ++
 lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.h  | 109 
 12 files changed, 637 insertions(+), 30 deletions(-)
 create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp
 create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.h

diff --git a/lldb/include/lldb/API/SBData.h b/lldb/include/lldb/API/SBData.h
index 89a699f2f713a..1242ffdfc85b5 100644
--- a/lldb/include/lldb/API/SBData.h
+++ b/lldb/include/lldb/API/SBData.h
@@ -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")]]
   size_t ReadRawData(lldb::SBError &error, lldb::offset_t offset, void *buf,
  size_t size);
 
@@ -80,9 +81,11 @@ class LLDB_API SBData {
   // DataExtractor, but having two SetData() signatures triggers a SWIG bug
   // where the typemap isn't applied before resolving the overload, and thus
   // the right function never gets called
+  [[clang::annotate("lldb-rpc-gen pointer plus len")]]
   void SetData(lldb::SBError &error, const void *buf, size_t size,
lldb::ByteOrder endian, uint8_t addr_size);
 
+  [[clang::annotate("lldb-rpc-gen pointer plus len")]]
   void SetDataWithOwnership(lldb::SBError &error, const void *buf, size_t size,
 lldb::ByteOrder endian, uint8_t addr_size);
 
@@ -96,41 +99,46 @@ class LLDB_API SBData {
   // in the following CreateData*() and SetData*() prototypes, the two
   // parameters array and array_len should not be renamed or rearranged,
   // because doing so will break the SWIG typemap
-  static lldb::SBData CreateDataFromUInt64Array(lldb::ByteOrder endian,
-uint32_t addr_byte_size,
-uint64_t *array,
-size_t array_len);
-
-  static lldb::SBData CreateDataFromUInt32Array(lldb::ByteOrder endian,
-uint32_t addr_byte_size,
-uint32_t *array,
-size_t array_len);
-
-  static lldb::SBData CreateDataFromSInt64Array(lldb::ByteOrder endian,
-uint32_t addr_byte_size,
-int64_t *array,
-size_t array_len);
-
-  static lldb::SBData CreateDataFromSInt32Ar

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

2025-07-15 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Chelsea Cassanova (chelcassanova)


Changes

In LLDB RPC, we need to keep track of methods that have a pointer parameter 
followed by a lengtgh parameter as these parameters need some exceptions when 
they're being emitted by lldb-rpc-gen. Previously, we used an exception list to 
keep track of every method that fell under this category using their mangled 
names. This method worked, but manually maintaining an exception list this way 
is unwieldly and can lead to hard-to-track errors for clients that use RPC and 
forget to add a method that they use to said list.

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.

---

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


12 Files Affected:

- (modified) lldb/include/lldb/API/SBData.h (+32-24) 
- (modified) lldb/include/lldb/API/SBDebugger.h (+2) 
- (modified) lldb/include/lldb/API/SBFile.h (+2) 
- (modified) lldb/include/lldb/API/SBFileSpec.h (+2) 
- (modified) lldb/include/lldb/API/SBModule.h (+1) 
- (modified) lldb/include/lldb/API/SBModuleSpec.h (+1) 
- (modified) lldb/include/lldb/API/SBProcess.h (+6) 
- (modified) lldb/include/lldb/API/SBStructuredData.h (+1) 
- (modified) lldb/include/lldb/API/SBTarget.h (+11-6) 
- (modified) lldb/include/lldb/API/SBThread.h (+1) 
- (added) lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp (+469) 
- (added) lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.h (+109) 


``diff
diff --git a/lldb/include/lldb/API/SBData.h b/lldb/include/lldb/API/SBData.h
index 89a699f2f713a..1242ffdfc85b5 100644
--- a/lldb/include/lldb/API/SBData.h
+++ b/lldb/include/lldb/API/SBData.h
@@ -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")]]
   size_t ReadRawData(lldb::SBError &error, lldb::offset_t offset, void *buf,
  size_t size);
 
@@ -80,9 +81,11 @@ class LLDB_API SBData {
   // DataExtractor, but having two SetData() signatures triggers a SWIG bug
   // where the typemap isn't applied before resolving the overload, and thus
   // the right function never gets called
+  [[clang::annotate("lldb-rpc-gen pointer plus len")]]
   void SetData(lldb::SBError &error, const void *buf, size_t size,
lldb::ByteOrder endian, uint8_t addr_size);
 
+  [[clang::annotate("lldb-rpc-gen pointer plus len")]]
   void SetDataWithOwnership(lldb::SBError &error, const void *buf, size_t size,
 lldb::ByteOrder endian, uint8_t addr_size);
 
@@ -96,41 +99,46 @@ class LLDB_API SBData {
   // in the following CreateData*() and SetData*() prototypes, the two
   // parameters array and array_len should not be renamed or rearranged,
   // because doing so will break the SWIG typemap
-  static lldb::SBData CreateDataFromUInt64Array(lldb::ByteOrder endian,
-uint32_t addr_byte_size,
-uint64_t *array,
-size_t array_len);
-
-  static lldb::SBData CreateDataFromUInt32Array(lldb::ByteOrder endian,
-uint32_t addr_byte_size,
-uint32_t *array,
-size_t array_len);
-
-  static lldb::SBData CreateDataFromSInt64Array(lldb::ByteOrder endian,
-uint32_t addr_byte_size,
-int64_t *array,
-size_t array_len);
-
-  static lldb::SBData CreateDataFromSInt32Array(lldb::ByteOrder endian,
-uint32_t addr_byte_size,
-int32_t *array,
-size_t array_len);
-
-  static lldb::SBData CreateDataFromDoubleArray(lldb::ByteOrder endian,
-uint32_t addr_byte_size,
-double *array,
-size_t array_len);
+  [[clang::annotate("lldb-rpc-gen pointer plus len")]]
+  static lldb::SBData
+  CreateDataFromUInt64Array(lldb::ByteOrder endian, uint32_t addr_byte_size,
+uint64_t *array, size_t array_len);
+
+  [[clang::annotate("lldb-rpc-gen pointer plus len")]]
+  static lldb::SBData
+  CreateDataFromUInt32Array(lldb::ByteOrder endian, uint32_t addr_byte_size,
+uint32_t *array, size_t array_len);
+
+  [[clang::annotate("lldb-rpc-gen pointer plus len")]]
+  static 

[Lldb-commits] [lldb] Add new "target module replace" command (PR #148735)

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

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

>From c021e054277a590901012e6c9fcdcff8fedf9867 Mon Sep 17 00:00:00 2001
From: Jeffrey Tan 
Date: Wed, 21 Jul 2021 13:32:56 -0700
Subject: [PATCH] Add new "target module replace" command

Summary:
For dump debugging (both minidump and coredump), the dump most likely only 
contains the process memory without real modules so placeholder object files 
are created for the modules.

LLDB lacks a feature to hydrate/upgrade these dummy modules into real modules. 
This diff bridges the gap with a new `target module replace` command.

The new command would replace the place holder object file in target module 
with input new/real object file and refresh the symbol table/stack. The target 
module is located with file name matching, users can also specify the target 
module via "-s" option if the module names differ.

Another change is placeholder modules will have `(*)` added at the end as hint.

The workflow would be:
* lldb -c 
* `image list` to see place holder modules
* download fbpkg and unzip it
* `target module replace `

Test Plan:
A new unit test is added.
c4crasher end-to-end debugging is tested.
c4crasher testing workflow is documented here: 
https://www.internalfb.com/intern/wiki/Coredumper/Developer_Guide/Development_Process/

Reviewers: wanyi, #lldb_team

Reviewed By: wanyi

Subscribers: gclayton, #lldb_team

Differential Revision: https://phabricator.intern.facebook.com/D43756670
---
 lldb/include/lldb/Core/Module.h   |  21 +++
 lldb/source/Commands/CommandObjectTarget.cpp  | 155 +-
 lldb/source/Core/Module.cpp   |  89 ++
 .../postmortem/elf-core/TestLinuxCore.py  |  35 
 4 files changed, 267 insertions(+), 33 deletions(-)

diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 8bb55c95773bc..04e1427a6a984 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -547,6 +547,22 @@ class Module : public std::enable_shared_from_this,
   /// remains valid as long as the object is around.
   virtual ObjectFile *GetObjectFile();
 
+  /// Replace existing backing object file with new \param object_file.
+  ///
+  /// The old object file being replaced will be kept alive to prevent from
+  /// dangling symbol references.
+  /// UUID and underlying symbol file will be reparsed during further access.
+  /// A common use case is to replace an Placeholder object file with a real
+  /// one during dump debugging.
+  ///
+  /// \param[in] target
+  ///The target to update object file load address.
+  ///
+  /// \param[in] object_file
+  /// The new object file spec to replace the existing one.
+  virtual void ReplaceObjectFile(Target &target, FileSpec object_file,
+ uint64_t object_offset);
+
   /// Get the unified section list for the module. This is the section list
   /// created by the module's object file and any debug info and symbol files
   /// created by the symbol vendor.
@@ -1032,6 +1048,9 @@ class Module : public 
std::enable_shared_from_this,
   lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
/// parser for this module as it may or may
/// not be shared with the SymbolFile
+  lldb::ObjectFileSP m_old_objfile_sp; /// Strong reference to keep the old
+   /// object file being replaced alive.
+
   UnwindTable m_unwind_table;  ///< Table of FuncUnwinders
/// objects created for this
/// Module's functions
@@ -1093,6 +1112,8 @@ class Module : public 
std::enable_shared_from_this,
 private:
   Module(); // Only used internally by CreateJITModule ()
 
+  void LoadObjectFile();
+
   Module(const Module &) = delete;
   const Module &operator=(const Module &) = delete;
 
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index dbebbbd38093e..9d7207d032058 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -2866,6 +2866,150 @@ class CommandObjectTargetModulesAdd : public 
CommandObjectParsed {
   }
 };
 
+class CommandObjectTargetModulesReplace : public CommandObjectParsed {
+public:
+  CommandObjectTargetModulesReplace(CommandInterpreter &interpreter)
+  : CommandObjectParsed(
+interpreter, "target modules replace",
+"Replace module's existing object file with a new object file.",
+"target modules replace []", eCommandRequiresTarget),
+m_file_to_replace(LLDB_OPT_SET_1, false, "shlib", 's',
+  lldb::eModuleCompletion, eArgTypeShlibName,
+  "File name of the shared library to replace.") {
+m_option_group.Append(&m_uuid_option_group, LLDB_OPT_SET_ALL

[Lldb-commits] [lldb] [lldb] Fix a crash in lldb-server during RemoveSoftwareBreakpoint() (PR #148738)

2025-07-15 Thread via lldb-commits

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

>From 890eb98ceada6495f6a089f7f0a4823b7369d2ec Mon Sep 17 00:00:00 2001
From: royshi 
Date: Mon, 14 Jul 2025 13:45:13 -0700
Subject: [PATCH 1/2] [lldb] Fix a crash in lldb-server during
 RemoveSoftwareBreakpoint()

---
 .../Host/common/NativeProcessProtocol.cpp  | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp 
b/lldb/source/Host/common/NativeProcessProtocol.cpp
index 405acbb5662d6..196f54b93538d 100644
--- a/lldb/source/Host/common/NativeProcessProtocol.cpp
+++ b/lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -366,12 +366,19 @@ Status 
NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) {
   if (--it->second.ref_count > 0)
 return Status();
 
+  // Remove the entry from m_software_breakpoints rightaway, so that we don't
+  // leave behind an entry with ref_count == 0 in case one of the following
+  // conditions returns an error. The breakpoint is moved so that it can be
+  // accessed below.
+  SoftwareBreakpoint bkpt = std::move(it->second);
+  m_software_breakpoints.erase(it);
+
   // This is the last reference. Let's remove the breakpoint.
   Status error;
 
   // Clear a software breakpoint instruction
-  llvm::SmallVector curr_break_op(
-  it->second.breakpoint_opcodes.size(), 0);
+  llvm::SmallVector curr_break_op(bkpt.breakpoint_opcodes.size(),
+  0);
 
   // Read the breakpoint opcode
   size_t bytes_read = 0;
@@ -382,10 +389,10 @@ Status 
NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) {
 "addr=0x%" PRIx64 ": tried to read %zu bytes but only read %zu", addr,
 curr_break_op.size(), bytes_read);
   }
-  const auto &saved = it->second.saved_opcodes;
+  const auto &saved = bkpt.saved_opcodes;
   // Make sure the breakpoint opcode exists at this address
-  if (llvm::ArrayRef(curr_break_op) != it->second.breakpoint_opcodes) {
-if (curr_break_op != it->second.saved_opcodes)
+  if (llvm::ArrayRef(curr_break_op) != bkpt.breakpoint_opcodes) {
+if (curr_break_op != bkpt.saved_opcodes)
   return Status::FromErrorString(
   "Original breakpoint trap is no longer in memory.");
 LLDB_LOG(log,
@@ -418,7 +425,6 @@ Status 
NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) {
llvm::make_range(saved.begin(), saved.end()));
   }
 
-  m_software_breakpoints.erase(it);
   return Status();
 }
 

>From d15f269446dbd8abcaa4cf365b03dc647824dc90 Mon Sep 17 00:00:00 2001
From: royshi 
Date: Tue, 15 Jul 2025 14:58:49 -0700
Subject: [PATCH 2/2] Add unit test

---
 .../Host/NativeProcessProtocolTest.cpp| 93 ++-
 1 file changed, 92 insertions(+), 1 deletion(-)

diff --git a/lldb/unittests/Host/NativeProcessProtocolTest.cpp 
b/lldb/unittests/Host/NativeProcessProtocolTest.cpp
index a48e67c9213da..91c4fd69d6e54 100644
--- a/lldb/unittests/Host/NativeProcessProtocolTest.cpp
+++ b/lldb/unittests/Host/NativeProcessProtocolTest.cpp
@@ -73,6 +73,97 @@ TEST(NativeProcessProtocolTest, SetBreakpointFailVerify) {
 llvm::Failed());
 }
 
+TEST(NativeProcessProtocolTest, RemoveSoftwareBreakpoint) {
+  NiceMock DummyDelegate;
+  MockProcess Process(DummyDelegate,
+ ArchSpec("x86_64-pc-linux"));
+  auto Trap = cantFail(Process.GetSoftwareBreakpointTrapOpcode(1));
+  auto Original = std::vector{0xbb};
+
+  // Set up a breakpoint.
+  {
+InSequence S;
+EXPECT_CALL(Process, ReadMemory(0x47, 1))
+.WillOnce(Return(ByMove(Original)));
+EXPECT_CALL(Process, WriteMemory(0x47, Trap)).WillOnce(Return(ByMove(1)));
+EXPECT_CALL(Process, ReadMemory(0x47, 1)).WillOnce(Return(ByMove(Trap)));
+EXPECT_THAT_ERROR(Process.SetBreakpoint(0x47, 0, false).ToError(),
+  llvm::Succeeded());
+  }
+
+  // Remove the breakpoint for the first time. This should remove the 
breakpoint
+  // from m_software_breakpoints.
+  //
+  // Should succeed.
+  {
+InSequence S;
+EXPECT_CALL(Process, ReadMemory(0x47, 1)).WillOnce(Return(ByMove(Trap)));
+EXPECT_CALL(Process, WriteMemory(0x47, llvm::ArrayRef(Original)))
+.WillOnce(Return(ByMove(1)));
+EXPECT_CALL(Process, ReadMemory(0x47, 1))
+.WillOnce(Return(ByMove(Original)));
+EXPECT_THAT_ERROR(Process.RemoveBreakpoint(0x47, false).ToError(),
+  llvm::Succeeded());
+  }
+
+  // Remove the breakpoint for the second time.
+  //
+  // Should fail. None of the ReadMemory() or WriteMemory() should be called,
+  // because the function should early return when seeing that the breakpoint
+  // isn't in m_software_breakpoints.
+  {
+EXPECT_CALL(Process, ReadMemory(_, _)).Times(0);
+EXPECT_CALL(Process, WriteMemory(_, _)).Times(0);
+EXPECT_THAT_ERROR(Process.RemoveBreakpoint(0x47, false).ToError(),
+  

[Lldb-commits] [lldb] [LLDB] Disable DIL QualifiedId test on Windows. (PR #148940)

2025-07-15 Thread via lldb-commits

https://github.com/cmtice created 
https://github.com/llvm/llvm-project/pull/148940

The lldb-x86_64-win buildbot is failing on this one DIL test. Disable the test 
on Windows until we can debug it on Windows.

>From 83094baf1eb1969e66c1a458ef7c29d2b1c3ef7f Mon Sep 17 00:00:00 2001
From: Caroline Tice 
Date: Tue, 15 Jul 2025 12:29:34 -0700
Subject: [PATCH] [LLDB] Disable DIL QualifiedId test on Windows.

The lldb-x86_64-win buildbot is failing on this one DIL test. Disable
the test on Windows until we can debug it on Windows.
---
 .../var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
index 8c009aa182d07..6f00b9e0cfb6c 100644
--- 
a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
+++ 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
@@ -18,6 +18,7 @@ class TestFrameVarDILQualifiedId(TestBase):
 # each debug info format.
 NO_DEBUG_INFO_TESTCASE = True
 
+@skipIfWindows
 def test_frame_var(self):
 self.build()
 lldbutil.run_to_source_breakpoint(

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


[Lldb-commits] [lldb] [LLDB] Disable DIL QualifiedId test on Windows. (PR #148940)

2025-07-15 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (cmtice)


Changes

The lldb-x86_64-win buildbot is failing on this one DIL test. Disable the test 
on Windows until we can debug it on Windows.

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


1 Files Affected:

- (modified) 
lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
 (+1) 


``diff
diff --git 
a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
index 8c009aa182d07..6f00b9e0cfb6c 100644
--- 
a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
+++ 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
@@ -18,6 +18,7 @@ class TestFrameVarDILQualifiedId(TestBase):
 # each debug info format.
 NO_DEBUG_INFO_TESTCASE = True
 
+@skipIfWindows
 def test_frame_var(self):
 self.build()
 lldbutil.run_to_source_breakpoint(

``




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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang][modules] Serialize `CodeGenOptions` (PR #146422)

2025-07-15 Thread Jan Svoboda via lldb-commits

jansvoboda11 wrote:

Windows CI failure look unrelated.

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


[Lldb-commits] [lldb] [llvm] [LLDB] Switch to using DIL as default implementation for 'frame var'. (PR #147887)

2025-07-15 Thread via lldb-commits

https://github.com/cmtice updated 
https://github.com/llvm/llvm-project/pull/147887

>From 3dbe09deb36a44eb056fa2d3d7dacd341e391697 Mon Sep 17 00:00:00 2001
From: Caroline Tice 
Date: Wed, 9 Jul 2025 20:42:03 -0700
Subject: [PATCH 1/4] [LLDB] Switch to using DIL as default implementation for
 'frame var'.

---
 lldb/source/Target/TargetProperties.td | 4 ++--
 llvm/docs/ReleaseNotes.md  | 8 
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Target/TargetProperties.td 
b/lldb/source/Target/TargetProperties.td
index 4aa9e046d6077..656503bb8d228 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -5,8 +5,8 @@ let Definition = "target_experimental" in {
 Global, DefaultTrue,
 Desc<"If true, inject local variables explicitly into the expression text. 
This will fix symbol resolution when there are name collisions between ivars 
and local variables. But it can make expressions run much more slowly.">;
   def UseDIL : Property<"use-DIL", "Boolean">,
-Global, DefaultFalse,
-Desc<"If true, use the alternative DIL implementation for frame variable 
evaluation.">;
+Global, DefaultTrue,
+Desc<"If true, use the DIL implementation for frame variable evaluation.">;
 }
 
 let Definition = "target" in {
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index daf822388a2ff..5d2146b7f2f75 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -306,6 +306,14 @@ Changes to LLDB
 stop reason = SIGSEGV: sent by tkill system call (sender pid=649752, 
uid=2667987)
   ```
 * ELF Cores can now have their siginfo structures inspected using `thread 
siginfo`.
+* LLDB now uses
+  [DIL](https://discourse.llvm.org/t/rfc-data-inspection-language/69893) as the
+  default implementation for 'frame variable'. This should not change the
+  behavior of 'frame variable' at all, at this time. To revert to using the
+  old implementation use
+  ```
+ settings set target.experimental.use-DIL false
+   ```
 
 ### Changes to lldb-dap
 

>From c3d1940ddb086bda4dffe03737754a57f62a5507 Mon Sep 17 00:00:00 2001
From: Caroline Tice 
Date: Fri, 11 Jul 2025 16:35:24 -0700
Subject: [PATCH 2/4] Small fixes:  - Remove not-always-valid field-name check
 when evaluating field members.  - Fix unexpected passes in TestDAP_evaluate
 (test owner said it was ok).  - Add more anonymous namespace tests.

---
 lldb/source/ValueObject/DILEval.cpp   |  2 +-
 .../QualifiedId/TestFrameVarDILQualifiedId.py | 14 +
 .../frame/var-dil/basics/QualifiedId/main.cpp | 21 ++-
 .../lldb-dap/evaluate/TestDAP_evaluate.py |  6 +++---
 4 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/lldb/source/ValueObject/DILEval.cpp 
b/lldb/source/ValueObject/DILEval.cpp
index fd3f9f8724608..6f28434c646cd 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -303,7 +303,7 @@ Interpreter::Visit(const MemberOfNode *node) {
 }
   }
 
-  if (field_obj && field_obj->GetName() == node->GetFieldName()) {
+  if (field_obj) {
 if (m_use_dynamic != lldb::eNoDynamicValues) {
   lldb::ValueObjectSP dynamic_val_sp =
   field_obj->GetDynamicValue(m_use_dynamic);
diff --git 
a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
index b2ce9602e6a50..8c009aa182d07 100644
--- 
a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
+++ 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py
@@ -29,3 +29,17 @@ def test_frame_var(self):
 self.expect_var_path("ns::i", value="1")
 self.expect_var_path("::ns::ns::i", value="2")
 self.expect_var_path("ns::ns::i", value="2")
+
+self.expect_var_path("foo", value="1")
+self.expect_var_path("::(anonymous namespace)::foo", value="13")
+self.expect_var_path("(anonymous namespace)::foo", value="13")
+self.expect_var_path("ns1::(anonymous namespace)::foo", value="5")
+self.expect_var_path(
+"(anonymous namespace)::ns2::(anonymous namespace)::foo",
+value="7",
+)
+self.expect_var_path("::ns1::(anonymous namespace)::foo", value="5")
+self.expect_var_path(
+"::(anonymous namespace)::ns2::(anonymous namespace)::foo",
+value="7",
+)
diff --git a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp 
b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp
index 8a5c47a6f364c..8c7e01a6f40af 100644
--- a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp
+++ b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp
@@ -10,7 +10,26 @@ int i = 2;
 
 } // namespace ns
 
+namespace {
+int foo = 13;
+}
+
+namespace ns1 {
+namespace {
+

[Lldb-commits] [lldb] [lldb] Convert registers values into target endian for expressions (PR #148836)

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

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

Relates to 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.

>From fc80b9c5f559eed17701ab90f1a538796993e365 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Mon, 14 Jul 2025 14:24:14 +
Subject: [PATCH] [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/commands/expression/TestRegisterExpressionEndian.py 
b/lldb/test/API/commands/expression/TestRegisterExpressionEndian.py
new fi

[Lldb-commits] [lldb] [lldb] Convert registers values into target endian for expressions (PR #148836)

2025-07-15 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

Relates to 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.

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


2 Files Affected:

- (modified) lldb/source/Expression/Materializer.cpp (+11-14) 
- (added) lldb/test/API/commands/expression/TestRegisterExpressionEndian.py 
(+86) 


``diff
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..66e38df3a9696
--- /dev/null
+++ b/lldb/test/API/commands/expression/TestRegisterExpressionEndian.py
@@ -0,0 +1,86 @@
+""" 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 import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
+
+
+class Endian(Enum):
+BIG = 0
+LITTLE = 1
+
+
+class Responder(MockGDBServerResponder):
+def __init__(self, doc, endian):
+super().__init__()
+self.target_xml = doc
+self.endian = endian
+
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return self.target_xml, False
+return (None,)
+
+def readRegister(self, regnum):
+return "E01"
+
+def readRegisters(self):
+# 64 bit pc value.
+data = ["00", "00", "00", "00", "00", "00", "12", "34"]
+if self.endian == Endian.LITTLE:
+data.reverse()
+return "".join(data)
+
+
+class TestXMLRegisterFlags(GDBRemoteTestBase):
+def do_endian_test(self, endian):
+architecture, pc_reg_name = {
+Endian.BIG: ("s390x", "pswa"),
+Endian.LITTLE: ("aarch64", "pc"),
+}[endia

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

2025-07-15 Thread via lldb-commits

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

>From 2ca001ffd2c84410877680d832af2effbc560dde Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Sat, 21 Jun 2025 17:35:23 +0200
Subject: [PATCH 1/2] [LLDB] Add formatters for MSVC STL std::vector

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  30 +-
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   5 +
 .../Language/CPlusPlus/MsvcStlVector.cpp  | 297 ++
 .../vbool/TestDataFormatterStdVBool.py|  24 +-
 .../data-formatter-stl/generic/vbool/main.cpp |  39 ++-
 .../vector/TestDataFormatterStdVector.py  |  11 +
 7 files changed, 399 insertions(+), 8 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlVector.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 296159ea28407..21f55700e834d 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
   MsvcStlSmartPointer.cpp
+  MsvcStlVector.cpp
   MSVCUndecoratedNameParser.cpp
 
   LINK_COMPONENTS
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 9a869f3ea0289..638d3fb8b59ed 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1404,7 +1404,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags.SetFrontEndWantsDereference();
 
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?vector<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::vector<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
@@ -1465,10 +1465,10 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   "libstdc++ std::bitset summary provider",
   "^std::(__debug::)?bitset<.+>(( )?&)?$", stl_summary_flags, true);
 
-  AddCXXSummary(
-  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
-  "libstdc++ std::vector summary provider",
-  "^std::(__debug::)?vector<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp,
+lldb_private::formatters::ContainerSizeSummaryProvider,
+"libstdc++ std::__debug::vector summary provider",
+"^std::__debug::vector<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(
   cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
@@ -1613,6 +1613,20 @@ static bool GenericUniquePtrSummaryProvider(ValueObject 
&valobj, Stream &stream,
   return LibStdcppUniquePointerSummaryProvider(valobj, stream, options);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericVectorSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+  lldb::ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  // checks for vector and vector
+  if (auto *msvc = MsvcStlVectorSyntheticFrontEndCreator(valobj_sp))
+return msvc;
+
+  return new ScriptedSyntheticChildren::FrontEnd(
+  "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider", *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)
@@ -1678,6 +1692,12 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSummary(cpp_category_sp, GenericUniquePtrSummaryProvider,
 "MSVC STL/libstdc++ std::unique_ptr summary provider",
 "^std::unique_ptr<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC/libstdc++ std::vector summary provider",
+"^std::vector<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericVectorSyntheticFrontEndCreator,
+  "MSVC/libstdc++ std::vector synthetic provider",
+  "^std::vector<.+>(( )?&)?$", stl_synth_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 fe75bf275f8e2..4d5cee619cc36 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
@@ -45,6 +45,11 @@ bool MsvcStlUniquePtrSummaryProvider(ValueObject &valobj, 
Stream &stream,
 lldb_private::SyntheticChildrenFrontEnd *
 

[Lldb-commits] [lldb] [lldb] Convert registers values into target endian for expressions (PR #148836)

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


@@ -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);

DavidSpickett wrote:

This `map.GetByteOrder` is the key part.

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


[Lldb-commits] [lldb] [lldb] Implement RISCV function unwinding using instruction emulation (PR #147434)

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

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


[Lldb-commits] [lldb] [lldb] Implement RISCV function unwinding using instruction emulation (PR #147434)

2025-07-15 Thread Greg Clayton via lldb-commits


@@ -57,11 +57,12 @@ class EmulateInstructionRISCV : public EmulateInstruction {
 
   static bool SupportsThisInstructionType(InstructionType inst_type) {
 switch (inst_type) {
-case eInstructionTypeAny:
-case eInstructionTypePCModifying:
+case lldb_private::eInstructionTypeAny:
+case lldb_private::eInstructionTypePrologueEpilogue:
   return true;
-case eInstructionTypePrologueEpilogue:
-case eInstructionTypeAll:
+
+case lldb_private::eInstructionTypePCModifying:

clayborg wrote:

I told Satya to try this, but it seems they must have been already emulating PC 
modifying instructions. We don't get any backtrace if we don't say we handle 
`eInstructionTypePrologueEpilogue` and when we changed it we did get a 
backtrace. If we don't return true for `eInstructionTypePrologueEpilogue` then 
`EmulateInstructionRISCV::CreateFunctionEntryUnwind()` never gets called. But 
it sounds like we need to modify the instruction emulator to handle the 
prologue opcodes for this patch.

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


[Lldb-commits] [lldb] Fix a deadlock in ModuleList when starting a standalone lldb client/server (PR #148774)

2025-07-15 Thread David Peixotto via lldb-commits

dmpots wrote:

Would it be possible to add a test that triggers this bug? It looks like a 
fairly simple scenario that launches lldb-server and then attaches to it. Seems 
like good coverage to have in the test if we don't already. Also, is this a 
100% reproducable deadlock or is it somewhat non-deterministic?

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


[Lldb-commits] [lldb] [lldb] Implement RISCV function unwinding using instruction emulation (PR #147434)

2025-07-15 Thread Greg Clayton via lldb-commits

clayborg wrote:

> > Unfortunately there is no easy way to add testing for this. No RISCV 
> > hardware at the disposal. I welcome the suggestions.
> 
> Make a core file that does not include any internal data and then it can be 
> tested on any system. If you have to satisfy internal policies around that, 
> consider obj2yaml-ing the file, and then either using the yaml in the test, 
> or just using the yaml format as a way to hack out any internal data then 
> convert it back to an object.

obj2yaml doesn't work well at all for core files. Core files have only program 
headers and obj2yaml doesn't allow program header to specify data. On sections 
in the section header can have data. 



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


[Lldb-commits] [lldb] [lldb][NFC] Small fixes identified by the clang static analyzer (PR #148773)

2025-07-15 Thread Dave Lee via lldb-commits


@@ -289,12 +286,8 @@ void LanguageRuntime::InitializeCommands(CommandObject 
*parent) {
   if (!parent->IsMultiwordObject())
 return;
 
-  LanguageRuntimeCreateInstance create_callback;
-
   for (uint32_t idx = 0;
-   (create_callback =
-PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(idx)) !=
-   nullptr;

kastiglione wrote:

I've noticed this unnecessary assignment in the for-loop before, thanks for 
deleting it.

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


[Lldb-commits] [lldb] [lldb] Improve setting of program for filtering disassembly (PR #148823)

2025-07-15 Thread via lldb-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/148823
___
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::(forward_)list (PR #148285)

2025-07-15 Thread via lldb-commits


@@ -1642,19 +1662,34 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   },
   "MSVC STL/libstdc++ std::wstring summary provider"));
 
+  stl_summary_flags.SetDontShowChildren(false);
+  stl_summary_flags.SetSkipPointers(false);
+
   AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator,
   "std::shared_ptr synthetic children",
   "^std::shared_ptr<.+>(( )?&)?$", stl_synth_flags, true);
   AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator,
   "std::weak_ptr synthetic children",
   "^std::weak_ptr<.+>(( )?&)?$", stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericListSyntheticFrontEndCreator,
+  "std::list synthetic children", "^std::list<.+>(( )?&)?$",
+  stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericForwardListSyntheticFrontEndCreator,
+  "std::forward_list synthetic children",
+  "^std::forward_list<.+>(( )?&)?$", stl_synth_flags, true);
 
   AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider,
 "MSVC STL/libstdc++ std::shared_ptr summary provider",
 "^std::shared_ptr<.+>(( )?&)?$", stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider,
 "MSVC STL/libstdc++ std::weak_ptr summary provider",
 "^std::weak_ptr<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstdc++ std::list summary provider",
+"^std::list<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstdc++ std::forward_list summary provider",
+"^std::forward_list<.+>(( )?&)?$", stl_summary_flags, true);

Nerixyz wrote:

I don't think this will help or provide useful information. In 
https://github.com/llvm/llvm-project/commit/318800a6a9fc054ad18d33b3ae947328cdf6f08c,
 I added this to both `forward_list` and `list`. Most importantly, we don't 
know that the list contains more elements when it's capped. Consider the 
following:

```
(lldb) b main.cpp:21
Breakpoint 1: where = main.exe`main + 265 at main.cpp:21:1, address = 
0x000140001129
(lldb) r
Process 19688 launched: ...
(lldb) settings set target.max-children-count 4
(lldb) fr v thousand_elts
(std::forward_list) thousand_elts = size=4 {
  [0] = 999
  [1] = 998
  [2] = 997
  [3] = 996
}
(lldb) settings set target.max-children-count 3
(lldb) fr v thousand_elts
(std::forward_list) thousand_elts = (capped) size=4 {
  [0] = 999
  [1] = 998
  [2] = 997
  ...
}
*** Some of the displayed variables have more members than the debugger will 
show by default. To show all of them, you can either use the 
--show-all-children option to frame variable or raise the limit by changing the 
target.max-children-count setting.
```

When we first inspect the list, we traverse the list for at most four elements. 
The synthetic children know that they're not done, but the summary doesn't know 
that. Now when the max children are lowered, we don't update the synthetic 
children, so they still know of four elements. Then, the summary knows that 
there are at least four elements, so it displays "(capped)".

This was the behavior with the libstdc++ summary as well (I only ported it to 
C++). I think it's a bit misleading as LLDB will also show that there are more 
children as you can see above.

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


[Lldb-commits] [lldb] [lldb][framework] Glob headers from source for framework (PR #148736)

2025-07-15 Thread Chelsea Cassanova via lldb-commits


@@ -106,17 +112,17 @@ add_dependencies(liblldb-resource-headers 
liblldb-header-staging)
 add_dependencies(liblldb liblldb-resource-headers)
 
 # Take the headers from the staging directory and fix up their includes for 
the framework.
-# Then write them to the output directory.
+# Then write them to the framework itself.
 # Also, run unifdef to remove any specified guards from the header files.
-file(GLOB lldb_framework_header_staging_list 
${lldb_framework_header_staging}/*)
+file(GLOB lldb_framework_staged_headers 
${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/*.h)

chelcassanova wrote:

> Do we need this at all? The framework-header-fix script is already doin the 
> unifdefing so I'm not sure what this is doing in the first place.

If by this you mean `FrameworkHeaders` then I would say that I like having a 
staging directory to work from for the framework headers specifically, though I 
do agree that since the framework fix script already unifdefs the headers then 
the unifdefing that we have before we run the script should not be necessary 
anymore. I think from there then that loop that we have for unifdefing can be 
used for step (2) as you described while the loop for fixing up can be used for 
step (3). Any thoughts?

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


[Lldb-commits] [lldb] [lldb] Add completions for plugin list/enable/disable (PR #147775)

2025-07-15 Thread Greg Clayton via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Add completions for plugin list/enable/disable (PR #147775)

2025-07-15 Thread Greg Clayton via lldb-commits


@@ -1321,10 +1321,11 @@ enum CompletionType {
   eTypeCategoryNameCompletion = (1ul << 24),
   eCustomCompletion = (1ul << 25),
   eThreadIDCompletion = (1ul << 26),
+  eManagedPluginCompletion = (1ul << 27),
   // This last enum element is just for input validation.
   // Add new completions before this element,
   // and then increment eTerminatorCompletion's shift value
-  eTerminatorCompletion = (1ul << 27)
+  eTerminatorCompletion = (1ul << 28)

clayborg wrote:

This eTerminatorCompletion is not good as it will change and any older binaries 
that linked against a previous version of LLDB could now get 
`eManagedPluginCompletion` instead of `eTerminatorCompletion`. Can we remove 
the `eTerminatorCompletion`? It can cause API issues.

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


[Lldb-commits] [lldb] [LLDB] Fix Memory64 BaseRVA, move all non-stack memory to Mem64. (PR #146777)

2025-07-15 Thread Jacob Lalonde via lldb-commits

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

>From d17473cc32acb31935759012ca87342d750d68f7 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Wed, 2 Jul 2025 09:18:59 -0700
Subject: [PATCH 01/16] Fix logs, prevent accidentally printing a partial read
 when that's not true, and fix where we write the base RVA 8 bytes earlier
 than it starts

---
 .../Minidump/MinidumpFileBuilder.cpp   | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 806f256d9da48..34a71f41f3b84 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -977,6 +977,7 @@ Status MinidumpFileBuilder::ReadWriteMemoryInChunks(
   const lldb::addr_t addr = range.range.start();
   const lldb::addr_t size = range.range.size();
   Log *log = GetLog(LLDBLog::Object);
+  uint64_t total_bytes_read = 0;
   Status addDataError;
   Process::ReadMemoryChunkCallback callback =
   [&](Status &error, lldb::addr_t current_addr, const void *buf,
@@ -984,7 +985,7 @@ Status MinidumpFileBuilder::ReadWriteMemoryInChunks(
 if (error.Fail() || bytes_read == 0) {
   LLDB_LOGF(log,
 "Failed to read memory region at: 0x%" PRIx64
-". Bytes read: %" PRIx64 ", error: %s",
+". Bytes read: 0x%" PRIx64 ", error: %s",
 current_addr, bytes_read, error.AsCString());
 
   // If we failed in a memory read, we would normally want to skip
@@ -997,6 +998,10 @@ Status MinidumpFileBuilder::ReadWriteMemoryInChunks(
   return lldb_private::IterationAction::Stop;
 }
 
+if (current_addr != addr + total_bytes_read) {
+  LLDB_LOGF(log, "Current addr is at expected address, 0x%" PRIx64 ", 
expected at 0x%" PRIx64, current_addr, addr + total_bytes_read);
+}
+
 // Write to the minidump file with the chunk potentially flushing to
 // disk.
 // This error will be captured by the outer scope and is considered fatal.
@@ -1006,13 +1011,14 @@ Status MinidumpFileBuilder::ReadWriteMemoryInChunks(
 if (addDataError.Fail())
   return lldb_private::IterationAction::Stop;
 
+total_bytes_read += bytes_read;
 // If we have a partial read, report it, but only if the partial read
 // didn't finish reading the entire region.
 if (bytes_read != data_buffer.GetByteSize() &&
-current_addr + bytes_read != size) {
+total_bytes_read != size) {
   LLDB_LOGF(log,
-"Memory region at: %" PRIx64 " partiall read 0x%" PRIx64
-" bytes out of %" PRIx64 " bytes.",
+"Memory region at: 0x%" PRIx64 " partial read 0x%" PRIx64
+" bytes out of 0x%" PRIx64 " bytes.",
 current_addr, bytes_read,
 data_buffer.GetByteSize() - bytes_read);
 
@@ -1059,7 +1065,7 @@ 
MinidumpFileBuilder::AddMemoryList_32(std::vector &ranges,
 
 LLDB_LOGF(log,
   "AddMemoryList %zu/%zu reading memory for region "
-  "(%" PRIx64 " bytes) [%" PRIx64 ", %" PRIx64 ")",
+  "(0x%" PRIx64 " bytes) [0x%" PRIx64 ", 0x%" PRIx64 ")",
   region_index, ranges.size(), size, addr, addr + size);
 ++region_index;
 
@@ -1130,7 +1136,7 @@ 
MinidumpFileBuilder::AddMemoryList_64(std::vector &ranges,
   // Capture the starting offset for all the descriptors so we can clean them 
up
   // if needed.
   offset_t starting_offset =
-  GetCurrentDataEndOffset() + sizeof(llvm::support::ulittle64_t);
+  GetCurrentDataEndOffset() + sizeof(llvm::minidump::Memory64ListHeader);
   // The base_rva needs to start after the directories, which is right after
   // this 8 byte variable.
   offset_t base_rva =

>From cbb5ee7914c201323730b73dee9d0394f012673c Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Wed, 2 Jul 2025 11:01:03 -0700
Subject: [PATCH 02/16] Add new iterator to SBSaveCoreOptions to enable better
 test asserts

---
 .../include/lldb/API/SBMemoryRegionInfoList.h |  1 +
 lldb/include/lldb/API/SBSaveCoreOptions.h |  8 
 lldb/include/lldb/Symbol/SaveCoreOptions.h|  2 +
 lldb/source/API/SBSaveCoreOptions.cpp | 19 
 .../Minidump/MinidumpFileBuilder.cpp  |  2 +-
 lldb/source/Symbol/SaveCoreOptions.cpp| 23 +-
 .../TestSBSaveCoreOptions.py  | 44 +++
 7 files changed, 97 insertions(+), 2 deletions(-)

diff --git a/lldb/include/lldb/API/SBMemoryRegionInfoList.h 
b/lldb/include/lldb/API/SBMemoryRegionInfoList.h
index 1d939dff55faa..8ac9c1aceb6f6 100644
--- a/lldb/include/lldb/API/SBMemoryRegionInfoList.h
+++ b/lldb/include/lldb/API/SBMemoryRegionInfoList.h
@@ -45,6 +45,7 @@ class LLDB_API SBMemoryRegionInfoList {
 
 private:
   friend class SBProcess;
+  friend class SBSaveCoreOptions;

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

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

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


https://github.com/llvm/llvm-project/pull/147538
___
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::tuple (PR #148548)

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

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


[Lldb-commits] [lldb] eec98be - [LLDB] Add formatters for MSVC STL std::tuple (#148548)

2025-07-15 Thread via lldb-commits

Author: nerix
Date: 2025-07-15T17:17:28+01:00
New Revision: eec98bef84b8a68533d9176468c1d2010f26717f

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

LOG: [LLDB] Add formatters for MSVC STL std::tuple (#148548)

Adds synthetic children for MSVC STL's
[`std::tuple`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/tuple).
A `tuple` is a chain of base classes:
```cpp
template <>
class tuple<> {};

template 
class tuple<_This, _Rest...> : private tuple<_Rest...> {
  _Tuple_val<_This> _Myfirst;
};
```

So the provider walks the base classes to the desired one.

The implementation makes it hard to detect if the empty tuple is from
this STL. Fortunately, libstdc++'s synthetic children provider works for
empty MSVC STL tuples as well.

Towards #24834.

Added: 
lldb/source/Plugins/Language/CPlusPlus/MsvcStlTuple.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/tuple/TestDataFormatterStdTuple.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/main.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 296159ea28407..ea86b6b4327be 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
   MsvcStlSmartPointer.cpp
+  MsvcStlTuple.cpp
   MSVCUndecoratedNameParser.cpp
 
   LINK_COMPONENTS

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 9a869f3ea0289..bf4139119a76b 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1507,10 +1507,6 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
 stl_summary_flags, true);
 
-  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
-"libstdc++ std::tuple summary provider",
-"^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
-
   cpp_category_sp->AddTypeSummary(
   "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
   eFormatterMatchRegex,
@@ -1540,11 +1536,6 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   lldb_private::formatters::LibStdcppUniquePtrSyntheticFrontEndCreator,
   "std::unique_ptr synthetic children", "^std::unique_ptr<.+>(( )?&)?$",
   stl_synth_flags, true);
-  AddCXXSynthetic(
-  cpp_category_sp,
-  lldb_private::formatters::LibStdcppTupleSyntheticFrontEndCreator,
-  "std::tuple synthetic children", "^std::tuple<.*>(( )?&)?$",
-  stl_synth_flags, true);
 
   static constexpr const char *const libstdcpp_std_coroutine_handle_regex =
   "^std::coroutine_handle<.+>(( )?&)?$";
@@ -1613,6 +1604,17 @@ static bool GenericUniquePtrSummaryProvider(ValueObject 
&valobj, Stream &stream,
   return LibStdcppUniquePointerSummaryProvider(valobj, stream, options);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericTupleSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+ lldb::ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  if (IsMsvcStlTuple(*valobj_sp))
+return MsvcStlTupleSyntheticFrontEndCreator(children, valobj_sp);
+  return LibStdcppTupleSyntheticFrontEndCreator(children, 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)
@@ -1668,6 +1670,9 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSynthetic(cpp_category_sp, GenericUniquePtrSyntheticFrontEndCreator,
   "std::unique_ptr synthetic children",
   "^std::unique_ptr<.+>(( )?&)?$", stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericTupleSyntheticFrontEndCreator,
+  "std::tuple synthetic children", "^std::tuple<.*>(( )?&)?$",
+  stl_synth_flags, true);
 
   AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider,
 "MSVC STL/libstdc++ std::shared_ptr summary provider",
@@ -1678,6 +1683,9 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_c

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

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

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


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


[Lldb-commits] [lldb] Fix a deadlock in ModuleList when starting a standalone lldb client/server (PR #148774)

2025-07-15 Thread Greg Clayton via lldb-commits

https://github.com/clayborg commented:

This patch looks good to me unless we are trying to protect the ModuleList 
contents during the notification to ensure it doesn't change before the 
notification has been delivered. Jim and Jonas? Thoughts?

https://github.com/llvm/llvm-project/pull/148774
___
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::vector (PR #147538)

2025-07-15 Thread via lldb-commits

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

>From d8a898b9a3f6b16d551baa7253344402d75ca4d8 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Sat, 21 Jun 2025 17:35:23 +0200
Subject: [PATCH 1/2] [LLDB] Add formatters for MSVC STL std::vector

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  30 +-
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   5 +
 .../Language/CPlusPlus/MsvcStlVector.cpp  | 297 ++
 .../vbool/TestDataFormatterStdVBool.py|  24 +-
 .../data-formatter-stl/generic/vbool/main.cpp |  39 ++-
 .../vector/TestDataFormatterStdVector.py  |  11 +
 7 files changed, 399 insertions(+), 8 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlVector.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index ea86b6b4327be..8ee6e2a246c55 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
   MsvcStlSmartPointer.cpp
   MsvcStlTuple.cpp
+  MsvcStlVector.cpp
   MSVCUndecoratedNameParser.cpp
 
   LINK_COMPONENTS
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index bf4139119a76b..8724e829835c1 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1404,7 +1404,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags.SetFrontEndWantsDereference();
 
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?vector<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::vector<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
@@ -1465,10 +1465,10 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   "libstdc++ std::bitset summary provider",
   "^std::(__debug::)?bitset<.+>(( )?&)?$", stl_summary_flags, true);
 
-  AddCXXSummary(
-  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
-  "libstdc++ std::vector summary provider",
-  "^std::(__debug::)?vector<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp,
+lldb_private::formatters::ContainerSizeSummaryProvider,
+"libstdc++ std::__debug::vector summary provider",
+"^std::__debug::vector<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(
   cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
@@ -1615,6 +1615,20 @@ 
GenericTupleSyntheticFrontEndCreator(CXXSyntheticChildren *children,
   return LibStdcppTupleSyntheticFrontEndCreator(children, valobj_sp);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericVectorSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+  lldb::ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  // checks for vector and vector
+  if (auto *msvc = MsvcStlVectorSyntheticFrontEndCreator(valobj_sp))
+return msvc;
+
+  return new ScriptedSyntheticChildren::FrontEnd(
+  "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider", *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)
@@ -1686,6 +1700,12 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
 "MSVC STL/libstdc++ std::tuple summary provider",
 "^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC/libstdc++ std::vector summary provider",
+"^std::vector<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericVectorSyntheticFrontEndCreator,
+  "MSVC/libstdc++ std::vector synthetic provider",
+  "^std::vector<.+>(( )?&)?$", stl_synth_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 bad47701904bb..81397851b6010 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
@@ -51,6 +51,11 @@ SyntheticChildrenFrontEnd *
 MsvcStlTupleSyntheticFrontEndCreator(CXXSyntheticChildren *,
  lldb::ValueObjectSP valobj_sp

[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)

2025-07-15 Thread via lldb-commits

athierry-oct wrote:

@jimingham  Yes can you revert it please, while I figure this out?
Thank you

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


[Lldb-commits] [lldb] bcd0a7a - Revert "[lldb] Fix race condition in Process::WaitForProcessToStop() … (#148915)

2025-07-15 Thread via lldb-commits

Author: jimingham
Date: 2025-07-15T11:04:04-07:00
New Revision: bcd0a7ae2a3ae81545190a0b2796eb63656b5d42

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

LOG: Revert "[lldb] Fix race condition in Process::WaitForProcessToStop() … 
(#148915)

…(#144919)"

This was causing a couple of failures on the Ubuntu bots. Reverting
while we wait on a fix for those issues.
This reverts commit 8612926c306c5191a5fb385dd11467728c59e982.

Added: 


Modified: 
lldb/include/lldb/Utility/Listener.h
lldb/source/Utility/Broadcaster.cpp
lldb/source/Utility/Listener.cpp
lldb/unittests/Utility/ListenerTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Listener.h 
b/lldb/include/lldb/Utility/Listener.h
index 393169091390c..d48816ec0ea4d 100644
--- a/lldb/include/lldb/Utility/Listener.h
+++ b/lldb/include/lldb/Utility/Listener.h
@@ -53,13 +53,6 @@ class Listener : public 
std::enable_shared_from_this {
 
   void AddEvent(lldb::EventSP &event);
 
-  /// Transfers all events matching the specified broadcaster and type to the
-  /// destination listener. This can be useful when setting up a hijack 
listener,
-  /// to ensure that no relevant events are missed.
-  void MoveEvents(lldb::ListenerSP destination,
-  Broadcaster *broadcaster, // nullptr for any broadcaster
-  uint32_t event_type_mask);
-
   void Clear();
 
   const char *GetName() { return m_name.c_str(); }

diff  --git a/lldb/source/Utility/Broadcaster.cpp 
b/lldb/source/Utility/Broadcaster.cpp
index 41b782fee55fa..c6b2606afe0c8 100644
--- a/lldb/source/Utility/Broadcaster.cpp
+++ b/lldb/source/Utility/Broadcaster.cpp
@@ -335,18 +335,6 @@ bool Broadcaster::BroadcasterImpl::HijackBroadcaster(
   "{0} Broadcaster(\"{1}\")::HijackBroadcaster (listener(\"{2}\")={3})",
   static_cast(this), GetBroadcasterName(),
   listener_sp->m_name.c_str(), static_cast(listener_sp.get()));
-
-  // Move pending events from the previous listener to the hijack listener.
-  // This ensures that no relevant event queued before the transition is missed
-  // by the hijack listener.
-  ListenerSP prev_listener;
-  if (!m_hijacking_listeners.empty())
-prev_listener = m_hijacking_listeners.back();
-  else if (m_primary_listener_sp)
-prev_listener = m_primary_listener_sp;
-  if (prev_listener && listener_sp)
-prev_listener->MoveEvents(listener_sp, &m_broadcaster, event_mask);
-
   m_hijacking_listeners.push_back(listener_sp);
   m_hijacking_masks.push_back(event_mask);
   return true;
@@ -379,19 +367,6 @@ void Broadcaster::BroadcasterImpl::RestoreBroadcaster() {
  static_cast(this), GetBroadcasterName(),
  listener_sp->m_name.c_str(),
  static_cast(listener_sp.get()));
-
-// Move any remaining events from the hijack listener back to
-// the previous listener. This ensures that no events are dropped when
-// restoring the original listener.
-ListenerSP prev_listener;
-if (m_hijacking_listeners.size() > 1)
-  prev_listener = m_hijacking_listeners[m_hijacking_listeners.size() - 2];
-else if (m_primary_listener_sp)
-  prev_listener = m_primary_listener_sp;
-if (listener_sp && prev_listener && !m_hijacking_masks.empty())
-  listener_sp->MoveEvents(prev_listener, &m_broadcaster,
-  m_hijacking_masks.back());
-
 m_hijacking_listeners.pop_back();
   }
   if (!m_hijacking_masks.empty())

diff  --git a/lldb/source/Utility/Listener.cpp 
b/lldb/source/Utility/Listener.cpp
index a9b733579d2f7..d4ce3bf25ec5a 100644
--- a/lldb/source/Utility/Listener.cpp
+++ b/lldb/source/Utility/Listener.cpp
@@ -176,33 +176,6 @@ void Listener::AddEvent(EventSP &event_sp) {
   m_events_condition.notify_all();
 }
 
-void Listener::MoveEvents(
-ListenerSP destination,
-Broadcaster *broadcaster, // nullptr for any broadcaster
-uint32_t event_type_mask) {
-  Log *log = GetLog(LLDBLog::Events);
-
-  std::lock_guard guard(m_events_mutex);
-  auto pos = m_events.begin();
-  while (pos != m_events.end()) {
-EventSP &event_sp = *pos;
-if (event_sp &&
-((broadcaster == nullptr) || event_sp->BroadcasterIs(broadcaster)) &&
-(event_type_mask == 0 || event_type_mask & event_sp->GetType())) {
-  LLDB_LOGF(
-  log, "%p Listener('%s')::MoveEvents moving event %p to %p('%s')",
-  static_cast(this), m_name.c_str(),
-  static_cast(event_sp.get()),
-  static_cast(destination.get()), destination->GetName());
-
-  destination->AddEvent(event_sp);
-  pos = m_events.erase(pos);
-} else {
-  ++pos;
-}
-  }
-}
-
 bool Listener::FindNextEventInternal(
 std::unique_lock &lock,
 Broadcaster *broadcaster, // nullptr for any broadcaster

diff  --git a

[Lldb-commits] [lldb] Revert "[lldb] Fix race condition in Process::WaitForProcessToStop() … (PR #148915)

2025-07-15 Thread via lldb-commits

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


[Lldb-commits] [lldb] Revert "[lldb] Fix race condition in Process::WaitForProcessToStop() … (PR #148915)

2025-07-15 Thread via lldb-commits

https://github.com/jimingham created 
https://github.com/llvm/llvm-project/pull/148915

…(#144919)"

This was causing a couple of failures on the Ubuntu bots.  Reverting while we 
wait on a fix for those issues.
This reverts commit 8612926c306c5191a5fb385dd11467728c59e982.

>From f7ebd7ec19a2099e6c6e566b741e76cfaa3d9e44 Mon Sep 17 00:00:00 2001
From: Jim Ingham 
Date: Tue, 15 Jul 2025 11:02:06 -0700
Subject: [PATCH] Revert "[lldb] Fix race condition in
 Process::WaitForProcessToStop() (#144919)"

This was causing a couple of failures on the Ubuntu bots.  Reverting while we
wait on a fix for those issues.
This reverts commit 8612926c306c5191a5fb385dd11467728c59e982.
---
 lldb/include/lldb/Utility/Listener.h|  7 ---
 lldb/source/Utility/Broadcaster.cpp | 25 
 lldb/source/Utility/Listener.cpp| 27 -
 lldb/unittests/Utility/ListenerTest.cpp | 81 -
 4 files changed, 140 deletions(-)

diff --git a/lldb/include/lldb/Utility/Listener.h 
b/lldb/include/lldb/Utility/Listener.h
index 393169091390c..d48816ec0ea4d 100644
--- a/lldb/include/lldb/Utility/Listener.h
+++ b/lldb/include/lldb/Utility/Listener.h
@@ -53,13 +53,6 @@ class Listener : public 
std::enable_shared_from_this {
 
   void AddEvent(lldb::EventSP &event);
 
-  /// Transfers all events matching the specified broadcaster and type to the
-  /// destination listener. This can be useful when setting up a hijack 
listener,
-  /// to ensure that no relevant events are missed.
-  void MoveEvents(lldb::ListenerSP destination,
-  Broadcaster *broadcaster, // nullptr for any broadcaster
-  uint32_t event_type_mask);
-
   void Clear();
 
   const char *GetName() { return m_name.c_str(); }
diff --git a/lldb/source/Utility/Broadcaster.cpp 
b/lldb/source/Utility/Broadcaster.cpp
index 41b782fee55fa..c6b2606afe0c8 100644
--- a/lldb/source/Utility/Broadcaster.cpp
+++ b/lldb/source/Utility/Broadcaster.cpp
@@ -335,18 +335,6 @@ bool Broadcaster::BroadcasterImpl::HijackBroadcaster(
   "{0} Broadcaster(\"{1}\")::HijackBroadcaster (listener(\"{2}\")={3})",
   static_cast(this), GetBroadcasterName(),
   listener_sp->m_name.c_str(), static_cast(listener_sp.get()));
-
-  // Move pending events from the previous listener to the hijack listener.
-  // This ensures that no relevant event queued before the transition is missed
-  // by the hijack listener.
-  ListenerSP prev_listener;
-  if (!m_hijacking_listeners.empty())
-prev_listener = m_hijacking_listeners.back();
-  else if (m_primary_listener_sp)
-prev_listener = m_primary_listener_sp;
-  if (prev_listener && listener_sp)
-prev_listener->MoveEvents(listener_sp, &m_broadcaster, event_mask);
-
   m_hijacking_listeners.push_back(listener_sp);
   m_hijacking_masks.push_back(event_mask);
   return true;
@@ -379,19 +367,6 @@ void Broadcaster::BroadcasterImpl::RestoreBroadcaster() {
  static_cast(this), GetBroadcasterName(),
  listener_sp->m_name.c_str(),
  static_cast(listener_sp.get()));
-
-// Move any remaining events from the hijack listener back to
-// the previous listener. This ensures that no events are dropped when
-// restoring the original listener.
-ListenerSP prev_listener;
-if (m_hijacking_listeners.size() > 1)
-  prev_listener = m_hijacking_listeners[m_hijacking_listeners.size() - 2];
-else if (m_primary_listener_sp)
-  prev_listener = m_primary_listener_sp;
-if (listener_sp && prev_listener && !m_hijacking_masks.empty())
-  listener_sp->MoveEvents(prev_listener, &m_broadcaster,
-  m_hijacking_masks.back());
-
 m_hijacking_listeners.pop_back();
   }
   if (!m_hijacking_masks.empty())
diff --git a/lldb/source/Utility/Listener.cpp b/lldb/source/Utility/Listener.cpp
index a9b733579d2f7..d4ce3bf25ec5a 100644
--- a/lldb/source/Utility/Listener.cpp
+++ b/lldb/source/Utility/Listener.cpp
@@ -176,33 +176,6 @@ void Listener::AddEvent(EventSP &event_sp) {
   m_events_condition.notify_all();
 }
 
-void Listener::MoveEvents(
-ListenerSP destination,
-Broadcaster *broadcaster, // nullptr for any broadcaster
-uint32_t event_type_mask) {
-  Log *log = GetLog(LLDBLog::Events);
-
-  std::lock_guard guard(m_events_mutex);
-  auto pos = m_events.begin();
-  while (pos != m_events.end()) {
-EventSP &event_sp = *pos;
-if (event_sp &&
-((broadcaster == nullptr) || event_sp->BroadcasterIs(broadcaster)) &&
-(event_type_mask == 0 || event_type_mask & event_sp->GetType())) {
-  LLDB_LOGF(
-  log, "%p Listener('%s')::MoveEvents moving event %p to %p('%s')",
-  static_cast(this), m_name.c_str(),
-  static_cast(event_sp.get()),
-  static_cast(destination.get()), destination->GetName());
-
-  destination->AddEvent(event_sp);
-  pos = m_events.erase(pos);
-} else {
-  ++pos;
-}
-  }
-}
-
 bool Listener::FindNextEventInternal(
 std::unique_l

[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)

2025-07-15 Thread via lldb-commits

jimingham wrote:

The revert was:

https://github.com/llvm/llvm-project/pull/148915

Good hunting!

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


[Lldb-commits] [lldb] [lldb] Document MCP tools & resources (PR #148708)

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

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


[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)

2025-07-15 Thread via lldb-commits

jimingham wrote:

@athierry-oct - this patch seems to have caused some failures on the ubuntu 
bot.  If you think you can resolve those failures quickly, then please do.  If 
you aren't able to do that give me a ping and I'll revert this till you can 
figure this out.

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang][modules] Serialize `CodeGenOptions` (PR #146422)

2025-07-15 Thread Jan Svoboda via lldb-commits


@@ -46,13 +46,32 @@ class CodeGenOptionsBase {
   enum class CompatibilityKind {
 /// Does affect the construction of the AST in a way that does prevent
 /// module interoperability.
-Affecting,
+NotCompatible,
+/// Does affect the construction of the AST in a way that doesn't prevent
+/// interoperability (that is, the value can be different between an
+/// explicit module and the user of that module).
+Compatible,
 /// Does not affect the construction of the AST in any way (that is, the
 /// value can be different between an implicit module and the user of that
 /// module).
 Benign,
   };
 
+  using CFBranchLabelSchemeKind = CFBranchLabelSchemeKind;
+  using ProfileInstrKind = llvm::driver::ProfileInstrKind;

jansvoboda11 wrote:

These are necessary, because now we use these types outside of `CodeGenOptions` 
in `ASTReader::ParseCodeGenOptions()` so we either need to fully qualify the 
types in `CodeGenOptions.def` or leave just the type names without namespaces, 
pull the types into `CodeGenOptions` and qualify them with 
`clang::CodeGenOptions::` in clients. That's what `LangOptions` do, so I chose 
to do it here for consistency.

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang][modules] Serialize `CodeGenOptions` (PR #146422)

2025-07-15 Thread Jan Svoboda via lldb-commits


@@ -36,13 +36,13 @@ void CodeGenOptions::resetNonModularOptions(StringRef 
ModuleFormat) {
   // emitted into the PCM (-gmodules).
   if (ModuleFormat == "raw" && !DebugTypeExtRefs) {
 #define DEBUGOPT(Name, Bits, Default, Compatibility)   
\
-  if constexpr (CK::Compatibility == CK::Affecting)
\
+  if constexpr (CK::Compatibility != CK::Benign)   
\
 Name = Default;
 #define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility) 
\
-  if constexpr (CK::Compatibility == CK::Affecting)
\
+  if constexpr (CK::Compatibility == CK::Benign)   
\

jansvoboda11 wrote:

Good catch. These should actually all be `!= CK::Benign`. Removing the 
condition would be fine semantically, but `if constexpr` is more efficient. I 
don't have a strong preference here, just wanted to keep the original behavior.

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


[Lldb-commits] [lldb] Fix a deadlock in ModuleList when starting a standalone lldb client/server (PR #148774)

2025-07-15 Thread via lldb-commits

jimingham wrote:

Actually, the test will be a little harder than that because the deadlock comes 
between the main lldb work and async work done by the status line.  So my test, 
which just runs lldb in Python, wouldn't have shown that error.

I wonder if it would be possible to have a version of the status line that is 
always running, just discarding its output if there's no Terminal to write it 
to.  As it stands, the test suite isn't doing exercising the interaction 
between lldb and the status line filling thread nearly as much as our users now 
are...

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang][modules] Serialize `CodeGenOptions` (PR #146422)

2025-07-15 Thread Jan Svoboda via lldb-commits

https://github.com/jansvoboda11 updated 
https://github.com/llvm/llvm-project/pull/146422

>From 69049bfcd81134f3787d1ee14ab3e5c6d91eb87d Mon Sep 17 00:00:00 2001
From: Jan Svoboda 
Date: Thu, 3 Jul 2025 12:46:58 -0700
Subject: [PATCH 1/4] [clang][modules] Serialize `CodeGenOptions`

---
 clang-tools-extra/clangd/ModulesBuilder.cpp   |   3 +-
 clang/include/clang/Basic/CodeGenOptions.def  |  30 ++--
 clang/include/clang/Basic/CodeGenOptions.h|  20 ++-
 clang/include/clang/Basic/DebugOptions.def|  58 
 .../Basic/DiagnosticSerializationKinds.td |   4 +
 clang/include/clang/Basic/LangOptions.def |   3 -
 clang/include/clang/Frontend/ASTUnit.h|   2 +
 .../include/clang/Frontend/CompilerInstance.h |   1 +
 .../include/clang/Serialization/ASTBitCodes.h |   5 +-
 clang/include/clang/Serialization/ASTReader.h |  39 --
 clang/include/clang/Serialization/ASTWriter.h |  21 ++-
 clang/lib/Basic/CodeGenOptions.cpp|   6 +-
 clang/lib/CodeGen/CGDebugInfo.cpp |  34 +++--
 clang/lib/CodeGen/CGOpenMPRuntime.cpp |   4 +-
 clang/lib/CodeGen/CodeGenAction.cpp   |   2 +-
 clang/lib/Frontend/ASTUnit.cpp|  36 +++--
 clang/lib/Frontend/ChainedIncludesSource.cpp  |   5 +-
 clang/lib/Frontend/CompilerInstance.cpp   |   8 +-
 clang/lib/Frontend/CompilerInvocation.cpp |  37 +++--
 clang/lib/Frontend/FrontendAction.cpp |   5 +-
 clang/lib/Frontend/FrontendActions.cpp|  17 +--
 clang/lib/Frontend/InitPreprocessor.cpp   |  12 +-
 clang/lib/Frontend/PrecompiledPreamble.cpp|   8 +-
 clang/lib/Serialization/ASTReader.cpp | 130 +-
 clang/lib/Serialization/ASTWriter.cpp |  21 ++-
 clang/lib/Serialization/GeneratePCH.cpp   |   6 +-
 clang/test/PCH/no-validate-pch.cl |   2 +-
 llvm/clang/test/Modules/implicit-opt-level.c  |  15 ++
 28 files changed, 386 insertions(+), 148 deletions(-)
 create mode 100644 llvm/clang/test/Modules/implicit-opt-level.c

diff --git a/clang-tools-extra/clangd/ModulesBuilder.cpp 
b/clang-tools-extra/clangd/ModulesBuilder.cpp
index d88aa01aad05d..b9aeb3889f5f2 100644
--- a/clang-tools-extra/clangd/ModulesBuilder.cpp
+++ b/clang-tools-extra/clangd/ModulesBuilder.cpp
@@ -209,8 +209,9 @@ bool IsModuleFileUpToDate(PathRef ModuleFilePath,
 
   IntrusiveRefCntPtr ModCache = createCrossProcessModuleCache();
   PCHContainerOperations PCHOperations;
+  CodeGenOptions CodeGenOpts;
   ASTReader Reader(PP, *ModCache, /*ASTContext=*/nullptr,
-   PCHOperations.getRawReader(), {});
+   PCHOperations.getRawReader(), CodeGenOpts, {});
 
   // We don't need any listener here. By default it will use a validator
   // listener.
diff --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index 41031026c99f6..a11e12d495cd2 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -209,17 +209,17 @@ CODEGENOPT(ObjCAvoidHeapifyLocalBlocks, 1, 0, Benign)
 
 
 // The optimization options affect frontend options, which in turn do affect 
the AST.
-VALUE_CODEGENOPT(OptimizationLevel, 2, 0, Affecting) ///< The -O[0-3] option 
specified.
-VALUE_CODEGENOPT(OptimizeSize, 2, 0, Affecting) ///< If -Os (==1, Benign) or 
-Oz (==2, Benign) is specified.
+VALUE_CODEGENOPT(OptimizationLevel, 2, 0, Compatible) ///< The -O[0-3] option 
specified.
+VALUE_CODEGENOPT(OptimizeSize, 2, 0, Compatible) ///< If -Os (==1, Benign) or 
-Oz (==2, Benign) is specified.
 
 CODEGENOPT(AtomicProfileUpdate , 1, 0, Benign) ///< Set -fprofile-update=atomic
 CODEGENOPT(ContinuousProfileSync, 1, 0, Benign) ///< Enable continuous 
instrumentation profiling
 /// Choose profile instrumenation kind or no instrumentation.
 
-ENUM_CODEGENOPT(ProfileInstr, llvm::driver::ProfileInstrKind, 4, 
llvm::driver::ProfileInstrKind::ProfileNone, Benign)
+ENUM_CODEGENOPT(ProfileInstr, ProfileInstrKind, 4, 
ProfileInstrKind::ProfileNone, Benign)
 
 /// Choose profile kind for PGO use compilation.
-ENUM_CODEGENOPT(ProfileUse, llvm::driver::ProfileInstrKind, 2, 
llvm::driver::ProfileInstrKind::ProfileNone, Benign)
+ENUM_CODEGENOPT(ProfileUse, ProfileInstrKind, 2, 
ProfileInstrKind::ProfileNone, Benign)
 /// Partition functions into N groups and select only functions in group i to 
be
 /// instrumented. Selected group numbers can be 0 to N-1 inclusive.
 VALUE_CODEGENOPT(ProfileTotalFunctionGroups, 32, 1, Benign)
@@ -244,8 +244,8 @@ CODEGENOPT(SaveTempLabels, 1, 0, Benign) ///< Save 
temporary labels.
 CODEGENOPT(SanitizeAddressUseAfterScope , 1, 0, Benign) ///< Enable 
use-after-scope detection
 ///< in 
AddressSanitizer
 ENUM_CODEGENOPT(SanitizeAddressUseAfterReturn,
-llvm::AsanDetectStackUseAfterReturnMode, 2,
-llvm::AsanDetectStackUseAfterReturnMode::Runtime,
+AsanDetectStackUseAfterReturnMode

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

2025-07-15 Thread via lldb-commits

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

>From 9f719389412467375cbd4c51ec970fc16da3d54d Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Sat, 21 Jun 2025 17:35:23 +0200
Subject: [PATCH 1/3] [LLDB] Add formatters for MSVC STL std::vector

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  30 +-
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   5 +
 .../Language/CPlusPlus/MsvcStlVector.cpp  | 297 ++
 .../vbool/TestDataFormatterStdVBool.py|  24 +-
 .../data-formatter-stl/generic/vbool/main.cpp |  39 ++-
 .../vector/TestDataFormatterStdVector.py  |  11 +
 7 files changed, 399 insertions(+), 8 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlVector.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index ea86b6b4327be..8ee6e2a246c55 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
   MsvcStlSmartPointer.cpp
   MsvcStlTuple.cpp
+  MsvcStlVector.cpp
   MSVCUndecoratedNameParser.cpp
 
   LINK_COMPONENTS
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index bf4139119a76b..8724e829835c1 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1404,7 +1404,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags.SetFrontEndWantsDereference();
 
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?vector<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::vector<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
@@ -1465,10 +1465,10 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   "libstdc++ std::bitset summary provider",
   "^std::(__debug::)?bitset<.+>(( )?&)?$", stl_summary_flags, true);
 
-  AddCXXSummary(
-  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
-  "libstdc++ std::vector summary provider",
-  "^std::(__debug::)?vector<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp,
+lldb_private::formatters::ContainerSizeSummaryProvider,
+"libstdc++ std::__debug::vector summary provider",
+"^std::__debug::vector<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(
   cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
@@ -1615,6 +1615,20 @@ 
GenericTupleSyntheticFrontEndCreator(CXXSyntheticChildren *children,
   return LibStdcppTupleSyntheticFrontEndCreator(children, valobj_sp);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericVectorSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+  lldb::ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  // checks for vector and vector
+  if (auto *msvc = MsvcStlVectorSyntheticFrontEndCreator(valobj_sp))
+return msvc;
+
+  return new ScriptedSyntheticChildren::FrontEnd(
+  "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider", *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)
@@ -1686,6 +1700,12 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
 "MSVC STL/libstdc++ std::tuple summary provider",
 "^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC/libstdc++ std::vector summary provider",
+"^std::vector<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericVectorSyntheticFrontEndCreator,
+  "MSVC/libstdc++ std::vector synthetic provider",
+  "^std::vector<.+>(( )?&)?$", stl_synth_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 bad47701904bb..81397851b6010 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
@@ -51,6 +51,11 @@ SyntheticChildrenFrontEnd *
 MsvcStlTupleSyntheticFrontEndCreator(CXXSyntheticChildren *,
  lldb::ValueObjectSP valobj_sp

[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang][modules] Serialize `CodeGenOptions` (PR #146422)

2025-07-15 Thread Ben Langmuir via lldb-commits

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

LGTM, thanks!

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


[Lldb-commits] [lldb] [LLDB] Compile API tests with exceptions enabled on Windows (PR #148691)

2025-07-15 Thread via lldb-commits

Nerixyz wrote:

I can't merge this on my own, could you merge this for me please? @JDevlieghere 

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


[Lldb-commits] [lldb] 95fa676 - [LLDB] Compile API tests with exceptions enabled on Windows (#148691)

2025-07-15 Thread via lldb-commits

Author: nerix
Date: 2025-07-15T11:38:43-07:00
New Revision: 95fa67603c4ab5d75a2f8df328d7da5580466d50

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

LOG: [LLDB] Compile API tests with exceptions enabled on Windows (#148691)

>From #148554 - compile tests with exceptions on Windows
(`-fno-exceptions` was added 11 years ago in
c7826524acda6a9c8816261d5c48b94dc92935ed). The variant test uses `try {}
catch {}` to create variants that are valueless by exception. On other
platforms, exceptions are enabled as well.

I have no clue why compiling with exceptions will optimize out
`a_long_guy` in the changed test (even with `-O0`). Taking the address
of that value will ensure it's kept.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/make/Makefile.rules

lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 58833e1b0cc78..8521ca508a479 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -344,10 +344,6 @@ endif
 #--
 ifeq "$(OS)" "Windows_NT"
ifeq ($(CC_TYPE), clang)
-   # Clang for Windows doesn't support C++ Exceptions
-   CXXFLAGS += -fno-exceptions
-   CXXFLAGS += -D_HAS_EXCEPTIONS=0
-
# MSVC 2015 or higher is required, which depends on c++14, so
# append these values unconditionally.
CXXFLAGS += -fms-compatibility-version=19.0

diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp 
b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp
index 9d12ca30f984c..32f5f2ce436fe 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp
@@ -165,6 +165,7 @@ int main (int argc, const char * argv[])
 Simple a_simple_object(3,0.14,'E');
 
 VeryLong a_long_guy;
+auto *unused = &a_long_guy; // ensure a_long_guy isn't optimized out
 
 std::string some_string = "012345678901234567890123456789"
   "012345678901234567890123456789"



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


[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)

2025-07-15 Thread via lldb-commits

athierry-oct wrote:

Gentle ping — is this PR ready to merge? I don’t have merge privileges, so if 
one of the reviewers could take care of it when it's ready, I’d appreciate it!

https://github.com/llvm/llvm-project/pull/144919
___
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::(forward_)list (PR #148285)

2025-07-15 Thread via lldb-commits

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

>From 104fbb9daa6ea0d4483939662ae08a8d42d77f44 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Fri, 11 Jul 2025 22:06:47 +0200
Subject: [PATCH 1/3] [LLDB] Add formatters for MSVC STL std::(forward_)list

---
 lldb/examples/synthetic/gnu_libstdcpp.py  |   9 -
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   2 +-
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  62 +++-
 .../{LibCxxList.cpp => GenericList.cpp}   | 294 +++---
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   9 +
 .../TestDataFormatterGenericForwardList.py|  33 +-
 .../list/TestDataFormatterGenericList.py  |  35 ++-
 .../loop/TestDataFormatterGenericListLoop.py  |  18 +-
 .../generic/list/loop/main.cpp|   5 -
 9 files changed, 356 insertions(+), 111 deletions(-)
 rename lldb/source/Plugins/Language/CPlusPlus/{LibCxxList.cpp => 
GenericList.cpp} (58%)

diff --git a/lldb/examples/synthetic/gnu_libstdcpp.py 
b/lldb/examples/synthetic/gnu_libstdcpp.py
index 20b9488af5597..e59eb5fa18c02 100644
--- a/lldb/examples/synthetic/gnu_libstdcpp.py
+++ b/lldb/examples/synthetic/gnu_libstdcpp.py
@@ -6,15 +6,6 @@
 # thing for your setup
 
 
-def ForwardListSummaryProvider(valobj, dict):
-list_capping_size = 
valobj.GetTarget().GetMaximumNumberOfChildrenToDisplay()
-text = "size=" + str(valobj.GetNumChildren())
-if valobj.GetNumChildren() > list_capping_size:
-return "(capped) " + text
-else:
-return text
-
-
 def StdOptionalSummaryProvider(valobj, dict):
 has_value = valobj.GetNumChildren() > 0
 # We add wrapping spaces for consistency with the libcxx formatter
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 296159ea28407..c7f12c1255ece 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -14,11 +14,11 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   CxxStringTypes.cpp
   Generic.cpp
   GenericBitset.cpp
+  GenericList.cpp
   GenericOptional.cpp
   LibCxx.cpp
   LibCxxAtomic.cpp
   LibCxxInitializerList.cpp
-  LibCxxList.cpp
   LibCxxMap.cpp
   LibCxxQueue.cpp
   LibCxxRangesRefView.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 9a869f3ea0289..8e5bd014fcd85 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1440,14 +1440,12 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider")));
@@ -1501,22 +1499,19 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
 
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::ContainerSizeSummaryProvider,
-"libstdc++ std::list summary provider",
-"^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
+  "libstdc++ std::list summary provider",
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
 "libstdc++ std::tuple summary provider",
 "^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
 
-  cpp_category_sp->AddTypeSummary(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
-  TypeSummaryImplSP(new ScriptSummaryFormat(
-  stl_summary_flags,
-  "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider")));
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"libstdc++ std::forward_list summary provider",
+"^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$",
+

[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::(forward_)list (PR #148285)

2025-07-15 Thread via lldb-commits

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

>From 104fbb9daa6ea0d4483939662ae08a8d42d77f44 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Fri, 11 Jul 2025 22:06:47 +0200
Subject: [PATCH 1/3] [LLDB] Add formatters for MSVC STL std::(forward_)list

---
 lldb/examples/synthetic/gnu_libstdcpp.py  |   9 -
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   2 +-
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  62 +++-
 .../{LibCxxList.cpp => GenericList.cpp}   | 294 +++---
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   9 +
 .../TestDataFormatterGenericForwardList.py|  33 +-
 .../list/TestDataFormatterGenericList.py  |  35 ++-
 .../loop/TestDataFormatterGenericListLoop.py  |  18 +-
 .../generic/list/loop/main.cpp|   5 -
 9 files changed, 356 insertions(+), 111 deletions(-)
 rename lldb/source/Plugins/Language/CPlusPlus/{LibCxxList.cpp => 
GenericList.cpp} (58%)

diff --git a/lldb/examples/synthetic/gnu_libstdcpp.py 
b/lldb/examples/synthetic/gnu_libstdcpp.py
index 20b9488af5597..e59eb5fa18c02 100644
--- a/lldb/examples/synthetic/gnu_libstdcpp.py
+++ b/lldb/examples/synthetic/gnu_libstdcpp.py
@@ -6,15 +6,6 @@
 # thing for your setup
 
 
-def ForwardListSummaryProvider(valobj, dict):
-list_capping_size = 
valobj.GetTarget().GetMaximumNumberOfChildrenToDisplay()
-text = "size=" + str(valobj.GetNumChildren())
-if valobj.GetNumChildren() > list_capping_size:
-return "(capped) " + text
-else:
-return text
-
-
 def StdOptionalSummaryProvider(valobj, dict):
 has_value = valobj.GetNumChildren() > 0
 # We add wrapping spaces for consistency with the libcxx formatter
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 296159ea28407..c7f12c1255ece 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -14,11 +14,11 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   CxxStringTypes.cpp
   Generic.cpp
   GenericBitset.cpp
+  GenericList.cpp
   GenericOptional.cpp
   LibCxx.cpp
   LibCxxAtomic.cpp
   LibCxxInitializerList.cpp
-  LibCxxList.cpp
   LibCxxMap.cpp
   LibCxxQueue.cpp
   LibCxxRangesRefView.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 9a869f3ea0289..8e5bd014fcd85 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1440,14 +1440,12 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider")));
@@ -1501,22 +1499,19 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
 
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::ContainerSizeSummaryProvider,
-"libstdc++ std::list summary provider",
-"^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
+  "libstdc++ std::list summary provider",
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
 "libstdc++ std::tuple summary provider",
 "^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
 
-  cpp_category_sp->AddTypeSummary(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
-  TypeSummaryImplSP(new ScriptSummaryFormat(
-  stl_summary_flags,
-  "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider")));
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"libstdc++ std::forward_list summary provider",
+"^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$",
+

[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)

2025-07-15 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/include/lldb/Expression/Expression.h lldb/include/lldb/Symbol/SymbolFile.h 
lldb/source/Expression/IRExecutionUnit.cpp 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp 
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
lldb/unittests/Symbol/TestTypeSystemClang.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index 2edfa661b..4f8e84612 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -775,19 +775,22 @@ private:
   lldb::addr_t m_best_internal_load_address = LLDB_INVALID_ADDRESS;
 };
 
-static llvm::Expected GetModulePtr(llvm::StringRef module, Target 
&target) {
+static llvm::Expected GetModulePtr(llvm::StringRef module,
+ Target &target) {
   uintptr_t module_ptr = 0;
-  if (module.starts_with("0x") && !module.consumeInteger(0, module_ptr)
-  && module_ptr != 0)
+  if (module.starts_with("0x") && !module.consumeInteger(0, module_ptr) &&
+  module_ptr != 0)
 return reinterpret_cast(module_ptr);
 
   UUID module_uuid;
   if (!module_uuid.SetFromStringRef(module) || !module_uuid.IsValid())
-return llvm::createStringError("failed to create Module UUID from '%s'", 
module.data());
+return llvm::createStringError("failed to create Module UUID from '%s'",
+   module.data());
 
   Module *found_module = target.GetImages().FindModule(module_uuid).get();
   if (!found_module)
-return llvm::createStringError("failed to find module with UUID '{0}'", 
module.data());
+return llvm::createStringError("failed to find module with UUID '{0}'",
+   module.data());
 
   return found_module;
 }
@@ -841,13 +844,13 @@ ResolveFunctionCallLabel(llvm::StringRef label,
   // TODO: module UID is only a Darwin concept (?)
   auto found_module_or_err = GetModulePtr(module, *target);
   if (!found_module_or_err) {
-LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions), 
found_module_or_err.takeError(),
-   "Failed to resolve function label {1}: {0}",
-   label);
+LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions),
+   found_module_or_err.takeError(),
+   "Failed to resolve function label {1}: {0}", label);
 return LLDB_INVALID_ADDRESS;
   }
 
-  Module * found_module = *found_module_or_err;
+  Module *found_module = *found_module_or_err;
 
   lldb::user_id_t die_id;
   if (die.consumeInteger(/*Radix=*/0, die_id)) {
@@ -857,7 +860,7 @@ ResolveFunctionCallLabel(llvm::StringRef label,
  label, components[2]);
 return LLDB_INVALID_ADDRESS;
   }
- 
+
   auto *symbol_file = found_module->GetSymbolFile();
   if (!symbol_file) {
 LLDB_LOG(GetLog(LLDBLog::Expressions),
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 069e817fb..a7cbc794c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -272,7 +272,7 @@ static std::optional 
MakeLLDBFuncAsmLabel(const DWARFDIE &die) {
   // Maybe add character to signal whether this is a pointer
   // or UUID. Or maybe if it's not hex that implies a UUID?
   auto module_id = module_sp->GetUUID();
-  Module * module_ptr = nullptr;
+  Module *module_ptr = nullptr;
   if (!module_id.IsValid())
 module_ptr = module_sp.get();
 
@@ -281,7 +281,10 @@ static std::optional 
MakeLLDBFuncAsmLabel(const DWARFDIE &die) {
 return label;
 
   return llvm::formatv("{0}:{1}:{2}:{3:x}", FunctionCallLabelPrefix,
-   mangled ? mangled : "", module_ptr ? 
llvm::formatv("{0:x}", module_ptr).str() : module_id.GetAsString(), die_id)
+   mangled ? mangled : "",
+   module_ptr ? llvm::formatv("{0:x}", module_ptr).str()
+  : module_id.GetAsString(),
+   die_id)
   .str();
 }
 

``




https://github.com/llvm/llvm-project/pull/148877
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.o

[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)

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


@@ -249,6 +250,41 @@ static unsigned GetCXXMethodCVQuals(const DWARFDIE 
&subprogram,
   return cv_quals;
 }
 
+// TODO:
+// 0. Adjust FindInSymbols
+// 1. log failure paths
+// 2. What happens for functions without a linkage name? Previously we didn't
+// attach a label for those but now we would
+// 3. Unit-test
+// 4. API test (whilch checks expr and AST dump)
+static std::optional MakeLLDBFuncAsmLabel(const DWARFDIE &die) {
+  std::optional label;
+  char const *mangled = die.GetMangledName(/*substitute_name_allowed=*/false);
+  if (mangled)
+label.emplace(mangled);
+
+  auto module_sp = die.GetModule();
+  if (!module_sp)
+return label;
+
+  // Module UID is only a Darwin concept (?)
+  // If UUID is not available encode as pointer.
+  // Maybe add character to signal whether this is a pointer
+  // or UUID. Or maybe if it's not hex that implies a UUID?
+  auto module_id = module_sp->GetUUID();
+  Module * module_ptr = nullptr;
+  if (!module_id.IsValid())
+module_ptr = module_sp.get();

Michael137 wrote:

@labath I'm trying to clean up this prototype of your suggestion in my 
[ABI-tagged structors 
RFC](https://discourse.llvm.org/t/rfc-lldb-handling-abi-tagged-constructors-destructors-in-expression-evaluator/82816/7).

This function here is what encodes the label.

Something I wasn't sure about though was how we should encode the Module in the 
string. Since UIDs need not exist (e.g., on Linux IIUC?), was your original 
suggestion to simply print out the pointer? If so, how would we defend against 
the module getting unloaded under our feet? I might've misunderstood your idea 
though.

https://github.com/llvm/llvm-project/pull/148877
___
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::(forward_)list (PR #148285)

2025-07-15 Thread via lldb-commits

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

>From 104fbb9daa6ea0d4483939662ae08a8d42d77f44 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Fri, 11 Jul 2025 22:06:47 +0200
Subject: [PATCH 1/3] [LLDB] Add formatters for MSVC STL std::(forward_)list

---
 lldb/examples/synthetic/gnu_libstdcpp.py  |   9 -
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   2 +-
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  62 +++-
 .../{LibCxxList.cpp => GenericList.cpp}   | 294 +++---
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   9 +
 .../TestDataFormatterGenericForwardList.py|  33 +-
 .../list/TestDataFormatterGenericList.py  |  35 ++-
 .../loop/TestDataFormatterGenericListLoop.py  |  18 +-
 .../generic/list/loop/main.cpp|   5 -
 9 files changed, 356 insertions(+), 111 deletions(-)
 rename lldb/source/Plugins/Language/CPlusPlus/{LibCxxList.cpp => 
GenericList.cpp} (58%)

diff --git a/lldb/examples/synthetic/gnu_libstdcpp.py 
b/lldb/examples/synthetic/gnu_libstdcpp.py
index 20b9488af5597..e59eb5fa18c02 100644
--- a/lldb/examples/synthetic/gnu_libstdcpp.py
+++ b/lldb/examples/synthetic/gnu_libstdcpp.py
@@ -6,15 +6,6 @@
 # thing for your setup
 
 
-def ForwardListSummaryProvider(valobj, dict):
-list_capping_size = 
valobj.GetTarget().GetMaximumNumberOfChildrenToDisplay()
-text = "size=" + str(valobj.GetNumChildren())
-if valobj.GetNumChildren() > list_capping_size:
-return "(capped) " + text
-else:
-return text
-
-
 def StdOptionalSummaryProvider(valobj, dict):
 has_value = valobj.GetNumChildren() > 0
 # We add wrapping spaces for consistency with the libcxx formatter
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 296159ea28407..c7f12c1255ece 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -14,11 +14,11 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   CxxStringTypes.cpp
   Generic.cpp
   GenericBitset.cpp
+  GenericList.cpp
   GenericOptional.cpp
   LibCxx.cpp
   LibCxxAtomic.cpp
   LibCxxInitializerList.cpp
-  LibCxxList.cpp
   LibCxxMap.cpp
   LibCxxQueue.cpp
   LibCxxRangesRefView.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 9a869f3ea0289..8e5bd014fcd85 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1440,14 +1440,12 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider")));
@@ -1501,22 +1499,19 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
 
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::ContainerSizeSummaryProvider,
-"libstdc++ std::list summary provider",
-"^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
+  "libstdc++ std::list summary provider",
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
 "libstdc++ std::tuple summary provider",
 "^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
 
-  cpp_category_sp->AddTypeSummary(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
-  TypeSummaryImplSP(new ScriptSummaryFormat(
-  stl_summary_flags,
-  "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider")));
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"libstdc++ std::forward_list summary provider",
+"^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$",
+

[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)

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

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

None

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

---
 lldb/include/lldb/Expression/Expression.h |  12 ++
 lldb/include/lldb/Symbol/SymbolFile.h |   7 +
 lldb/source/Expression/IRExecutionUnit.cpp| 127 ++
 .../Clang/ClangExpressionDeclMap.cpp  |   2 +-
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |   7 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  |  56 +---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  52 +++
 .../SymbolFile/DWARF/SymbolFileDWARF.h|   5 +
 .../SymbolFile/NativePDB/PdbAstBuilder.cpp|   6 +-
 .../Plugins/SymbolFile/PDB/PDBASTParser.cpp   |   7 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  50 ++-
 .../TypeSystem/Clang/TypeSystemClang.h|   5 +-
 lldb/unittests/Symbol/TestTypeSystemClang.cpp |  12 +-
 13 files changed, 310 insertions(+), 38 deletions(-)

diff --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 8de9364436ccf..a3f1fcc0ef442 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -96,6 +96,18 @@ class Expression {
  ///invalid.
 };
 
+inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func";
+
+inline bool hasFunctionCallLabelPrefix(llvm::StringRef name) {
+  name.consume_front("_");
+  return name.starts_with(FunctionCallLabelPrefix);
+}
+
+inline bool consumeFunctionCallLabelPrefix(llvm::StringRef &name) {
+  name.consume_front("_");
+  return name.consume_front(FunctionCallLabelPrefix);
+}
+
 } // 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..bfb89721c98c8 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,12 @@ class SymbolFile : public PluginInterface {
   GetMangledNamesForFunction(const std::string &scope_qualified_name,
  std::vector &mangled_names);
 
+  virtual ConstString GetMangledNameForUID(lldb::user_id_t uid) { return {}; }
+  virtual llvm::Error ResolveFunctionUID(SymbolContextList &sc_list,
+ lldb::user_id_t uid) {
+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/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index e445fa8833022..2edfa661b4e98 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -6,6 +6,7 @@
 //
 
//===--===//
 
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/ExecutionEngine/ObjectCache.h"
 #include "llvm/IR/Constants.h"
@@ -19,7 +20,9 @@
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Disassembler.h"
 #include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleList.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Expression/Expression.h"
 #include "lldb/Expression/IRExecutionUnit.h"
 #include "lldb/Expression/ObjectFileJIT.h"
 #include "lldb/Host/HostInfo.h"
@@ -36,6 +39,7 @@
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/lldb-defines.h"
 
 #include 
 
@@ -771,6 +775,123 @@ class LoadAddressResolver {
   lldb::addr_t m_best_internal_load_address = LLDB_INVALID_ADDRESS;
 };
 
+static llvm::Expected GetModulePtr(llvm::StringRef module, Target 
&target) {
+  uintptr_t module_ptr = 0;
+  if (module.starts_with("0x") && !module.consumeInteger(0, module_ptr)
+  && module_ptr != 0)
+return reinterpret_cast(module_ptr);
+
+  UUID module_uuid;
+  if (!module_uuid.SetFromStringRef(module) || !module_uuid.IsValid())
+return llvm::createStringError("failed to create Module UUID from '%s'", 
module.data());
+
+  Module *found_module = target.GetImages().FindModule(module_uuid).get();
+  if (!found_module)
+return llvm::createStringError("failed to find module with UUID '{0}'", 
module.data());
+
+  return found_module;
+}
+
+static lldb::addr_t
+ResolveFunctionCallLabel(llvm::StringRef label,
+ const lldb_

[Lldb-commits] [lldb] [lldb] Fix a crash in lldb-server during RemoveSoftwareBreakpoint() (PR #148738)

2025-07-15 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix a crash in lldb-server during RemoveSoftwareBreakpoint() (PR #148738)

2025-07-15 Thread via lldb-commits

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


[Lldb-commits] [lldb] 8612926 - [lldb] Fix race condition in Process::WaitForProcessToStop() (#144919)

2025-07-15 Thread via lldb-commits

Author: athierry-oct
Date: 2025-07-15T09:33:00-07:00
New Revision: 8612926c306c5191a5fb385dd11467728c59e982

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

LOG: [lldb] Fix race condition in Process::WaitForProcessToStop() (#144919)

This PR addresses a race condition encountered when using LLDB through
the Python scripting interface.

I'm relatively new to LLDB, so feedback is very welcome, especially if
there's a more appropriate way to address this issue.

### Bug Description

When running a script that repeatedly calls
`debugger.GetListener().WaitForEvent()` in a loop, and at some point
invokes `process.Kill()` from within that loop to terminate the session,
a race condition can occur if `process.Kill()` is called around the same
time a breakpoint is hit.

### Race Condition Details

The issue arises when the following sequence of events happens:

1. The process's **private state** transitions to `stopped` when the
breakpoint is hit.
2. `process.Kill()` calls `Process::Destroy()`, which invokes
`Process::WaitForProcessToStop()`. At this point:
   - `private_state = stopped`
- `public_state = running` (the public state has not yet been updated)
3. The **public stop event** is broadcast **before** the hijack listener
is installed.
4. As a result, the stop event is delivered to the **non-hijack
listener**.
5. The interrupt request sent by `Process::StopForDestroyOrDetach()` is
ignored because the process is already stopped (`private_state =
stopped`).
6. No public stop event reaches the hijack listener.
7. `Process::WaitForProcessToStop()` hangs waiting for a public stop
event, but the event is never received.
8. `process.Kill()` times out after 20 seconds

### Fix Summary

This patch modifies `Process::WaitForProcessToStop()` to ensure that any
pending events in the non-hijack listener queue are processed before
checking the hijack listener. This guarantees that any missed public
state change events are handled, preventing the hang.


### Additional Context

A discussion of this issue, including a script to reproduce the bug, can
be found here:
[LLDB hangs when killing process at the same time a breakpoint is
hit](https://discourse.llvm.org/t/lldb-hangs-when-killing-process-at-the-same-time-a-breakpoint-is-hit)

Added: 


Modified: 
lldb/include/lldb/Utility/Listener.h
lldb/source/Utility/Broadcaster.cpp
lldb/source/Utility/Listener.cpp
lldb/unittests/Utility/ListenerTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Listener.h 
b/lldb/include/lldb/Utility/Listener.h
index d48816ec0ea4d..393169091390c 100644
--- a/lldb/include/lldb/Utility/Listener.h
+++ b/lldb/include/lldb/Utility/Listener.h
@@ -53,6 +53,13 @@ class Listener : public 
std::enable_shared_from_this {
 
   void AddEvent(lldb::EventSP &event);
 
+  /// Transfers all events matching the specified broadcaster and type to the
+  /// destination listener. This can be useful when setting up a hijack 
listener,
+  /// to ensure that no relevant events are missed.
+  void MoveEvents(lldb::ListenerSP destination,
+  Broadcaster *broadcaster, // nullptr for any broadcaster
+  uint32_t event_type_mask);
+
   void Clear();
 
   const char *GetName() { return m_name.c_str(); }

diff  --git a/lldb/source/Utility/Broadcaster.cpp 
b/lldb/source/Utility/Broadcaster.cpp
index c6b2606afe0c8..41b782fee55fa 100644
--- a/lldb/source/Utility/Broadcaster.cpp
+++ b/lldb/source/Utility/Broadcaster.cpp
@@ -335,6 +335,18 @@ bool Broadcaster::BroadcasterImpl::HijackBroadcaster(
   "{0} Broadcaster(\"{1}\")::HijackBroadcaster (listener(\"{2}\")={3})",
   static_cast(this), GetBroadcasterName(),
   listener_sp->m_name.c_str(), static_cast(listener_sp.get()));
+
+  // Move pending events from the previous listener to the hijack listener.
+  // This ensures that no relevant event queued before the transition is missed
+  // by the hijack listener.
+  ListenerSP prev_listener;
+  if (!m_hijacking_listeners.empty())
+prev_listener = m_hijacking_listeners.back();
+  else if (m_primary_listener_sp)
+prev_listener = m_primary_listener_sp;
+  if (prev_listener && listener_sp)
+prev_listener->MoveEvents(listener_sp, &m_broadcaster, event_mask);
+
   m_hijacking_listeners.push_back(listener_sp);
   m_hijacking_masks.push_back(event_mask);
   return true;
@@ -367,6 +379,19 @@ void Broadcaster::BroadcasterImpl::RestoreBroadcaster() {
  static_cast(this), GetBroadcasterName(),
  listener_sp->m_name.c_str(),
  static_cast(listener_sp.get()));
+
+// Move any remaining events from the hijack listener back to
+// the previous listener. This ensures that no events are dropped when
+// restoring the original listener.
+ListenerS

[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)

2025-07-15 Thread via lldb-commits

github-actions[bot] wrote:



@athierry-oct Congratulations on having your first Pull Request (PR) merged 
into the LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a 
problem with a build, you may receive a report in an email or a comment on this 
PR.

Please check whether problems have been caused by your change specifically, as 
the builds can include changes from many authors. It is not uncommon for your 
change to be included in a build that fails due to someone else's changes, or 
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself. This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


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


[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)

2025-07-15 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)

2025-07-15 Thread via lldb-commits

jimingham wrote:

It doesn't look like there are any outstanding emendations.  Pushing.

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


[Lldb-commits] [lldb] [lldb] Fix a crash in lldb-server during RemoveSoftwareBreakpoint() (PR #148738)

2025-07-15 Thread via lldb-commits

https://github.com/royitaqi edited 
https://github.com/llvm/llvm-project/pull/148738
___
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-15 Thread via lldb-commits

jimingham wrote:

> From the issue, we can have persistent assembly source breakpoint if it is 
> set from the disassembly view.
> 
> We only create sourceReference and virtual disassembly file if there is no 
> source file for that frame.
> 
> we can store the necessary information in the adapter data to recreate an 
> instruction break-point and handle it like an instruction break-point.
> 
> Relevant Infographic.
> 
>  src="https://private-user-images.githubusercontent.com/57949090/466522246-ce8aec05-7a0e-4bec-bbd8-413d33424515.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTI1OTc1MDksIm5iZiI6MTc1MjU5NzIwOSwicGF0aCI6Ii81Nzk0OTA5MC80NjY1MjIyNDYtY2U4YWVjMDUtN2EwZS00YmVjLWJiZDgtNDEzZDMzNDI0NTE1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA3MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNzE1VDE2MzMyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRhZTMzZWEzMTg4MzQzNjNlZWE3MzcyMDk3ZTUwODBlZGRiMGM2ZGM5ODlmZTRkODM3MjNiYjJmZjQzMmFmZWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.X8QS415Rnn061oyM6j-wmH7351akX4V1yTXZY68Th0E";>

>From the infographic, you clearly know what address you want to set the 
>breakpoint on.  If the SBModule was also known at the point where you are 
>setting the breakpoint, you could make an SBAddress from the module and file 
>offset and set the breakpoint with `SBTarget::BreakpointCreateBySBAddress`.  

But if you want to set a file address offset for a module that isn't loaded 
yet, then you do need:

SBTarget::BreakpointCreateByFileAddress(SBModuleSpec module_spec, lldb:addr_t 
file_offset);

You should in this case use a ModlueSpec, not a FileSpec, both because it makes 
clear that you are looking for a Module and not a source file, for instance.  
Also, there's no reason you couldn't specify the Module you are seeking by UUID 
(in fact, if you are setting file offset breakpoint you really do want to make 
sure this is the build of the binary you expect - we really try to make as safe 
as possible the random insertion of traps into the binary.)

But I still don't see the need for the additional `offset` and `instruction 
offset` parameters here.

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] [lldb] When running OS Plugins from dSYM's, make sure start state is correct (PR #146441)

2025-07-15 Thread David Peixotto via lldb-commits

dmpots wrote:

@jimingham we found a deadlock that we suspect is related to this patch. Please 
take a look at the proposed fix in #148774. Thanks!

https://github.com/llvm/llvm-project/pull/146441
___
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::tuple (PR #148548)

2025-07-15 Thread via lldb-commits

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

>From 9950cdb7fa60c9ef3f284e7d091c2afb3a5f7aa6 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Sun, 13 Jul 2025 22:46:23 +0200
Subject: [PATCH] [LLDB] Add formatters for MSVC STL std::tuple

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  26 +++--
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   6 +
 .../Language/CPlusPlus/MsvcStlTuple.cpp   | 105 ++
 .../tuple/TestDataFormatterStdTuple.py|   6 +
 .../data-formatter-stl/generic/tuple/main.cpp |   1 +
 6 files changed, 136 insertions(+), 9 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlTuple.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 296159ea28407..ea86b6b4327be 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
   MsvcStlSmartPointer.cpp
+  MsvcStlTuple.cpp
   MSVCUndecoratedNameParser.cpp
 
   LINK_COMPONENTS
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 9a869f3ea0289..bf4139119a76b 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1507,10 +1507,6 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
 stl_summary_flags, true);
 
-  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
-"libstdc++ std::tuple summary provider",
-"^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
-
   cpp_category_sp->AddTypeSummary(
   "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
   eFormatterMatchRegex,
@@ -1540,11 +1536,6 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   lldb_private::formatters::LibStdcppUniquePtrSyntheticFrontEndCreator,
   "std::unique_ptr synthetic children", "^std::unique_ptr<.+>(( )?&)?$",
   stl_synth_flags, true);
-  AddCXXSynthetic(
-  cpp_category_sp,
-  lldb_private::formatters::LibStdcppTupleSyntheticFrontEndCreator,
-  "std::tuple synthetic children", "^std::tuple<.*>(( )?&)?$",
-  stl_synth_flags, true);
 
   static constexpr const char *const libstdcpp_std_coroutine_handle_regex =
   "^std::coroutine_handle<.+>(( )?&)?$";
@@ -1613,6 +1604,17 @@ static bool GenericUniquePtrSummaryProvider(ValueObject 
&valobj, Stream &stream,
   return LibStdcppUniquePointerSummaryProvider(valobj, stream, options);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericTupleSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+ lldb::ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  if (IsMsvcStlTuple(*valobj_sp))
+return MsvcStlTupleSyntheticFrontEndCreator(children, valobj_sp);
+  return LibStdcppTupleSyntheticFrontEndCreator(children, 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)
@@ -1668,6 +1670,9 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSynthetic(cpp_category_sp, GenericUniquePtrSyntheticFrontEndCreator,
   "std::unique_ptr synthetic children",
   "^std::unique_ptr<.+>(( )?&)?$", stl_synth_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericTupleSyntheticFrontEndCreator,
+  "std::tuple synthetic children", "^std::tuple<.*>(( )?&)?$",
+  stl_synth_flags, true);
 
   AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider,
 "MSVC STL/libstdc++ std::shared_ptr summary provider",
@@ -1678,6 +1683,9 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSummary(cpp_category_sp, GenericUniquePtrSummaryProvider,
 "MSVC STL/libstdc++ std::unique_ptr summary provider",
 "^std::unique_ptr<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC STL/libstdc++ std::tuple summary provider",
+"^std::tuple<.*>(( )?&)?$", 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 fe75bf275f8e2..bad47701904bb 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
+++ b/lldb/s

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

2025-07-15 Thread via lldb-commits


@@ -1656,9 +1658,6 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   },
   "MSVC STL/libstdc++ std::wstring summary provider"));
 
-  stl_summary_flags.SetDontShowChildren(false);

Nerixyz wrote:

I didn't rebase correctly. In this PR I had them after the synthetic children, 
but in the already merged one I had them before. It doesn't make a difference.

https://github.com/llvm/llvm-project/pull/148548
___
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::(forward_)list (PR #148285)

2025-07-15 Thread via lldb-commits

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

>From 104fbb9daa6ea0d4483939662ae08a8d42d77f44 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Fri, 11 Jul 2025 22:06:47 +0200
Subject: [PATCH 1/3] [LLDB] Add formatters for MSVC STL std::(forward_)list

---
 lldb/examples/synthetic/gnu_libstdcpp.py  |   9 -
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   2 +-
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  62 +++-
 .../{LibCxxList.cpp => GenericList.cpp}   | 294 +++---
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   9 +
 .../TestDataFormatterGenericForwardList.py|  33 +-
 .../list/TestDataFormatterGenericList.py  |  35 ++-
 .../loop/TestDataFormatterGenericListLoop.py  |  18 +-
 .../generic/list/loop/main.cpp|   5 -
 9 files changed, 356 insertions(+), 111 deletions(-)
 rename lldb/source/Plugins/Language/CPlusPlus/{LibCxxList.cpp => 
GenericList.cpp} (58%)

diff --git a/lldb/examples/synthetic/gnu_libstdcpp.py 
b/lldb/examples/synthetic/gnu_libstdcpp.py
index 20b9488af5597..e59eb5fa18c02 100644
--- a/lldb/examples/synthetic/gnu_libstdcpp.py
+++ b/lldb/examples/synthetic/gnu_libstdcpp.py
@@ -6,15 +6,6 @@
 # thing for your setup
 
 
-def ForwardListSummaryProvider(valobj, dict):
-list_capping_size = 
valobj.GetTarget().GetMaximumNumberOfChildrenToDisplay()
-text = "size=" + str(valobj.GetNumChildren())
-if valobj.GetNumChildren() > list_capping_size:
-return "(capped) " + text
-else:
-return text
-
-
 def StdOptionalSummaryProvider(valobj, dict):
 has_value = valobj.GetNumChildren() > 0
 # We add wrapping spaces for consistency with the libcxx formatter
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index 296159ea28407..c7f12c1255ece 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -14,11 +14,11 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN
   CxxStringTypes.cpp
   Generic.cpp
   GenericBitset.cpp
+  GenericList.cpp
   GenericOptional.cpp
   LibCxx.cpp
   LibCxxAtomic.cpp
   LibCxxInitializerList.cpp
-  LibCxxList.cpp
   LibCxxMap.cpp
   LibCxxQueue.cpp
   LibCxxRangesRefView.cpp
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 9a869f3ea0289..8e5bd014fcd85 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1440,14 +1440,12 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
+  "^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider")));
@@ -1501,22 +1499,19 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
 "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
 stl_summary_flags, true);
 
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::ContainerSizeSummaryProvider,
-"libstdc++ std::list summary provider",
-"^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
+  "libstdc++ std::list summary provider",
+  "^std::__(debug|cxx11)::list<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
 "libstdc++ std::tuple summary provider",
 "^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
 
-  cpp_category_sp->AddTypeSummary(
-  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
-  eFormatterMatchRegex,
-  TypeSummaryImplSP(new ScriptSummaryFormat(
-  stl_summary_flags,
-  "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider")));
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"libstdc++ std::forward_list summary provider",
+"^std::__(debug|cxx11)::forward_list<.+>(( )?&)?$",
+

[Lldb-commits] [lldb] [lldb][NFC] Small fixes identified by the clang static analyzer (PR #148773)

2025-07-15 Thread Dave Lee via lldb-commits


@@ -539,6 +540,8 @@ static Status HandleFileAction(ProcessLaunchInfo 
&launch_info,
: "unable to launch");
   }
 
+  [env_dict release];
+  [options release];

kastiglione wrote:

I wonder if these objc++ files can switch to using ARC (not that you should 
deal with that for this PR)

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


[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)

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

llvm-ci wrote:

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

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


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

```
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: commands/disassemble/basic/TestFrameDisassemble.py (30 of 
2287)
UNSUPPORTED: lldb-api :: commands/dwim-print/objc/TestDWIMPrintObjC.py (31 of 
2287)
PASS: lldb-api :: commands/expression/calculator_mode/TestCalculatorMode.py (32 
of 2287)
PASS: lldb-api :: 
commands/expression/anonymous-struct/TestCallUserAnonTypedef.py (33 of 2287)
PASS: lldb-api :: 
commands/expression/argument_passing_restrictions/TestArgumentPassingRestrictions.py
 (34 of 2287)
PASS: lldb-api :: commands/expression/bitfield_enums/TestBitfieldEnums.py (35 
of 2287)
PASS: lldb-api :: api/listeners/TestListener.py (36 of 2287)
PASS: lldb-api :: commands/expression/call-function/TestCallBuiltinFunction.py 
(37 of 2287)
UNSUPPORTED: lldb-api :: commands/expression/call-throws/TestCallThatThrows.py 
(38 of 2287)
PASS: lldb-api :: commands/command/script/TestCommandScript.py (39 of 2287)
FAIL: lldb-api :: commands/expression/call-restarts/TestCallThatRestarts.py (40 
of 2287)
 TEST 'lldb-api :: 
commands/expression/call-restarts/TestCallThatRestarts.py' FAILED 

Script:
--
/usr/bin/python3.10 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env 
LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include 
--env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin 
--arch aarch64 --build-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb 
--compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang 
--dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil 
--make /usr/bin/gmake --llvm-tools-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --cmake-build-type 
Release 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/expression/call-restarts
 -p TestCallThatRestarts.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 
8612926c306c5191a5fb385dd11467728c59e982)
  clang revision 8612926c306c5191a5fb385dd11467728c59e982
  llvm revision 8612926c306c5191a5fb385dd11467728c59e982
Skipping the following test categories: ['libc++', 'msvcstl', 'dsym', 
'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
FAIL: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test (TestCallThatRestarts.ExprCommandThatRestartsTestCase)
==
FAIL: test (TestCallThatRestarts.ExprCommandThatRestartsTestCase)
   Test calling function that hits a signal and restarts.
--
Traceback (most recent call last):
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py",
 line 581, in wrapper
func(*args, **kwargs)
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py",
 line 581, in wrapper
func(*args, **kwargs)
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py",
 line 29, in test
self.call_function()
  File 
"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py",
 line 136, in call_function
self.assertEqual(
AssertionError: 281473636542668 != 187650944797248 : Continuing returned to the 
place we started.
Config=aarch64-/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang
--
Ran 1 test in 0.595s

FAILED (failures=1)


```



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


[Lldb-commits] [lldb] [DRAFT][lldb][RPC] Design doc for upstreaming PR (PR #138612)

2025-07-15 Thread Chelsea Cassanova via lldb-commits

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

>From 3d29af3b776c407de606cf507c9b03c49daa11b0 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Wed, 30 Apr 2025 09:04:40 -0700
Subject: [PATCH] [lldb][RPC] Design doc for upstreaming PR

This mainly adds as design doc to help follow with the current PRs up
for upstreaming the `lldb-rpc-gen` tool and emitters.
---
 lldb/docs/rpc-design-doc.rst | 181 +++
 1 file changed, 181 insertions(+)
 create mode 100644 lldb/docs/rpc-design-doc.rst

diff --git a/lldb/docs/rpc-design-doc.rst b/lldb/docs/rpc-design-doc.rst
new file mode 100644
index 0..8e816bab74c29
--- /dev/null
+++ b/lldb/docs/rpc-design-doc.rst
@@ -0,0 +1,181 @@
+LLDB RPC Upstreaming Design Doc
+===
+
+This document aims to explain the general structure of the upstreaming patches 
for adding LLDB RPC. The 2 primary concepts explained here will be:
+
+* How LLDB RPC is used
+* How the ``lldb-rpc-gen`` works and what it outputs
+
+LLDB RPC
+*
+
+LLDB RPC is a framework by which processes can communicate with LLDB out of 
process while maintaining compatibility with the SB API. More details are 
explained in the 
`RFC`_ for 
upstreaming LLDB RPC, but the main focus in this doc for this section will be 
how exactly the code is structured for the PRs that will upstream this code.
+
+The ``lldb-rpc-gen`` tool
+*
+
+``lldb-rpc-gen`` is the tool that generates the main client and server 
interfaces for LLDB RPC. It is a ``ClangTool`` that reads all SB API header 
files and their functions and outputs the client/server interfaces and certain 
other pieces of code, such as RPC-specfic versions of Python bindings used for 
the test suite. There's 3 main components behind ``lldb-rpc-gen``:
+
+1. The ``lldb-rpc-gen`` tool itself, which contains the main driver that uses 
the ``ClangTool``.
+2. The code that generates all interfaces, which we call "emitters". All 
generated code for the interfaces are in C++, so the server side has one 
emitter for its generated source code and another for its generated header 
code. The client side has the same.
+3. All common code shared between all emitters, such as helper methods and 
information about exceptions to take when emitting.
+
+There are currently 2 PRs up for upstreaming RPC:
+- One that adds the ``lldb-rpc-gen`` tool and its common code: 
https://github.com/llvm/llvm-project/pull/138031
+- One that adds the RPC client-side interface code emitters: 
https://github.com/llvm/llvm-project/pull/147655
+
+The `current PR`_ up for 
upstreaming LLDB RPC upstreams a subset of the code used for the tool. It 
upstreams the ``lldb-rpc-gen`` tool and all code needed for the server side 
emitters. Here's an example of what ``lldb-rpc-gen`` will output for the server 
side interface:
+
+Input
+-
+
+We'll use ``SBDebugger::CreateTarget(const char *filename)`` as an example. 
``lldb-rpc-gen`` will read this method from ``SBDebugger.h``. The output is as 
follows.
+
+Server-side Output
+**
+
+Source Code Output
+--
+
+Server-side Source Code
+~~~
+::
+
+   bool 
rpc_server::_ZN4lldb10SBDebugger12CreateTargetEPKc::HandleRPCCall(rpc_common::Connection
 &connection, RPCStream &send, RPCStream &response) {
+   // 1) Make local storage for incoming function arguments
+   lldb::SBDebugger *this_ptr = nullptr;
+   rpc_common::ConstCharPointer filename;
+   // 2) Decode all function arguments
+   this_ptr = RPCServerObjectDecoder(send, 
rpc_common::RPCPacket::ValueType::Argument);
+   if (!this_ptr)
+   return false;
+   if (!RPCValueDecoder(send, rpc_common::RPCPacket::ValueType::Argument, 
filename))
+   return false;
+   // 3) Call the method and encode the return value
+   lldb::SBTarget && __result = this_ptr->CreateTarget(filename.c_str());
+   RPCServerObjectEncoder(response, 
rpc_common::RPCPacket::ValueType::ReturnValue, std::move(__result));
+   return true;
+   }
+
+Function signature
+~~
+
+All server-side source code functions have a function signature that take the 
format ``bool 
rpc_serverHandleRPCCall(rpc_common::Connection 
&connection, RPCStream &send, RPCStream &response)``. The mangled name is used 
in order to differentiate between overloaded methods. Here the ``connection`` 
is what's maintained between the client and server. The ``send`` variable is a 
byte stream that carries information sent from the client. ``response`` is also 
a byte stream that will be populated with the return value obtained from the 
call into the SB API function that will be sent back to the client.
+
+For the client-side sources, the function signature is identical to that of 
what the signature looks like in the main SB API.
+
+Local variable storage
+

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

2025-07-15 Thread via lldb-commits

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

>From d8a898b9a3f6b16d551baa7253344402d75ca4d8 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Sat, 21 Jun 2025 17:35:23 +0200
Subject: [PATCH 1/3] [LLDB] Add formatters for MSVC STL std::vector

---
 .../Plugins/Language/CPlusPlus/CMakeLists.txt |   1 +
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  30 +-
 .../Plugins/Language/CPlusPlus/MsvcStl.h  |   5 +
 .../Language/CPlusPlus/MsvcStlVector.cpp  | 297 ++
 .../vbool/TestDataFormatterStdVBool.py|  24 +-
 .../data-formatter-stl/generic/vbool/main.cpp |  39 ++-
 .../vector/TestDataFormatterStdVector.py  |  11 +
 7 files changed, 399 insertions(+), 8 deletions(-)
 create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlVector.cpp

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
index ea86b6b4327be..8ee6e2a246c55 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
   MsvcStlSmartPointer.cpp
   MsvcStlTuple.cpp
+  MsvcStlVector.cpp
   MSVCUndecoratedNameParser.cpp
 
   LINK_COMPONENTS
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index bf4139119a76b..8724e829835c1 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1404,7 +1404,7 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags.SetFrontEndWantsDereference();
 
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__debug::)?vector<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::__debug::vector<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
@@ -1465,10 +1465,10 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   "libstdc++ std::bitset summary provider",
   "^std::(__debug::)?bitset<.+>(( )?&)?$", stl_summary_flags, true);
 
-  AddCXXSummary(
-  cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
-  "libstdc++ std::vector summary provider",
-  "^std::(__debug::)?vector<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp,
+lldb_private::formatters::ContainerSizeSummaryProvider,
+"libstdc++ std::__debug::vector summary provider",
+"^std::__debug::vector<.+>(( )?&)?$", stl_summary_flags, true);
 
   AddCXXSummary(
   cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
@@ -1615,6 +1615,20 @@ 
GenericTupleSyntheticFrontEndCreator(CXXSyntheticChildren *children,
   return LibStdcppTupleSyntheticFrontEndCreator(children, valobj_sp);
 }
 
+static SyntheticChildrenFrontEnd *
+GenericVectorSyntheticFrontEndCreator(CXXSyntheticChildren *children,
+  lldb::ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+return nullptr;
+
+  // checks for vector and vector
+  if (auto *msvc = MsvcStlVectorSyntheticFrontEndCreator(valobj_sp))
+return msvc;
+
+  return new ScriptedSyntheticChildren::FrontEnd(
+  "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider", *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)
@@ -1686,6 +1700,12 @@ static void 
LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
 "MSVC STL/libstdc++ std::tuple summary provider",
 "^std::tuple<.*>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider,
+"MSVC/libstdc++ std::vector summary provider",
+"^std::vector<.+>(( )?&)?$", stl_summary_flags, true);
+  AddCXXSynthetic(cpp_category_sp, GenericVectorSyntheticFrontEndCreator,
+  "MSVC/libstdc++ std::vector synthetic provider",
+  "^std::vector<.+>(( )?&)?$", stl_synth_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 bad47701904bb..81397851b6010 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h
@@ -51,6 +51,11 @@ SyntheticChildrenFrontEnd *
 MsvcStlTupleSyntheticFrontEndCreator(CXXSyntheticChildren *,
  lldb::ValueObjectSP valobj_sp

[Lldb-commits] [lldb] [lldb][rpc] Upstream RPC Client Library Emitters (PR #147655)

2025-07-15 Thread Chelsea Cassanova via lldb-commits

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


  1   2   >