[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)

2025-03-25 Thread Pavel Labath via lldb-commits

labath wrote:

> Moving out only 1 function `CPlusPlusLanguage::IsCPPMangledName()` is not 
> enough anymore to reduce the size of lldb-server. But this patch works fine 
> because moves all code used by Module.cpp.

I still don't think we should be doing this, and this is the reason why. It's 
not a good solution if random perturbations in unrelated code can cause this to 
work or not.

> Note it is mainline clang/lld.

All the more reason to get to the bottom of this. Either we find a bug in the 
compiler/linker (and make it better for everyone), or we learn what is the 
property that makes this work (and then we can try to find a way to make it 
work reliably).

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


[Lldb-commits] [lldb] [lldb] Remove (deprecated) Function::GetAddressRange (PR #132923)

2025-03-25 Thread Pavel Labath via lldb-commits

https://github.com/labath created 
https://github.com/llvm/llvm-project/pull/132923

All uses have been replaced by GetAddressRange*s* or GetAddress.

Also fix two internal uses of the range member.

>From 511d6027e952ed6a675bd899dffa07de934a080e Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Tue, 25 Mar 2025 13:05:36 +0100
Subject: [PATCH] [lldb] Remove (deprecated) Function::GetAddressRange

All uses have been replaced by GetAddressRange*s* or GetAddress.

Also fix two internal uses of the range member.
---
 lldb/include/lldb/Symbol/Function.h |  8 
 lldb/source/Symbol/Function.cpp | 28 +++-
 2 files changed, 3 insertions(+), 33 deletions(-)

diff --git a/lldb/include/lldb/Symbol/Function.h 
b/lldb/include/lldb/Symbol/Function.h
index ee3a8304fc5b3..21b3f9ab4a70c 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -445,9 +445,6 @@ class Function : public UserID, public SymbolContextScope {
 
   Function *CalculateSymbolContextFunction() override;
 
-  /// DEPRECATED: Use GetAddressRanges instead.
-  const AddressRange &GetAddressRange() { return m_range; }
-
   AddressRanges GetAddressRanges() { return m_block.GetRanges(); }
 
   /// Return the address of the function (its entry point). This address is 
also
@@ -658,11 +655,6 @@ class Function : public UserID, public SymbolContextScope {
   /// All lexical blocks contained in this function.
   Block m_block;
 
-  /// The function address range that covers the widest range needed to contain
-  /// all blocks. DEPRECATED: do not use this field in new code as the range 
may
-  /// include addresses belonging to other functions.
-  AddressRange m_range;
-
   /// The address (entry point) of the function.
   Address m_address;
 
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index 2c4467cc2e9c5..4fc793750f84f 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -254,33 +254,13 @@ Function *IndirectCallEdge::GetCallee(ModuleList &images,
 
 /// @}
 
-AddressRange CollapseRanges(llvm::ArrayRef ranges) {
-  if (ranges.empty())
-return AddressRange();
-  if (ranges.size() == 1)
-return ranges[0];
-
-  Address lowest_addr = ranges[0].GetBaseAddress();
-  addr_t highest_addr = lowest_addr.GetFileAddress() + ranges[0].GetByteSize();
-  for (const AddressRange &range : ranges.drop_front()) {
-Address range_begin = range.GetBaseAddress();
-addr_t range_end = range_begin.GetFileAddress() + range.GetByteSize();
-if (range_begin.GetFileAddress() < lowest_addr.GetFileAddress())
-  lowest_addr = range_begin;
-if (range_end > highest_addr)
-  highest_addr = range_end;
-  }
-  return AddressRange(lowest_addr, highest_addr - 
lowest_addr.GetFileAddress());
-}
-
 //
 Function::Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t type_uid, const Mangled &mangled, Type 
*type,
Address address, AddressRanges ranges)
 : UserID(func_uid), m_comp_unit(comp_unit), m_type_uid(type_uid),
   m_type(type), m_mangled(mangled), m_block(*this, func_uid),
-  m_range(CollapseRanges(ranges)), m_address(std::move(address)),
-  m_prologue_byte_size(0) {
+  m_address(std::move(address)), m_prologue_byte_size(0) {
   assert(comp_unit != nullptr);
   lldb::addr_t base_file_addr = m_address.GetFileAddress();
   for (const AddressRange &range : ranges)
@@ -464,8 +444,7 @@ void Function::Dump(Stream *s, bool show_context) const {
   s->EOL();
   // Dump the root object
   if (m_block.BlockInfoHasBeenParsed())
-m_block.Dump(s, m_range.GetBaseAddress().GetFileAddress(), INT_MAX,
- show_context);
+m_block.Dump(s, m_address.GetFileAddress(), INT_MAX, show_context);
 }
 
 void Function::CalculateSymbolContext(SymbolContext *sc) {
@@ -474,8 +453,7 @@ void Function::CalculateSymbolContext(SymbolContext *sc) {
 }
 
 ModuleSP Function::CalculateSymbolContextModule() {
-  SectionSP section_sp(m_range.GetBaseAddress().GetSection());
-  if (section_sp)
+  if (SectionSP section_sp = m_address.GetSection())
 return section_sp->GetModule();
 
   return this->GetCompileUnit()->GetModule();

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


[Lldb-commits] [lldb] [lldb] Remove (deprecated) Function::GetAddressRange (PR #132923)

2025-03-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)


Changes

All uses have been replaced by GetAddressRange*s* or GetAddress.

Also fix two internal uses of the range member.

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


2 Files Affected:

- (modified) lldb/include/lldb/Symbol/Function.h (-8) 
- (modified) lldb/source/Symbol/Function.cpp (+3-25) 


``diff
diff --git a/lldb/include/lldb/Symbol/Function.h 
b/lldb/include/lldb/Symbol/Function.h
index ee3a8304fc5b3..21b3f9ab4a70c 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -445,9 +445,6 @@ class Function : public UserID, public SymbolContextScope {
 
   Function *CalculateSymbolContextFunction() override;
 
-  /// DEPRECATED: Use GetAddressRanges instead.
-  const AddressRange &GetAddressRange() { return m_range; }
-
   AddressRanges GetAddressRanges() { return m_block.GetRanges(); }
 
   /// Return the address of the function (its entry point). This address is 
also
@@ -658,11 +655,6 @@ class Function : public UserID, public SymbolContextScope {
   /// All lexical blocks contained in this function.
   Block m_block;
 
-  /// The function address range that covers the widest range needed to contain
-  /// all blocks. DEPRECATED: do not use this field in new code as the range 
may
-  /// include addresses belonging to other functions.
-  AddressRange m_range;
-
   /// The address (entry point) of the function.
   Address m_address;
 
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index 2c4467cc2e9c5..4fc793750f84f 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -254,33 +254,13 @@ Function *IndirectCallEdge::GetCallee(ModuleList &images,
 
 /// @}
 
-AddressRange CollapseRanges(llvm::ArrayRef ranges) {
-  if (ranges.empty())
-return AddressRange();
-  if (ranges.size() == 1)
-return ranges[0];
-
-  Address lowest_addr = ranges[0].GetBaseAddress();
-  addr_t highest_addr = lowest_addr.GetFileAddress() + ranges[0].GetByteSize();
-  for (const AddressRange &range : ranges.drop_front()) {
-Address range_begin = range.GetBaseAddress();
-addr_t range_end = range_begin.GetFileAddress() + range.GetByteSize();
-if (range_begin.GetFileAddress() < lowest_addr.GetFileAddress())
-  lowest_addr = range_begin;
-if (range_end > highest_addr)
-  highest_addr = range_end;
-  }
-  return AddressRange(lowest_addr, highest_addr - 
lowest_addr.GetFileAddress());
-}
-
 //
 Function::Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t type_uid, const Mangled &mangled, Type 
*type,
Address address, AddressRanges ranges)
 : UserID(func_uid), m_comp_unit(comp_unit), m_type_uid(type_uid),
   m_type(type), m_mangled(mangled), m_block(*this, func_uid),
-  m_range(CollapseRanges(ranges)), m_address(std::move(address)),
-  m_prologue_byte_size(0) {
+  m_address(std::move(address)), m_prologue_byte_size(0) {
   assert(comp_unit != nullptr);
   lldb::addr_t base_file_addr = m_address.GetFileAddress();
   for (const AddressRange &range : ranges)
@@ -464,8 +444,7 @@ void Function::Dump(Stream *s, bool show_context) const {
   s->EOL();
   // Dump the root object
   if (m_block.BlockInfoHasBeenParsed())
-m_block.Dump(s, m_range.GetBaseAddress().GetFileAddress(), INT_MAX,
- show_context);
+m_block.Dump(s, m_address.GetFileAddress(), INT_MAX, show_context);
 }
 
 void Function::CalculateSymbolContext(SymbolContext *sc) {
@@ -474,8 +453,7 @@ void Function::CalculateSymbolContext(SymbolContext *sc) {
 }
 
 ModuleSP Function::CalculateSymbolContextModule() {
-  SectionSP section_sp(m_range.GetBaseAddress().GetSection());
-  if (section_sp)
+  if (SectionSP section_sp = m_address.GetSection())
 return section_sp->GetModule();
 
   return this->GetCompileUnit()->GetModule();

``




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


[Lldb-commits] [lldb] [lldb][AIX] Minor AIX specific changes (PR #132718)

2025-03-25 Thread Dhruv Srivastava via lldb-commits

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


[Lldb-commits] [lldb] [lldb][NFC] Break ThreadMemory into smaller abstractions (PR #132905)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan created 
https://github.com/llvm/llvm-project/pull/132905

ThreadMemory attempts to be a class abstracting the notion of a "fake" Thread 
that is backed by a "real" thread. According to its documentation, it is meant 
to be a class forwarding most methods to the backing thread, but it does so 
only for a handful of methods.

Along the way, it also tries to represent a Thread that may or may not have a 
different name, and may or may not have a different queue from the backing 
thread. This can be problematic for a couple of reasons:

1. It forces all users into this optional behavior.
2. The forwarding behavior is incomplete: not all methods are currently being 
forwarded properly. Some of them involve queues and seem to have been 
intentionally left unimplemented.

This commit creates the following separation:

ThreadMemory <- ThreadMemoryProvidingName <- ThreadMemoryProvidingNameAndQueue

ThreadMemory captures the notion of a backed thread that _really_ forwards all 
methods to the backing thread. (Missing methods should be implemented in a 
later commit, and allowing them to be implemented without changing behavior of 
other derived classes is the main purpose of this refactor).

ThreadMemoryProvidingNameAndQueue is a ThreadMemory that allows users to 
override the thread name. If a name is present, it is used; otherwise the 
forwarding behavior is used.

ThreadMemoryProvidingNameAndQueue is a ThreadMemoryProvidingName that allows 
users to override queue information. If queue information is present, it is 
used; otherwise, the forwarding behavior is used.

With this separation, we can more explicitly implement missing methods of the 
base class and override them, if needed, in ThreadMemoryProvidingNameAndQueue. 
But this commit really is NFC, no new methods are implemented and no method 
implementation is changed.

>From 723c78774fe2b0471361ca626f1df0caa1708dfb Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Thu, 20 Mar 2025 14:59:33 -0300
Subject: [PATCH] [lldb][NFC] Break ThreadMemory into smaller abstractions

ThreadMemory attempts to be a class abstracting the notion of a "fake"
Thread that is backed by a "real" thread. According to its
documentation, it is meant to be a class forwarding most methods to the
backing thread, but it does so only for a handful of methods.

Along the way, it also tries to represent a Thread that may or may not
have a different name, and may or may not have a different queue from
the backing thread. This can be problematic for a couple of reasons:

1. It forces all users into this optional behavior.
2. The forwarding behavior is incomplete: not all methods are currently
   being forwarded properly. Some of them involve queues and seem to
   have been intentionally left unimplemented.

This commit creates the following separation:

ThreadMemory <- ThreadMemoryProvidingName <- ThreadMemoryProvidingNameAndQueue

ThreadMemory captures the notion of a backed thread that _really_
forwards all methods to the backing thread. (Missing methods should be
implemented in a later commit, and allowing them to be implemented
without changing behavior of other derived classes is the main purpose
of this refactor).

ThreadMemoryProvidingNameAndQueue is a ThreadMemory that allows users to
override the thread name. If a name is present, it is used; otherwise
the forwarding behavior is used.

ThreadMemoryProvidingNameAndQueue is a ThreadMemoryProvidingName that
allows users to override queue information. If queue information is
present, it is used; otherwise, the forwarding behavior is used.

With this separation, we can more explicitly implement missing methods
of the base class and override them, if needed, in
ThreadMemoryProvidingNameAndQueue. But this commit really is NFC, no new
methods are implemented and no method implementation is changed.
---
 .../Python/OperatingSystemPython.cpp  |  4 +-
 .../Plugins/Process/Utility/ThreadMemory.cpp  | 23 +++--
 .../Plugins/Process/Utility/ThreadMemory.h| 86 +--
 3 files changed, 75 insertions(+), 38 deletions(-)

diff --git 
a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp 
b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index aff521890858c..96b2b9d9ee088 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -259,8 +259,8 @@ ThreadSP OperatingSystemPython::CreateThreadFromThreadInfo(
   if (!thread_sp) {
 if (did_create_ptr)
   *did_create_ptr = true;
-thread_sp = std::make_shared(*m_process, tid, name, queue,
-   reg_data_addr);
+thread_sp = std::make_shared(
+*m_process, tid, name, queue, reg_data_addr);
   }
 
   if (core_number < core_thread_list.GetSize(false)) {
diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp 
b/lldb/source/Plugin

[Lldb-commits] [lldb] [lldb][NFC] Break ThreadMemory into smaller abstractions (PR #132905)

2025-03-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Felipe de Azevedo Piovezan (felipepiovezan)


Changes

ThreadMemory attempts to be a class abstracting the notion of a "fake" Thread 
that is backed by a "real" thread. According to its documentation, it is meant 
to be a class forwarding most methods to the backing thread, but it does so 
only for a handful of methods.

Along the way, it also tries to represent a Thread that may or may not have a 
different name, and may or may not have a different queue from the backing 
thread. This can be problematic for a couple of reasons:

1. It forces all users into this optional behavior.
2. The forwarding behavior is incomplete: not all methods are currently being 
forwarded properly. Some of them involve queues and seem to have been 
intentionally left unimplemented.

This commit creates the following separation:

ThreadMemory <- ThreadMemoryProvidingName <- 
ThreadMemoryProvidingNameAndQueue

ThreadMemory captures the notion of a backed thread that _really_ forwards all 
methods to the backing thread. (Missing methods should be implemented in a 
later commit, and allowing them to be implemented without changing behavior of 
other derived classes is the main purpose of this refactor).

ThreadMemoryProvidingNameAndQueue is a ThreadMemory that allows users to 
override the thread name. If a name is present, it is used; otherwise the 
forwarding behavior is used.

ThreadMemoryProvidingNameAndQueue is a ThreadMemoryProvidingName that allows 
users to override queue information. If queue information is present, it is 
used; otherwise, the forwarding behavior is used.

With this separation, we can more explicitly implement missing methods of the 
base class and override them, if needed, in ThreadMemoryProvidingNameAndQueue. 
But this commit really is NFC, no new methods are implemented and no method 
implementation is changed.

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


3 Files Affected:

- (modified) 
lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (+2-2) 
- (modified) lldb/source/Plugins/Process/Utility/ThreadMemory.cpp (+11-12) 
- (modified) lldb/source/Plugins/Process/Utility/ThreadMemory.h (+62-24) 


``diff
diff --git 
a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp 
b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index aff521890858c..96b2b9d9ee088 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -259,8 +259,8 @@ ThreadSP OperatingSystemPython::CreateThreadFromThreadInfo(
   if (!thread_sp) {
 if (did_create_ptr)
   *did_create_ptr = true;
-thread_sp = std::make_shared(*m_process, tid, name, queue,
-   reg_data_addr);
+thread_sp = std::make_shared(
+*m_process, tid, name, queue, reg_data_addr);
   }
 
   if (core_number < core_thread_list.GetSize(false)) {
diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp 
b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
index 550b53688fd39..f4bfba117226f 100644
--- a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
+++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
@@ -20,18 +20,17 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ThreadMemory::ThreadMemory(Process &process, lldb::tid_t tid,
-   const ValueObjectSP &thread_info_valobj_sp)
-: Thread(process, tid), m_backing_thread_sp(),
-  m_thread_info_valobj_sp(thread_info_valobj_sp), m_name(), m_queue(),
-  m_register_data_addr(LLDB_INVALID_ADDRESS) {}
-
-ThreadMemory::ThreadMemory(Process &process, lldb::tid_t tid,
-   llvm::StringRef name, llvm::StringRef queue,
-   lldb::addr_t register_data_addr)
-: Thread(process, tid), m_backing_thread_sp(), m_thread_info_valobj_sp(),
-  m_name(std::string(name)), m_queue(std::string(queue)),
-  m_register_data_addr(register_data_addr) {}
+ThreadMemoryProvidingNameAndQueue::ThreadMemoryProvidingNameAndQueue(
+Process &process, lldb::tid_t tid,
+const ValueObjectSP &thread_info_valobj_sp)
+: ThreadMemoryProvidingName(process, tid, LLDB_INVALID_ADDRESS, ""),
+  m_thread_info_valobj_sp(thread_info_valobj_sp), m_queue() {}
+
+ThreadMemoryProvidingNameAndQueue::ThreadMemoryProvidingNameAndQueue(
+Process &process, lldb::tid_t tid, llvm::StringRef name,
+llvm::StringRef queue, lldb::addr_t register_data_addr)
+: ThreadMemoryProvidingName(process, tid, register_data_addr, name),
+  m_thread_info_valobj_sp(), m_queue(std::string(queue)) {}
 
 ThreadMemory::~ThreadMemory() { DestroyThread(); }
 
diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.h 
b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
index cebb31538eaf2..7cabde202518e 100644
--- a/lldb/source/Plugins/Process/Utility/Th

[Lldb-commits] [lldb] [lldb][NFC] Break ThreadMemory into smaller abstractions (PR #132905)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

This was reviewed and approved in 
https://github.com/llvm/llvm-project/pull/132734
But,  in order to preserve the small commits, I'm merging through separate PRs.

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


[Lldb-commits] [lldb] [lldb][NFC] Break ThreadMemory into smaller abstractions (PR #132905)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

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


[Lldb-commits] [lldb] 65ad02b - [lldb][NFC] Break ThreadMemory into smaller abstractions (#132905)

2025-03-25 Thread via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2025-03-25T06:50:52-03:00
New Revision: 65ad02b882ba545dafbfc195a78e204c218e93ed

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

LOG: [lldb][NFC] Break ThreadMemory into smaller abstractions (#132905)

ThreadMemory attempts to be a class abstracting the notion of a "fake"
Thread that is backed by a "real" thread. According to its
documentation, it is meant to be a class forwarding most methods to the
backing thread, but it does so only for a handful of methods.

Along the way, it also tries to represent a Thread that may or may not
have a different name, and may or may not have a different queue from
the backing thread. This can be problematic for a couple of reasons:

1. It forces all users into this optional behavior.
2. The forwarding behavior is incomplete: not all methods are currently
being forwarded properly. Some of them involve queues and seem to have
been intentionally left unimplemented.

This commit creates the following separation:

ThreadMemory <- ThreadMemoryProvidingName <-
ThreadMemoryProvidingNameAndQueue

ThreadMemory captures the notion of a backed thread that _really_
forwards all methods to the backing thread. (Missing methods should be
implemented in a later commit, and allowing them to be implemented
without changing behavior of other derived classes is the main purpose
of this refactor).

ThreadMemoryProvidingNameAndQueue is a ThreadMemory that allows users to
override the thread name. If a name is present, it is used; otherwise
the forwarding behavior is used.

ThreadMemoryProvidingNameAndQueue is a ThreadMemoryProvidingName that
allows users to override queue information. If queue information is
present, it is used; otherwise, the forwarding behavior is used.

With this separation, we can more explicitly implement missing methods
of the base class and override them, if needed, in
ThreadMemoryProvidingNameAndQueue. But this commit really is NFC, no new
methods are implemented and no method implementation is changed.

Added: 


Modified: 
lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
lldb/source/Plugins/Process/Utility/ThreadMemory.h

Removed: 




diff  --git 
a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp 
b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index aff521890858c..96b2b9d9ee088 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -259,8 +259,8 @@ ThreadSP OperatingSystemPython::CreateThreadFromThreadInfo(
   if (!thread_sp) {
 if (did_create_ptr)
   *did_create_ptr = true;
-thread_sp = std::make_shared(*m_process, tid, name, queue,
-   reg_data_addr);
+thread_sp = std::make_shared(
+*m_process, tid, name, queue, reg_data_addr);
   }
 
   if (core_number < core_thread_list.GetSize(false)) {

diff  --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp 
b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
index 550b53688fd39..f4bfba117226f 100644
--- a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
+++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
@@ -20,18 +20,17 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ThreadMemory::ThreadMemory(Process &process, lldb::tid_t tid,
-   const ValueObjectSP &thread_info_valobj_sp)
-: Thread(process, tid), m_backing_thread_sp(),
-  m_thread_info_valobj_sp(thread_info_valobj_sp), m_name(), m_queue(),
-  m_register_data_addr(LLDB_INVALID_ADDRESS) {}
-
-ThreadMemory::ThreadMemory(Process &process, lldb::tid_t tid,
-   llvm::StringRef name, llvm::StringRef queue,
-   lldb::addr_t register_data_addr)
-: Thread(process, tid), m_backing_thread_sp(), m_thread_info_valobj_sp(),
-  m_name(std::string(name)), m_queue(std::string(queue)),
-  m_register_data_addr(register_data_addr) {}
+ThreadMemoryProvidingNameAndQueue::ThreadMemoryProvidingNameAndQueue(
+Process &process, lldb::tid_t tid,
+const ValueObjectSP &thread_info_valobj_sp)
+: ThreadMemoryProvidingName(process, tid, LLDB_INVALID_ADDRESS, ""),
+  m_thread_info_valobj_sp(thread_info_valobj_sp), m_queue() {}
+
+ThreadMemoryProvidingNameAndQueue::ThreadMemoryProvidingNameAndQueue(
+Process &process, lldb::tid_t tid, llvm::StringRef name,
+llvm::StringRef queue, lldb::addr_t register_data_addr)
+: ThreadMemoryProvidingName(process, tid, register_data_addr, name),
+  m_thread_info_valobj_sp(), m_queue(std::string(queue)) {}
 
 ThreadMemory::~ThreadMemory() { Des

[Lldb-commits] [lldb] 07c82b1 - [lldb] Implement missing queue overloads from ThreadMemory (#132906)

2025-03-25 Thread via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2025-03-25T06:52:07-03:00
New Revision: 07c82b1622de1c5c4329ffb769bef7fef1b07429

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

LOG: [lldb] Implement missing queue overloads from ThreadMemory (#132906)

This commit makes ThreadMemory a real "forwarder" class by implementing
the missing queue methods: they will just call the corresponding backing
thread method.

To make this patch NFC(*) and not change the behavior of the Python OS
plugin, NamedThreadMemoryWithQueue also overrides these methods to
simply call the `Thread` method, just as it was doing before. This also
makes it obvious that there are missing pieces of this class if it were
to provide full queue support.

(*) This patch is NFC in the sense that all llvm.org plugins will not
have any behavior change, but downstream consumers of ThreadMemory will
benefit from the newly implemented forwarding methods.

Added: 


Modified: 
lldb/source/Plugins/Process/Utility/ThreadMemory.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.h 
b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
index 7cabde202518e..f47bbd8848436 100644
--- a/lldb/source/Plugins/Process/Utility/ThreadMemory.h
+++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
@@ -53,6 +53,69 @@ class ThreadMemory : public lldb_private::Thread {
 
   void WillResume(lldb::StateType resume_state) override;
 
+  void SetQueueName(const char *name) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueName(name);
+  }
+
+  lldb::queue_id_t GetQueueID() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueueID();
+return LLDB_INVALID_QUEUE_ID;
+  }
+
+  void SetQueueID(lldb::queue_id_t new_val) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueID(new_val);
+  }
+
+  lldb::QueueKind GetQueueKind() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueueKind();
+return lldb::eQueueKindUnknown;
+  }
+
+  void SetQueueKind(lldb::QueueKind kind) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueKind(kind);
+  }
+
+  lldb::QueueSP GetQueue() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueue();
+return lldb::QueueSP();
+  }
+
+  lldb::addr_t GetQueueLibdispatchQueueAddress() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueueLibdispatchQueueAddress();
+return LLDB_INVALID_ADDRESS;
+  }
+
+  void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override 
{
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueLibdispatchQueueAddress(dispatch_queue_t);
+  }
+
+  lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetAssociatedWithLibdispatchQueue();
+return lldb_private::eLazyBoolNo;
+  }
+
+  void SetAssociatedWithLibdispatchQueue(
+  lldb_private::LazyBool associated_with_libdispatch_queue) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetAssociatedWithLibdispatchQueue(
+  associated_with_libdispatch_queue);
+  }
+
+  bool ThreadHasQueueInformation() const override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->ThreadHasQueueInformation();
+return false;
+  }
+
   void DidResume() override {
 if (m_backing_thread_sp)
   m_backing_thread_sp->DidResume();
@@ -134,6 +197,55 @@ class ThreadMemoryProvidingNameAndQueue : public 
ThreadMemoryProvidingName {
 return ThreadMemory::GetQueueName();
   }
 
+  /// TODO: this method should take into account the queue override.
+  void SetQueueName(const char *name) override { Thread::SetQueueName(name); }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::queue_id_t GetQueueID() override { return Thread::GetQueueID(); }
+
+  /// TODO: this method should take into account the queue override.
+  void SetQueueID(lldb::queue_id_t new_val) override {
+Thread::SetQueueID(new_val);
+  }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::QueueKind GetQueueKind() override { return Thread::GetQueueKind(); }
+
+  /// TODO: this method should take into account the queue override.
+  void SetQueueKind(lldb::QueueKind kind) override {
+Thread::SetQueueKind(kind);
+  }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::QueueSP GetQueue() override { return Thread::GetQueue(); }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::addr_t GetQueueLibdispatchQueueAddress() override {
+return Thread::GetQueueLibdispatchQueueAddress();
+  }
+
+  /// TODO: this method

[Lldb-commits] [lldb] [lldb] Implement missing queue overloads from ThreadMemory (PR #132906)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Implement missing queue overloads from ThreadMemory (PR #132906)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

This was reviewed and approved in 
https://github.com/llvm/llvm-project/pull/132734
But, in order to preserve the small commits, I'm merging through separate PRs.

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


[Lldb-commits] [lldb] [lldb] Implement missing queue overloads from ThreadMemory (PR #132906)

2025-03-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Felipe de Azevedo Piovezan (felipepiovezan)


Changes

This commit makes ThreadMemory a real "forwarder" class by implementing the 
missing queue methods: they will just call the corresponding backing thread 
method.

To make this patch NFC(*) and not change the behavior of the Python OS plugin, 
NamedThreadMemoryWithQueue also overrides these methods to simply call the 
`Thread` method, just as it was doing before. This also makes it obvious that 
there are missing pieces of this class if it were to provide full queue support.

(*) This patch is NFC in the sense that all llvm.org plugins will not have any 
behavior change, but downstream consumers of ThreadMemory will benefit from the 
newly implemented forwarding methods.

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


1 Files Affected:

- (modified) lldb/source/Plugins/Process/Utility/ThreadMemory.h (+112) 


``diff
diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.h 
b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
index 7cabde202518e..f47bbd8848436 100644
--- a/lldb/source/Plugins/Process/Utility/ThreadMemory.h
+++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
@@ -53,6 +53,69 @@ class ThreadMemory : public lldb_private::Thread {
 
   void WillResume(lldb::StateType resume_state) override;
 
+  void SetQueueName(const char *name) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueName(name);
+  }
+
+  lldb::queue_id_t GetQueueID() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueueID();
+return LLDB_INVALID_QUEUE_ID;
+  }
+
+  void SetQueueID(lldb::queue_id_t new_val) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueID(new_val);
+  }
+
+  lldb::QueueKind GetQueueKind() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueueKind();
+return lldb::eQueueKindUnknown;
+  }
+
+  void SetQueueKind(lldb::QueueKind kind) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueKind(kind);
+  }
+
+  lldb::QueueSP GetQueue() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueue();
+return lldb::QueueSP();
+  }
+
+  lldb::addr_t GetQueueLibdispatchQueueAddress() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueueLibdispatchQueueAddress();
+return LLDB_INVALID_ADDRESS;
+  }
+
+  void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override 
{
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueLibdispatchQueueAddress(dispatch_queue_t);
+  }
+
+  lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetAssociatedWithLibdispatchQueue();
+return lldb_private::eLazyBoolNo;
+  }
+
+  void SetAssociatedWithLibdispatchQueue(
+  lldb_private::LazyBool associated_with_libdispatch_queue) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetAssociatedWithLibdispatchQueue(
+  associated_with_libdispatch_queue);
+  }
+
+  bool ThreadHasQueueInformation() const override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->ThreadHasQueueInformation();
+return false;
+  }
+
   void DidResume() override {
 if (m_backing_thread_sp)
   m_backing_thread_sp->DidResume();
@@ -134,6 +197,55 @@ class ThreadMemoryProvidingNameAndQueue : public 
ThreadMemoryProvidingName {
 return ThreadMemory::GetQueueName();
   }
 
+  /// TODO: this method should take into account the queue override.
+  void SetQueueName(const char *name) override { Thread::SetQueueName(name); }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::queue_id_t GetQueueID() override { return Thread::GetQueueID(); }
+
+  /// TODO: this method should take into account the queue override.
+  void SetQueueID(lldb::queue_id_t new_val) override {
+Thread::SetQueueID(new_val);
+  }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::QueueKind GetQueueKind() override { return Thread::GetQueueKind(); }
+
+  /// TODO: this method should take into account the queue override.
+  void SetQueueKind(lldb::QueueKind kind) override {
+Thread::SetQueueKind(kind);
+  }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::QueueSP GetQueue() override { return Thread::GetQueue(); }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::addr_t GetQueueLibdispatchQueueAddress() override {
+return Thread::GetQueueLibdispatchQueueAddress();
+  }
+
+  /// TODO: this method should take into account the queue override.
+  void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override 
{
+Thread::SetQueueLibdispatchQueueAddress(dispatch_queue_t);
+  }
+
+  /// TODO: this method should take into account the queue override.
+ 

[Lldb-commits] [lldb] [lldb] Fix missing overloads in ThreadMemory (PR #132734)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Implement missing queue overloads from ThreadMemory (PR #132906)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan created 
https://github.com/llvm/llvm-project/pull/132906

This commit makes ThreadMemory a real "forwarder" class by implementing the 
missing queue methods: they will just call the corresponding backing thread 
method.

To make this patch NFC(*) and not change the behavior of the Python OS plugin, 
NamedThreadMemoryWithQueue also overrides these methods to simply call the 
`Thread` method, just as it was doing before. This also makes it obvious that 
there are missing pieces of this class if it were to provide full queue support.

(*) This patch is NFC in the sense that all llvm.org plugins will not have any 
behavior change, but downstream consumers of ThreadMemory will benefit from the 
newly implemented forwarding methods.

>From 4242173b75c1a55ade1ab020d1a11cc7e54580b4 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Fri, 21 Mar 2025 14:59:05 -0300
Subject: [PATCH] [lldb] Implement missing queue overloads from ThreadMemory

This commit makes ThreadMemory a real "forwarder" class by implementing
the missing queue methods: they will just call the corresponding backing
thread method.

To make this patch NFC(*) and not change the behavior of the Python OS
plugin, NamedThreadMemoryWithQueue also overrides these methods to
simply call the `Thread` method, just as it was doing before. This also
makes it obvious that there are missing pieces of this class if it were
to provide full queue support.

(*) This patch is NFC in the sense that all llvm.org plugins will not have
any behavior change, but downstream consumers of ThreadMemory will
benefit from the newly implemented forwarding methods.
---
 .../Plugins/Process/Utility/ThreadMemory.h| 112 ++
 1 file changed, 112 insertions(+)

diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.h 
b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
index 7cabde202518e..f47bbd8848436 100644
--- a/lldb/source/Plugins/Process/Utility/ThreadMemory.h
+++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
@@ -53,6 +53,69 @@ class ThreadMemory : public lldb_private::Thread {
 
   void WillResume(lldb::StateType resume_state) override;
 
+  void SetQueueName(const char *name) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueName(name);
+  }
+
+  lldb::queue_id_t GetQueueID() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueueID();
+return LLDB_INVALID_QUEUE_ID;
+  }
+
+  void SetQueueID(lldb::queue_id_t new_val) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueID(new_val);
+  }
+
+  lldb::QueueKind GetQueueKind() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueueKind();
+return lldb::eQueueKindUnknown;
+  }
+
+  void SetQueueKind(lldb::QueueKind kind) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueKind(kind);
+  }
+
+  lldb::QueueSP GetQueue() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueue();
+return lldb::QueueSP();
+  }
+
+  lldb::addr_t GetQueueLibdispatchQueueAddress() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetQueueLibdispatchQueueAddress();
+return LLDB_INVALID_ADDRESS;
+  }
+
+  void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override 
{
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetQueueLibdispatchQueueAddress(dispatch_queue_t);
+  }
+
+  lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->GetAssociatedWithLibdispatchQueue();
+return lldb_private::eLazyBoolNo;
+  }
+
+  void SetAssociatedWithLibdispatchQueue(
+  lldb_private::LazyBool associated_with_libdispatch_queue) override {
+if (m_backing_thread_sp)
+  m_backing_thread_sp->SetAssociatedWithLibdispatchQueue(
+  associated_with_libdispatch_queue);
+  }
+
+  bool ThreadHasQueueInformation() const override {
+if (m_backing_thread_sp)
+  return m_backing_thread_sp->ThreadHasQueueInformation();
+return false;
+  }
+
   void DidResume() override {
 if (m_backing_thread_sp)
   m_backing_thread_sp->DidResume();
@@ -134,6 +197,55 @@ class ThreadMemoryProvidingNameAndQueue : public 
ThreadMemoryProvidingName {
 return ThreadMemory::GetQueueName();
   }
 
+  /// TODO: this method should take into account the queue override.
+  void SetQueueName(const char *name) override { Thread::SetQueueName(name); }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::queue_id_t GetQueueID() override { return Thread::GetQueueID(); }
+
+  /// TODO: this method should take into account the queue override.
+  void SetQueueID(lldb::queue_id_t new_val) override {
+Thread::SetQueueID(new_val);
+  }
+
+  /// TODO: this method should take into account the queue override.
+  lldb::QueueKind GetQueueKind() override { return Thread::Get

[Lldb-commits] [lldb] [lldb][docs][NFC] Fix some doxygen comments (PR #132910)

2025-03-25 Thread Michael Buch via lldb-commits

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

These weren't rendering properly (mostly mis-use the syntax for commenting 
member variables).

>From f50582268aca77a5f5c807b7a03e5ea20c67bcb6 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Tue, 25 Mar 2025 10:15:36 +
Subject: [PATCH] [lldb][docs][NFC] Fix some doxygen comments

These weren't rendering properly (mostly mis-use the syntax for commenting 
member variables).
---
 lldb/include/lldb/Core/Mangled.h |  6 +++---
 lldb/include/lldb/Core/Module.h  |  4 ++--
 lldb/include/lldb/Interpreter/CommandInterpreter.h   | 12 ++--
 lldb/include/lldb/Symbol/SymbolFile.h| 12 ++--
 lldb/include/lldb/Target/Target.h|  6 +++---
 lldb/include/lldb/ValueObject/ValueObjectVariable.h  |  5 +++--
 .../InstrumentationRuntime/Utility/Utility.cpp   |  4 
 .../Plugins/InstrumentationRuntime/Utility/Utility.h | 10 +-
 8 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/lldb/include/lldb/Core/Mangled.h b/lldb/include/lldb/Core/Mangled.h
index 9ca28917ccffa..5988d919a89b8 100644
--- a/lldb/include/lldb/Core/Mangled.h
+++ b/lldb/include/lldb/Core/Mangled.h
@@ -276,11 +276,11 @@ class Mangled {
   void Encode(DataEncoder &encoder, ConstStringTable &strtab) const;
 
 private:
-  ///< The mangled version of the name.
+  /// The mangled version of the name.
   ConstString m_mangled;
 
-  ///< Mutable so we can get it on demand with
-  ///< a const version of this object.
+  /// Mutable so we can get it on demand with
+  /// a const version of this object.
   mutable ConstString m_demangled;
 };
 
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 9aa05ed3eb074..1ad67d6747850 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -951,8 +951,8 @@ class Module : public std::enable_shared_from_this,
 /// names we are looking for
 lldb::FunctionNameType m_name_type_mask = lldb::eFunctionNameTypeNone;
 
-///< If \b true, then demangled names that match will need to contain
-///< "m_name" in order to be considered a match
+/// If \b true, then demangled names that match will need to contain
+/// "m_name" in order to be considered a match
 bool m_match_name_after_lookup = false;
   };
 
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index d5425788fe1c9..b65edcf68b251 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -246,12 +246,12 @@ class CommandInterpreter : public Broadcaster,
   };
 
   enum CommandTypes {
-eCommandTypesBuiltin = 0x0001, //< native commands such as "frame"
-eCommandTypesUserDef = 0x0002, //< scripted commands
-eCommandTypesUserMW = 0x0004,  //< multiword commands (command containers)
-eCommandTypesAliases = 0x0008, //< aliases such as "po"
-eCommandTypesHidden = 0x0010,  //< commands prefixed with an underscore
-eCommandTypesAllThem = 0x  //< all commands
+eCommandTypesBuiltin = 0x0001, ///< native commands such as "frame"
+eCommandTypesUserDef = 0x0002, ///< scripted commands
+eCommandTypesUserMW = 0x0004,  ///< multiword commands (command containers)
+eCommandTypesAliases = 0x0008, ///< aliases such as "po"
+eCommandTypesHidden = 0x0010,  ///< commands prefixed with an underscore
+eCommandTypesAllThem = 0x  ///< all commands
   };
 
   using CommandReturnObjectCallback =
diff --git a/lldb/include/lldb/Symbol/SymbolFile.h 
b/lldb/include/lldb/Symbol/SymbolFile.h
index 837b922ae77f7..dd056035d546e 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -212,13 +212,13 @@ class SymbolFile : public PluginInterface {
   struct ArrayInfo {
 int64_t first_index = 0;
 
-///< Each entry belongs to a distinct DW_TAG_subrange_type.
-///< For multi-dimensional DW_TAG_array_types we would have
-///< an entry for each dimension. An entry represents the
-///< optional element count of the subrange.
+/// Each entry belongs to a distinct DW_TAG_subrange_type.
+/// For multi-dimensional DW_TAG_array_types we would have
+/// an entry for each dimension. An entry represents the
+/// optional element count of the subrange.
 ///
-///< The order of entries follows the order of the DW_TAG_subrange_type
-///< children of this DW_TAG_array_type.
+/// The order of entries follows the order of the DW_TAG_subrange_type
+/// children of this DW_TAG_array_type.
 llvm::SmallVector, 1> element_orders;
 uint32_t byte_stride = 0;
 uint32_t bit_stride = 0;
diff --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index 98273fb7e1c97..d1748d5385b86 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/l

[Lldb-commits] [lldb] [lldb][docs][NFC] Fix some doxygen comments (PR #132910)

2025-03-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

These weren't rendering properly (mostly mis-use the syntax for commenting 
member variables).

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


8 Files Affected:

- (modified) lldb/include/lldb/Core/Mangled.h (+3-3) 
- (modified) lldb/include/lldb/Core/Module.h (+2-2) 
- (modified) lldb/include/lldb/Interpreter/CommandInterpreter.h (+6-6) 
- (modified) lldb/include/lldb/Symbol/SymbolFile.h (+6-6) 
- (modified) lldb/include/lldb/Target/Target.h (+3-3) 
- (modified) lldb/include/lldb/ValueObject/ValueObjectVariable.h (+3-2) 
- (modified) lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp 
(-4) 
- (modified) lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.h 
(+5-5) 


``diff
diff --git a/lldb/include/lldb/Core/Mangled.h b/lldb/include/lldb/Core/Mangled.h
index 9ca28917ccffa..5988d919a89b8 100644
--- a/lldb/include/lldb/Core/Mangled.h
+++ b/lldb/include/lldb/Core/Mangled.h
@@ -276,11 +276,11 @@ class Mangled {
   void Encode(DataEncoder &encoder, ConstStringTable &strtab) const;
 
 private:
-  ///< The mangled version of the name.
+  /// The mangled version of the name.
   ConstString m_mangled;
 
-  ///< Mutable so we can get it on demand with
-  ///< a const version of this object.
+  /// Mutable so we can get it on demand with
+  /// a const version of this object.
   mutable ConstString m_demangled;
 };
 
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 9aa05ed3eb074..1ad67d6747850 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -951,8 +951,8 @@ class Module : public std::enable_shared_from_this,
 /// names we are looking for
 lldb::FunctionNameType m_name_type_mask = lldb::eFunctionNameTypeNone;
 
-///< If \b true, then demangled names that match will need to contain
-///< "m_name" in order to be considered a match
+/// If \b true, then demangled names that match will need to contain
+/// "m_name" in order to be considered a match
 bool m_match_name_after_lookup = false;
   };
 
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index d5425788fe1c9..b65edcf68b251 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -246,12 +246,12 @@ class CommandInterpreter : public Broadcaster,
   };
 
   enum CommandTypes {
-eCommandTypesBuiltin = 0x0001, //< native commands such as "frame"
-eCommandTypesUserDef = 0x0002, //< scripted commands
-eCommandTypesUserMW = 0x0004,  //< multiword commands (command containers)
-eCommandTypesAliases = 0x0008, //< aliases such as "po"
-eCommandTypesHidden = 0x0010,  //< commands prefixed with an underscore
-eCommandTypesAllThem = 0x  //< all commands
+eCommandTypesBuiltin = 0x0001, ///< native commands such as "frame"
+eCommandTypesUserDef = 0x0002, ///< scripted commands
+eCommandTypesUserMW = 0x0004,  ///< multiword commands (command containers)
+eCommandTypesAliases = 0x0008, ///< aliases such as "po"
+eCommandTypesHidden = 0x0010,  ///< commands prefixed with an underscore
+eCommandTypesAllThem = 0x  ///< all commands
   };
 
   using CommandReturnObjectCallback =
diff --git a/lldb/include/lldb/Symbol/SymbolFile.h 
b/lldb/include/lldb/Symbol/SymbolFile.h
index 837b922ae77f7..dd056035d546e 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -212,13 +212,13 @@ class SymbolFile : public PluginInterface {
   struct ArrayInfo {
 int64_t first_index = 0;
 
-///< Each entry belongs to a distinct DW_TAG_subrange_type.
-///< For multi-dimensional DW_TAG_array_types we would have
-///< an entry for each dimension. An entry represents the
-///< optional element count of the subrange.
+/// Each entry belongs to a distinct DW_TAG_subrange_type.
+/// For multi-dimensional DW_TAG_array_types we would have
+/// an entry for each dimension. An entry represents the
+/// optional element count of the subrange.
 ///
-///< The order of entries follows the order of the DW_TAG_subrange_type
-///< children of this DW_TAG_array_type.
+/// The order of entries follows the order of the DW_TAG_subrange_type
+/// children of this DW_TAG_array_type.
 llvm::SmallVector, 1> element_orders;
 uint32_t byte_stride = 0;
 uint32_t bit_stride = 0;
diff --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index 98273fb7e1c97..d1748d5385b86 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -510,9 +510,9 @@ class EvaluateExpressionOptions {
   mutable std::string m_pound_line_file;
   mutable uint32_t m_pound_line_line = 0;
 
-  ///< During expression evaluation, any SymbolContext in this list will be
-  /

[Lldb-commits] [lldb] [lldb][Instrumentation] GetPreferredAsanModule should be no-op on non-Darwin platforms (PR #132911)

2025-03-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

The regex we use to find the compiler-rt library is already Darwin-specific, so 
no need to run this on non-Darwin platforms.

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


1 Files Affected:

- (modified) lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp 
(+4) 


``diff
diff --git a/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp 
b/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
index 3cbd03b24297a..0f69a5e9e57c8 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
@@ -18,6 +18,10 @@ namespace lldb_private {
 ///< This helper searches the target for such a dylib. Returns nullptr if no
 ///< such dylib was found.
 lldb::ModuleSP GetPreferredAsanModule(const Target &target) {
+  // Currently only supported on Darwin.
+  if (!target.GetArchitecture().GetTriple().isOSDarwin())
+return nullptr;
+
   lldb::ModuleSP module;
   llvm::Regex pattern(R"(libclang_rt\.asan_.*_dynamic\.dylib)");
   target.GetImages().ForEach([&](const lldb::ModuleSP &m) {

``




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


[Lldb-commits] [lldb] [lldb][Instrumentation] GetPreferredAsanModule should be no-op on non-Darwin platforms (PR #132911)

2025-03-25 Thread Michael Buch via lldb-commits

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

The regex we use to find the compiler-rt library is already Darwin-specific, so 
no need to run this on non-Darwin platforms.

>From 219355ada6f01f2c5e1a0654a2dc6231e70340ad Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Tue, 25 Mar 2025 10:20:04 +
Subject: [PATCH] [lldb][Instrumentation] GetPreferredAsanModule should be
 no-op on non-Darwin platforms

The regex we use to find the compiler-rt library is already
Darwin-specific, so no need to run this on non-Darwin platforms.
---
 .../source/Plugins/InstrumentationRuntime/Utility/Utility.cpp | 4 
 1 file changed, 4 insertions(+)

diff --git a/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp 
b/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
index 3cbd03b24297a..0f69a5e9e57c8 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
@@ -18,6 +18,10 @@ namespace lldb_private {
 ///< This helper searches the target for such a dylib. Returns nullptr if no
 ///< such dylib was found.
 lldb::ModuleSP GetPreferredAsanModule(const Target &target) {
+  // Currently only supported on Darwin.
+  if (!target.GetArchitecture().GetTriple().isOSDarwin())
+return nullptr;
+
   lldb::ModuleSP module;
   llvm::Regex pattern(R"(libclang_rt\.asan_.*_dynamic\.dylib)");
   target.GetImages().ForEach([&](const lldb::ModuleSP &m) {

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


[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/129728

>From 21103adacdf9c08cee4065f8a6b90ff812fefbb3 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Tue, 4 Mar 2025 11:01:46 -0500
Subject: [PATCH 01/11] [LLDB][Telemetry] Collect telemetry from client when
 allowed.

This patch is slightly different from other impl in that we dispatch 
client-telemetry via a different helper method.
This is to make it easier for vendor to opt-out (simply by overriding the 
method to do nothing).
There is also a configuration option to disallow collecting client telemetry.
---
 lldb/include/lldb/API/SBDebugger.h|  3 +
 lldb/include/lldb/Core/Debugger.h |  5 ++
 lldb/include/lldb/Core/Telemetry.h| 89 +---
 lldb/source/API/SBDebugger.cpp| 11 +++
 lldb/source/Core/Debugger.cpp |  6 ++
 lldb/source/Core/Telemetry.cpp| 99 +++
 lldb/tools/lldb-dap/DAP.cpp   |  5 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 34 +
 lldb/unittests/Core/TelemetryTest.cpp |  2 +-
 9 files changed, 214 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index e0819f1684f8b..28f92f2095951 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -13,6 +13,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBStructuredData.h"
 
 namespace lldb_private {
 class CommandPluginInterfaceImplementation;
@@ -249,6 +250,8 @@ class LLDB_API SBDebugger {
 
   lldb::SBTarget GetDummyTarget();
 
+  void DispatchClientTelemetry(const lldb::SBStructuredData &data);
+
   // Return true if target is deleted from the target list of the debugger.
   bool DeleteTarget(lldb::SBTarget &target);
 
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 6ebc6147800e1..e40666d5ceec7 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -19,6 +19,8 @@
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/SourceManager.h"
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Core/Telemetry.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/StreamFile.h"
@@ -31,6 +33,7 @@
 #include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
@@ -127,6 +130,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   void Clear();
 
+  void DispatchClientTelemetry(const lldb_private::StructuredDataImpl &entry);
+
   bool GetAsyncExecution();
 
   void SetAsyncExecution(bool async);
diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
index 7d8716f1659b5..cad4a4a6c9048 100644
--- a/lldb/include/lldb/Core/Telemetry.h
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Telemetry/Telemetry.h"
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,23 @@
 namespace lldb_private {
 namespace telemetry {
 
+struct LLDBConfig : public ::llvm::telemetry::Config {
+  // If true, we will collect full details about a debug command (eg., args and
+  // original command). Note: This may contain PII, hence can only be enabled 
by
+  // the vendor while creating the Manager.
+  const bool m_detailed_command_telemetry;
+  // If true, we will collect telemetry from LLDB's clients (eg., lldb-dap) via
+  // the SB interface. Must also be enabled by the vendor while creating the
+  // manager.
+  const bool m_enable_client_telemetry;
+
+  explicit LLDBConfig(bool enable_telemetry, bool detailed_command_telemetry,
+  bool enable_client_telemetry)
+  : ::llvm::telemetry::Config(enable_telemetry),
+m_detailed_command_telemetry(detailed_command_telemetry),
+m_enable_client_telemetry(enable_client_telemetry) {}
+};
+
 // We expect each (direct) subclass of LLDBTelemetryInfo to
 // have an LLDBEntryKind in the form 0b11
 // Specifically:
@@ -37,6 +55,7 @@ namespace telemetry {
 // must have their LLDBEntryKind in the similar form (ie., share common prefix)
 struct LLDBEntryKind : public ::llvm::telemetry::EntryKind {
   static const llvm::telemetry::KindType BaseInfo = 0b1100;
+  static const llvm::telemetry::KindType ClientInfo = 0b1110;
   static const llvm::telemetry::KindType DebuggerInfo = 0b11000100;
 };
 
@@ -86,6 +105,11 @@ struct DebuggerInfo : public LLDBBaseTelemetryInfo {
   void serialize(llvm::telemetry::Serializer &serializer) const override;
 };
 
+struct ClientInfo : public LLDBBaseTelemetryInfo {
+  std::string request_name;
+  std::optional error_msg;
+};
+
 /// The base Telemetry manager instance in LL

[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)

2025-03-25 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

@bulbazord 

> swiftlang#3240

Looks good.

> SwiftLanguageRuntime::MethodName::Parse(). Specifically, as it parses a name, 
> there are some codepaths that cause it to think some names are valid swift 
> method names.

It seems one solution might be to sort language plugins.
But I don't see any profit in enumerating language plugins and then sorting 
known plugins anyway.
It is possible to add a method for requesting a language plugin significance 
for sorting.
But it looks like unnecessary complication, IMHO.
Probably the hardcoded list of laguage plugins is simple and balanced solution.

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


[Lldb-commits] [lldb] [LLDB][MIPS] Fix signal number of SIGBUS on mips (PR #132688)

2025-03-25 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Remove UnwindPlan::Row shared_ptrs (PR #132370)

2025-03-25 Thread Alex Langford via lldb-commits

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

This seems ok to me. I think a good follow-up might be to stop handing out row 
pointers in case somebody tries to store one in the future. The pointers won't 
be stable as the vector resizes, but rows in unique_ptrs seems like a poor use 
of memory as well.

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


[Lldb-commits] [lldb] [llvm] [lldb][lldb-dap] Implement jump to cursor (PR #130503)

2025-03-25 Thread Greg Clayton via lldb-commits


@@ -77,6 +77,27 @@ enum class PacketStatus {
 
 enum class ReplMode { Variable = 0, Command, Auto };
 
+class Gotos {
+public:
+  /// \return the line_entry corresponding with \p id
+  ///
+  /// If \p id is invalid std::nullopt is returned.
+  std::optional GetLineEntry(uint64_t id) const;
+
+  /// Insert a new \p line_entry.
+  /// \return id assigned to this line_entry.
+  uint64_t InsertLineEntry(lldb::SBLineEntry line_entry);
+
+  /// Clears all line entries and reset the generated ids.
+  void Clear();
+
+private:
+  uint64_t NewSpecID();
+
+  llvm::DenseMap line_entries;
+  uint64_t new_id = 0;

clayborg wrote:

Do we need a llvm::DenseMap here? I was thinking we can just use a 
`std::vector' and just return an index to the entry as the 
result of `uint64_t InsertLineEntry(lldb::SBLineEntry line_entry);`?

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


[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)

2025-03-25 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

> I'm similarly confused about how moving these method definitions into a 
> separate CU makes a difference.

Please note Module.cpp uses only few functions which have no dependencies. 
After this patch the new CU CPlusPlusLanguageMethod.cpp with only necessary 
functions is linked. The rest CPlusPlusLanguage.cpp is not linked at all.
Module.cpp depends on new CPlusPlusLanguageMethod.cpp but nothing depends on 
updated CPlusPlusLanguage.cpp

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


[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)

2025-03-25 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

Note `-ffunction-sections -fdata-sections` are added in HandleLLVMOptions.cmake 
and `-Wl,--gc-sections` is added in  AddLLVM.cmake by default. But unused 
functions will be kept anyway if they contain linker gc roots. 
A lot of functions in CPlusPlusLanguage.cpp contain static variables like
```
  static constexpr const char *const libcxx_std_unique_ptr_regex =
  "^std::__[[:alnum:]]+::unique_ptr<.+>$";
```
or
```
lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() {
  static llvm::once_flag g_initialize;
  static TypeCategoryImplSP g_category;
  ...
}
```
These functions depend on BlockPointer.cpp, BlockPointer.cpp depends on 
TypeSystemClang.cpp, etc.
To avoid changes that may bring the problem back, I suggest to place moved 
functions to a subclass.

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


[Lldb-commits] [lldb] bdbad3e - [lldb] Fix build after #132780

2025-03-25 Thread Jan Svoboda via lldb-commits

Author: Jan Svoboda
Date: 2025-03-25T12:29:08-07:00
New Revision: bdbad3e4320509f632ae8b511d563136343d87d7

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

LOG: [lldb] Fix build after #132780

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 976cc47e5c51c..ed6297cc6f3e0 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1217,10 +1217,11 @@ TypeSystemClang::GetOrCreateClangModule(llvm::StringRef 
name,
 
   // Lazily initialize the module map.
   if (!m_header_search_up) {
-auto HSOpts = std::make_shared();
+m_header_search_opts_up = std::make_unique();
 m_header_search_up = std::make_unique(
-HSOpts, *m_source_manager_up, *m_diagnostics_engine_up,
-*m_language_options_up, m_target_info_up.get());
+*m_header_search_opts_up, *m_source_manager_up,
+*m_diagnostics_engine_up, *m_language_options_up,
+m_target_info_up.get());
 m_module_map_up = std::make_unique(
 *m_source_manager_up, *m_diagnostics_engine_up, *m_language_options_up,
 m_target_info_up.get(), *m_header_search_up);

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 6579f7b68a9d2..442f88a5b79ae 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -47,6 +47,7 @@ class PDBASTParser;
 namespace clang {
 class FileManager;
 class HeaderSearch;
+class HeaderSearchOptions;
 class ModuleMap;
 } // namespace clang
 
@@ -1203,6 +1204,7 @@ class TypeSystemClang : public TypeSystem {
   std::unique_ptr m_identifier_table_up;
   std::unique_ptr m_selector_table_up;
   std::unique_ptr m_builtins_up;
+  std::unique_ptr m_header_search_opts_up;
   std::unique_ptr m_header_search_up;
   std::unique_ptr m_module_map_up;
   std::unique_ptr m_dwarf_ast_parser_up;



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


[Lldb-commits] [lldb] [lldb] Do not bump memory modificator ID when "internal" debugger memory is updated (PR #129092)

2025-03-25 Thread Mikhail Zakharov via lldb-commits

real-mikhail wrote:

Thanks folks. I agree that approach with the option is the best (will see what 
looks better, something like `target.process.expressions-flush-memory-cache` or 
flag in `SBExpressionOptions`). Since this flag will affect very low-level code 
maybe global flag (in `target.process`) will be easier to pass.
And yes, this flag will be disabled by default.

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


[Lldb-commits] [lldb] [llvm] [lldb][lldb-dap] Implement jump to cursor (PR #130503)

2025-03-25 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Migrating DAP 'initialize' to new typed RequestHandler. (PR #133007)

2025-03-25 Thread John Harrison via lldb-commits

https://github.com/ashgti updated 
https://github.com/llvm/llvm-project/pull/133007

>From b6850bfee90229c8da5ffa5359023c682b574954 Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Tue, 25 Mar 2025 14:58:03 -0700
Subject: [PATCH] [lldb-dap] Migrating DAP 'initialize' to new typed
 RequestHandler.

This adds new types and helpers to support the 'initialize' request with the 
new typed RequestHandler. While working on this I found there were a few cases 
where we incorrectly treated initialize arguments as capabilities. The new 
`lldb_dap::protocol::InitializeRequestArguments` and 
`lldb_dap::protocol::Capabilities` uncovered the inconsistencies.
---
 .../test/tools/lldb-dap/dap_server.py |   5 +-
 .../tools/lldb-dap/launch/TestDAP_launch.py   |   3 +-
 lldb/tools/lldb-dap/DAP.cpp   | 145 --
 lldb/tools/lldb-dap/DAP.h |   6 +-
 .../Handler/InitializeRequestHandler.cpp  | 162 ++-
 .../tools/lldb-dap/Handler/RequestHandler.cpp |   1 +
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |  89 +++---
 lldb/tools/lldb-dap/JSONUtils.cpp |  34 +--
 lldb/tools/lldb-dap/JSONUtils.h   |   3 +-
 .../lldb-dap/Protocol/ProtocolRequests.cpp|  52 
 .../lldb-dap/Protocol/ProtocolRequests.h  |  69 +
 .../tools/lldb-dap/Protocol/ProtocolTypes.cpp | 199 ++
 lldb/tools/lldb-dap/Protocol/ProtocolTypes.h  | 255 ++
 13 files changed, 800 insertions(+), 223 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 359ac718138b2..01ef4b68f2653 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -776,7 +776,8 @@ def request_initialize(self, sourceInitFile):
 "supportsVariablePaging": True,
 "supportsVariableType": True,
 "supportsStartDebuggingRequest": True,
-"sourceInitFile": sourceInitFile,
+"supportsProgressReporting": True,
+"$__lldb_sourceInitFile": sourceInitFile,
 },
 }
 response = self.send_recv(command_dict)
@@ -1261,7 +1262,7 @@ def launch(cls, /, executable, env=None, log_file=None, 
connection=None):
 expected_prefix = "Listening for: "
 out = process.stdout.readline().decode()
 if not out.startswith(expected_prefix):
-self.process.kill()
+process.kill()
 raise ValueError(
 "lldb-dap failed to print listening address, expected '{}', 
got '{}'".format(
 expected_prefix, out
diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py 
b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py
index 0c92e5bff07c6..64c99019a1c9b 100644
--- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py
+++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py
@@ -524,8 +524,7 @@ def test_version(self):
 
 # The first line is the prompt line like "(lldb) version", so we skip 
it.
 version_eval_output_without_prompt_line = 
version_eval_output.splitlines()[1:]
-lldb_json = self.dap_server.get_initialize_value("__lldb")
-version_string = lldb_json["version"]
+version_string = 
self.dap_server.get_initialize_value("$__lldb_version")
 self.assertEqual(
 version_eval_output_without_prompt_line,
 version_string.splitlines(),
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 65de0488729e5..0da8ce43f73c4 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -14,6 +14,7 @@
 #include "LLDBUtils.h"
 #include "OutputRedirector.h"
 #include "Protocol/ProtocolBase.h"
+#include "Protocol/ProtocolTypes.h"
 #include "Transport.h"
 #include "lldb/API/SBBreakpoint.h"
 #include "lldb/API/SBCommandInterpreter.h"
@@ -1144,31 +1145,137 @@ lldb::SBValue Variables::FindVariable(uint64_t 
variablesReference,
   return variable;
 }
 
-llvm::StringMap DAP::GetCapabilities() {
-  llvm::StringMap capabilities;
+static void mergeCapabilities(protocol::Capabilities &into,
+  const protocol::Capabilities &from) {
+  if (from.supportsConfigurationDoneRequest)
+into.supportsConfigurationDoneRequest =
+*from.supportsConfigurationDoneRequest;
+  if (from.supportsFunctionBreakpoints)
+into.supportsFunctionBreakpoints = *from.supportsFunctionBreakpoints;
+  if (from.supportsConditionalBreakpoints)
+into.supportsConditionalBreakpoints = *from.supportsConditionalBreakpoints;
+  if (from.supportsHitConditionalBreakpoints)
+into.supportsHitConditionalBreakpoints =
+*from.supportsHitConditionalBreakpoints;
+  if (from.supportsEvaluateForHovers)
+into.supportsEvaluateForHovers = *from.supportsEvaluateForHovers;
+  if (from.exceptionBreakpoi

[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/129728

>From 21103adacdf9c08cee4065f8a6b90ff812fefbb3 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Tue, 4 Mar 2025 11:01:46 -0500
Subject: [PATCH 01/13] [LLDB][Telemetry] Collect telemetry from client when
 allowed.

This patch is slightly different from other impl in that we dispatch 
client-telemetry via a different helper method.
This is to make it easier for vendor to opt-out (simply by overriding the 
method to do nothing).
There is also a configuration option to disallow collecting client telemetry.
---
 lldb/include/lldb/API/SBDebugger.h|  3 +
 lldb/include/lldb/Core/Debugger.h |  5 ++
 lldb/include/lldb/Core/Telemetry.h| 89 +---
 lldb/source/API/SBDebugger.cpp| 11 +++
 lldb/source/Core/Debugger.cpp |  6 ++
 lldb/source/Core/Telemetry.cpp| 99 +++
 lldb/tools/lldb-dap/DAP.cpp   |  5 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 34 +
 lldb/unittests/Core/TelemetryTest.cpp |  2 +-
 9 files changed, 214 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index e0819f1684f8b..28f92f2095951 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -13,6 +13,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBStructuredData.h"
 
 namespace lldb_private {
 class CommandPluginInterfaceImplementation;
@@ -249,6 +250,8 @@ class LLDB_API SBDebugger {
 
   lldb::SBTarget GetDummyTarget();
 
+  void DispatchClientTelemetry(const lldb::SBStructuredData &data);
+
   // Return true if target is deleted from the target list of the debugger.
   bool DeleteTarget(lldb::SBTarget &target);
 
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 6ebc6147800e1..e40666d5ceec7 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -19,6 +19,8 @@
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/SourceManager.h"
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Core/Telemetry.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/StreamFile.h"
@@ -31,6 +33,7 @@
 #include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
@@ -127,6 +130,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   void Clear();
 
+  void DispatchClientTelemetry(const lldb_private::StructuredDataImpl &entry);
+
   bool GetAsyncExecution();
 
   void SetAsyncExecution(bool async);
diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
index 7d8716f1659b5..cad4a4a6c9048 100644
--- a/lldb/include/lldb/Core/Telemetry.h
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Telemetry/Telemetry.h"
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,23 @@
 namespace lldb_private {
 namespace telemetry {
 
+struct LLDBConfig : public ::llvm::telemetry::Config {
+  // If true, we will collect full details about a debug command (eg., args and
+  // original command). Note: This may contain PII, hence can only be enabled 
by
+  // the vendor while creating the Manager.
+  const bool m_detailed_command_telemetry;
+  // If true, we will collect telemetry from LLDB's clients (eg., lldb-dap) via
+  // the SB interface. Must also be enabled by the vendor while creating the
+  // manager.
+  const bool m_enable_client_telemetry;
+
+  explicit LLDBConfig(bool enable_telemetry, bool detailed_command_telemetry,
+  bool enable_client_telemetry)
+  : ::llvm::telemetry::Config(enable_telemetry),
+m_detailed_command_telemetry(detailed_command_telemetry),
+m_enable_client_telemetry(enable_client_telemetry) {}
+};
+
 // We expect each (direct) subclass of LLDBTelemetryInfo to
 // have an LLDBEntryKind in the form 0b11
 // Specifically:
@@ -37,6 +55,7 @@ namespace telemetry {
 // must have their LLDBEntryKind in the similar form (ie., share common prefix)
 struct LLDBEntryKind : public ::llvm::telemetry::EntryKind {
   static const llvm::telemetry::KindType BaseInfo = 0b1100;
+  static const llvm::telemetry::KindType ClientInfo = 0b1110;
   static const llvm::telemetry::KindType DebuggerInfo = 0b11000100;
 };
 
@@ -86,6 +105,11 @@ struct DebuggerInfo : public LLDBBaseTelemetryInfo {
   void serialize(llvm::telemetry::Serializer &serializer) const override;
 };
 
+struct ClientInfo : public LLDBBaseTelemetryInfo {
+  std::string request_name;
+  std::optional error_msg;
+};
+
 /// The base Telemetry manager instance in LL

[Lldb-commits] [lldb] Make breakpoint stop reason more accurate for function breakpoints (PR #130841)

2025-03-25 Thread via lldb-commits


@@ -962,28 +962,43 @@ llvm::json::Value CreateThreadStopped(DAP &dap, 
lldb::SBThread &thread,
 body.try_emplace("reason", "step");
 break;
   case lldb::eStopReasonBreakpoint: {
-ExceptionBreakpoint *exc_bp = dap.GetExceptionBPFromStopReason(thread);
+const auto *exc_bp =
+dap.GetBreakpointFromStopReason(thread);
 if (exc_bp) {
   body.try_emplace("reason", "exception");
   EmplaceSafeString(body, "description", exc_bp->label);
 } else {
-  InstructionBreakpoint *inst_bp =
-  dap.GetInstructionBPFromStopReason(thread);
+  llvm::StringRef reason = "breakpoint";
+  const auto *inst_bp =
+  dap.GetBreakpointFromStopReason(thread);
   if (inst_bp) {
-body.try_emplace("reason", "instruction breakpoint");
+reason = "instruction breakpoint";
   } else {
-body.try_emplace("reason", "breakpoint");
+const auto *function_bp =
+dap.GetBreakpointFromStopReason(thread);
+if (function_bp) {
+  reason = "function breakpoint";
+}
   }
+  body.try_emplace("reason", reason);
   lldb::break_id_t bp_id = thread.GetStopReasonDataAtIndex(0);
   lldb::break_id_t bp_loc_id = thread.GetStopReasonDataAtIndex(1);
   std::string desc_str =
-  llvm::formatv("breakpoint {0}.{1}", bp_id, bp_loc_id);
+  llvm::formatv("{0} {1}.{2}", reason, bp_id, bp_loc_id);
   body.try_emplace("hitBreakpointIds",
llvm::json::Array{llvm::json::Value(bp_id)});
   EmplaceSafeString(body, "description", desc_str);
 }
   } break;
-  case lldb::eStopReasonWatchpoint:
+  case lldb::eStopReasonWatchpoint: {
+// Assuming that all watch points are data breakpoints.
+body.try_emplace("reason", "data breakpoint");

satyajanga wrote:

VS Code also calls them watchpoints. 
"data breakpoint" is a DAP terminology. 
https://microsoft.github.io/debug-adapter-protocol/specification#Requests_SetDataBreakpoints
  and they trigger SetDataBreakpointsRequestHandler 
https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/Handler/SetDataBreakpointsRequestHandler.cpp

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


[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/129728

>From 21103adacdf9c08cee4065f8a6b90ff812fefbb3 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Tue, 4 Mar 2025 11:01:46 -0500
Subject: [PATCH 01/14] [LLDB][Telemetry] Collect telemetry from client when
 allowed.

This patch is slightly different from other impl in that we dispatch 
client-telemetry via a different helper method.
This is to make it easier for vendor to opt-out (simply by overriding the 
method to do nothing).
There is also a configuration option to disallow collecting client telemetry.
---
 lldb/include/lldb/API/SBDebugger.h|  3 +
 lldb/include/lldb/Core/Debugger.h |  5 ++
 lldb/include/lldb/Core/Telemetry.h| 89 +---
 lldb/source/API/SBDebugger.cpp| 11 +++
 lldb/source/Core/Debugger.cpp |  6 ++
 lldb/source/Core/Telemetry.cpp| 99 +++
 lldb/tools/lldb-dap/DAP.cpp   |  5 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 34 +
 lldb/unittests/Core/TelemetryTest.cpp |  2 +-
 9 files changed, 214 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index e0819f1684f8b..28f92f2095951 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -13,6 +13,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBStructuredData.h"
 
 namespace lldb_private {
 class CommandPluginInterfaceImplementation;
@@ -249,6 +250,8 @@ class LLDB_API SBDebugger {
 
   lldb::SBTarget GetDummyTarget();
 
+  void DispatchClientTelemetry(const lldb::SBStructuredData &data);
+
   // Return true if target is deleted from the target list of the debugger.
   bool DeleteTarget(lldb::SBTarget &target);
 
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 6ebc6147800e1..e40666d5ceec7 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -19,6 +19,8 @@
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/SourceManager.h"
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Core/Telemetry.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/StreamFile.h"
@@ -31,6 +33,7 @@
 #include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
@@ -127,6 +130,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   void Clear();
 
+  void DispatchClientTelemetry(const lldb_private::StructuredDataImpl &entry);
+
   bool GetAsyncExecution();
 
   void SetAsyncExecution(bool async);
diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
index 7d8716f1659b5..cad4a4a6c9048 100644
--- a/lldb/include/lldb/Core/Telemetry.h
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Telemetry/Telemetry.h"
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,23 @@
 namespace lldb_private {
 namespace telemetry {
 
+struct LLDBConfig : public ::llvm::telemetry::Config {
+  // If true, we will collect full details about a debug command (eg., args and
+  // original command). Note: This may contain PII, hence can only be enabled 
by
+  // the vendor while creating the Manager.
+  const bool m_detailed_command_telemetry;
+  // If true, we will collect telemetry from LLDB's clients (eg., lldb-dap) via
+  // the SB interface. Must also be enabled by the vendor while creating the
+  // manager.
+  const bool m_enable_client_telemetry;
+
+  explicit LLDBConfig(bool enable_telemetry, bool detailed_command_telemetry,
+  bool enable_client_telemetry)
+  : ::llvm::telemetry::Config(enable_telemetry),
+m_detailed_command_telemetry(detailed_command_telemetry),
+m_enable_client_telemetry(enable_client_telemetry) {}
+};
+
 // We expect each (direct) subclass of LLDBTelemetryInfo to
 // have an LLDBEntryKind in the form 0b11
 // Specifically:
@@ -37,6 +55,7 @@ namespace telemetry {
 // must have their LLDBEntryKind in the similar form (ie., share common prefix)
 struct LLDBEntryKind : public ::llvm::telemetry::EntryKind {
   static const llvm::telemetry::KindType BaseInfo = 0b1100;
+  static const llvm::telemetry::KindType ClientInfo = 0b1110;
   static const llvm::telemetry::KindType DebuggerInfo = 0b11000100;
 };
 
@@ -86,6 +105,11 @@ struct DebuggerInfo : public LLDBBaseTelemetryInfo {
   void serialize(llvm::telemetry::Serializer &serializer) const override;
 };
 
+struct ClientInfo : public LLDBBaseTelemetryInfo {
+  std::string request_name;
+  std::optional error_msg;
+};
+
 /// The base Telemetry manager instance in LL

[Lldb-commits] [lldb] draft: [lldb] Upgrade ValueObject::GetData to return llvm::Expected (PR #130516)

2025-03-25 Thread Julius Alexandre via lldb-commits

wizardengineer wrote:

This is taking longer than expected, I'm encountering a lot of linker bugs 
unrelated the patches I've made. Even after create a fresh clone of llvm 
without the patches. I'm still encountering issues. 

One them being 
https://github.com/llvm/llvm-project/issues/132845#issuecomment-2749669663

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


[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)

2025-03-25 Thread Alex Langford via lldb-commits

bulbazord wrote:

I'm similarly confused about how moving these method definitions into a 
separate CU makes a difference. +1 to Jonas's suggestion, properly refactoring 
Module to use language plugins.

For reference, I attempted this a few years ago (albeit on Apple's swift fork) 
and had trouble getting it working. You can take a look at my attempt here: 
https://github.com/swiftlang/llvm-project/pull/3240

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


[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

Should this also change the interface of DWAFExpressionList?

```
  DWARFExpressionList(lldb::ModuleSP module_sp,
  const plugin::dwarf::DWARFUnit *dwarf_cu,
  lldb::addr_t func_file_addr)
  : m_module_wp(module_sp), m_dwarf_cu(dwarf_cu),
m_func_file_addr(func_file_addr) {}

  DWARFExpressionList(lldb::ModuleSP module_sp, DWARFExpression expr,
  const plugin::dwarf::DWARFUnit *dwarf_cu)
  : m_module_wp(module_sp), m_dwarf_cu(dwarf_cu) {
AddExpression(0, LLDB_INVALID_ADDRESS, expr);
  }
```

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


[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/129728

>From 21103adacdf9c08cee4065f8a6b90ff812fefbb3 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Tue, 4 Mar 2025 11:01:46 -0500
Subject: [PATCH 01/12] [LLDB][Telemetry] Collect telemetry from client when
 allowed.

This patch is slightly different from other impl in that we dispatch 
client-telemetry via a different helper method.
This is to make it easier for vendor to opt-out (simply by overriding the 
method to do nothing).
There is also a configuration option to disallow collecting client telemetry.
---
 lldb/include/lldb/API/SBDebugger.h|  3 +
 lldb/include/lldb/Core/Debugger.h |  5 ++
 lldb/include/lldb/Core/Telemetry.h| 89 +---
 lldb/source/API/SBDebugger.cpp| 11 +++
 lldb/source/Core/Debugger.cpp |  6 ++
 lldb/source/Core/Telemetry.cpp| 99 +++
 lldb/tools/lldb-dap/DAP.cpp   |  5 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 34 +
 lldb/unittests/Core/TelemetryTest.cpp |  2 +-
 9 files changed, 214 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index e0819f1684f8b..28f92f2095951 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -13,6 +13,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBStructuredData.h"
 
 namespace lldb_private {
 class CommandPluginInterfaceImplementation;
@@ -249,6 +250,8 @@ class LLDB_API SBDebugger {
 
   lldb::SBTarget GetDummyTarget();
 
+  void DispatchClientTelemetry(const lldb::SBStructuredData &data);
+
   // Return true if target is deleted from the target list of the debugger.
   bool DeleteTarget(lldb::SBTarget &target);
 
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 6ebc6147800e1..e40666d5ceec7 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -19,6 +19,8 @@
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/SourceManager.h"
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Core/Telemetry.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/StreamFile.h"
@@ -31,6 +33,7 @@
 #include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
@@ -127,6 +130,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   void Clear();
 
+  void DispatchClientTelemetry(const lldb_private::StructuredDataImpl &entry);
+
   bool GetAsyncExecution();
 
   void SetAsyncExecution(bool async);
diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
index 7d8716f1659b5..cad4a4a6c9048 100644
--- a/lldb/include/lldb/Core/Telemetry.h
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Telemetry/Telemetry.h"
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,23 @@
 namespace lldb_private {
 namespace telemetry {
 
+struct LLDBConfig : public ::llvm::telemetry::Config {
+  // If true, we will collect full details about a debug command (eg., args and
+  // original command). Note: This may contain PII, hence can only be enabled 
by
+  // the vendor while creating the Manager.
+  const bool m_detailed_command_telemetry;
+  // If true, we will collect telemetry from LLDB's clients (eg., lldb-dap) via
+  // the SB interface. Must also be enabled by the vendor while creating the
+  // manager.
+  const bool m_enable_client_telemetry;
+
+  explicit LLDBConfig(bool enable_telemetry, bool detailed_command_telemetry,
+  bool enable_client_telemetry)
+  : ::llvm::telemetry::Config(enable_telemetry),
+m_detailed_command_telemetry(detailed_command_telemetry),
+m_enable_client_telemetry(enable_client_telemetry) {}
+};
+
 // We expect each (direct) subclass of LLDBTelemetryInfo to
 // have an LLDBEntryKind in the form 0b11
 // Specifically:
@@ -37,6 +55,7 @@ namespace telemetry {
 // must have their LLDBEntryKind in the similar form (ie., share common prefix)
 struct LLDBEntryKind : public ::llvm::telemetry::EntryKind {
   static const llvm::telemetry::KindType BaseInfo = 0b1100;
+  static const llvm::telemetry::KindType ClientInfo = 0b1110;
   static const llvm::telemetry::KindType DebuggerInfo = 0b11000100;
 };
 
@@ -86,6 +105,11 @@ struct DebuggerInfo : public LLDBBaseTelemetryInfo {
   void serialize(llvm::telemetry::Serializer &serializer) const override;
 };
 
+struct ClientInfo : public LLDBBaseTelemetryInfo {
+  std::string request_name;
+  std::optional error_msg;
+};
+
 /// The base Telemetry manager instance in LL

[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits

oontvoo wrote:

> I'm not really sure what to think about this. You call it "client telemetry", 
> which sounds generic, but the implementation (mainly, the "request" field) 
> sounds very specific to lldb-dap (not every lldb "client" needs to have a 
> "request", or even if it has, the term "request" may mean something very 
> different for it.

How about renaming it to "client_data"? (We'd record both the request's command 
and the response's command)

>  I understand why you did that, but it kinda goes against the principle that 
> (lib)lldb shouldn't tie itself to any specific user/client.
> 
> Maybe that's okay, maybe not, but I don't feel comfortable approving on my 
> own.



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


[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

This type of patch also slightly worries me in that it could make it harder to 
unify the LLDB dwarf data structures with the LLVM ones

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


[Lldb-commits] [lldb] [lldb-dap] Migrating DAP 'initialize' to new typed RequestHandler. (PR #133007)

2025-03-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)


Changes

This adds new types and helpers to support the 'initialize' request with the 
new typed RequestHandler. While working on this I found there were a few cases 
where we incorrectly treated initialize arguments as capabilities. The new 
`lldb_dap::protocol::InitializeRequestArguments` and 
`lldb_dap::protocol::Capabilities` uncovered the inconsistencies.

---

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


13 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
(+3-2) 
- (modified) lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py (+1-2) 
- (modified) lldb/tools/lldb-dap/DAP.cpp (+126-19) 
- (modified) lldb/tools/lldb-dap/DAP.h (+4-2) 
- (modified) lldb/tools/lldb-dap/Handler/InitializeRequestHandler.cpp (+25-137) 
- (modified) lldb/tools/lldb-dap/Handler/RequestHandler.cpp (+1) 
- (modified) lldb/tools/lldb-dap/Handler/RequestHandler.h (+57-32) 
- (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+6-28) 
- (modified) lldb/tools/lldb-dap/JSONUtils.h (+2-1) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp (+52) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolRequests.h (+69) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp (+199) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.h (+255) 


``diff
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 359ac718138b2..01ef4b68f2653 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -776,7 +776,8 @@ def request_initialize(self, sourceInitFile):
 "supportsVariablePaging": True,
 "supportsVariableType": True,
 "supportsStartDebuggingRequest": True,
-"sourceInitFile": sourceInitFile,
+"supportsProgressReporting": True,
+"$__lldb_sourceInitFile": sourceInitFile,
 },
 }
 response = self.send_recv(command_dict)
@@ -1261,7 +1262,7 @@ def launch(cls, /, executable, env=None, log_file=None, 
connection=None):
 expected_prefix = "Listening for: "
 out = process.stdout.readline().decode()
 if not out.startswith(expected_prefix):
-self.process.kill()
+process.kill()
 raise ValueError(
 "lldb-dap failed to print listening address, expected '{}', 
got '{}'".format(
 expected_prefix, out
diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py 
b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py
index 0c92e5bff07c6..64c99019a1c9b 100644
--- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py
+++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py
@@ -524,8 +524,7 @@ def test_version(self):
 
 # The first line is the prompt line like "(lldb) version", so we skip 
it.
 version_eval_output_without_prompt_line = 
version_eval_output.splitlines()[1:]
-lldb_json = self.dap_server.get_initialize_value("__lldb")
-version_string = lldb_json["version"]
+version_string = 
self.dap_server.get_initialize_value("$__lldb_version")
 self.assertEqual(
 version_eval_output_without_prompt_line,
 version_string.splitlines(),
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 65de0488729e5..0da8ce43f73c4 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -14,6 +14,7 @@
 #include "LLDBUtils.h"
 #include "OutputRedirector.h"
 #include "Protocol/ProtocolBase.h"
+#include "Protocol/ProtocolTypes.h"
 #include "Transport.h"
 #include "lldb/API/SBBreakpoint.h"
 #include "lldb/API/SBCommandInterpreter.h"
@@ -1144,31 +1145,137 @@ lldb::SBValue Variables::FindVariable(uint64_t 
variablesReference,
   return variable;
 }
 
-llvm::StringMap DAP::GetCapabilities() {
-  llvm::StringMap capabilities;
+static void mergeCapabilities(protocol::Capabilities &into,
+  const protocol::Capabilities &from) {
+  if (from.supportsConfigurationDoneRequest)
+into.supportsConfigurationDoneRequest =
+*from.supportsConfigurationDoneRequest;
+  if (from.supportsFunctionBreakpoints)
+into.supportsFunctionBreakpoints = *from.supportsFunctionBreakpoints;
+  if (from.supportsConditionalBreakpoints)
+into.supportsConditionalBreakpoints = *from.supportsConditionalBreakpoints;
+  if (from.supportsHitConditionalBreakpoints)
+into.supportsHitConditionalBreakpoints =
+*from.supportsHitConditionalBreakpoints;
+  if (from.supportsEvaluateForHovers)
+into.supportsEvaluateForHovers = *from.supportsEvaluateForHovers;
+  if (from.exceptionBreakpointFilters)
+into.exceptionBreak

[Lldb-commits] [lldb] [lldb] Expose the Target API lock through the SB API (PR #131404)

2025-03-25 Thread Adrian Vogelsgesang via lldb-commits

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


[Lldb-commits] [lldb] [LLDB][MIPS] Fix signal number of SIGBUS on mips (PR #132688)

2025-03-25 Thread David Spickett via lldb-commits


@@ -61,10 +61,17 @@ void LinuxSignals::Reset() {
   AddSignal(5,  "SIGTRAP",  true, true,   true,   "trace trap (not 
reset when caught)");
   AddSignal(6,  "SIGABRT",  false,true,   true,   "abort()/IOT 
trap", "SIGIOT");
 
-  AddSignal(7,  "SIGBUS",   false,true,   true,   "bus error");
-  ADD_SIGCODE(SIGBUS, 7, BUS_ADRALN, 1, "illegal alignment");
-  ADD_SIGCODE(SIGBUS, 7, BUS_ADRERR, 2, "illegal address");
-  ADD_SIGCODE(SIGBUS, 7, BUS_OBJERR, 3, "hardware error");
+#if defined(mips) || defined(__mips__) || defined(__mips)
+AddSignal(10,  "SIGBUS",   false,true,   true,   "bus error");
+ADD_SIGCODE(SIGBUS, 10, BUS_ADRALN, 1, "illegal alignment");
+ADD_SIGCODE(SIGBUS, 10, BUS_ADRERR, 2, "illegal address");
+ADD_SIGCODE(SIGBUS, 10, BUS_OBJERR, 3, "hardware error");
+#else
+AddSignal(7,  "SIGBUS",   false,true,   true,   "bus error");
+ADD_SIGCODE(SIGBUS, 7, BUS_ADRALN, 1, "illegal alignment");
+ADD_SIGCODE(SIGBUS, 7, BUS_ADRERR, 2, "illegal address");
+ADD_SIGCODE(SIGBUS, 7, BUS_OBJERR, 3, "hardware error");
+#endif

DavidSpickett wrote:

I suspect that this code is also used in the `lldb` client, which may be built 
on a platform other than the target platform. For example, I can debug MIPS 
Linux remotely from a Mac OS host. It will need to be a runtime check in this 
case, and the compile time checks relaxed.

If this code only ever runs in lldb-server, then it could be fine.

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


[Lldb-commits] [lldb] 8704635 - Fix the managing of the session dictionary when you have nested wrappers (#132846)

2025-03-25 Thread via lldb-commits

Author: jimingham
Date: 2025-03-25T09:56:58-07:00
New Revision: 870463519bab45acf8590d41d9f2a161c37f26d5

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

LOG: Fix the managing of the session dictionary when you have nested wrappers 
(#132846)

Since the inner wrapper call might have removed one of the entries from
the global dict that the outer wrapper ALSO was going to delete, make
sure that we check that the key is still in the global dict before
trying to act on it.

Added: 
lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/Makefile

lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/TestNestedBreakpointCommands.py
lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/main.c

lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/make_bkpt_cmds.py

Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 00d01981c64ff..4b7694de697c1 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -1267,6 +1267,8 @@ Status 
ScriptInterpreterPythonImpl::ExportFunctionDefinitionToInterpreter(
 StringList &function_def) {
   // Convert StringList to one long, newline delimited, const char *.
   std::string function_def_string(function_def.CopyList());
+  LLDB_LOG(GetLog(LLDBLog::Script), "Added Function:\n%s\n",
+   function_def_string.c_str());
 
   Status error = ExecuteMultipleLines(
   function_def_string.c_str(), ExecuteScriptOptions().SetEnableIO(false));
@@ -1336,13 +1338,15 @@ Status 
ScriptInterpreterPythonImpl::GenerateFunction(const char *signature,
   "for key in new_keys:"); // Iterate over all the keys from session
// dict
   auto_generated_function.AppendString(
-  "internal_dict[key] = global_dict[key]"); // Update session dict
-// values
+  "if key in old_keys:"); // If key was originally in
+  // global dict
   auto_generated_function.AppendString(
-  "if key not in old_keys:"); // If key was not originally in
-  // global dict
+  "internal_dict[key] = global_dict[key]"); // Update it
   auto_generated_function.AppendString(
-  "del global_dict[key]"); //  ...then remove key/value from
+  "elif key in global_dict:"); // Then if it is still in the
+   // global dict
+  auto_generated_function.AppendString(
+  "del global_dict[key]"); //  remove key/value from the
//  global dict
   auto_generated_function.AppendString(
   "return __return_val"); //  Return the user callback return value.

diff  --git 
a/lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/Makefile 
b/lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/Makefile
new file mode 100644
index 0..695335e068c0c
--- /dev/null
+++ 
b/lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/Makefile
@@ -0,0 +1,4 @@
+C_SOURCES := main.c
+CFLAGS_EXTRAS := -std=c99
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/TestNestedBreakpointCommands.py
 
b/lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/TestNestedBreakpointCommands.py
new file mode 100644
index 0..aef95215f0373
--- /dev/null
+++ 
b/lldb/test/API/functionalities/breakpoint/nested_breakpoint_commands/TestNestedBreakpointCommands.py
@@ -0,0 +1,59 @@
+"""
+Test that a Python breakpoint callback defined in another Python
+breakpoint callback works properly. 
+"""
+
+
+import lldb
+import os
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+
+class TestNestedBreakpointCommands(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_nested_commands(self):
+self.build()
+self.main_source_file = lldb.SBFileSpec("main.c")
+self.callback_module = "make_bkpt_cmds"
+self.do_test()
+
+def do_test(self):
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+self, "Set a breakpoint here", self.main_source_file
+)
+
+outer_bkpt = target.BreakpointCreateBySourceRegex(
+"Set outer breakpoint here", self.main_source_file
+

[Lldb-commits] [lldb] Fix the managing of the session dictionary when you have nested wrappers (PR #132846)

2025-03-25 Thread via lldb-commits

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


[Lldb-commits] [lldb] [LLDB][MIPS] Fix signal number of SIGBUS on mips (PR #132688)

2025-03-25 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> MIPS changed the SIGBUS signal number to be the same as other architectures.

But your change appears to use different numbers for MIPS, which looks like the 
opposite.

Also please cite in the PR description the changes in the Linux Kernel that did 
this.

Also I'm pretty sure @labath removed a bunch of Linux MIPS support code at some 
point due to lack of use. So if you are about to add it all back, it would be 
good to know what your use case here is. Are you trying to get LLDB on MIPS 
Linux working again?

(we still support MIPS FreeBSD, though the latest FreeBSD release has dropped 
it)

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


[Lldb-commits] [lldb] [lldb][Instrumentation] GetPreferredAsanModule should be no-op on non-Darwin platforms (PR #132911)

2025-03-25 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] 1bb755f - [lldb][Instrumentation] GetPreferredAsanModule should be no-op on non-Darwin platforms (#132911)

2025-03-25 Thread via lldb-commits

Author: Michael Buch
Date: 2025-03-25T15:50:20Z
New Revision: 1bb755fdcd61695c748d925ee756fc3cba4f15ae

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

LOG: [lldb][Instrumentation] GetPreferredAsanModule should be no-op on 
non-Darwin platforms (#132911)

The regex we use to find the compiler-rt library is already
Darwin-specific, so no need to run this on non-Darwin platforms.

Added: 


Modified: 
lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp

Removed: 




diff  --git a/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp 
b/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
index b724083e1e3dd..7fe76a6f0d8ff 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/Utility/Utility.cpp
@@ -14,6 +14,10 @@
 namespace lldb_private {
 
 lldb::ModuleSP GetPreferredAsanModule(const Target &target) {
+  // Currently only supported on Darwin.
+  if (!target.GetArchitecture().GetTriple().isOSDarwin())
+return nullptr;
+
   lldb::ModuleSP module;
   llvm::Regex pattern(R"(libclang_rt\.asan_.*_dynamic\.dylib)");
   target.GetImages().ForEach([&](const lldb::ModuleSP &m) {



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


[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/129728

>From 21103adacdf9c08cee4065f8a6b90ff812fefbb3 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Tue, 4 Mar 2025 11:01:46 -0500
Subject: [PATCH 1/7] [LLDB][Telemetry] Collect telemetry from client when
 allowed.

This patch is slightly different from other impl in that we dispatch 
client-telemetry via a different helper method.
This is to make it easier for vendor to opt-out (simply by overriding the 
method to do nothing).
There is also a configuration option to disallow collecting client telemetry.
---
 lldb/include/lldb/API/SBDebugger.h|  3 +
 lldb/include/lldb/Core/Debugger.h |  5 ++
 lldb/include/lldb/Core/Telemetry.h| 89 +---
 lldb/source/API/SBDebugger.cpp| 11 +++
 lldb/source/Core/Debugger.cpp |  6 ++
 lldb/source/Core/Telemetry.cpp| 99 +++
 lldb/tools/lldb-dap/DAP.cpp   |  5 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 34 +
 lldb/unittests/Core/TelemetryTest.cpp |  2 +-
 9 files changed, 214 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index e0819f1684f8b..28f92f2095951 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -13,6 +13,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBStructuredData.h"
 
 namespace lldb_private {
 class CommandPluginInterfaceImplementation;
@@ -249,6 +250,8 @@ class LLDB_API SBDebugger {
 
   lldb::SBTarget GetDummyTarget();
 
+  void DispatchClientTelemetry(const lldb::SBStructuredData &data);
+
   // Return true if target is deleted from the target list of the debugger.
   bool DeleteTarget(lldb::SBTarget &target);
 
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 6ebc6147800e1..e40666d5ceec7 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -19,6 +19,8 @@
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/SourceManager.h"
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Core/Telemetry.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/StreamFile.h"
@@ -31,6 +33,7 @@
 #include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
@@ -127,6 +130,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   void Clear();
 
+  void DispatchClientTelemetry(const lldb_private::StructuredDataImpl &entry);
+
   bool GetAsyncExecution();
 
   void SetAsyncExecution(bool async);
diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
index 7d8716f1659b5..cad4a4a6c9048 100644
--- a/lldb/include/lldb/Core/Telemetry.h
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Telemetry/Telemetry.h"
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,23 @@
 namespace lldb_private {
 namespace telemetry {
 
+struct LLDBConfig : public ::llvm::telemetry::Config {
+  // If true, we will collect full details about a debug command (eg., args and
+  // original command). Note: This may contain PII, hence can only be enabled 
by
+  // the vendor while creating the Manager.
+  const bool m_detailed_command_telemetry;
+  // If true, we will collect telemetry from LLDB's clients (eg., lldb-dap) via
+  // the SB interface. Must also be enabled by the vendor while creating the
+  // manager.
+  const bool m_enable_client_telemetry;
+
+  explicit LLDBConfig(bool enable_telemetry, bool detailed_command_telemetry,
+  bool enable_client_telemetry)
+  : ::llvm::telemetry::Config(enable_telemetry),
+m_detailed_command_telemetry(detailed_command_telemetry),
+m_enable_client_telemetry(enable_client_telemetry) {}
+};
+
 // We expect each (direct) subclass of LLDBTelemetryInfo to
 // have an LLDBEntryKind in the form 0b11
 // Specifically:
@@ -37,6 +55,7 @@ namespace telemetry {
 // must have their LLDBEntryKind in the similar form (ie., share common prefix)
 struct LLDBEntryKind : public ::llvm::telemetry::EntryKind {
   static const llvm::telemetry::KindType BaseInfo = 0b1100;
+  static const llvm::telemetry::KindType ClientInfo = 0b1110;
   static const llvm::telemetry::KindType DebuggerInfo = 0b11000100;
 };
 
@@ -86,6 +105,11 @@ struct DebuggerInfo : public LLDBBaseTelemetryInfo {
   void serialize(llvm::telemetry::Serializer &serializer) const override;
 };
 
+struct ClientInfo : public LLDBBaseTelemetryInfo {
+  std::string request_name;
+  std::optional error_msg;
+};
+
 /// The base Telemetry manager instance in LLDB

[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/129728

>From 21103adacdf9c08cee4065f8a6b90ff812fefbb3 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Tue, 4 Mar 2025 11:01:46 -0500
Subject: [PATCH 1/8] [LLDB][Telemetry] Collect telemetry from client when
 allowed.

This patch is slightly different from other impl in that we dispatch 
client-telemetry via a different helper method.
This is to make it easier for vendor to opt-out (simply by overriding the 
method to do nothing).
There is also a configuration option to disallow collecting client telemetry.
---
 lldb/include/lldb/API/SBDebugger.h|  3 +
 lldb/include/lldb/Core/Debugger.h |  5 ++
 lldb/include/lldb/Core/Telemetry.h| 89 +---
 lldb/source/API/SBDebugger.cpp| 11 +++
 lldb/source/Core/Debugger.cpp |  6 ++
 lldb/source/Core/Telemetry.cpp| 99 +++
 lldb/tools/lldb-dap/DAP.cpp   |  5 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 34 +
 lldb/unittests/Core/TelemetryTest.cpp |  2 +-
 9 files changed, 214 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index e0819f1684f8b..28f92f2095951 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -13,6 +13,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBStructuredData.h"
 
 namespace lldb_private {
 class CommandPluginInterfaceImplementation;
@@ -249,6 +250,8 @@ class LLDB_API SBDebugger {
 
   lldb::SBTarget GetDummyTarget();
 
+  void DispatchClientTelemetry(const lldb::SBStructuredData &data);
+
   // Return true if target is deleted from the target list of the debugger.
   bool DeleteTarget(lldb::SBTarget &target);
 
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 6ebc6147800e1..e40666d5ceec7 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -19,6 +19,8 @@
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/SourceManager.h"
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Core/Telemetry.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/StreamFile.h"
@@ -31,6 +33,7 @@
 #include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
@@ -127,6 +130,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   void Clear();
 
+  void DispatchClientTelemetry(const lldb_private::StructuredDataImpl &entry);
+
   bool GetAsyncExecution();
 
   void SetAsyncExecution(bool async);
diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
index 7d8716f1659b5..cad4a4a6c9048 100644
--- a/lldb/include/lldb/Core/Telemetry.h
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Telemetry/Telemetry.h"
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,23 @@
 namespace lldb_private {
 namespace telemetry {
 
+struct LLDBConfig : public ::llvm::telemetry::Config {
+  // If true, we will collect full details about a debug command (eg., args and
+  // original command). Note: This may contain PII, hence can only be enabled 
by
+  // the vendor while creating the Manager.
+  const bool m_detailed_command_telemetry;
+  // If true, we will collect telemetry from LLDB's clients (eg., lldb-dap) via
+  // the SB interface. Must also be enabled by the vendor while creating the
+  // manager.
+  const bool m_enable_client_telemetry;
+
+  explicit LLDBConfig(bool enable_telemetry, bool detailed_command_telemetry,
+  bool enable_client_telemetry)
+  : ::llvm::telemetry::Config(enable_telemetry),
+m_detailed_command_telemetry(detailed_command_telemetry),
+m_enable_client_telemetry(enable_client_telemetry) {}
+};
+
 // We expect each (direct) subclass of LLDBTelemetryInfo to
 // have an LLDBEntryKind in the form 0b11
 // Specifically:
@@ -37,6 +55,7 @@ namespace telemetry {
 // must have their LLDBEntryKind in the similar form (ie., share common prefix)
 struct LLDBEntryKind : public ::llvm::telemetry::EntryKind {
   static const llvm::telemetry::KindType BaseInfo = 0b1100;
+  static const llvm::telemetry::KindType ClientInfo = 0b1110;
   static const llvm::telemetry::KindType DebuggerInfo = 0b11000100;
 };
 
@@ -86,6 +105,11 @@ struct DebuggerInfo : public LLDBBaseTelemetryInfo {
   void serialize(llvm::telemetry::Serializer &serializer) const override;
 };
 
+struct ClientInfo : public LLDBBaseTelemetryInfo {
+  std::string request_name;
+  std::optional error_msg;
+};
+
 /// The base Telemetry manager instance in LLDB

[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/129728

>From 21103adacdf9c08cee4065f8a6b90ff812fefbb3 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Tue, 4 Mar 2025 11:01:46 -0500
Subject: [PATCH 1/9] [LLDB][Telemetry] Collect telemetry from client when
 allowed.

This patch is slightly different from other impl in that we dispatch 
client-telemetry via a different helper method.
This is to make it easier for vendor to opt-out (simply by overriding the 
method to do nothing).
There is also a configuration option to disallow collecting client telemetry.
---
 lldb/include/lldb/API/SBDebugger.h|  3 +
 lldb/include/lldb/Core/Debugger.h |  5 ++
 lldb/include/lldb/Core/Telemetry.h| 89 +---
 lldb/source/API/SBDebugger.cpp| 11 +++
 lldb/source/Core/Debugger.cpp |  6 ++
 lldb/source/Core/Telemetry.cpp| 99 +++
 lldb/tools/lldb-dap/DAP.cpp   |  5 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 34 +
 lldb/unittests/Core/TelemetryTest.cpp |  2 +-
 9 files changed, 214 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index e0819f1684f8b..28f92f2095951 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -13,6 +13,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBStructuredData.h"
 
 namespace lldb_private {
 class CommandPluginInterfaceImplementation;
@@ -249,6 +250,8 @@ class LLDB_API SBDebugger {
 
   lldb::SBTarget GetDummyTarget();
 
+  void DispatchClientTelemetry(const lldb::SBStructuredData &data);
+
   // Return true if target is deleted from the target list of the debugger.
   bool DeleteTarget(lldb::SBTarget &target);
 
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 6ebc6147800e1..e40666d5ceec7 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -19,6 +19,8 @@
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/SourceManager.h"
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Core/Telemetry.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/StreamFile.h"
@@ -31,6 +33,7 @@
 #include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
@@ -127,6 +130,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   void Clear();
 
+  void DispatchClientTelemetry(const lldb_private::StructuredDataImpl &entry);
+
   bool GetAsyncExecution();
 
   void SetAsyncExecution(bool async);
diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
index 7d8716f1659b5..cad4a4a6c9048 100644
--- a/lldb/include/lldb/Core/Telemetry.h
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Telemetry/Telemetry.h"
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,23 @@
 namespace lldb_private {
 namespace telemetry {
 
+struct LLDBConfig : public ::llvm::telemetry::Config {
+  // If true, we will collect full details about a debug command (eg., args and
+  // original command). Note: This may contain PII, hence can only be enabled 
by
+  // the vendor while creating the Manager.
+  const bool m_detailed_command_telemetry;
+  // If true, we will collect telemetry from LLDB's clients (eg., lldb-dap) via
+  // the SB interface. Must also be enabled by the vendor while creating the
+  // manager.
+  const bool m_enable_client_telemetry;
+
+  explicit LLDBConfig(bool enable_telemetry, bool detailed_command_telemetry,
+  bool enable_client_telemetry)
+  : ::llvm::telemetry::Config(enable_telemetry),
+m_detailed_command_telemetry(detailed_command_telemetry),
+m_enable_client_telemetry(enable_client_telemetry) {}
+};
+
 // We expect each (direct) subclass of LLDBTelemetryInfo to
 // have an LLDBEntryKind in the form 0b11
 // Specifically:
@@ -37,6 +55,7 @@ namespace telemetry {
 // must have their LLDBEntryKind in the similar form (ie., share common prefix)
 struct LLDBEntryKind : public ::llvm::telemetry::EntryKind {
   static const llvm::telemetry::KindType BaseInfo = 0b1100;
+  static const llvm::telemetry::KindType ClientInfo = 0b1110;
   static const llvm::telemetry::KindType DebuggerInfo = 0b11000100;
 };
 
@@ -86,6 +105,11 @@ struct DebuggerInfo : public LLDBBaseTelemetryInfo {
   void serialize(llvm::telemetry::Serializer &serializer) const override;
 };
 
+struct ClientInfo : public LLDBBaseTelemetryInfo {
+  std::string request_name;
+  std::optional error_msg;
+};
+
 /// The base Telemetry manager instance in LLDB

[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits


@@ -119,6 +125,53 @@ llvm::Error TelemetryManager::preDispatch(TelemetryInfo 
*entry) {
   return llvm::Error::success();
 }
 
+void TelemetryManager::DispatchClientTelemetry(
+const lldb_private::StructuredDataImpl &entry, Debugger *debugger) {
+  if (!m_config->enable_client_telemetry)
+return;
+
+  ClientInfo client_info;
+  client_info.debugger = debugger;
+  auto *dict = entry.GetObjectSP()->GetAsDictionary();

oontvoo wrote:

done

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


[Lldb-commits] [lldb] [LLDB][Telemetry] Collect telemetry from client when allowed. (PR #129728)

2025-03-25 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/129728

>From 21103adacdf9c08cee4065f8a6b90ff812fefbb3 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Tue, 4 Mar 2025 11:01:46 -0500
Subject: [PATCH 1/6] [LLDB][Telemetry] Collect telemetry from client when
 allowed.

This patch is slightly different from other impl in that we dispatch 
client-telemetry via a different helper method.
This is to make it easier for vendor to opt-out (simply by overriding the 
method to do nothing).
There is also a configuration option to disallow collecting client telemetry.
---
 lldb/include/lldb/API/SBDebugger.h|  3 +
 lldb/include/lldb/Core/Debugger.h |  5 ++
 lldb/include/lldb/Core/Telemetry.h| 89 +---
 lldb/source/API/SBDebugger.cpp| 11 +++
 lldb/source/Core/Debugger.cpp |  6 ++
 lldb/source/Core/Telemetry.cpp| 99 +++
 lldb/tools/lldb-dap/DAP.cpp   |  5 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 34 +
 lldb/unittests/Core/TelemetryTest.cpp |  2 +-
 9 files changed, 214 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index e0819f1684f8b..28f92f2095951 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -13,6 +13,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBStructuredData.h"
 
 namespace lldb_private {
 class CommandPluginInterfaceImplementation;
@@ -249,6 +250,8 @@ class LLDB_API SBDebugger {
 
   lldb::SBTarget GetDummyTarget();
 
+  void DispatchClientTelemetry(const lldb::SBStructuredData &data);
+
   // Return true if target is deleted from the target list of the debugger.
   bool DeleteTarget(lldb::SBTarget &target);
 
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 6ebc6147800e1..e40666d5ceec7 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -19,6 +19,8 @@
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/SourceManager.h"
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Core/Telemetry.h"
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/StreamFile.h"
@@ -31,6 +33,7 @@
 #include "lldb/Utility/Diagnostics.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
@@ -127,6 +130,8 @@ class Debugger : public 
std::enable_shared_from_this,
 
   void Clear();
 
+  void DispatchClientTelemetry(const lldb_private::StructuredDataImpl &entry);
+
   bool GetAsyncExecution();
 
   void SetAsyncExecution(bool async);
diff --git a/lldb/include/lldb/Core/Telemetry.h 
b/lldb/include/lldb/Core/Telemetry.h
index 7d8716f1659b5..cad4a4a6c9048 100644
--- a/lldb/include/lldb/Core/Telemetry.h
+++ b/lldb/include/lldb/Core/Telemetry.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Telemetry/Telemetry.h"
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,23 @@
 namespace lldb_private {
 namespace telemetry {
 
+struct LLDBConfig : public ::llvm::telemetry::Config {
+  // If true, we will collect full details about a debug command (eg., args and
+  // original command). Note: This may contain PII, hence can only be enabled 
by
+  // the vendor while creating the Manager.
+  const bool m_detailed_command_telemetry;
+  // If true, we will collect telemetry from LLDB's clients (eg., lldb-dap) via
+  // the SB interface. Must also be enabled by the vendor while creating the
+  // manager.
+  const bool m_enable_client_telemetry;
+
+  explicit LLDBConfig(bool enable_telemetry, bool detailed_command_telemetry,
+  bool enable_client_telemetry)
+  : ::llvm::telemetry::Config(enable_telemetry),
+m_detailed_command_telemetry(detailed_command_telemetry),
+m_enable_client_telemetry(enable_client_telemetry) {}
+};
+
 // We expect each (direct) subclass of LLDBTelemetryInfo to
 // have an LLDBEntryKind in the form 0b11
 // Specifically:
@@ -37,6 +55,7 @@ namespace telemetry {
 // must have their LLDBEntryKind in the similar form (ie., share common prefix)
 struct LLDBEntryKind : public ::llvm::telemetry::EntryKind {
   static const llvm::telemetry::KindType BaseInfo = 0b1100;
+  static const llvm::telemetry::KindType ClientInfo = 0b1110;
   static const llvm::telemetry::KindType DebuggerInfo = 0b11000100;
 };
 
@@ -86,6 +105,11 @@ struct DebuggerInfo : public LLDBBaseTelemetryInfo {
   void serialize(llvm::telemetry::Serializer &serializer) const override;
 };
 
+struct ClientInfo : public LLDBBaseTelemetryInfo {
+  std::string request_name;
+  std::optional error_msg;
+};
+
 /// The base Telemetry manager instance in LLDB

[Lldb-commits] [lldb] [llvm] [lldb][lldb-dap] Implement jump to cursor (PR #130503)

2025-03-25 Thread Walter Erquinigo via lldb-commits


@@ -0,0 +1,165 @@
+//===-- GoToTargetsRequestHandler.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 "DAP.h"
+
+#include "JSONUtils.h"
+
+#include 
+#include 
+#include 
+
+namespace lldb_dap {
+
+static llvm::SmallVector
+GetLineValidEntry(DAP &dap, const lldb::SBFileSpec &file_spec, uint32_t line) {
+  // disable breakpoint listeners so they do not send events to the DAP client.
+  lldb::SBListener listener = dap.debugger.GetListener();
+  lldb::SBBroadcaster broadcaster = dap.target.GetBroadcaster();
+  constexpr auto event_mask = lldb::SBTarget::eBroadcastBitBreakpointChanged;
+  listener.StopListeningForEvents(broadcaster, event_mask);

walter-erquinigo wrote:

yes, I think we shuold do that with broadcasting. The IDE should transparently 
behave well after cli commands.

I don't see clearly how broadcasting would simplify this code, but I trust 
Jonas. Having to stop listening for events for some time open the door to some 
hard-to-catch bugs and we should avoid that whenever possible.

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


[Lldb-commits] [lldb] 58027fa - [lldb] Require wide char support in unicode test (#131951)

2025-03-25 Thread via lldb-commits

Author: David Peixotto
Date: 2025-03-19T08:17:59-07:00
New Revision: 58027fa989391451d7eaa21fe24c135bcad52e79

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

LOG: [lldb] Require wide char support in unicode test (#131951)

The unicode test sends some unicode input to lldb through pexpect and
expects the output to be echoed back in an error message. This only
works correctly when editline was compiled with wide character support.

This commit modifies the test to require the necessary libedit
configuration.

Added: 


Modified: 
lldb/test/API/iohandler/unicode/TestUnicode.py

Removed: 




diff  --git a/lldb/test/API/iohandler/unicode/TestUnicode.py 
b/lldb/test/API/iohandler/unicode/TestUnicode.py
index 93e2ae38f8262..f13427f2c30a8 100644
--- a/lldb/test/API/iohandler/unicode/TestUnicode.py
+++ b/lldb/test/API/iohandler/unicode/TestUnicode.py
@@ -16,6 +16,7 @@ class TestCase(PExpectTest):
 # under ASAN on a loaded machine..
 @skipIfAsan
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
+@skipIfEditlineWideCharSupportMissing
 def test_unicode_input(self):
 self.launch()
 



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


[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)

2025-03-25 Thread Dmitry Vasilyev via lldb-commits


@@ -40,6 +35,31 @@ class DWARFUnit;
 /// location expression or a location list and interprets it.
 class DWARFExpression {
 public:
+  class Delegate {
+  public:
+Delegate() = default;
+virtual ~Delegate() = default;
+
+virtual uint16_t GetVersion() const = 0;
+virtual dw_addr_t GetBaseAddress() const = 0;
+virtual uint8_t GetAddressByteSize() const = 0;
+virtual llvm::Error GetDIEBitSizeAndSign(uint64_t die_offset,
+ uint64_t &bit_size,
+ bool &sign) = 0;

slydiman wrote:

Done.

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


[Lldb-commits] [lldb] [lldb][AIX] Minor AIX specific changes (PR #132718)

2025-03-25 Thread Pavel Labath via lldb-commits


@@ -19,7 +19,9 @@
 #include 
 #include 
 #include 
+#ifndef _AIX
 #include 
+#endif

labath wrote:

Let's try deleting this. AFAICT, the file does not actually depend on the 
header (anymore).

```suggestion
```

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


[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)

2025-03-25 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

@labath What do you suggest for a solution? Reducing lldb-server size from 17MB 
to 8MB is the significant reason to do something.

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


[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)

2025-03-25 Thread Pavel Labath via lldb-commits

labath wrote:

https://github.com/llvm/llvm-project/pull/132274#issuecomment-2742168197

https://github.com/llvm/llvm-project/pull/132274#issuecomment-2743008635

https://github.com/llvm/llvm-project/issues/129543#issuecomment-2728697037

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


[Lldb-commits] [lldb] [lldb][AIX] Minor AIX specific changes (PR #132718)

2025-03-25 Thread Dhruv Srivastava via lldb-commits


@@ -19,7 +19,9 @@
 #include 
 #include 
 #include 
+#ifndef _AIX
 #include 
+#endif

DhruvSrivastavaX wrote:

Done, checked compilation on linux as well.

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


[Lldb-commits] [lldb] [lldb][AIX] Minor AIX specific changes (PR #132718)

2025-03-25 Thread Dhruv Srivastava via lldb-commits

https://github.com/DhruvSrivastavaX updated 
https://github.com/llvm/llvm-project/pull/132718

>From c6392f75d270467300c5cf6cdbcfae088d1e48eb Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava 
Date: Mon, 24 Mar 2025 06:44:24 -0500
Subject: [PATCH 1/2] Minor AIX specific changes

---
 lldb/source/Host/CMakeLists.txt  | 4 
 lldb/source/Host/common/Host.cpp | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index 52ef67feeb6ab..a2ae6f1430c38 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -7,6 +7,10 @@ if (APPLE AND LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY)
   endif()
 endif()
 
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_ALL_SOURCE")
+endif()
+
 macro(add_host_subdirectory group)
   list(APPEND HOST_SOURCES ${ARGN})
   source_group(${group} FILES ${ARGN})
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 6e5a75128eb27..a08c97d8e22f8 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -19,7 +19,9 @@
 #include 
 #include 
 #include 
+#ifndef _AIX
 #include 
+#endif
 #include 
 #include 
 #endif

>From a799ea44afb3796a3a0717d008a0f25527a6ea23 Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava 
Date: Tue, 25 Mar 2025 04:12:38 -0500
Subject: [PATCH 2/2] Removed syscall.h

---
 lldb/source/Host/common/Host.cpp | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index a08c97d8e22f8..5992b54318f73 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -19,9 +19,6 @@
 #include 
 #include 
 #include 
-#ifndef _AIX
-#include 
-#endif
 #include 
 #include 
 #endif

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


[Lldb-commits] [lldb] [lldb] Fix missing overloads in ThreadMemory (PR #132734)

2025-03-25 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

In order to preserve the two separate commits (and not squash them) I've merged 
this into two separate PRs:
https://github.com/llvm/llvm-project/pull/132905
https://github.com/llvm/llvm-project/pull/132906

So I'll close this now.

https://github.com/llvm/llvm-project/pull/132734
___
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] [lld] [lldb] [llvm] [mlir] [polly] [NFC] Add explicit #include llvm-config.h where its macros are used. (PR #106810)

2025-03-25 Thread Daniil Fukalov via lldb-commits

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