[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reapply "[clang] Avoid re-evaluating field bitwidth" (PR #122289)

2025-01-10 Thread Timm Baeder via lldb-commits
Timm =?utf-8?q?Bäder?= 
Message-ID:
In-Reply-To: 


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


[Lldb-commits] [lldb] [lldb][OpenBSD] Fixes for process handling (PR #122534)

2025-01-10 Thread Brad Smith via lldb-commits

https://github.com/brad0 updated 
https://github.com/llvm/llvm-project/pull/122534

>From ed0cceef34f81d4a2544aa6aa8b51afa0fc92959 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 2 Jan 2025 06:50:38 -0500
Subject: [PATCH] [lldb][OpenBSD] Fixes for process handling

---
 lldb/source/Host/openbsd/Host.cpp | 118 +-
 1 file changed, 67 insertions(+), 51 deletions(-)

diff --git a/lldb/source/Host/openbsd/Host.cpp 
b/lldb/source/Host/openbsd/Host.cpp
index 2b66a3c8696b10..7391c8ee946fcd 100644
--- a/lldb/source/Host/openbsd/Host.cpp
+++ b/lldb/source/Host/openbsd/Host.cpp
@@ -40,49 +40,63 @@ class ProcessLaunchInfo;
 static bool
 GetOpenBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr,
   ProcessInstanceInfo &process_info) {
-  if (process_info.ProcessIDIsValid()) {
-int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ARGS,
-  (int)process_info.GetProcessID()};
-
-char arg_data[8192];
-size_t arg_data_size = sizeof(arg_data);
-if (::sysctl(mib, 4, arg_data, &arg_data_size, NULL, 0) == 0) {
-  DataExtractor data(arg_data, arg_data_size, endian::InlHostByteOrder(),
- sizeof(void *));
-  lldb::offset_t offset = 0;
-  const char *cstr;
-
-  cstr = data.GetCStr(&offset);
-  if (cstr) {
-process_info.GetExecutableFile().SetFile(cstr, 
FileSpec::Style::native);
-
-if (!(match_info_ptr == NULL ||
-  NameMatches(
-  process_info.GetExecutableFile().GetFilename().GetCString(),
-  match_info_ptr->GetNameMatchType(),
-  match_info_ptr->GetProcessInfo().GetName(
-  return false;
-
-Args &proc_args = process_info.GetArguments();
-while (1) {
-  const uint8_t *p = data.PeekData(offset, 1);
-  while ((p != NULL) && (*p == '\0') && offset < arg_data_size) {
-++offset;
-p = data.PeekData(offset, 1);
-  }
-  if (p == NULL || offset >= arg_data_size)
-return true;
-
-  cstr = data.GetCStr(&offset);
-  if (cstr)
-proc_args.AppendArgument(llvm::StringRef(cstr));
-  else
-return true;
-}
-  }
-}
+  if (!process_info.ProcessIDIsValid())
+return false;
+
+  int pid = process_info.GetProcessID();
+
+  int mib[4] = {CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_ARGV};
+  size_t kern_proc_args_size = 0;
+
+  // On OpenBSD, this will just fill ARG_MAX all the time
+  if (::sysctl(mib, 4, NULL, &kern_proc_args_size, NULL, 0) == -1)
+return false;
+
+  std::string arg_data(kern_proc_args_size, 0);
+
+  if (::sysctl(mib, 4, (void *)arg_data.data(), &kern_proc_args_size, NULL,
+   0) == -1)
+return false;
+
+  arg_data.resize(kern_proc_args_size);
+
+  // arg_data is a NULL terminated list of pointers, where the pointers
+  // point within arg_data to the location of the arg string
+  DataExtractor data(arg_data.data(), arg_data.length(),
+ endian::InlHostByteOrder(), sizeof(void *));
+
+  lldb::offset_t offset = 0;
+  lldb::offset_t arg_offset = 0;
+  uint64_t arg_addr = 0;
+  const char *cstr;
+
+  arg_addr = data.GetAddress(&offset);
+  arg_offset = arg_addr - (uint64_t)arg_data.data();
+  cstr = data.GetCStr(&arg_offset);
+
+  if (!cstr)
+return false;
+
+  process_info.GetExecutableFile().SetFile(cstr, FileSpec::Style::native);
+
+  if (match_info_ptr != NULL &&
+  !NameMatches(process_info.GetExecutableFile().GetFilename().GetCString(),
+   match_info_ptr->GetNameMatchType(),
+   match_info_ptr->GetProcessInfo().GetName())) {
+return false;
   }
-  return false;
+
+  Args &proc_args = process_info.GetArguments();
+
+  while (1) {
+arg_addr = data.GetAddress(&offset);
+if (arg_addr == 0)
+  break;
+arg_offset = arg_addr - (uint64_t)arg_data.data();
+cstr = data.GetCStr(&arg_offset);
+proc_args.AppendArgument(cstr);
+  }
+  return true;
 }
 
 static bool GetOpenBSDProcessCPUType(ProcessInstanceInfo &process_info) {
@@ -96,15 +110,15 @@ static bool GetOpenBSDProcessCPUType(ProcessInstanceInfo 
&process_info) {
 }
 
 static bool GetOpenBSDProcessUserAndGroup(ProcessInstanceInfo &process_info) {
-  struct kinfo_proc proc_kinfo;
-  size_t proc_kinfo_size;
 
   if (process_info.ProcessIDIsValid()) {
-int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID,
-  (int)process_info.GetProcessID()};
-proc_kinfo_size = sizeof(struct kinfo_proc);
+struct kinfo_proc proc_kinfo = {};
+size_t proc_kinfo_size = sizeof(proc_kinfo);
+int mib[6] = {CTL_KERN,   KERN_PROC,
+  KERN_PROC_PID,  (int)process_info.GetProcessID(),
+  sizeof(proc_kinfo), 1};
 
-if (::sysctl(mib, 4, &proc_kinfo, &proc_kinfo_size, NULL, 0) == 0) {
+if (::sysctl(mib, 6, &proc_kinfo, &proc_kinfo_size, NULL, 0) == 0) {
   if (proc_kinf

[Lldb-commits] [lldb] The _code field in an NSError is signed, not unsigned. (PR #119764)

2025-01-10 Thread via lldb-commits

https://github.com/jimingham updated 
https://github.com/llvm/llvm-project/pull/119764

>From b41b19c7b9bf5a784914e662b7485ac96c2ccdc4 Mon Sep 17 00:00:00 2001
From: Jim Ingham 
Date: Thu, 12 Dec 2024 13:20:37 -0800
Subject: [PATCH 1/2] The _code field in an NSError is signed, not unsigned.

---
 lldb/source/Plugins/Language/ObjC/NSError.cpp | 8 
 .../data-formatter-objc/TestDataFormatterObjCNSError.py   | 4 ++--
 .../data-formatter/data-formatter-objc/main.m | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lldb/source/Plugins/Language/ObjC/NSError.cpp 
b/lldb/source/Plugins/Language/ObjC/NSError.cpp
index 2356bc4ef4babd..389ff5a7edb1bf 100644
--- a/lldb/source/Plugins/Language/ObjC/NSError.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSError.cpp
@@ -66,7 +66,7 @@ bool lldb_private::formatters::NSError_SummaryProvider(
   lldb::addr_t domain_location = ptr_value + 3 * ptr_size;
 
   Status error;
-  uint64_t code = process_sp->ReadUnsignedIntegerFromMemory(code_location,
+  int64_t code = process_sp->ReadSignedIntegerFromMemory(code_location,
 ptr_size, 0, 
error);
   if (error.Fail())
 return false;
@@ -77,7 +77,7 @@ bool lldb_private::formatters::NSError_SummaryProvider(
 return false;
 
   if (!domain_str_value) {
-stream.Printf("domain: nil - code: %" PRIu64, code);
+stream.Printf("domain: nil - code: %" PRIi64, code);
 return true;
   }
 
@@ -98,11 +98,11 @@ bool lldb_private::formatters::NSError_SummaryProvider(
   StreamString domain_str_summary;
   if (NSStringSummaryProvider(*domain_str_sp, domain_str_summary, options) &&
   !domain_str_summary.Empty()) {
-stream.Printf("domain: %s - code: %" PRIu64, domain_str_summary.GetData(),
+stream.Printf("domain: %s - code: %" PRIi64, domain_str_summary.GetData(),
   code);
 return true;
   } else {
-stream.Printf("domain: nil - code: %" PRIu64, code);
+stream.Printf("domain: nil - code: %" PRIi64, code);
 return true;
   }
 }
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSError.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSError.py
index 8a052cf84ef0ee..8709386bfbd384 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSError.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSError.py
@@ -23,10 +23,10 @@ def test_nserror_with_run_command_no_const(self):
 self.appkit_tester_impl(self.nserror_data_formatter_commands, False)
 
 def nserror_data_formatter_commands(self):
-self.expect("frame variable nserror", substrs=['domain: @"Foobar" - 
code: 12'])
+self.expect("frame variable nserror", substrs=['domain: @"Foobar" - 
code: -1234'])
 
 self.expect(
-"frame variable nserrorptr", substrs=['domain: @"Foobar" - code: 
12']
+"frame variable nserrorptr", substrs=['domain: @"Foobar" - code: 
-1234']
 )
 
 self.expect("frame variable nserror->_userInfo", substrs=["2 key/value 
pairs"])
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
index 0ca5cf98bd3a53..314bada49303d3 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
@@ -618,7 +618,7 @@ int main(int argc, const char *argv[]) {
 
   NSDictionary *error_userInfo = @{@"a" : @1, @"b" : @2};
   NSError *nserror = [[NSError alloc] initWithDomain:@"Foobar"
-code:12
+code:-1234
 userInfo:error_userInfo];
   NSError **nserrorptr = &nserror;
 

>From 0b1b6c5eddec10a1b9f7c4cf8201925b28fc61f5 Mon Sep 17 00:00:00 2001
From: Jim Ingham 
Date: Fri, 10 Jan 2025 15:48:37 -0800
Subject: [PATCH 2/2] Bow

---
 lldb/source/Plugins/Language/ObjC/NSError.cpp | 2 +-
 .../data-formatter-objc/TestDataFormatterObjCNSError.py   | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Language/ObjC/NSError.cpp 
b/lldb/source/Plugins/Language/ObjC/NSError.cpp
index 389ff5a7edb1bf..bb54044ae1d61e 100644
--- a/lldb/source/Plugins/Language/ObjC/NSError.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSError.cpp
@@ -67,7 +67,7 @@ bool lldb_private::formatters::NSError_SummaryProvider(
 
   Status error;
   int64_t code = process_sp->ReadSignedIntegerFromMemory(code_location,
-ptr_size, 0, 
error);
+ ptr_size, 0, error);
   if (error.Fail())
 return false;
 
diff --git 
a/lldb

[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Jacob Lalonde via lldb-commits

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

>From 5a756db04b1e5124b99fa44c162439fbf8385aee Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Fri, 10 Jan 2025 14:26:10 -0800
Subject: [PATCH 1/3] Make the thread list for SBSaveCoreOptions iterable

---
 lldb/include/lldb/API/SBSaveCoreOptions.h | 15 +++
 lldb/include/lldb/Symbol/SaveCoreOptions.h|  8 +++-
 lldb/source/API/SBSaveCoreOptions.cpp | 13 ++
 lldb/source/Symbol/SaveCoreOptions.cpp| 34 +++---
 .../TestSBSaveCoreOptions.py  | 45 +--
 .../sbsavecoreoptions/basic_minidump.yaml | 10 +
 6 files changed, 114 insertions(+), 11 deletions(-)

diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index 74aa2fe5bd5f92..d480b6272749e6 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -111,6 +111,21 @@ class LLDB_API SBSaveCoreOptions {
   ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
+  /// Get the number of Threads to be saved
+  ///
+  /// \returns
+  ///  The count of Threads to be saved.
+  uint32_t GetNumThreads() const;
+
+  /// Get the Thread at the specified index.
+  ///
+  /// \param [in] idx
+  ///   The index of the thread to return.
+  /// \returns
+  ///   The thread at the specified index, or an empty thread if the index is
+  ///   greater than or equal to the number of threads.
+  lldb::SBThread GetThreadAtIndex(uint32_t idx) const;
+
   /// Reset all options.
   void Clear();
 
diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h 
b/lldb/include/lldb/Symbol/SaveCoreOptions.h
index d90d08026016dc..b33e02b2d72922 100644
--- a/lldb/include/lldb/Symbol/SaveCoreOptions.h
+++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h
@@ -13,7 +13,6 @@
 #include "lldb/Utility/RangeMap.h"
 
 #include 
-#include 
 #include 
 #include 
 
@@ -47,6 +46,9 @@ class SaveCoreOptions {
 
   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion);
 
+  std::optional GetThreadAtIndex(uint32_t idx) const;
+  uint32_t GetNumThreads() const;
+
   void Clear();
 
 private:
@@ -56,8 +58,10 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;
   MemoryRanges m_regions_to_save;
+
+  std::vector m_thread_indexes;
 };
 } // namespace lldb_private
 
diff --git a/lldb/source/API/SBSaveCoreOptions.cpp 
b/lldb/source/API/SBSaveCoreOptions.cpp
index c79b57fa62c2be..6e50145add822e 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -100,6 +100,19 @@ SBSaveCoreOptions::AddMemoryRegionToSave(const 
SBMemoryRegionInfo ®ion) {
   return SBError();
 }
 
+uint32_t lldb::SBSaveCoreOptions::GetNumThreads() const {
+  LLDB_INSTRUMENT_VA(this);
+  return m_opaque_up->GetNumThreads();
+}
+
+SBThread SBSaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  LLDB_INSTRUMENT_VA(this, idx);
+  std::optional thread_sp = m_opaque_up->GetThreadAtIndex(idx);
+  if (thread_sp)
+return SBThread(thread_sp.value());
+  return SBThread();
+}
+
 void SBSaveCoreOptions::Clear() {
   LLDB_INSTRUMENT_VA(this);
   m_opaque_up->Clear();
diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp 
b/lldb/source/Symbol/SaveCoreOptions.cpp
index 8d9aadece2152d..84c4a76f09453e 100644
--- a/lldb/source/Symbol/SaveCoreOptions.cpp
+++ b/lldb/source/Symbol/SaveCoreOptions.cpp
@@ -87,12 +87,33 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) 
{
 m_process_sp = thread_sp->GetProcess();
   }
 
-  m_threads_to_save.insert(thread_sp->GetID());
+  m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
+  m_thread_indexes.push_back(thread_sp->GetID());
   return error;
 }
 
 bool SaveCoreOptions::RemoveThread(lldb::ThreadSP thread_sp) {
-  return thread_sp && m_threads_to_save.erase(thread_sp->GetID()) > 0;
+  if (!thread_sp)
+return false;
+  if (m_threads_to_save.erase(thread_sp->GetID()) == 0)
+return false;
+
+  auto it = std::find(m_thread_indexes.begin(), m_thread_indexes.end(),
+  thread_sp->GetID());
+  m_thread_indexes.erase(it);
+  return true;
+}
+
+uint32_t SaveCoreOptions::GetNumThreads() const {
+  return m_threads_to_save.size();
+}
+
+std::optional
+SaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  if (idx >= m_thread_indexes.size())
+return std::nullopt;
+  lldb::tid_t tid = m_thread_indexes[idx];
+  return m_threads_to_save.find(tid)->second;
 }
 
 bool SaveCoreOptions::ShouldThreadBeSaved(lldb::tid_t tid) const {
@@ -115,8 +136,8 @@ const MemoryRanges 
&SaveCoreOptions::GetCoreFileMemoryRanges() const {
   return m_regions_to_save;
 }
 
-Status SaveCoreOptions::EnsureValidConfiguration(
-lldb::ProcessSP process_sp) const {
+Status
+SaveCoreOptions::EnsureValidConfiguration(lldb::

[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reapply "[clang] Avoid re-evaluating field bitwidth" (PR #122289)

2025-01-10 Thread Timm Baeder via lldb-commits
Timm =?utf-8?q?Bäder?= 
Message-ID:
In-Reply-To: 


https://github.com/tbaederr updated 
https://github.com/llvm/llvm-project/pull/122289

>From 59abbcc54700d5a8ba31ecd3b37431ffe86f7d70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= 
Date: Thu, 9 Jan 2025 16:01:59 +0100
Subject: [PATCH 1/2] Reapply "[clang] Avoid re-evaluating field bitwidth
 (#117732)"

This reverts commit 59bdea24b09bca9332a7092b583ebf377efb0d50.
---
 .../bugprone/NarrowingConversionsCheck.cpp|  2 +-
 .../bugprone/TooSmallLoopVariableCheck.cpp|  2 +-
 .../hicpp/MultiwayPathsCoveredCheck.cpp   |  2 +-
 clang-tools-extra/clangd/Hover.cpp|  2 +-
 clang/include/clang/AST/Decl.h|  6 --
 clang/include/clang/ASTMatchers/ASTMatchers.h |  3 +--
 clang/lib/AST/ASTContext.cpp  | 10 -
 clang/lib/AST/ByteCode/Interp.h   | 10 -
 .../lib/AST/ByteCode/InterpBuiltinBitCast.cpp |  8 +++
 clang/lib/AST/Decl.cpp| 16 +-
 clang/lib/AST/DeclCXX.cpp |  2 +-
 clang/lib/AST/Expr.cpp|  3 +--
 clang/lib/AST/ExprConstant.cpp|  2 +-
 clang/lib/AST/Randstruct.cpp  |  2 +-
 clang/lib/AST/RecordLayoutBuilder.cpp |  6 +++---
 clang/lib/CodeGen/ABIInfo.cpp |  2 +-
 clang/lib/CodeGen/ABIInfoImpl.cpp |  2 +-
 clang/lib/CodeGen/CGCall.cpp  |  6 +++---
 clang/lib/CodeGen/CGClass.cpp |  2 +-
 clang/lib/CodeGen/CGDebugInfo.cpp |  8 +++
 clang/lib/CodeGen/CGNonTrivialStruct.cpp  |  6 +++---
 clang/lib/CodeGen/CGObjCMac.cpp   |  3 +--
 clang/lib/CodeGen/CGObjCRuntime.cpp   |  2 +-
 clang/lib/CodeGen/CGRecordLayoutBuilder.cpp   | 20 +-
 clang/lib/CodeGen/SwiftCallingConv.cpp|  2 +-
 clang/lib/CodeGen/Targets/LoongArch.cpp   |  2 +-
 clang/lib/CodeGen/Targets/RISCV.cpp   |  2 +-
 clang/lib/CodeGen/Targets/X86.cpp |  2 +-
 clang/lib/CodeGen/Targets/XCore.cpp   |  2 +-
 .../Frontend/Rewrite/RewriteModernObjC.cpp|  3 ++-
 clang/lib/Sema/SemaChecking.cpp   | 10 -
 clang/lib/Sema/SemaDecl.cpp   | 21 ++-
 clang/lib/Sema/SemaDeclCXX.cpp|  6 +++---
 clang/lib/Sema/SemaDeclObjC.cpp   |  3 +--
 clang/lib/Sema/SemaOverload.cpp   |  2 +-
 clang/lib/StaticAnalyzer/Core/RegionStore.cpp |  2 +-
 clang/tools/libclang/CXType.cpp   |  2 +-
 clang/unittests/AST/ASTImporterTest.cpp   |  4 ++--
 38 files changed, 96 insertions(+), 94 deletions(-)

diff --git 
a/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp
index a950704208c73b..408390ebc70b64 100644
--- a/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp
@@ -38,7 +38,7 @@ AST_MATCHER(FieldDecl, hasIntBitwidth) {
   assert(Node.isBitField());
   const ASTContext &Ctx = Node.getASTContext();
   unsigned IntBitWidth = Ctx.getIntWidth(Ctx.IntTy);
-  unsigned CurrentBitWidth = Node.getBitWidthValue(Ctx);
+  unsigned CurrentBitWidth = Node.getBitWidthValue();
   return IntBitWidth == CurrentBitWidth;
 }
 
diff --git 
a/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
index a73d46f01d9b2d..4ceeefb78ee824 100644
--- a/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
@@ -124,7 +124,7 @@ static MagnitudeBits calcMagnitudeBits(const ASTContext 
&Context,
   unsigned SignedBits = IntExprType->isUnsignedIntegerType() ? 0U : 1U;
 
   if (const auto *BitField = IntExpr->getSourceBitField()) {
-unsigned BitFieldWidth = BitField->getBitWidthValue(Context);
+unsigned BitFieldWidth = BitField->getBitWidthValue();
 return {BitFieldWidth - SignedBits, BitFieldWidth};
   }
 
diff --git a/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp 
b/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
index 47dafca2d03ff0..7028c3958f103e 100644
--- a/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
+++ b/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
@@ -160,7 +160,7 @@ void MultiwayPathsCoveredCheck::handleSwitchWithoutDefault(
 }
 if (const auto *BitfieldDecl =
 Result.Nodes.getNodeAs("bitfield")) {
-  return twoPow(BitfieldDecl->getBitWidthValue(*Result.Context));
+  return twoPow(BitfieldDecl->getBitWidthValue());
 }
 
 return static_cast(0);
diff --git a/clang-tools-extra/clangd/Hover.cpp 
b/clang-tools-extra/clangd/Hover.cpp
index 298fa79e3fd0ba..5e136d0e76ece7 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools

[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reapply "[clang] Avoid re-evaluating field bitwidth" (PR #122289)

2025-01-10 Thread Timm Baeder via lldb-commits
Timm =?utf-8?q?Bäder?= 
Message-ID:
In-Reply-To: 


https://github.com/tbaederr updated 
https://github.com/llvm/llvm-project/pull/122289

>From 59abbcc54700d5a8ba31ecd3b37431ffe86f7d70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= 
Date: Thu, 9 Jan 2025 16:01:59 +0100
Subject: [PATCH 1/2] Reapply "[clang] Avoid re-evaluating field bitwidth
 (#117732)"

This reverts commit 59bdea24b09bca9332a7092b583ebf377efb0d50.
---
 .../bugprone/NarrowingConversionsCheck.cpp|  2 +-
 .../bugprone/TooSmallLoopVariableCheck.cpp|  2 +-
 .../hicpp/MultiwayPathsCoveredCheck.cpp   |  2 +-
 clang-tools-extra/clangd/Hover.cpp|  2 +-
 clang/include/clang/AST/Decl.h|  6 --
 clang/include/clang/ASTMatchers/ASTMatchers.h |  3 +--
 clang/lib/AST/ASTContext.cpp  | 10 -
 clang/lib/AST/ByteCode/Interp.h   | 10 -
 .../lib/AST/ByteCode/InterpBuiltinBitCast.cpp |  8 +++
 clang/lib/AST/Decl.cpp| 16 +-
 clang/lib/AST/DeclCXX.cpp |  2 +-
 clang/lib/AST/Expr.cpp|  3 +--
 clang/lib/AST/ExprConstant.cpp|  2 +-
 clang/lib/AST/Randstruct.cpp  |  2 +-
 clang/lib/AST/RecordLayoutBuilder.cpp |  6 +++---
 clang/lib/CodeGen/ABIInfo.cpp |  2 +-
 clang/lib/CodeGen/ABIInfoImpl.cpp |  2 +-
 clang/lib/CodeGen/CGCall.cpp  |  6 +++---
 clang/lib/CodeGen/CGClass.cpp |  2 +-
 clang/lib/CodeGen/CGDebugInfo.cpp |  8 +++
 clang/lib/CodeGen/CGNonTrivialStruct.cpp  |  6 +++---
 clang/lib/CodeGen/CGObjCMac.cpp   |  3 +--
 clang/lib/CodeGen/CGObjCRuntime.cpp   |  2 +-
 clang/lib/CodeGen/CGRecordLayoutBuilder.cpp   | 20 +-
 clang/lib/CodeGen/SwiftCallingConv.cpp|  2 +-
 clang/lib/CodeGen/Targets/LoongArch.cpp   |  2 +-
 clang/lib/CodeGen/Targets/RISCV.cpp   |  2 +-
 clang/lib/CodeGen/Targets/X86.cpp |  2 +-
 clang/lib/CodeGen/Targets/XCore.cpp   |  2 +-
 .../Frontend/Rewrite/RewriteModernObjC.cpp|  3 ++-
 clang/lib/Sema/SemaChecking.cpp   | 10 -
 clang/lib/Sema/SemaDecl.cpp   | 21 ++-
 clang/lib/Sema/SemaDeclCXX.cpp|  6 +++---
 clang/lib/Sema/SemaDeclObjC.cpp   |  3 +--
 clang/lib/Sema/SemaOverload.cpp   |  2 +-
 clang/lib/StaticAnalyzer/Core/RegionStore.cpp |  2 +-
 clang/tools/libclang/CXType.cpp   |  2 +-
 clang/unittests/AST/ASTImporterTest.cpp   |  4 ++--
 38 files changed, 96 insertions(+), 94 deletions(-)

diff --git 
a/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp
index a950704208c73b..408390ebc70b64 100644
--- a/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp
@@ -38,7 +38,7 @@ AST_MATCHER(FieldDecl, hasIntBitwidth) {
   assert(Node.isBitField());
   const ASTContext &Ctx = Node.getASTContext();
   unsigned IntBitWidth = Ctx.getIntWidth(Ctx.IntTy);
-  unsigned CurrentBitWidth = Node.getBitWidthValue(Ctx);
+  unsigned CurrentBitWidth = Node.getBitWidthValue();
   return IntBitWidth == CurrentBitWidth;
 }
 
diff --git 
a/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
index a73d46f01d9b2d..4ceeefb78ee824 100644
--- a/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
@@ -124,7 +124,7 @@ static MagnitudeBits calcMagnitudeBits(const ASTContext 
&Context,
   unsigned SignedBits = IntExprType->isUnsignedIntegerType() ? 0U : 1U;
 
   if (const auto *BitField = IntExpr->getSourceBitField()) {
-unsigned BitFieldWidth = BitField->getBitWidthValue(Context);
+unsigned BitFieldWidth = BitField->getBitWidthValue();
 return {BitFieldWidth - SignedBits, BitFieldWidth};
   }
 
diff --git a/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp 
b/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
index 47dafca2d03ff0..7028c3958f103e 100644
--- a/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
+++ b/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
@@ -160,7 +160,7 @@ void MultiwayPathsCoveredCheck::handleSwitchWithoutDefault(
 }
 if (const auto *BitfieldDecl =
 Result.Nodes.getNodeAs("bitfield")) {
-  return twoPow(BitfieldDecl->getBitWidthValue(*Result.Context));
+  return twoPow(BitfieldDecl->getBitWidthValue());
 }
 
 return static_cast(0);
diff --git a/clang-tools-extra/clangd/Hover.cpp 
b/clang-tools-extra/clangd/Hover.cpp
index 298fa79e3fd0ba..5e136d0e76ece7 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools

[Lldb-commits] [lldb] The _code field in an NSError is signed, not unsigned. (PR #119764)

2025-01-10 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reapply "[clang] Avoid re-evaluating field bitwidth" (PR #122289)

2025-01-10 Thread Jonas Devlieghere via lldb-commits
Timm =?utf-8?q?Bäder?= 
Message-ID:
In-Reply-To: 


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

LGTM but please give @Michael137 a chance to take a look as this is his area of 
expertise. 

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Jacob Lalonde via lldb-commits


@@ -47,6 +46,9 @@ class SaveCoreOptions {
 
   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion);
 
+  std::optional GetThreadAtIndex(uint32_t idx) const;

Jlalond wrote:

We can, I'm personally willing to trade the complexity for the performance 
wins. I think we have some minor complexity gain, primarily in the RemoveThread 
option, but the insertion case is quite simple. I rationally understand we may 
only today have a small number of threads, but I could imagine a world where we 
want to save a huge amount of threads, Potentially even GPU threads! 

I agree the added complexity is ugly and only to maintain the insertion order. 
I think alternatively it would be nice if we could give out something akin to 
an SBIterator. As we only need to maintain the order today due to the caller 
only having access via index. Every usecase I can forsee will enumerate all 
threads, individual indexing isn't necessarily valuable.

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reapply "[clang] Avoid re-evaluating field bitwidth" (PR #122289)

2025-01-10 Thread Michael Buch via lldb-commits
Timm =?utf-8?q?B=C3=A4der?= 
Message-ID:
In-Reply-To: 


https://github.com/Michael137 commented:

LLDB changes LGTM

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


[Lldb-commits] [lldb] The _code field in an NSError is signed, not unsigned. (PR #119764)

2025-01-10 Thread Jonas Devlieghere via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Jacob Lalonde via lldb-commits

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

>From 5a756db04b1e5124b99fa44c162439fbf8385aee Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Fri, 10 Jan 2025 14:26:10 -0800
Subject: [PATCH 1/2] Make the thread list for SBSaveCoreOptions iterable

---
 lldb/include/lldb/API/SBSaveCoreOptions.h | 15 +++
 lldb/include/lldb/Symbol/SaveCoreOptions.h|  8 +++-
 lldb/source/API/SBSaveCoreOptions.cpp | 13 ++
 lldb/source/Symbol/SaveCoreOptions.cpp| 34 +++---
 .../TestSBSaveCoreOptions.py  | 45 +--
 .../sbsavecoreoptions/basic_minidump.yaml | 10 +
 6 files changed, 114 insertions(+), 11 deletions(-)

diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index 74aa2fe5bd5f92..d480b6272749e6 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -111,6 +111,21 @@ class LLDB_API SBSaveCoreOptions {
   ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
+  /// Get the number of Threads to be saved
+  ///
+  /// \returns
+  ///  The count of Threads to be saved.
+  uint32_t GetNumThreads() const;
+
+  /// Get the Thread at the specified index.
+  ///
+  /// \param [in] idx
+  ///   The index of the thread to return.
+  /// \returns
+  ///   The thread at the specified index, or an empty thread if the index is
+  ///   greater than or equal to the number of threads.
+  lldb::SBThread GetThreadAtIndex(uint32_t idx) const;
+
   /// Reset all options.
   void Clear();
 
diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h 
b/lldb/include/lldb/Symbol/SaveCoreOptions.h
index d90d08026016dc..b33e02b2d72922 100644
--- a/lldb/include/lldb/Symbol/SaveCoreOptions.h
+++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h
@@ -13,7 +13,6 @@
 #include "lldb/Utility/RangeMap.h"
 
 #include 
-#include 
 #include 
 #include 
 
@@ -47,6 +46,9 @@ class SaveCoreOptions {
 
   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion);
 
+  std::optional GetThreadAtIndex(uint32_t idx) const;
+  uint32_t GetNumThreads() const;
+
   void Clear();
 
 private:
@@ -56,8 +58,10 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;
   MemoryRanges m_regions_to_save;
+
+  std::vector m_thread_indexes;
 };
 } // namespace lldb_private
 
diff --git a/lldb/source/API/SBSaveCoreOptions.cpp 
b/lldb/source/API/SBSaveCoreOptions.cpp
index c79b57fa62c2be..6e50145add822e 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -100,6 +100,19 @@ SBSaveCoreOptions::AddMemoryRegionToSave(const 
SBMemoryRegionInfo ®ion) {
   return SBError();
 }
 
+uint32_t lldb::SBSaveCoreOptions::GetNumThreads() const {
+  LLDB_INSTRUMENT_VA(this);
+  return m_opaque_up->GetNumThreads();
+}
+
+SBThread SBSaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  LLDB_INSTRUMENT_VA(this, idx);
+  std::optional thread_sp = m_opaque_up->GetThreadAtIndex(idx);
+  if (thread_sp)
+return SBThread(thread_sp.value());
+  return SBThread();
+}
+
 void SBSaveCoreOptions::Clear() {
   LLDB_INSTRUMENT_VA(this);
   m_opaque_up->Clear();
diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp 
b/lldb/source/Symbol/SaveCoreOptions.cpp
index 8d9aadece2152d..84c4a76f09453e 100644
--- a/lldb/source/Symbol/SaveCoreOptions.cpp
+++ b/lldb/source/Symbol/SaveCoreOptions.cpp
@@ -87,12 +87,33 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) 
{
 m_process_sp = thread_sp->GetProcess();
   }
 
-  m_threads_to_save.insert(thread_sp->GetID());
+  m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
+  m_thread_indexes.push_back(thread_sp->GetID());
   return error;
 }
 
 bool SaveCoreOptions::RemoveThread(lldb::ThreadSP thread_sp) {
-  return thread_sp && m_threads_to_save.erase(thread_sp->GetID()) > 0;
+  if (!thread_sp)
+return false;
+  if (m_threads_to_save.erase(thread_sp->GetID()) == 0)
+return false;
+
+  auto it = std::find(m_thread_indexes.begin(), m_thread_indexes.end(),
+  thread_sp->GetID());
+  m_thread_indexes.erase(it);
+  return true;
+}
+
+uint32_t SaveCoreOptions::GetNumThreads() const {
+  return m_threads_to_save.size();
+}
+
+std::optional
+SaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  if (idx >= m_thread_indexes.size())
+return std::nullopt;
+  lldb::tid_t tid = m_thread_indexes[idx];
+  return m_threads_to_save.find(tid)->second;
 }
 
 bool SaveCoreOptions::ShouldThreadBeSaved(lldb::tid_t tid) const {
@@ -115,8 +136,8 @@ const MemoryRanges 
&SaveCoreOptions::GetCoreFileMemoryRanges() const {
   return m_regions_to_save;
 }
 
-Status SaveCoreOptions::EnsureValidConfiguration(
-lldb::ProcessSP process_sp) const {
+Status
+SaveCoreOptions::EnsureValidConfiguration(lldb::

[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 91892e8fa3830ed6590eda0bc62e2a2ea8df8872 
d848e954f969fcbb1d09b8dcca328dc1854337a8 --extensions cpp,h -- 
lldb/include/lldb/API/SBSaveCoreOptions.h 
lldb/include/lldb/API/SBThreadCollection.h 
lldb/include/lldb/Symbol/SaveCoreOptions.h 
lldb/source/API/SBSaveCoreOptions.cpp lldb/source/Symbol/SaveCoreOptions.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp 
b/lldb/source/Symbol/SaveCoreOptions.cpp
index 743114accf..84afc585a8 100644
--- a/lldb/source/Symbol/SaveCoreOptions.cpp
+++ b/lldb/source/Symbol/SaveCoreOptions.cpp
@@ -116,7 +116,8 @@ const MemoryRanges 
&SaveCoreOptions::GetCoreFileMemoryRanges() const {
 }
 
 lldb::ThreadCollectionSP SaveCoreOptions::GetThreadsToSave() const {
-  lldb::ThreadCollectionSP threadcollection_sp = 
std::make_shared();
+  lldb::ThreadCollectionSP threadcollection_sp =
+  std::make_shared();
   for (const auto &thread : m_threads_to_save) {
 threadcollection_sp->AddThread(thread.second);
   }

``




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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Jacob Lalonde via lldb-commits

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

>From 5a756db04b1e5124b99fa44c162439fbf8385aee Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Fri, 10 Jan 2025 14:26:10 -0800
Subject: [PATCH 1/3] Make the thread list for SBSaveCoreOptions iterable

---
 lldb/include/lldb/API/SBSaveCoreOptions.h | 15 +++
 lldb/include/lldb/Symbol/SaveCoreOptions.h|  8 +++-
 lldb/source/API/SBSaveCoreOptions.cpp | 13 ++
 lldb/source/Symbol/SaveCoreOptions.cpp| 34 +++---
 .../TestSBSaveCoreOptions.py  | 45 +--
 .../sbsavecoreoptions/basic_minidump.yaml | 10 +
 6 files changed, 114 insertions(+), 11 deletions(-)

diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index 74aa2fe5bd5f92..d480b6272749e6 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -111,6 +111,21 @@ class LLDB_API SBSaveCoreOptions {
   ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
+  /// Get the number of Threads to be saved
+  ///
+  /// \returns
+  ///  The count of Threads to be saved.
+  uint32_t GetNumThreads() const;
+
+  /// Get the Thread at the specified index.
+  ///
+  /// \param [in] idx
+  ///   The index of the thread to return.
+  /// \returns
+  ///   The thread at the specified index, or an empty thread if the index is
+  ///   greater than or equal to the number of threads.
+  lldb::SBThread GetThreadAtIndex(uint32_t idx) const;
+
   /// Reset all options.
   void Clear();
 
diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h 
b/lldb/include/lldb/Symbol/SaveCoreOptions.h
index d90d08026016dc..b33e02b2d72922 100644
--- a/lldb/include/lldb/Symbol/SaveCoreOptions.h
+++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h
@@ -13,7 +13,6 @@
 #include "lldb/Utility/RangeMap.h"
 
 #include 
-#include 
 #include 
 #include 
 
@@ -47,6 +46,9 @@ class SaveCoreOptions {
 
   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion);
 
+  std::optional GetThreadAtIndex(uint32_t idx) const;
+  uint32_t GetNumThreads() const;
+
   void Clear();
 
 private:
@@ -56,8 +58,10 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;
   MemoryRanges m_regions_to_save;
+
+  std::vector m_thread_indexes;
 };
 } // namespace lldb_private
 
diff --git a/lldb/source/API/SBSaveCoreOptions.cpp 
b/lldb/source/API/SBSaveCoreOptions.cpp
index c79b57fa62c2be..6e50145add822e 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -100,6 +100,19 @@ SBSaveCoreOptions::AddMemoryRegionToSave(const 
SBMemoryRegionInfo ®ion) {
   return SBError();
 }
 
+uint32_t lldb::SBSaveCoreOptions::GetNumThreads() const {
+  LLDB_INSTRUMENT_VA(this);
+  return m_opaque_up->GetNumThreads();
+}
+
+SBThread SBSaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  LLDB_INSTRUMENT_VA(this, idx);
+  std::optional thread_sp = m_opaque_up->GetThreadAtIndex(idx);
+  if (thread_sp)
+return SBThread(thread_sp.value());
+  return SBThread();
+}
+
 void SBSaveCoreOptions::Clear() {
   LLDB_INSTRUMENT_VA(this);
   m_opaque_up->Clear();
diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp 
b/lldb/source/Symbol/SaveCoreOptions.cpp
index 8d9aadece2152d..84c4a76f09453e 100644
--- a/lldb/source/Symbol/SaveCoreOptions.cpp
+++ b/lldb/source/Symbol/SaveCoreOptions.cpp
@@ -87,12 +87,33 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) 
{
 m_process_sp = thread_sp->GetProcess();
   }
 
-  m_threads_to_save.insert(thread_sp->GetID());
+  m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
+  m_thread_indexes.push_back(thread_sp->GetID());
   return error;
 }
 
 bool SaveCoreOptions::RemoveThread(lldb::ThreadSP thread_sp) {
-  return thread_sp && m_threads_to_save.erase(thread_sp->GetID()) > 0;
+  if (!thread_sp)
+return false;
+  if (m_threads_to_save.erase(thread_sp->GetID()) == 0)
+return false;
+
+  auto it = std::find(m_thread_indexes.begin(), m_thread_indexes.end(),
+  thread_sp->GetID());
+  m_thread_indexes.erase(it);
+  return true;
+}
+
+uint32_t SaveCoreOptions::GetNumThreads() const {
+  return m_threads_to_save.size();
+}
+
+std::optional
+SaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  if (idx >= m_thread_indexes.size())
+return std::nullopt;
+  lldb::tid_t tid = m_thread_indexes[idx];
+  return m_threads_to_save.find(tid)->second;
 }
 
 bool SaveCoreOptions::ShouldThreadBeSaved(lldb::tid_t tid) const {
@@ -115,8 +136,8 @@ const MemoryRanges 
&SaveCoreOptions::GetCoreFileMemoryRanges() const {
   return m_regions_to_save;
 }
 
-Status SaveCoreOptions::EnsureValidConfiguration(
-lldb::ProcessSP process_sp) const {
+Status
+SaveCoreOptions::EnsureValidConfiguration(lldb::

[Lldb-commits] [lldb] [llvm] Debuginfod cache use index cache settings and include real file name (PR #120814)

2025-01-10 Thread via lldb-commits

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


[Lldb-commits] [lldb] [llvm] Debuginfod cache use index cache settings and include real file name (PR #120814)

2025-01-10 Thread via lldb-commits


@@ -141,6 +142,25 @@ SymbolLocator *SymbolLocatorDebuginfod::CreateInstance() {
   return new SymbolLocatorDebuginfod();
 }
 
+static llvm::StringRef getFileName(const ModuleSpec &module_spec,
+   std::string url_path) {
+  // Check if the URL path requests an executable file or a symbol file
+  bool is_executable = url_path.find("debuginfo") == std::string::npos;
+  if (is_executable) {
+return module_spec.GetFileSpec().GetFilename().GetStringRef();
+  }
+  llvm::StringRef symbol_file =

GeorgeHuyubo wrote:

Shouldn't matter I think

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


[Lldb-commits] [lldb] 9b528ed - Debuginfod cache use index cache settings and include real file name (#120814)

2025-01-10 Thread via lldb-commits

Author: GeorgeHuyubo
Date: 2025-01-10T18:13:46-08:00
New Revision: 9b528ed38038e39c441927b1fd0220654c253a3c

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

LOG: Debuginfod cache use index cache settings and include real file name 
(#120814)

This PR include two changes:
1. Change debuginfod cache file name to include origin file name, the
new file name would be something like:

llvmcache-13267c5f5d2e3df472c133c8efa45fb3331ef1ea-liblzma.so.5.2.2.debuginfo.dwp
So it will provide more information in image list instead of a plain
llvmcache-123
2. Switch debuginfod cache to use lldb index cache settings. Currently
we don't have proper settings for setting the cache path or the cache
expiration time for debuginfod cache. We want to use the lldb index
cache settings, as they make sense to be in the same place and have the
same TTL.

-

Co-authored-by: George Hu 

Added: 


Modified: 
lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
llvm/include/llvm/Debuginfod/Debuginfod.h
llvm/lib/Debuginfod/Debuginfod.cpp
llvm/unittests/Debuginfod/DebuginfodTests.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp 
b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
index 2cd7244902..905f4d783ac958 100644
--- a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
+++ b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
@@ -8,6 +8,7 @@
 
 #include "SymbolLocatorDebuginfod.h"
 
+#include "lldb/Core/DataFileCache.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Interpreter/OptionValueString.h"
 #include "lldb/Utility/Args.h"
@@ -141,6 +142,24 @@ SymbolLocator *SymbolLocatorDebuginfod::CreateInstance() {
   return new SymbolLocatorDebuginfod();
 }
 
+static llvm::StringRef getFileName(const ModuleSpec &module_spec,
+   std::string url_path) {
+  // Check if the URL path requests an executable file or a symbol file
+  bool is_executable = url_path.find("debuginfo") == std::string::npos;
+  if (is_executable)
+return module_spec.GetFileSpec().GetFilename().GetStringRef();
+  llvm::StringRef symbol_file =
+  module_spec.GetSymbolFileSpec().GetFilename().GetStringRef();
+  // Remove llvmcache- prefix and hash, keep origin file name
+  if (symbol_file.starts_with("llvmcache-")) {
+size_t pos = symbol_file.rfind('-');
+if (pos != llvm::StringRef::npos) {
+  symbol_file = symbol_file.substr(pos + 1);
+}
+  }
+  return symbol_file;
+}
+
 static std::optional
 GetFileForModule(const ModuleSpec &module_spec,
  std::function UrlBuilder) 
{
@@ -154,11 +173,14 @@ GetFileForModule(const ModuleSpec &module_spec,
   // Grab LLDB's Debuginfod overrides from the
   // plugin.symbol-locator.debuginfod.* settings.
   PluginProperties &plugin_props = GetGlobalPluginProperties();
-  llvm::Expected cache_path_or_err = plugin_props.GetCachePath();
-  // A cache location is *required*.
-  if (!cache_path_or_err)
-return {};
-  std::string cache_path = *cache_path_or_err;
+  // Grab the lldb index cache settings from the global module list properties.
+  ModuleListProperties &properties =
+  ModuleList::GetGlobalModuleListProperties();
+  std::string cache_path = properties.GetLLDBIndexCachePath().GetPath();
+
+  llvm::CachePruningPolicy pruning_policy =
+  DataFileCache::GetLLDBIndexCachePolicy();
+
   llvm::SmallVector debuginfod_urls =
   llvm::getDefaultDebuginfodUrls();
   std::chrono::milliseconds timeout = plugin_props.GetTimeout();
@@ -166,9 +188,13 @@ GetFileForModule(const ModuleSpec &module_spec,
   // We're ready to ask the Debuginfod library to find our file.
   llvm::object::BuildID build_id(module_uuid.GetBytes());
   std::string url_path = UrlBuilder(build_id);
-  std::string cache_key = llvm::getDebuginfodCacheKey(url_path);
+  llvm::StringRef file_name = getFileName(module_spec, url_path);
+  std::string cache_file_name = llvm::toHex(build_id, true);
+  if (!file_name.empty())
+cache_file_name += "-" + file_name.str();
   llvm::Expected result = llvm::getCachedOrDownloadArtifact(
-  cache_key, url_path, cache_path, debuginfod_urls, timeout);
+  cache_file_name, url_path, cache_path, debuginfod_urls, timeout,
+  pruning_policy);
   if (result)
 return FileSpec(*result);
 

diff  --git a/llvm/include/llvm/Debuginfod/Debuginfod.h 
b/llvm/include/llvm/Debuginfod/Debuginfod.h
index 99fe15ad859794..aebcf31cd48227 100644
--- a/llvm/include/llvm/Debuginfod/Debuginfod.h
+++ b/llvm/include/llvm/Debuginfod/Debuginfod.h
@@ -25,6 +25,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Object/BuildID.h"
+#incl

[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond created 
https://github.com/llvm/llvm-project/pull/122541

This patch adds the ability to get a thread at a give index, based on insertion 
order, for SBSaveCore Options. This is primarily to benefit scripts using 
SBSaveCore, and remove the need to have both options and a second collection if 
your script is tracking what threads need to be saved. Such as if you want to 
collect the source of all the threads to be saved after the Core is generated.

>From 194d6e3a3e407a2de72d0668f52400f5c4ac743d Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Fri, 10 Jan 2025 14:26:10 -0800
Subject: [PATCH] Make the thread list for SBSaveCoreOptions iterable

---
 lldb/include/lldb/API/SBSaveCoreOptions.h | 15 +++
 lldb/include/lldb/Symbol/SaveCoreOptions.h|  8 +++-
 lldb/source/API/SBSaveCoreOptions.cpp | 13 ++
 lldb/source/Symbol/SaveCoreOptions.cpp| 34 +++---
 .../TestSBSaveCoreOptions.py  | 45 +--
 .../sbsavecoreoptions/basic_minidump.yaml | 10 +
 6 files changed, 114 insertions(+), 11 deletions(-)

diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index 74aa2fe5bd5f92..d480b6272749e6 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -111,6 +111,21 @@ class LLDB_API SBSaveCoreOptions {
   ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
+  /// Get the number of Threads to be saved
+  ///
+  /// \returns
+  ///  The count of Threads to be saved.
+  uint32_t GetNumThreads() const;
+
+  /// Get the Thread at the specified index.
+  ///
+  /// \param [in] idx
+  ///   The index of the thread to return.
+  /// \returns
+  ///   The thread at the specified index, or an empty thread if the index is
+  ///   greater than or equal to the number of threads.
+  lldb::SBThread GetThreadAtIndex(uint32_t idx) const;
+
   /// Reset all options.
   void Clear();
 
diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h 
b/lldb/include/lldb/Symbol/SaveCoreOptions.h
index d90d08026016dc..ebe68cb45c1216 100644
--- a/lldb/include/lldb/Symbol/SaveCoreOptions.h
+++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h
@@ -13,7 +13,6 @@
 #include "lldb/Utility/RangeMap.h"
 
 #include 
-#include 
 #include 
 #include 
 
@@ -47,6 +46,9 @@ class SaveCoreOptions {
 
   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion);
 
+  std::optional GetThreadAtIndex(uint32_t idx) const;
+  uint32_t GetNumThreads() const;
+
   void Clear();
 
 private:
@@ -56,8 +58,10 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;
   MemoryRanges m_regions_to_save;
+
+  std::vector m_thread_indexes; // Indexes into m_threads_to_save
 };
 } // namespace lldb_private
 
diff --git a/lldb/source/API/SBSaveCoreOptions.cpp 
b/lldb/source/API/SBSaveCoreOptions.cpp
index c79b57fa62c2be..6e50145add822e 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -100,6 +100,19 @@ SBSaveCoreOptions::AddMemoryRegionToSave(const 
SBMemoryRegionInfo ®ion) {
   return SBError();
 }
 
+uint32_t lldb::SBSaveCoreOptions::GetNumThreads() const {
+  LLDB_INSTRUMENT_VA(this);
+  return m_opaque_up->GetNumThreads();
+}
+
+SBThread SBSaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  LLDB_INSTRUMENT_VA(this, idx);
+  std::optional thread_sp = m_opaque_up->GetThreadAtIndex(idx);
+  if (thread_sp)
+return SBThread(thread_sp.value());
+  return SBThread();
+}
+
 void SBSaveCoreOptions::Clear() {
   LLDB_INSTRUMENT_VA(this);
   m_opaque_up->Clear();
diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp 
b/lldb/source/Symbol/SaveCoreOptions.cpp
index 8d9aadece2152d..84c4a76f09453e 100644
--- a/lldb/source/Symbol/SaveCoreOptions.cpp
+++ b/lldb/source/Symbol/SaveCoreOptions.cpp
@@ -87,12 +87,33 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) 
{
 m_process_sp = thread_sp->GetProcess();
   }
 
-  m_threads_to_save.insert(thread_sp->GetID());
+  m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
+  m_thread_indexes.push_back(thread_sp->GetID());
   return error;
 }
 
 bool SaveCoreOptions::RemoveThread(lldb::ThreadSP thread_sp) {
-  return thread_sp && m_threads_to_save.erase(thread_sp->GetID()) > 0;
+  if (!thread_sp)
+return false;
+  if (m_threads_to_save.erase(thread_sp->GetID()) == 0)
+return false;
+
+  auto it = std::find(m_thread_indexes.begin(), m_thread_indexes.end(),
+  thread_sp->GetID());
+  m_thread_indexes.erase(it);
+  return true;
+}
+
+uint32_t SaveCoreOptions::GetNumThreads() const {
+  return m_threads_to_save.size();
+}
+
+std::optional
+SaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  if (idx >= m_thread_indexes.size())
+return std::nullopt;
+  lldb::tid_

[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)


Changes

This patch adds the ability to get a thread at a give index, based on insertion 
order, for SBSaveCore Options. This is primarily to benefit scripts using 
SBSaveCore, and remove the need to have both options and a second collection if 
your script is tracking what threads need to be saved. Such as if you want to 
collect the source of all the threads to be saved after the Core is generated.

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


6 Files Affected:

- (modified) lldb/include/lldb/API/SBSaveCoreOptions.h (+15) 
- (modified) lldb/include/lldb/Symbol/SaveCoreOptions.h (+6-2) 
- (modified) lldb/source/API/SBSaveCoreOptions.cpp (+13) 
- (modified) lldb/source/Symbol/SaveCoreOptions.cpp (+28-6) 
- (modified) 
lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py (+42-3) 
- (modified) lldb/test/API/python_api/sbsavecoreoptions/basic_minidump.yaml 
(+10) 


``diff
diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index 74aa2fe5bd5f92..d480b6272749e6 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -111,6 +111,21 @@ class LLDB_API SBSaveCoreOptions {
   ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
+  /// Get the number of Threads to be saved
+  ///
+  /// \returns
+  ///  The count of Threads to be saved.
+  uint32_t GetNumThreads() const;
+
+  /// Get the Thread at the specified index.
+  ///
+  /// \param [in] idx
+  ///   The index of the thread to return.
+  /// \returns
+  ///   The thread at the specified index, or an empty thread if the index is
+  ///   greater than or equal to the number of threads.
+  lldb::SBThread GetThreadAtIndex(uint32_t idx) const;
+
   /// Reset all options.
   void Clear();
 
diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h 
b/lldb/include/lldb/Symbol/SaveCoreOptions.h
index d90d08026016dc..ebe68cb45c1216 100644
--- a/lldb/include/lldb/Symbol/SaveCoreOptions.h
+++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h
@@ -13,7 +13,6 @@
 #include "lldb/Utility/RangeMap.h"
 
 #include 
-#include 
 #include 
 #include 
 
@@ -47,6 +46,9 @@ class SaveCoreOptions {
 
   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion);
 
+  std::optional GetThreadAtIndex(uint32_t idx) const;
+  uint32_t GetNumThreads() const;
+
   void Clear();
 
 private:
@@ -56,8 +58,10 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;
   MemoryRanges m_regions_to_save;
+
+  std::vector m_thread_indexes; // Indexes into m_threads_to_save
 };
 } // namespace lldb_private
 
diff --git a/lldb/source/API/SBSaveCoreOptions.cpp 
b/lldb/source/API/SBSaveCoreOptions.cpp
index c79b57fa62c2be..6e50145add822e 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -100,6 +100,19 @@ SBSaveCoreOptions::AddMemoryRegionToSave(const 
SBMemoryRegionInfo ®ion) {
   return SBError();
 }
 
+uint32_t lldb::SBSaveCoreOptions::GetNumThreads() const {
+  LLDB_INSTRUMENT_VA(this);
+  return m_opaque_up->GetNumThreads();
+}
+
+SBThread SBSaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  LLDB_INSTRUMENT_VA(this, idx);
+  std::optional thread_sp = m_opaque_up->GetThreadAtIndex(idx);
+  if (thread_sp)
+return SBThread(thread_sp.value());
+  return SBThread();
+}
+
 void SBSaveCoreOptions::Clear() {
   LLDB_INSTRUMENT_VA(this);
   m_opaque_up->Clear();
diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp 
b/lldb/source/Symbol/SaveCoreOptions.cpp
index 8d9aadece2152d..84c4a76f09453e 100644
--- a/lldb/source/Symbol/SaveCoreOptions.cpp
+++ b/lldb/source/Symbol/SaveCoreOptions.cpp
@@ -87,12 +87,33 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) 
{
 m_process_sp = thread_sp->GetProcess();
   }
 
-  m_threads_to_save.insert(thread_sp->GetID());
+  m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
+  m_thread_indexes.push_back(thread_sp->GetID());
   return error;
 }
 
 bool SaveCoreOptions::RemoveThread(lldb::ThreadSP thread_sp) {
-  return thread_sp && m_threads_to_save.erase(thread_sp->GetID()) > 0;
+  if (!thread_sp)
+return false;
+  if (m_threads_to_save.erase(thread_sp->GetID()) == 0)
+return false;
+
+  auto it = std::find(m_thread_indexes.begin(), m_thread_indexes.end(),
+  thread_sp->GetID());
+  m_thread_indexes.erase(it);
+  return true;
+}
+
+uint32_t SaveCoreOptions::GetNumThreads() const {
+  return m_threads_to_save.size();
+}
+
+std::optional
+SaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  if (idx >= m_thread_indexes.size())
+return std::nullopt;
+  lldb::tid_t tid = m_thread_indexes[idx];
+  return m_threads_to_save.find(tid)->second;
 }
 
 bool SaveCoreOptio

[Lldb-commits] [lldb] [lldb] Add amd64 ArchSpec (PR #122533)

2025-01-10 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere commented:

Please add a test to `ArchSpecTest.cpp`. 

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


[Lldb-commits] [lldb] [llvm] Debuginfod cache use index cache settings and include real file name (PR #120814)

2025-01-10 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] [llvm] Debuginfod cache use index cache settings and include real file name (PR #120814)

2025-01-10 Thread Greg Clayton via lldb-commits

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

Just fix removing {} from single line if statements.

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


[Lldb-commits] [lldb] [llvm] Debuginfod cache use index cache settings and include real file name (PR #120814)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -154,21 +174,29 @@ GetFileForModule(const ModuleSpec &module_spec,
   // Grab LLDB's Debuginfod overrides from the
   // plugin.symbol-locator.debuginfod.* settings.
   PluginProperties &plugin_props = GetGlobalPluginProperties();
-  llvm::Expected cache_path_or_err = plugin_props.GetCachePath();
-  // A cache location is *required*.
-  if (!cache_path_or_err)
-return {};
-  std::string cache_path = *cache_path_or_err;
+  // Grab the lldb index cache settings from the global module list properties.
+  ModuleListProperties &properties =
+  ModuleList::GetGlobalModuleListProperties();
+  std::string cache_path = properties.GetLLDBIndexCachePath().GetPath();
+
+  llvm::CachePruningPolicy pruning_policy =
+  DataFileCache::GetLLDBIndexCachePolicy();
+
   llvm::SmallVector debuginfod_urls =
   llvm::getDefaultDebuginfodUrls();
   std::chrono::milliseconds timeout = plugin_props.GetTimeout();
 
   // We're ready to ask the Debuginfod library to find our file.
   llvm::object::BuildID build_id(module_uuid.GetBytes());
   std::string url_path = UrlBuilder(build_id);
-  std::string cache_key = llvm::getDebuginfodCacheKey(url_path);
+  llvm::StringRef file_name = getFileName(module_spec, url_path);
+  std::string cache_file_name = llvm::toHex(build_id, true);
+  if (!file_name.empty()) {
+cache_file_name += "-" + file_name.str();
+  }

clayborg wrote:

remove {} from single line if statement per llvm coding guidelines

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


[Lldb-commits] [lldb] [llvm] Debuginfod cache use index cache settings and include real file name (PR #120814)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -141,6 +142,25 @@ SymbolLocator *SymbolLocatorDebuginfod::CreateInstance() {
   return new SymbolLocatorDebuginfod();
 }
 
+static llvm::StringRef getFileName(const ModuleSpec &module_spec,
+   std::string url_path) {
+  // Check if the URL path requests an executable file or a symbol file
+  bool is_executable = url_path.find("debuginfo") == std::string::npos;
+  if (is_executable) {
+return module_spec.GetFileSpec().GetFilename().GetStringRef();
+  }

clayborg wrote:

remove {} from single line if statement per llvm coding guidelines

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


[Lldb-commits] [lldb] [llvm] Debuginfod cache use index cache settings and include real file name (PR #120814)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -141,6 +142,25 @@ SymbolLocator *SymbolLocatorDebuginfod::CreateInstance() {
   return new SymbolLocatorDebuginfod();
 }
 
+static llvm::StringRef getFileName(const ModuleSpec &module_spec,
+   std::string url_path) {
+  // Check if the URL path requests an executable file or a symbol file
+  bool is_executable = url_path.find("debuginfo") == std::string::npos;
+  if (is_executable) {
+return module_spec.GetFileSpec().GetFilename().GetStringRef();
+  }
+  llvm::StringRef symbol_file =

clayborg wrote:

Do we need to check if this is empty?

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


[Lldb-commits] [lldb] [lldb][test] Fix some 'import-std-module' tests (PR #122358)

2025-01-10 Thread Pavel Labath via lldb-commits

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

Yes, that's the general idea. Just add a comment about why this is being done.

If this ends up failing in some configuration, there are plenty of other (more 
indirect) ways of pulling in this symbol that we can try.

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


[Lldb-commits] [lldb] 66a88f6 - [lldb] Add Function::GetAddress and redirect some uses (#115836)

2025-01-10 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-01-10T09:56:55+01:00
New Revision: 66a88f62cd56e55b5fa0ddb1bdffa549f7565f8f

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

LOG: [lldb] Add Function::GetAddress and redirect some uses (#115836)

Many calls to Function::GetAddressRange() were not interested in the
range itself. Instead they wanted to find the address of the function
(its entry point) or the base address for relocation of function-scoped
entities (technically, the two don't need to be the same, but there's
isn't good reason for them not to be). This PR creates a separate
function for retrieving this, and changes the existing
(non-controversial) uses to call that instead.

Added: 


Modified: 
lldb/include/lldb/Symbol/Function.h
lldb/source/API/SBBlock.cpp
lldb/source/API/SBFunction.cpp
lldb/source/Breakpoint/BreakpointResolver.cpp
lldb/source/Breakpoint/BreakpointResolverName.cpp
lldb/source/Core/SearchFilter.cpp
lldb/source/Expression/DWARFExpressionList.cpp
lldb/source/Expression/IRExecutionUnit.cpp
lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Symbol/Block.cpp
lldb/source/Symbol/Function.cpp
lldb/source/Symbol/SymbolContext.cpp
lldb/source/Symbol/Variable.cpp
lldb/source/Target/StackFrame.cpp
lldb/source/Target/ThreadPlanStepInRange.cpp
lldb/source/ValueObject/ValueObjectVariable.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/Function.h 
b/lldb/include/lldb/Symbol/Function.h
index e4118c1f9be867..157c007bdf0e84 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -449,6 +449,11 @@ class Function : public UserID, public SymbolContextScope {
 
   AddressRanges GetAddressRanges() { return m_block.GetRanges(); }
 
+  /// Return the address of the function (its entry point). This address is 
also
+  /// used as a base address for relocation of function-scope entities (blocks
+  /// and variables).
+  const Address &GetAddress() const { return m_address; }
+
   lldb::LanguageType GetLanguage() const;
   /// Find the file and line number of the source location of the start of the
   /// function.  This will use the declaration if present and fall back on the
@@ -658,6 +663,9 @@ class Function : public UserID, public SymbolContextScope {
   /// include addresses belonging to other functions.
   AddressRange m_range;
 
+  /// The address (entry point) of the function.
+  Address m_address;
+
   /// The frame base expression for variables that are relative to the frame
   /// pointer.
   DWARFExpressionList m_frame_base;

diff  --git a/lldb/source/API/SBBlock.cpp b/lldb/source/API/SBBlock.cpp
index b921ccd9802454..2ef4cc7227cf95 100644
--- a/lldb/source/API/SBBlock.cpp
+++ b/lldb/source/API/SBBlock.cpp
@@ -176,8 +176,7 @@ bool SBBlock::GetDescription(SBStream &description) {
 m_opaque_ptr->CalculateSymbolContext(&sc);
 if (sc.function) {
   m_opaque_ptr->DumpAddressRanges(
-  &strm,
-  sc.function->GetAddressRange().GetBaseAddress().GetFileAddress());
+  &strm, sc.function->GetAddress().GetFileAddress());
 }
   } else
 strm.PutCString("No value");

diff  --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp
index 3f6b4eea983187..414eccc357c0e4 100644
--- a/lldb/source/API/SBFunction.cpp
+++ b/lldb/source/API/SBFunction.cpp
@@ -120,8 +120,7 @@ SBInstructionList SBFunction::GetInstructions(SBTarget 
target,
   if (m_opaque_ptr) {
 TargetSP target_sp(target.GetSP());
 std::unique_lock lock;
-ModuleSP module_sp(
-m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModule());
+ModuleSP module_sp(m_opaque_ptr->GetAddress().GetModule());
 if (target_sp && module_sp) {
   lock = std::unique_lock(target_sp->GetAPIMutex());
   const bool force_live_memory = true;

diff  --git a/lldb/source/Breakpoint/BreakpointResolver.cpp 
b/lldb/source/Breakpoint/BreakpointResolver.cpp
index 9643602d78c751..5fe544908c39e2 100644
--- a/lldb/source/Breakpoint/BreakpointResolver.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolver.cpp
@@ -325,7 +325,7 @@ void BreakpointResolver::AddLocation(SearchFilter &filter,
   // If the line number is before the prologue end, move it there...
   bool skipped_prologue = false;
   if (skip_prologue && sc.function) {
-Addres

[Lldb-commits] [lldb] [lldb] Add Function::GetAddress and redirect some uses (PR #115836)

2025-01-10 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add Function::GetAddress and redirect some uses (PR #115836)

2025-01-10 Thread Pavel Labath via lldb-commits

labath wrote:

The reason I picked this name is to match Symbol::GetAddress.

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


[Lldb-commits] [lldb] [lldb][AIX] Added support for AIX in HostInfo section (PR #122301)

2025-01-10 Thread David Spickett via lldb-commits

DavidSpickett wrote:

You can never 100% trust anything that isn't the code (and even then, be 
careful), but it is nice when the descriptions are at least helpful.

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


[Lldb-commits] [lldb] [lldb] Migrate away from PointerUnion::{is, get} (NFC) (PR #122420)

2025-01-10 Thread Nikita Popov via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][AIX] Added support for AIX in HostInfo section (PR #122301)

2025-01-10 Thread Dhruv Srivastava via lldb-commits

DhruvSrivastavaX wrote:

> In future, please remember to remove anything from the commit message that 
> was purely for the review process, or generally no longer applies to the code 
> being landed. GitHub gives you a chance to do this just before the PR is 
> merged.
> 
> In this case it just meant I got an extra ping when this landed by being `@` 
> in the commit message, so no big deal.

Okay, Thanks for informing! 
I was actually unsure whether I should change the original message or not. Will 
change from next PR onwards.

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


[Lldb-commits] [lldb] [lldb] Migrate away from PointerUnion::{is, get} (NFC) (PR #122420)

2025-01-10 Thread David Spickett via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][AIX] Added support for AIX in HostInfo section (PR #122301)

2025-01-10 Thread David Spickett via lldb-commits

DavidSpickett wrote:

This is actually a common point of confusion, the LLVM repo is setup to create 
the final commit message from the PR description, not the commit(s) message(s) 
in the PR itself. I guess because A: the PR description is easier to edit and 
B: we always squash before merging, so the combination of the commit messages 
rarely makes any sense.

So when you merge, GitHub starts with the PR description, then lets you edit 
from there, but it doesn't write back any changes to the PR description. So you 
can leave it as is if you want to.

The main thing to think about is: would anything here mislead a future reader?

And for this PR no, it's just a few extra GitHub pings. But for example if you 
posted a PR to do X but were persuaded by reviewers to do !X, it will save 
confusion later if you update the descriptions.

And if you do push some misleading commit message (we all do it sometimes) you 
can always leave comments on the PR. We do that for reverts and post commit 
review also.

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


[Lldb-commits] [lldb] [lldb] Use the first address range as the function address (PR #122440)

2025-01-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)


Changes

This is the behavior expected by DWARF. It also requires some fixups to 
algorithms which were storing the addresses of some objects (Blocks and 
Variables) relative to the beginning of the function.

There are plenty of things that still don't work in this setups, but this 
change is sufficient for the expression evaluator to correctly recognize the 
entry point of a function in this case.

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


11 Files Affected:

- (modified) lldb/include/lldb/Symbol/Function.h (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
(+4-4) 
- (modified) lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp (+1-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(+20-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(+3-4) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+2-4) 
- (modified) lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(+5-7) 
- (modified) lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (+4-5) 
- (modified) lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (+8-8) 
- (modified) lldb/source/Symbol/Function.cpp (+2-2) 
- (modified) lldb/test/Shell/SymbolFile/DWARF/x86/discontinuous-function.s 
(+15-10) 


``diff
diff --git a/lldb/include/lldb/Symbol/Function.h 
b/lldb/include/lldb/Symbol/Function.h
index 157c007bdf0e84..858e2b15eb41c1 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -428,7 +428,7 @@ class Function : public UserID, public SymbolContextScope {
   /// The section offset based address for this function.
   Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t func_type_uid, const Mangled &mangled,
-   Type *func_type, AddressRanges ranges);
+   Type *func_type, Address address, AddressRanges ranges);
 
   /// Destructor.
   ~Function() override;
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index 45c8f121db2bc4..e82a853f7f24e6 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -251,11 +251,11 @@ FunctionSP 
SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) {
 addr_t address = record->Address + base;
 SectionSP section_sp = list->FindSectionContainingFileAddress(address);
 if (section_sp) {
-  AddressRange func_range(
-  section_sp, address - section_sp->GetFileAddress(), record->Size);
+  Address func_addr(section_sp, address-section_sp->GetFileAddress());
   // Use the CU's id because every CU has only one function inside.
-  func_sp = std::make_shared(&comp_unit, id, 0, func_name,
-   nullptr, AddressRanges{func_range});
+  func_sp = std::make_shared(
+  &comp_unit, id, 0, func_name, nullptr, func_addr,
+  AddressRanges{AddressRange(func_addr, record->Size)});
   comp_unit.AddFunction(func_sp);
 }
   }
diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp 
b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index 15e8d38e7f334b..0feb927c5c9488 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -829,7 +829,7 @@ size_t SymbolFileCTF::ParseFunctions(CompileUnit &cu) {
   lldb::user_id_t func_uid = m_functions.size();
   FunctionSP function_sp = std::make_shared(
   &cu, func_uid, function_type_uid, symbol->GetMangled(), 
type_sp.get(),
-  AddressRanges{func_range});
+  symbol->GetAddress(), AddressRanges{func_range});
   m_functions.emplace_back(function_sp);
   cu.AddFunction(function_sp);
 }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index e2f76e88dd6f0f..5d4b3d9f509024 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2393,10 +2393,29 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(
 assert(func_type == nullptr || func_type != DIE_IS_BEING_PARSED);
 
 const user_id_t func_user_id = die.GetID();
+
+// The base address of the scope for any of the debugging information
+// entries listed above is given by either the DW_AT_low_pc attribute or 
the
+// first address in the first range entry in the list of ranges given by 
the
+// DW_AT_ranges attribute.
+//   -- DWARFv5, Section 2.17 Code Addresses, Ranges and Base Addresses
+//
+// If no DW_AT_entry_pc attribute is present, then the entry address is
+// assumed to be the same as t

[Lldb-commits] [lldb] [lldb] Use the first address range as the function address (PR #122440)

2025-01-10 Thread Pavel Labath via lldb-commits

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

This is the behavior expected by DWARF. It also requires some fixups to 
algorithms which were storing the addresses of some objects (Blocks and 
Variables) relative to the beginning of the function.

There are plenty of things that still don't work in this setups, but this 
change is sufficient for the expression evaluator to correctly recognize the 
entry point of a function in this case.

>From be424b1e32f0bc69d01bd582e1de51b66b920b25 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Fri, 10 Jan 2025 10:44:53 +0100
Subject: [PATCH] [lldb] Use the first address range as the function address

This is the behavior expected by DWARF. It also requires some fixups to
algorithms which were storing the addresses of some objects (Blocks and
Variables) relative to the beginning of the function.

There are plenty of things that still don't work in this setups, but
this change is sufficient for the expression evaluator to correctly
recognize the entry point of a function in this case.
---
 lldb/include/lldb/Symbol/Function.h   |  2 +-
 .../Breakpad/SymbolFileBreakpad.cpp   |  8 +++---
 .../Plugins/SymbolFile/CTF/SymbolFileCTF.cpp  |  2 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 21 +++-
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.cpp  |  7 +++---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  6 ++---
 .../NativePDB/SymbolFileNativePDB.cpp | 12 -
 .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp  |  9 +++
 .../SymbolFile/Symtab/SymbolFileSymtab.cpp| 16 ++--
 lldb/source/Symbol/Function.cpp   |  4 +--
 .../DWARF/x86/discontinuous-function.s| 25 +++
 11 files changed, 65 insertions(+), 47 deletions(-)

diff --git a/lldb/include/lldb/Symbol/Function.h 
b/lldb/include/lldb/Symbol/Function.h
index 157c007bdf0e84..858e2b15eb41c1 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -428,7 +428,7 @@ class Function : public UserID, public SymbolContextScope {
   /// The section offset based address for this function.
   Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t func_type_uid, const Mangled &mangled,
-   Type *func_type, AddressRanges ranges);
+   Type *func_type, Address address, AddressRanges ranges);
 
   /// Destructor.
   ~Function() override;
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index 45c8f121db2bc4..e82a853f7f24e6 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -251,11 +251,11 @@ FunctionSP 
SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) {
 addr_t address = record->Address + base;
 SectionSP section_sp = list->FindSectionContainingFileAddress(address);
 if (section_sp) {
-  AddressRange func_range(
-  section_sp, address - section_sp->GetFileAddress(), record->Size);
+  Address func_addr(section_sp, address-section_sp->GetFileAddress());
   // Use the CU's id because every CU has only one function inside.
-  func_sp = std::make_shared(&comp_unit, id, 0, func_name,
-   nullptr, AddressRanges{func_range});
+  func_sp = std::make_shared(
+  &comp_unit, id, 0, func_name, nullptr, func_addr,
+  AddressRanges{AddressRange(func_addr, record->Size)});
   comp_unit.AddFunction(func_sp);
 }
   }
diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp 
b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index 15e8d38e7f334b..0feb927c5c9488 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -829,7 +829,7 @@ size_t SymbolFileCTF::ParseFunctions(CompileUnit &cu) {
   lldb::user_id_t func_uid = m_functions.size();
   FunctionSP function_sp = std::make_shared(
   &cu, func_uid, function_type_uid, symbol->GetMangled(), 
type_sp.get(),
-  AddressRanges{func_range});
+  symbol->GetAddress(), AddressRanges{func_range});
   m_functions.emplace_back(function_sp);
   cu.AddFunction(function_sp);
 }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index e2f76e88dd6f0f..5d4b3d9f509024 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2393,10 +2393,29 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(
 assert(func_type == nullptr || func_type != DIE_IS_BEING_PARSED);
 
 const user_id_t func_user_id = die.GetID();
+
+// The base address of the scope for any of the debugging information
+// entries liste

[Lldb-commits] [lldb] [lldb] Use the first address range as the function address (PR #122440)

2025-01-10 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 66a88f62cd56e55b5fa0ddb1bdffa549f7565f8f 
be424b1e32f0bc69d01bd582e1de51b66b920b25 --extensions h,cpp -- 
lldb/include/lldb/Symbol/Function.h 
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp 
lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp 
lldb/source/Symbol/Function.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index e82a853f7f..c7229568e1 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -251,7 +251,7 @@ FunctionSP 
SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) {
 addr_t address = record->Address + base;
 SectionSP section_sp = list->FindSectionContainingFileAddress(address);
 if (section_sp) {
-  Address func_addr(section_sp, address-section_sp->GetFileAddress());
+  Address func_addr(section_sp, address - section_sp->GetFileAddress());
   // Use the CU's id because every CU has only one function inside.
   func_sp = std::make_shared(
   &comp_unit, id, 0, func_name, nullptr, func_addr,

``




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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Jacob Lalonde via lldb-commits

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

>From 5a756db04b1e5124b99fa44c162439fbf8385aee Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Fri, 10 Jan 2025 14:26:10 -0800
Subject: [PATCH 1/5] Make the thread list for SBSaveCoreOptions iterable

---
 lldb/include/lldb/API/SBSaveCoreOptions.h | 15 +++
 lldb/include/lldb/Symbol/SaveCoreOptions.h|  8 +++-
 lldb/source/API/SBSaveCoreOptions.cpp | 13 ++
 lldb/source/Symbol/SaveCoreOptions.cpp| 34 +++---
 .../TestSBSaveCoreOptions.py  | 45 +--
 .../sbsavecoreoptions/basic_minidump.yaml | 10 +
 6 files changed, 114 insertions(+), 11 deletions(-)

diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index 74aa2fe5bd5f92..d480b6272749e6 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -111,6 +111,21 @@ class LLDB_API SBSaveCoreOptions {
   ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
+  /// Get the number of Threads to be saved
+  ///
+  /// \returns
+  ///  The count of Threads to be saved.
+  uint32_t GetNumThreads() const;
+
+  /// Get the Thread at the specified index.
+  ///
+  /// \param [in] idx
+  ///   The index of the thread to return.
+  /// \returns
+  ///   The thread at the specified index, or an empty thread if the index is
+  ///   greater than or equal to the number of threads.
+  lldb::SBThread GetThreadAtIndex(uint32_t idx) const;
+
   /// Reset all options.
   void Clear();
 
diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h 
b/lldb/include/lldb/Symbol/SaveCoreOptions.h
index d90d08026016dc..b33e02b2d72922 100644
--- a/lldb/include/lldb/Symbol/SaveCoreOptions.h
+++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h
@@ -13,7 +13,6 @@
 #include "lldb/Utility/RangeMap.h"
 
 #include 
-#include 
 #include 
 #include 
 
@@ -47,6 +46,9 @@ class SaveCoreOptions {
 
   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion);
 
+  std::optional GetThreadAtIndex(uint32_t idx) const;
+  uint32_t GetNumThreads() const;
+
   void Clear();
 
 private:
@@ -56,8 +58,10 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;
   MemoryRanges m_regions_to_save;
+
+  std::vector m_thread_indexes;
 };
 } // namespace lldb_private
 
diff --git a/lldb/source/API/SBSaveCoreOptions.cpp 
b/lldb/source/API/SBSaveCoreOptions.cpp
index c79b57fa62c2be..6e50145add822e 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -100,6 +100,19 @@ SBSaveCoreOptions::AddMemoryRegionToSave(const 
SBMemoryRegionInfo ®ion) {
   return SBError();
 }
 
+uint32_t lldb::SBSaveCoreOptions::GetNumThreads() const {
+  LLDB_INSTRUMENT_VA(this);
+  return m_opaque_up->GetNumThreads();
+}
+
+SBThread SBSaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  LLDB_INSTRUMENT_VA(this, idx);
+  std::optional thread_sp = m_opaque_up->GetThreadAtIndex(idx);
+  if (thread_sp)
+return SBThread(thread_sp.value());
+  return SBThread();
+}
+
 void SBSaveCoreOptions::Clear() {
   LLDB_INSTRUMENT_VA(this);
   m_opaque_up->Clear();
diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp 
b/lldb/source/Symbol/SaveCoreOptions.cpp
index 8d9aadece2152d..84c4a76f09453e 100644
--- a/lldb/source/Symbol/SaveCoreOptions.cpp
+++ b/lldb/source/Symbol/SaveCoreOptions.cpp
@@ -87,12 +87,33 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) 
{
 m_process_sp = thread_sp->GetProcess();
   }
 
-  m_threads_to_save.insert(thread_sp->GetID());
+  m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
+  m_thread_indexes.push_back(thread_sp->GetID());
   return error;
 }
 
 bool SaveCoreOptions::RemoveThread(lldb::ThreadSP thread_sp) {
-  return thread_sp && m_threads_to_save.erase(thread_sp->GetID()) > 0;
+  if (!thread_sp)
+return false;
+  if (m_threads_to_save.erase(thread_sp->GetID()) == 0)
+return false;
+
+  auto it = std::find(m_thread_indexes.begin(), m_thread_indexes.end(),
+  thread_sp->GetID());
+  m_thread_indexes.erase(it);
+  return true;
+}
+
+uint32_t SaveCoreOptions::GetNumThreads() const {
+  return m_threads_to_save.size();
+}
+
+std::optional
+SaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  if (idx >= m_thread_indexes.size())
+return std::nullopt;
+  lldb::tid_t tid = m_thread_indexes[idx];
+  return m_threads_to_save.find(tid)->second;
 }
 
 bool SaveCoreOptions::ShouldThreadBeSaved(lldb::tid_t tid) const {
@@ -115,8 +136,8 @@ const MemoryRanges 
&SaveCoreOptions::GetCoreFileMemoryRanges() const {
   return m_regions_to_save;
 }
 
-Status SaveCoreOptions::EnsureValidConfiguration(
-lldb::ProcessSP process_sp) const {
+Status
+SaveCoreOptions::EnsureValidConfiguration(lldb::

[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Jacob Lalonde via lldb-commits

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

>From 5a756db04b1e5124b99fa44c162439fbf8385aee Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Fri, 10 Jan 2025 14:26:10 -0800
Subject: [PATCH 1/4] Make the thread list for SBSaveCoreOptions iterable

---
 lldb/include/lldb/API/SBSaveCoreOptions.h | 15 +++
 lldb/include/lldb/Symbol/SaveCoreOptions.h|  8 +++-
 lldb/source/API/SBSaveCoreOptions.cpp | 13 ++
 lldb/source/Symbol/SaveCoreOptions.cpp| 34 +++---
 .../TestSBSaveCoreOptions.py  | 45 +--
 .../sbsavecoreoptions/basic_minidump.yaml | 10 +
 6 files changed, 114 insertions(+), 11 deletions(-)

diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h 
b/lldb/include/lldb/API/SBSaveCoreOptions.h
index 74aa2fe5bd5f92..d480b6272749e6 100644
--- a/lldb/include/lldb/API/SBSaveCoreOptions.h
+++ b/lldb/include/lldb/API/SBSaveCoreOptions.h
@@ -111,6 +111,21 @@ class LLDB_API SBSaveCoreOptions {
   ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
+  /// Get the number of Threads to be saved
+  ///
+  /// \returns
+  ///  The count of Threads to be saved.
+  uint32_t GetNumThreads() const;
+
+  /// Get the Thread at the specified index.
+  ///
+  /// \param [in] idx
+  ///   The index of the thread to return.
+  /// \returns
+  ///   The thread at the specified index, or an empty thread if the index is
+  ///   greater than or equal to the number of threads.
+  lldb::SBThread GetThreadAtIndex(uint32_t idx) const;
+
   /// Reset all options.
   void Clear();
 
diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h 
b/lldb/include/lldb/Symbol/SaveCoreOptions.h
index d90d08026016dc..b33e02b2d72922 100644
--- a/lldb/include/lldb/Symbol/SaveCoreOptions.h
+++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h
@@ -13,7 +13,6 @@
 #include "lldb/Utility/RangeMap.h"
 
 #include 
-#include 
 #include 
 #include 
 
@@ -47,6 +46,9 @@ class SaveCoreOptions {
 
   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion);
 
+  std::optional GetThreadAtIndex(uint32_t idx) const;
+  uint32_t GetNumThreads() const;
+
   void Clear();
 
 private:
@@ -56,8 +58,10 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;
   MemoryRanges m_regions_to_save;
+
+  std::vector m_thread_indexes;
 };
 } // namespace lldb_private
 
diff --git a/lldb/source/API/SBSaveCoreOptions.cpp 
b/lldb/source/API/SBSaveCoreOptions.cpp
index c79b57fa62c2be..6e50145add822e 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -100,6 +100,19 @@ SBSaveCoreOptions::AddMemoryRegionToSave(const 
SBMemoryRegionInfo ®ion) {
   return SBError();
 }
 
+uint32_t lldb::SBSaveCoreOptions::GetNumThreads() const {
+  LLDB_INSTRUMENT_VA(this);
+  return m_opaque_up->GetNumThreads();
+}
+
+SBThread SBSaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  LLDB_INSTRUMENT_VA(this, idx);
+  std::optional thread_sp = m_opaque_up->GetThreadAtIndex(idx);
+  if (thread_sp)
+return SBThread(thread_sp.value());
+  return SBThread();
+}
+
 void SBSaveCoreOptions::Clear() {
   LLDB_INSTRUMENT_VA(this);
   m_opaque_up->Clear();
diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp 
b/lldb/source/Symbol/SaveCoreOptions.cpp
index 8d9aadece2152d..84c4a76f09453e 100644
--- a/lldb/source/Symbol/SaveCoreOptions.cpp
+++ b/lldb/source/Symbol/SaveCoreOptions.cpp
@@ -87,12 +87,33 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) 
{
 m_process_sp = thread_sp->GetProcess();
   }
 
-  m_threads_to_save.insert(thread_sp->GetID());
+  m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
+  m_thread_indexes.push_back(thread_sp->GetID());
   return error;
 }
 
 bool SaveCoreOptions::RemoveThread(lldb::ThreadSP thread_sp) {
-  return thread_sp && m_threads_to_save.erase(thread_sp->GetID()) > 0;
+  if (!thread_sp)
+return false;
+  if (m_threads_to_save.erase(thread_sp->GetID()) == 0)
+return false;
+
+  auto it = std::find(m_thread_indexes.begin(), m_thread_indexes.end(),
+  thread_sp->GetID());
+  m_thread_indexes.erase(it);
+  return true;
+}
+
+uint32_t SaveCoreOptions::GetNumThreads() const {
+  return m_threads_to_save.size();
+}
+
+std::optional
+SaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  if (idx >= m_thread_indexes.size())
+return std::nullopt;
+  lldb::tid_t tid = m_thread_indexes[idx];
+  return m_threads_to_save.find(tid)->second;
 }
 
 bool SaveCoreOptions::ShouldThreadBeSaved(lldb::tid_t tid) const {
@@ -115,8 +136,8 @@ const MemoryRanges 
&SaveCoreOptions::GetCoreFileMemoryRanges() const {
   return m_regions_to_save;
 }
 
-Status SaveCoreOptions::EnsureValidConfiguration(
-lldb::ProcessSP process_sp) const {
+Status
+SaveCoreOptions::EnsureValidConfiguration(lldb::

[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

@clayborg and I chatted offline. The need for indexable access wasn't as 
important as exposing an enumeration of threads. So we instead return a copy of 
the thread list in an SBThreadCollection.

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -56,7 +57,7 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;

clayborg wrote:

You can remove this change right? You can fetch the threads from the 
`m_process_sp` by `lldb::tid_t`

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits

https://github.com/clayborg requested changes to this pull request.


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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -56,8 +58,10 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;

clayborg wrote:

Not sure if we need this complexity of an unordered_map + vector. Most users 
will add a couple of threads, or none at all. Can we just change this to be:
```
std::vector m_threads_to_save;
```
The get rid of `m_thread_indexes`?

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -111,6 +111,21 @@ class LLDB_API SBSaveCoreOptions {
   ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
+  /// Get the number of Threads to be saved
+  ///
+  /// \returns
+  ///  The count of Threads to be saved.
+  uint32_t GetNumThreads() const;
+
+  /// Get the Thread at the specified index.
+  ///
+  /// \param [in] idx
+  ///   The index of the thread to return.
+  /// \returns
+  ///   The thread at the specified index, or an empty thread if the index is

clayborg wrote:

s/an empty thread/an invalid SBThread object/

Not sure what users might think "an empty thread" is. 

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -87,12 +87,33 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) 
{
 m_process_sp = thread_sp->GetProcess();
   }
 
-  m_threads_to_save.insert(thread_sp->GetID());
+  m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
+  m_thread_indexes.push_back(thread_sp->GetID());
   return error;
 }
 
 bool SaveCoreOptions::RemoveThread(lldb::ThreadSP thread_sp) {
-  return thread_sp && m_threads_to_save.erase(thread_sp->GetID()) > 0;
+  if (!thread_sp)
+return false;
+  if (m_threads_to_save.erase(thread_sp->GetID()) == 0)
+return false;
+
+  auto it = std::find(m_thread_indexes.begin(), m_thread_indexes.end(),
+  thread_sp->GetID());
+  m_thread_indexes.erase(it);
+  return true;
+}
+
+uint32_t SaveCoreOptions::GetNumThreads() const {
+  return m_threads_to_save.size();
+}
+
+std::optional
+SaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  if (idx >= m_thread_indexes.size())
+return std::nullopt;
+  lldb::tid_t tid = m_thread_indexes[idx];
+  return m_threads_to_save.find(tid)->second;

clayborg wrote:

If we only have a `std::vector m_threads_to_save` now, this can be:
```
if (!m_process_sp || idx >= m_threads_to_save.size())
  return ThreadSP();
return process_sp->GetThreadList().FindThreadByID(m_threads_to_save[idx], 
/*can_update=*/false);
```

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -100,6 +100,19 @@ SBSaveCoreOptions::AddMemoryRegionToSave(const 
SBMemoryRegionInfo ®ion) {
   return SBError();
 }
 
+uint32_t lldb::SBSaveCoreOptions::GetNumThreads() const {
+  LLDB_INSTRUMENT_VA(this);
+  return m_opaque_up->GetNumThreads();
+}
+
+SBThread SBSaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  LLDB_INSTRUMENT_VA(this, idx);
+  std::optional thread_sp = m_opaque_up->GetThreadAtIndex(idx);
+  if (thread_sp)
+return SBThread(thread_sp.value());
+  return SBThread();

clayborg wrote:

If we remove the optional as suggested above, this can just be:
```
return SBThread(m_opaque_up->GetThreadAtIndex(idx));
```

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -111,6 +111,21 @@ class LLDB_API SBSaveCoreOptions {
   ///   style specific regions.
   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo ®ion);
 
+  /// Get the number of Threads to be saved
+  ///
+  /// \returns
+  ///  The count of Threads to be saved.
+  uint32_t GetNumThreads() const;
+
+  /// Get the Thread at the specified index.
+  ///
+  /// \param [in] idx
+  ///   The index of the thread to return.

clayborg wrote:

```
/// The zero based index of the thread object to return.
```

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits

https://github.com/clayborg requested changes to this pull request.


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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -87,12 +87,33 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) 
{
 m_process_sp = thread_sp->GetProcess();
   }
 
-  m_threads_to_save.insert(thread_sp->GetID());
+  m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
+  m_thread_indexes.push_back(thread_sp->GetID());
   return error;
 }
 
 bool SaveCoreOptions::RemoveThread(lldb::ThreadSP thread_sp) {
-  return thread_sp && m_threads_to_save.erase(thread_sp->GetID()) > 0;
+  if (!thread_sp)
+return false;
+  if (m_threads_to_save.erase(thread_sp->GetID()) == 0)
+return false;
+

clayborg wrote:

If we only have a `std::vector m_threads_to_save` now, these lines go 
away.

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -47,6 +46,9 @@ class SaveCoreOptions {
 
   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion);
 
+  std::optional GetThreadAtIndex(uint32_t idx) const;

clayborg wrote:

We don't need optional if `lldb::ThreadSP` is what is returned, just return a 
`lldb::ThreadSP` and that can be checked for being invalid. There is no case 
where we want a valid optional with an empty `lldb::ThreadSP`.

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


[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

2025-01-10 Thread Jacob Lalonde via lldb-commits


@@ -56,7 +57,7 @@ class SaveCoreOptions {
   std::optional m_file;
   std::optional m_style;
   lldb::ProcessSP m_process_sp;
-  std::unordered_set m_threads_to_save;
+  std::unordered_map m_threads_to_save;

Jlalond wrote:

Yeah we can, good call out.

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


[Lldb-commits] [lldb] [lldb] Use the first address range as the function address (PR #122440)

2025-01-10 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/122440

>From be424b1e32f0bc69d01bd582e1de51b66b920b25 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Fri, 10 Jan 2025 10:44:53 +0100
Subject: [PATCH 1/2] [lldb] Use the first address range as the function
 address

This is the behavior expected by DWARF. It also requires some fixups to
algorithms which were storing the addresses of some objects (Blocks and
Variables) relative to the beginning of the function.

There are plenty of things that still don't work in this setups, but
this change is sufficient for the expression evaluator to correctly
recognize the entry point of a function in this case.
---
 lldb/include/lldb/Symbol/Function.h   |  2 +-
 .../Breakpad/SymbolFileBreakpad.cpp   |  8 +++---
 .../Plugins/SymbolFile/CTF/SymbolFileCTF.cpp  |  2 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 21 +++-
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.cpp  |  7 +++---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  6 ++---
 .../NativePDB/SymbolFileNativePDB.cpp | 12 -
 .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp  |  9 +++
 .../SymbolFile/Symtab/SymbolFileSymtab.cpp| 16 ++--
 lldb/source/Symbol/Function.cpp   |  4 +--
 .../DWARF/x86/discontinuous-function.s| 25 +++
 11 files changed, 65 insertions(+), 47 deletions(-)

diff --git a/lldb/include/lldb/Symbol/Function.h 
b/lldb/include/lldb/Symbol/Function.h
index 157c007bdf0e84..858e2b15eb41c1 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -428,7 +428,7 @@ class Function : public UserID, public SymbolContextScope {
   /// The section offset based address for this function.
   Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t func_type_uid, const Mangled &mangled,
-   Type *func_type, AddressRanges ranges);
+   Type *func_type, Address address, AddressRanges ranges);
 
   /// Destructor.
   ~Function() override;
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index 45c8f121db2bc4..e82a853f7f24e6 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -251,11 +251,11 @@ FunctionSP 
SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) {
 addr_t address = record->Address + base;
 SectionSP section_sp = list->FindSectionContainingFileAddress(address);
 if (section_sp) {
-  AddressRange func_range(
-  section_sp, address - section_sp->GetFileAddress(), record->Size);
+  Address func_addr(section_sp, address-section_sp->GetFileAddress());
   // Use the CU's id because every CU has only one function inside.
-  func_sp = std::make_shared(&comp_unit, id, 0, func_name,
-   nullptr, AddressRanges{func_range});
+  func_sp = std::make_shared(
+  &comp_unit, id, 0, func_name, nullptr, func_addr,
+  AddressRanges{AddressRange(func_addr, record->Size)});
   comp_unit.AddFunction(func_sp);
 }
   }
diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp 
b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index 15e8d38e7f334b..0feb927c5c9488 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -829,7 +829,7 @@ size_t SymbolFileCTF::ParseFunctions(CompileUnit &cu) {
   lldb::user_id_t func_uid = m_functions.size();
   FunctionSP function_sp = std::make_shared(
   &cu, func_uid, function_type_uid, symbol->GetMangled(), 
type_sp.get(),
-  AddressRanges{func_range});
+  symbol->GetAddress(), AddressRanges{func_range});
   m_functions.emplace_back(function_sp);
   cu.AddFunction(function_sp);
 }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index e2f76e88dd6f0f..5d4b3d9f509024 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2393,10 +2393,29 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(
 assert(func_type == nullptr || func_type != DIE_IS_BEING_PARSED);
 
 const user_id_t func_user_id = die.GetID();
+
+// The base address of the scope for any of the debugging information
+// entries listed above is given by either the DW_AT_low_pc attribute or 
the
+// first address in the first range entry in the list of ranges given by 
the
+// DW_AT_ranges attribute.
+//   -- DWARFv5, Section 2.17 Code Addresses, Ranges and Base Addresses
+//
+// If no DW_AT_entry_pc attribute is present, then the entry address is
+// assumed to be the same as the base address 

[Lldb-commits] [lldb] [lldb][AIX] Added support for AIX in HostInfo section (PR #122301)

2025-01-10 Thread Dhruv Srivastava via lldb-commits

DhruvSrivastavaX wrote:

Okay great. Thanks for explaining that! 
I'll make sure that the final story reads well. (Especially if we go from X to 
!X 🙂 )
And its always a plus to add footnotes to the post-merge discussion in such 
cases. 

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


[Lldb-commits] [lldb] f44ed64 - [lldb] Fix some log messages in NativeProcessLinux

2025-01-10 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2025-01-10T13:21:58+01:00
New Revision: f44ed64864642b008f0c757a5ff37c150ce47d48

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

LOG: [lldb] Fix some log messages in NativeProcessLinux

Added: 


Modified: 
lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp 
b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 38b7092682873b..7f2aba0e4eb2ca 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -353,7 +353,7 @@ static std::optional> 
WaitPid() {
 
   if (wait_pid == -1) {
 Status error(errno, eErrorTypePOSIX);
-LLDB_LOG(log, "waitpid(-1, &status, _) failed: {1}", error);
+LLDB_LOG(log, "waitpid(-1, &status, _) failed: {0}", error);
 return std::nullopt;
   }
 
@@ -874,7 +874,7 @@ void NativeProcessLinux::MonitorSignal(const siginfo_t 
&info,
   LLDB_LOG(log,
"received signal {0} ({1}) with code {2}, (siginfo pid = {3}, "
"waitpid pid = {4})",
-   Host::GetSignalAsCString(signo), signo, info.si_code,
+   Host::GetSignalAsCString(signo), signo, info.si_code, info.si_pid,
thread.GetID());
 
   // Check for thread stop notification.



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


[Lldb-commits] [lldb] [lldb] Use the first address range as the function address (PR #122440)

2025-01-10 Thread David Spickett via lldb-commits


@@ -428,7 +428,7 @@ class Function : public UserID, public SymbolContextScope {
   /// The section offset based address for this function.
   Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t func_type_uid, const Mangled &mangled,
-   Type *func_type, AddressRanges ranges);
+   Type *func_type, Address address, AddressRanges ranges);

DavidSpickett wrote:

DWARF expects the function entry point to be the start of the first range. So 
if all we supported was DWARF, this could just take the ranges and read the 
entry point from those, right?

However, we support more than DWARF (and maybe we create arbitrary function 
objects in some scenarios?), so we do not assume here that we can always use 
the start of the first range.

Is that right?

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


[Lldb-commits] [lldb] [lldb] Use the first address range as the function address (PR #122440)

2025-01-10 Thread David Spickett via lldb-commits


@@ -3,17 +3,30 @@
 # int baz();
 # int bar() { return 47; }
 # int foo(int flag) { return flag ? bar() : baz(); }
-# The function bar has been placed "in the middle" of foo.
+# The function bar has been placed "in the middle" of foo, and the function
+# entry point is deliberately not its lowest address.
 
 # RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t
-# RUN: %lldb %t -o "image lookup -v -n foo" -o exit | FileCheck %s
+# RUN: %lldb %t -o "image lookup -v -n foo" -o "expr -- &foo" -o exit | 
FileCheck %s
 
+# CHECK-LABEL: image lookup
 # CHECK: 1 match found in {{.*}}
 # CHECK: Summary: {{.*}}`foo
 # CHECK: Function: id = {{.*}}, name = "foo", ranges = 
[0x-0x000e)[0x0014-0x001c)
 
+# CHECK-LABEL: expr -- &foo
+# CHECK: (void (*)()) $0 = 0x0007
+
 .text
 
+foo.__part.1:
+.cfi_startproc
+callq   bar
+jmp foo.__part.3
+.Lfoo.__part.1_end:
+.size   foo.__part.1, .Lfoo.__part.1_end-foo.__part.1
+.cfi_endproc
+
 .type   foo,@function
 foo:

DavidSpickett wrote:

When you print `&foo`, you are expecting the value of it to point here, instead 
of to `foo.__part.1:`, which is earlier but not actually the entry point. Do I 
understand that correctly?

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


[Lldb-commits] [lldb] [lldb] Use the first address range as the function address (PR #122440)

2025-01-10 Thread David Spickett via lldb-commits


@@ -428,7 +428,7 @@ class Function : public UserID, public SymbolContextScope {
   /// The section offset based address for this function.
   Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t func_type_uid, const Mangled &mangled,
-   Type *func_type, AddressRanges ranges);
+   Type *func_type, Address address, AddressRanges ranges);

DavidSpickett wrote:

And it does seem like mixing concerns, even if all we supported was DWARF. 
Might as well be explicit about the choice of entry point.

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


[Lldb-commits] [clang] [lldb] [clang][DebugInfo] Expand detection of structured bindings to account for std::get free function (PR #122265)

2025-01-10 Thread Yanzuo Liu via lldb-commits

zwuis wrote:

Do we need a test case about explicit object member function? i.e.
```cpp
template int get(this triple);
template<> int get<0>(this triple t) { return /* ... */; }
```

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


[Lldb-commits] [lldb] [lldb/crashlog] Fix typo in error message when creating a target (PR #122514)

2025-01-10 Thread Chelsea Cassanova via lldb-commits

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

LGTM!

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


[Lldb-commits] [lldb] [lldb/crashlog] Fix typo in error message when creating a target (PR #122514)

2025-01-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)


Changes

This fixes a typo when creating a target from the crashlog script and that we 
were not able to find a valid architecture from the crash report.

rdar://137344016

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


1 Files Affected:

- (modified) lldb/examples/python/crashlog.py (+1-1) 


``diff
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 368437ed63e46b..ab8c2fcaf034b2 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -1512,7 +1512,7 @@ def load_crashlog_in_scripted_process(debugger, 
crashlog_path, options, result):
 arch = crashlog.process_arch
 if not arch:
 raise InteractiveCrashLogException(
-"couldn't create find the architecture to create the target"
+"couldn't find the architecture to create the target"
 )
 target = debugger.CreateTargetWithFileAndArch(None, arch)
 # 4. Fail

``




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


[Lldb-commits] [lldb] [lldb] Use the first address range as the function address (PR #122440)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -428,7 +428,7 @@ class Function : public UserID, public SymbolContextScope {
   /// The section offset based address for this function.
   Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
lldb::user_id_t func_type_uid, const Mangled &mangled,
-   Type *func_type, AddressRanges ranges);
+   Type *func_type, Address address, AddressRanges ranges);

clayborg wrote:

Do we want to call this `base_address`?

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


[Lldb-commits] [lldb] [lldb] Use the first address range as the function address (PR #122440)

2025-01-10 Thread Greg Clayton via lldb-commits


@@ -2393,10 +2393,29 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(
 assert(func_type == nullptr || func_type != DIE_IS_BEING_PARSED);
 
 const user_id_t func_user_id = die.GetID();
+
+// The base address of the scope for any of the debugging information
+// entries listed above is given by either the DW_AT_low_pc attribute or 
the
+// first address in the first range entry in the list of ranges given by 
the
+// DW_AT_ranges attribute.
+//   -- DWARFv5, Section 2.17 Code Addresses, Ranges and Base Addresses
+//
+// If no DW_AT_entry_pc attribute is present, then the entry address is
+// assumed to be the same as the base address of the containing scope.
+//   -- DWARFv5, Section 2.18 Entry Address
+//
+// We currently don't support Debug Info Entries with
+// DW_AT_low_pc/DW_AT_entry_pc and DW_AT_ranges attributes (the latter
+// attributes are ignored even though they should be used for the address 
of
+// the function), but compilers also don't emit that kind of information. 
If
+// this becomes a problem we need to plumb these attributes separately.
+Address func_addr = func_ranges[0].GetBaseAddress();
+
 func_sp = std::make_shared(
 &comp_unit,
 func_user_id, // UserID is the DIE offset
-func_user_id, func_name, func_type, std::move(func_ranges));
+func_user_id, func_name, func_type, std::move(func_addr),

clayborg wrote:

Does `std::move` help if we are passing this by value?

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


[Lldb-commits] [lldb] [lldb/crashlog] Fix typo in error message when creating a target (PR #122514)

2025-01-10 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben created 
https://github.com/llvm/llvm-project/pull/122514

This fixes a typo when creating a target from the crashlog script and that we 
were not able to find a valid architecture from the crash report.

rdar://137344016

>From 4b25769382f81fd03553703624e8b8e48d83aa72 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani 
Date: Fri, 10 Jan 2025 11:24:30 -0800
Subject: [PATCH] [lldb/crashlog] Fix typo in error message when creating a
 target

This fixes a typo when creating a target from the crashlog script and
that we were not able to find a valid architecture from the crash report.

rdar://137344016

Signed-off-by: Med Ismail Bennani 
---
 lldb/examples/python/crashlog.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 368437ed63e46b..ab8c2fcaf034b2 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -1512,7 +1512,7 @@ def load_crashlog_in_scripted_process(debugger, 
crashlog_path, options, result):
 arch = crashlog.process_arch
 if not arch:
 raise InteractiveCrashLogException(
-"couldn't create find the architecture to create the target"
+"couldn't find the architecture to create the target"
 )
 target = debugger.CreateTargetWithFileAndArch(None, arch)
 # 4. Fail

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


[Lldb-commits] [lldb] 05dfbc1 - [lldb] Regularize DWARFDIE::Get{TypeLookup, Decl}Context names (#122273)

2025-01-10 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-01-10T09:23:52+01:00
New Revision: 05dfbc146d87866f0ef22dc88f729b5b9fdfe1a0

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

LOG: [lldb] Regularize DWARFDIE::Get{TypeLookup,Decl}Context names (#122273)

The functions call GetName for everything except variables, where they
call GetPubname instead. The difference is that the latter prefers to
return the linkage name, if it is available.

This doesn't seem particularly useful given that the linkage name
already kind of contains the context of the variable, and I doubt that
anything depends on it as these functions are currently called on type
and subprogram DIEs -- not variables.

This makes it easier to simplify/deduplicate these functions later.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index 96b13efe583513..4b864b549f8ce6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -412,7 +412,7 @@ static void GetDeclContextImpl(DWARFDIE die,
   push_ctx(CompilerContextKind::Function, die.GetName());
   break;
 case DW_TAG_variable:
-  push_ctx(CompilerContextKind::Variable, die.GetPubname());
+  push_ctx(CompilerContextKind::Variable, die.GetName());
   break;
 case DW_TAG_typedef:
   push_ctx(CompilerContextKind::Typedef, die.GetName());
@@ -457,7 +457,7 @@ static void GetTypeLookupContextImpl(DWARFDIE die,
   push_ctx(CompilerContextKind::Enum, die.GetName());
   break;
 case DW_TAG_variable:
-  push_ctx(CompilerContextKind::Variable, die.GetPubname());
+  push_ctx(CompilerContextKind::Variable, die.GetName());
   break;
 case DW_TAG_typedef:
   push_ctx(CompilerContextKind::Typedef, die.GetName());



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


[Lldb-commits] [lldb] [lldb] Regularize DWARFDIE::Get{TypeLookup, Decl}Context names (PR #122273)

2025-01-10 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb][AIX] Added support for AIX in HostInfo section (PR #122301)

2025-01-10 Thread David Spickett via lldb-commits

DavidSpickett wrote:

In future, please remember to remove anything from the commit message that was 
purely for the review process, or generally no longer applies to the code being 
landed. GitHub gives you a chance to do this just before the PR is merged.

In this case it just meant I got an extra ping when this landed by being `@` in 
the commit message, so no big deal.

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