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

2025-05-21 Thread via lldb-commits


@@ -683,14 +683,14 @@ def _get_compilation_command(self, source, obj):
 args.append("-fms-compatibility-version=19")
 args.append("/c")
 
+if self.std:

Nerixyz wrote:

`/std` was appended after the `--`, so the compiler interpreted it as a file.

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


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

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


@@ -683,14 +683,14 @@ def _get_compilation_command(self, source, obj):
 args.append("-fms-compatibility-version=19")
 args.append("/c")
 
+if self.std:

Michael137 wrote:

I see, lets do that in a separate patch please

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-21 Thread Hemang Gadhavi via lldb-commits

https://github.com/HemangGadhavi updated 
https://github.com/llvm/llvm-project/pull/138687

>From a47e4642e6ebcbe6b5466ff118968bac83ccf1e9 Mon Sep 17 00:00:00 2001
From: HemangGadhavi 
Date: Tue, 6 May 2025 07:59:45 -0500
Subject: [PATCH 1/2] [lldb][AIX] get host info for AIX (cont..)

---
 lldb/source/Host/aix/Host.cpp| 49 +++-
 lldb/source/Host/aix/HostInfoAIX.cpp | 15 +
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Host/aix/Host.cpp b/lldb/source/Host/aix/Host.cpp
index a812e061ccae2..ead8202cbbdef 100644
--- a/lldb/source/Host/aix/Host.cpp
+++ b/lldb/source/Host/aix/Host.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Utility/ProcessInfo.h"
 #include "lldb/Utility/Status.h"
 #include "llvm/BinaryFormat/XCOFF.h"
+#include 
 #include 
 #include 
 
@@ -41,6 +42,14 @@ static ProcessInstanceInfo::timespec 
convert(pr_timestruc64_t t) {
   return ts;
 }
 
+static bool IsDirNumeric(const char *dname) {
+  for (; *dname; dname++) {
+if (!isdigit(*dname))
+  return false;
+  }
+  return true;
+}
+
 static bool GetStatusInfo(::pid_t pid, ProcessInstanceInfo &processInfo,
   ProcessState &State) {
   struct pstatus pstatusData;
@@ -133,7 +142,45 @@ static bool GetProcessAndStatInfo(::pid_t pid,
 
 uint32_t Host::FindProcessesImpl(const ProcessInstanceInfoMatch &match_info,
  ProcessInstanceInfoList &process_infos) {
-  return 0;
+  static const char procdir[] = "/proc/";
+
+  DIR *dirproc = opendir(procdir);
+  if (dirproc) {
+struct dirent *direntry = nullptr;
+const uid_t our_uid = getuid();
+const lldb::pid_t our_pid = getpid();
+bool all_users = match_info.GetMatchAllUsers();
+
+while ((direntry = readdir(dirproc)) != nullptr) {
+  if (!IsDirNumeric(direntry->d_name))
+continue;
+
+  lldb::pid_t pid = atoi(direntry->d_name);
+  // Skip this process.
+  if (pid == our_pid)
+continue;
+
+  ProcessState State;
+  ProcessInstanceInfo process_info;
+  if (!GetProcessAndStatInfo(pid, process_info, State))
+continue;
+
+  if (State == ProcessState::Zombie ||
+  State == ProcessState::TracedOrStopped)
+continue;
+
+  // Check for user match if we're not matching all users and not running
+  // as root.
+  if (!all_users && (our_uid != 0) && (process_info.GetUserID() != 
our_uid))
+continue;
+
+  if (match_info.Matches(process_info)) {
+process_infos.push_back(process_info);
+  }
+}
+closedir(dirproc);
+  }
+  return process_infos.size();
 }
 
 bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) {
diff --git a/lldb/source/Host/aix/HostInfoAIX.cpp 
b/lldb/source/Host/aix/HostInfoAIX.cpp
index 61b47462dd647..d720f5c52d3b1 100644
--- a/lldb/source/Host/aix/HostInfoAIX.cpp
+++ b/lldb/source/Host/aix/HostInfoAIX.cpp
@@ -7,6 +7,8 @@
 
//===--===//
 
 #include "lldb/Host/aix/HostInfoAIX.h"
+#include "lldb/Host/posix/Support.h"
+#include 
 
 using namespace lldb_private;
 
@@ -18,5 +20,18 @@ void HostInfoAIX::Terminate() { HostInfoBase::Terminate(); }
 
 FileSpec HostInfoAIX::GetProgramFileSpec() {
   static FileSpec g_program_filespec;
+  struct psinfo psinfoData;
+  auto BufferOrError = getProcFile(getpid(), "psinfo");
+  if (BufferOrError) {
+std::unique_ptr PsinfoBuffer =
+std::move(*BufferOrError);
+memcpy(&psinfoData, PsinfoBuffer->getBufferStart(), sizeof(psinfoData));
+llvm::StringRef exe_path(
+psinfoData.pr_psargs,
+strnlen(psinfoData.pr_psargs, sizeof(psinfoData.pr_psargs)));
+if (!exe_path.empty()) {
+  g_program_filespec.SetFile(exe_path, FileSpec::Style::native);
+}
+  }
   return g_program_filespec;
 }

>From f5a07780fe2521f9c7547c2890ce6670a37617c5 Mon Sep 17 00:00:00 2001
From: HemangGadhavi 
Date: Wed, 21 May 2025 05:22:07 -0400
Subject: [PATCH 2/2] Added testcase for GetProgramFileSpec & FindProcesses

---
 lldb/source/Host/aix/Host.cpp| 17 -
 lldb/source/Host/aix/HostInfoAIX.cpp |  3 +--
 lldb/unittests/Host/HostInfoTest.cpp |  6 ++
 lldb/unittests/Host/HostTest.cpp | 25 +
 4 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/lldb/source/Host/aix/Host.cpp b/lldb/source/Host/aix/Host.cpp
index ead8202cbbdef..b5572b93d93a9 100644
--- a/lldb/source/Host/aix/Host.cpp
+++ b/lldb/source/Host/aix/Host.cpp
@@ -42,14 +42,6 @@ static ProcessInstanceInfo::timespec 
convert(pr_timestruc64_t t) {
   return ts;
 }
 
-static bool IsDirNumeric(const char *dname) {
-  for (; *dname; dname++) {
-if (!isdigit(*dname))
-  return false;
-  }
-  return true;
-}
-
 static bool GetStatusInfo(::pid_t pid, ProcessInstanceInfo &processInfo,
   ProcessState &State) {
   struct pstatus pstatusData;
@@ -152,10 +144,10 @@ uint32_t Host::FindPr

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

2025-05-21 Thread via lldb-commits


@@ -0,0 +1,57 @@
+// clang-format off
+
+// REQUIRES: target-windows
+// RUN: %build --compiler=clang-cl -o %t.exe --std c++20 -- %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "run" 
-o "fr v" -o c | FileCheck %s
+
+#include 

Nerixyz wrote:

Do you have any specific tests? Ideally ones that test optional and shared_ptr. 
I can look at them later.  

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


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

2025-05-21 Thread via lldb-commits

Nerixyz wrote:

> Seems like a fine stop-gap for now to avoid crashing

Yes, exactly. The formatted output for these types is still incomplete (often, 
types are formatted without any children).
I'd love to help with support for MSVC's STL, but it's probably better to 
discuss that in #24834.

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-21 Thread Hemang Gadhavi via lldb-commits


@@ -18,5 +20,18 @@ void HostInfoAIX::Terminate() { HostInfoBase::Terminate(); }
 
 FileSpec HostInfoAIX::GetProgramFileSpec() {
   static FileSpec g_program_filespec;
+  struct psinfo psinfoData;
+  auto BufferOrError = getProcFile(getpid(), "psinfo");
+  if (BufferOrError) {
+std::unique_ptr PsinfoBuffer =
+std::move(*BufferOrError);
+memcpy(&psinfoData, PsinfoBuffer->getBufferStart(), sizeof(psinfoData));
+llvm::StringRef exe_path(
+psinfoData.pr_psargs,
+strnlen(psinfoData.pr_psargs, sizeof(psinfoData.pr_psargs)));
+if (!exe_path.empty()) {
+  g_program_filespec.SetFile(exe_path, FileSpec::Style::native);
+}

HemangGadhavi wrote:

Done

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-21 Thread Hemang Gadhavi via lldb-commits


@@ -133,7 +142,45 @@ static bool GetProcessAndStatInfo(::pid_t pid,
 
 uint32_t Host::FindProcessesImpl(const ProcessInstanceInfoMatch &match_info,
  ProcessInstanceInfoList &process_infos) {
-  return 0;
+  static const char procdir[] = "/proc/";
+
+  DIR *dirproc = opendir(procdir);
+  if (dirproc) {
+struct dirent *direntry = nullptr;
+const uid_t our_uid = getuid();
+const lldb::pid_t our_pid = getpid();
+bool all_users = match_info.GetMatchAllUsers();
+
+while ((direntry = readdir(dirproc)) != nullptr) {
+  if (!IsDirNumeric(direntry->d_name))
+continue;
+
+  lldb::pid_t pid = atoi(direntry->d_name);
+  // Skip this process.
+  if (pid == our_pid)
+continue;
+
+  ProcessState State;
+  ProcessInstanceInfo process_info;
+  if (!GetProcessAndStatInfo(pid, process_info, State))
+continue;
+
+  if (State == ProcessState::Zombie ||
+  State == ProcessState::TracedOrStopped)
+continue;
+
+  // Check for user match if we're not matching all users and not running
+  // as root.
+  if (!all_users && (our_uid != 0) && (process_info.GetUserID() != 
our_uid))
+continue;
+
+  if (match_info.Matches(process_info)) {
+process_infos.push_back(process_info);
+  }

HemangGadhavi wrote:

Done

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-21 Thread Hemang Gadhavi via lldb-commits


@@ -133,7 +142,45 @@ static bool GetProcessAndStatInfo(::pid_t pid,
 
 uint32_t Host::FindProcessesImpl(const ProcessInstanceInfoMatch &match_info,
  ProcessInstanceInfoList &process_infos) {
-  return 0;
+  static const char procdir[] = "/proc/";
+
+  DIR *dirproc = opendir(procdir);
+  if (dirproc) {
+struct dirent *direntry = nullptr;
+const uid_t our_uid = getuid();
+const lldb::pid_t our_pid = getpid();
+bool all_users = match_info.GetMatchAllUsers();
+
+while ((direntry = readdir(dirproc)) != nullptr) {
+  if (!IsDirNumeric(direntry->d_name))
+continue;
+
+  lldb::pid_t pid = atoi(direntry->d_name);

HemangGadhavi wrote:

Done

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


[Lldb-commits] [lldb] [lldb] Add support for displaying `__float128` variables (PR #98369)

2025-05-21 Thread via lldb-commits

https://github.com/beetrees updated 
https://github.com/llvm/llvm-project/pull/98369

>From 52f00a10537e738762adc62b5e88b71008336e65 Mon Sep 17 00:00:00 2001
From: beetrees 
Date: Wed, 10 Jul 2024 18:49:45 +0100
Subject: [PATCH] [lldb] Add support for displaying `__float128` variables

---
 lldb/bindings/python/python-extensions.swig   |  1 +
 lldb/docs/python_api_enums.rst|  2 ++
 lldb/include/lldb/Symbol/TypeSystem.h |  3 ++-
 lldb/include/lldb/lldb-enumerations.h |  7 -
 lldb/source/Commands/CommandObjectMemory.cpp  |  2 ++
 lldb/source/Core/DumpDataExtractor.cpp| 16 +---
 lldb/source/DataFormatters/FormatManager.cpp  |  1 +
 lldb/source/DataFormatters/VectorType.cpp |  2 ++
 .../TypeSystem/Clang/TypeSystemClang.cpp  | 26 ++-
 .../TypeSystem/Clang/TypeSystemClang.h|  3 ++-
 lldb/source/ValueObject/ValueObject.cpp   |  5 ++--
 lldb/unittests/Core/DumpDataExtractorTest.cpp |  6 +
 lldb/unittests/Symbol/TestTypeSystemClang.cpp |  2 ++
 13 files changed, 66 insertions(+), 10 deletions(-)

diff --git a/lldb/bindings/python/python-extensions.swig 
b/lldb/bindings/python/python-extensions.swig
index 4ba1607c70909..40fa76872ee96 100644
--- a/lldb/bindings/python/python-extensions.swig
+++ b/lldb/bindings/python/python-extensions.swig
@@ -594,6 +594,7 @@ def is_numeric_type(basic_type):
 if basic_type == eBasicTypeFloat: return (True,True)
 if basic_type == eBasicTypeDouble: return (True,True)
 if basic_type == eBasicTypeLongDouble: return (True,True)
+if basic_type == eBasicTypeFloat128: return (True,True)
 if basic_type == eBasicTypeFloatComplex: return (True,True)
 if basic_type == eBasicTypeDoubleComplex: return (True,True)
 if basic_type == eBasicTypeLongDoubleComplex: return (True,True)
diff --git a/lldb/docs/python_api_enums.rst b/lldb/docs/python_api_enums.rst
index b6a2497ea878e..a43a47b8d6985 100644
--- a/lldb/docs/python_api_enums.rst
+++ b/lldb/docs/python_api_enums.rst
@@ -321,6 +321,7 @@ Format
 .. py:data:: eFormatInstruction
 .. py:data:: eFormatVoid
 .. py:data:: eFormatUnicode8
+.. py:data:: eFormatFloat128
 
 
 .. _DescriptionLevel:
@@ -1045,6 +1046,7 @@ BasicType
 .. py:data:: eBasicTypeObjCSel
 .. py:data:: eBasicTypeNullPtr
 .. py:data:: eBasicTypeOther
+.. py:data:: eBasicTypeFloat128
 
 
 .. _TraceType:
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index df87fea32b72a..78f62e68177df 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -310,7 +310,8 @@ class TypeSystem : public PluginInterface,
 
   // Exploring the type
 
-  virtual const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) = 
0;
+  virtual const llvm::fltSemantics &
+  GetFloatTypeSemantics(size_t byte_size, lldb::Format format) = 0;
 
   virtual llvm::Expected
   GetBitSize(lldb::opaque_compiler_type_t type,
diff --git a/lldb/include/lldb/lldb-enumerations.h 
b/lldb/include/lldb/lldb-enumerations.h
index 6d10cc8bcffcb..311a18b850e0a 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -203,6 +203,10 @@ enum Format {
   eFormatInstruction, ///< Disassemble an opcode
   eFormatVoid,///< Do not print this
   eFormatUnicode8,
+  eFormatFloat128, ///< Disambiguate between 128-bit `long double` (which uses
+   ///< `eFormatFloat`) and `__float128` (which uses
+   ///< `eFormatFloat128`). If the value being formatted is not
+   ///< 128 bits, then this is identical to `eFormatFloat`.
   kNumFormats
 };
 
@@ -837,7 +841,8 @@ enum BasicType {
   eBasicTypeObjCClass,
   eBasicTypeObjCSel,
   eBasicTypeNullPtr,
-  eBasicTypeOther
+  eBasicTypeOther,
+  eBasicTypeFloat128
 };
 
 /// Deprecated
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp 
b/lldb/source/Commands/CommandObjectMemory.cpp
index 7140333bb3cde..5ccd4be7741e6 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -156,6 +156,7 @@ class OptionGroupReadMemory : public OptionGroup {
 
 case eFormatBinary:
 case eFormatFloat:
+case eFormatFloat128:
 case eFormatOctal:
 case eFormatDecimal:
 case eFormatEnum:
@@ -1330,6 +1331,7 @@ class CommandObjectMemoryWrite : public 
CommandObjectParsed {
   switch (m_format_options.GetFormat()) {
   case kNumFormats:
   case eFormatFloat: // TODO: add support for floats soon
+  case eFormatFloat128:
   case eFormatCharPrintable:
   case eFormatBytesWithASCII:
   case eFormatComplex:
diff --git a/lldb/source/Core/DumpDataExtractor.cpp 
b/lldb/source/Core/DumpDataExtractor.cpp
index 72140736d8877..37dffc72d76ac 100644
--- a/lldb/source/Core/DumpDataExtractor.cpp
+++ b/lldb/source/Core/DumpDataExtractor.cpp
@@ -318,14 +318,15 @@ static void printMemoryTags(const DataExtractor &DE, 
Stream *s,
 }
 
 static co

[Lldb-commits] [lldb] [lldb] Add support for displaying `__float128` variables (PR #98369)

2025-05-21 Thread via lldb-commits


@@ -4737,19 +4750,23 @@ CompilerType 
TypeSystemClang::CreateGenericFunctionPrototype() {
 // Exploring the type
 
 const llvm::fltSemantics &
-TypeSystemClang::GetFloatTypeSemantics(size_t byte_size) {
+TypeSystemClang::GetFloatTypeSemantics(size_t byte_size, bool prefer_float128) 
{
   clang::ASTContext &ast = getASTContext();
   const size_t bit_size = byte_size * 8;
   if (bit_size == ast.getTypeSize(ast.FloatTy))
 return ast.getFloatTypeSemantics(ast.FloatTy);
   else if (bit_size == ast.getTypeSize(ast.DoubleTy))
 return ast.getFloatTypeSemantics(ast.DoubleTy);
+  else if (prefer_float128 && bit_size == ast.getTypeSize(ast.Float128Ty))
+return ast.getFloatTypeSemantics(ast.Float128Ty);
   else if (bit_size == ast.getTypeSize(ast.LongDoubleTy) ||
bit_size == llvm::APFloat::semanticsSizeInBits(
ast.getFloatTypeSemantics(ast.LongDoubleTy)))
 return ast.getFloatTypeSemantics(ast.LongDoubleTy);
   else if (bit_size == ast.getTypeSize(ast.HalfTy))
 return ast.getFloatTypeSemantics(ast.HalfTy);
+  else if (bit_size == ast.getTypeSize(ast.Float128Ty))

beetrees wrote:

If the user formats a 128-bit value using `eFormatFloat` on a target where the 
only 128-bit float is float128 (a.k.a. `long double` is some other size), then 
the value should be formatted as a float128. The `eFormatFloat128` format is 
only needed to disambiguate when `long double` and float128 are both 128 bits.

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


[Lldb-commits] [lldb] [lldb] Add support for displaying `__float128` variables (PR #98369)

2025-05-21 Thread via lldb-commits


@@ -335,6 +336,10 @@ static const llvm::fltSemantics &GetFloatSemantics(const 
TargetSP &target_sp,
   return llvm::APFloat::IEEEsingle();
 case 8:
   return llvm::APFloat::IEEEdouble();
+case 16:
+  if (prefer_float128) {

beetrees wrote:

Done

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-21 Thread Hemang Gadhavi via lldb-commits

HemangGadhavi wrote:

> Could you also make unit tests for these two functions:
> 
> * call GetProgramFileSpec and make sure the result is reasonable (exists?)
> * create a Process and make sure FindProcesses finds it (you can use 
> [this](https://github.com/llvm/llvm-project/blob/52f568dbbb61ffe26b7973b482e0e504b405a0ab/lldb/unittests/Host/HostTest.cpp#L79)
>  trick to re-execute yourself)

Hi @labath 
Created the testcases for the GetProgramFileSpec & FindProcesses.

But for the FindProcesses() testcase, we are able to launch the process but 
later point we are seeing dump on the testcase.
Could you please verify are we giving the input correctly or missing something? 
from the logs we can see that GetProcessAndStatInfo() (which is invoked from 
GetProcessInfo() & FindProcesses()) dumping the core specifically while calling 
GetExePathAndArch() function on linux. 
Could you please help to guide on that.?



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


[Lldb-commits] [lldb] [lldb][AArch64] Correctly invalidate svg when vg is written (PR #140875)

2025-05-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

Recently the Linux Kernel has fixed a bunch of issues in SME support and while 
testing that, I found two tests failing: FAIL: 
test_za_register_dynamic_config_main_disabled 
(TestZAThreadedDynamic.AArch64ZAThreadedTestCase) FAIL: 
test_za_register_dynamic_config_main_enabled 
(TestZAThreadedDynamic.AArch64ZAThreadedTestCase)

These tests write to vg during streaming mode from lldb and expect to see that 
za has been resized to match it. Instead, it was unavilable. lldb-server was 
sending the correct amount of data but lldb client was expect the old size.

Turns out that instead of a write to vg invalidating svg, it was 
invalidating... something else. I'm still not sure how these tests ever worked 
but with this one line fix, they pass again.

I did not see this issue with SVE or streaming SVE Z registers because those 
always resize using the value of vg, and vg always has the value we just wrote.

(remember that vg is the vector length of the **current** mode, not of 
non-streaming mode, whereas svg is the vector length of streaming mode, even if 
you are currently in non-streaming mode)

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


1 Files Affected:

- (modified) lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp 
(+1-1) 


``diff
diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
index c004c0f3c3cf5..f2095c150609f 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
@@ -425,7 +425,7 @@ void RegisterInfoPOSIX_arm64::AddRegSetSME(bool has_zt) {
   //
   // This must be added now, rather than when vg is defined because SME is a
   // dynamic set that may or may not be present.
-  static uint32_t vg_invalidates[] = {sme_regnum + 1 /*svg*/,
+  static uint32_t vg_invalidates[] = {first_sme_regnum + 1 /*svg*/,
   LLDB_INVALID_REGNUM};
   m_dynamic_reg_infos[GetRegNumSVEVG()].invalidate_regs = vg_invalidates;
 }

``




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


[Lldb-commits] [lldb] [lldb][AArch64] Correctly invalidate svg when vg is written (PR #140875)

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

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

Recently the Linux Kernel has fixed a bunch of issues in SME support and while 
testing that, I found two tests failing: FAIL: 
test_za_register_dynamic_config_main_disabled 
(TestZAThreadedDynamic.AArch64ZAThreadedTestCase) FAIL: 
test_za_register_dynamic_config_main_enabled 
(TestZAThreadedDynamic.AArch64ZAThreadedTestCase)

These tests write to vg during streaming mode from lldb and expect to see that 
za has been resized to match it. Instead, it was unavilable. lldb-server was 
sending the correct amount of data but lldb client was expect the old size.

Turns out that instead of a write to vg invalidating svg, it was 
invalidating... something else. I'm still not sure how these tests ever worked 
but with this one line fix, they pass again.

I did not see this issue with SVE or streaming SVE Z registers because those 
always resize using the value of vg, and vg always has the value we just wrote.

(remember that vg is the vector length of the **current** mode, not of 
non-streaming mode, whereas svg is the vector length of streaming mode, even if 
you are currently in non-streaming mode)

>From e91a16b051193d3d66228901bae9419e02238d72 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Wed, 21 May 2025 09:57:26 +
Subject: [PATCH] [lldb][AArch64] Correctly invalidate svg when vg is written

Recently the Linux Kernel has fixed a bunch of issues in SME support
and while testing that, I found two tests failing:
FAIL: test_za_register_dynamic_config_main_disabled 
(TestZAThreadedDynamic.AArch64ZAThreadedTestCase)
FAIL: test_za_register_dynamic_config_main_enabled 
(TestZAThreadedDynamic.AArch64ZAThreadedTestCase)

These tests write to vg during streaming mode from lldb and expect to see that 
za has been
resized to match it. Instead, it was unavilable. lldb-server was sending
the correct amount of data but lldb client was expect the old size.

Turns out that instead of a write to vg invalidating svg, it was invalidating...
something else. I'm still not sure how these tests ever worked but
with this one line fix, they pass again.

I did not see this issue with SVE or streaming SVE Z registers because
those always resize using the value of vg, and vg always has the value we
just wrote.

(remember that vg is the vector length of the **current** mode,
not of non-streaming mode, whereas svg is the vector length of streaming
mode, even if you are currently in non-streaming mode)
---
 lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
index c004c0f3c3cf5..f2095c150609f 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
@@ -425,7 +425,7 @@ void RegisterInfoPOSIX_arm64::AddRegSetSME(bool has_zt) {
   //
   // This must be added now, rather than when vg is defined because SME is a
   // dynamic set that may or may not be present.
-  static uint32_t vg_invalidates[] = {sme_regnum + 1 /*svg*/,
+  static uint32_t vg_invalidates[] = {first_sme_regnum + 1 /*svg*/,
   LLDB_INVALID_REGNUM};
   m_dynamic_reg_infos[GetRegNumSVEVG()].invalidate_regs = vg_invalidates;
 }

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


[Lldb-commits] [lldb] [lldb] Don't query the platform for each load command (PR #140853)

2025-05-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Tal Keren (talkeren)


Changes

This change remove the call to GetPlatform from GetDeploymentInfo and instead
pass it as an argument,so GetPlatform will be called only once for all the
load commands. The reason is that if we try to query the platform too early we
will get an invalid response which we won't cache, and since each call to
`GetProcessPlatformViaDYLDSPI` is slow, handling the load commands is getting
increasnigly slower when there are many of them.
  
See #140610

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


5 Files Affected:

- (modified) lldb/tools/debugserver/source/DNB.cpp (+10-3) 
- (modified) lldb/tools/debugserver/source/DNB.h (+10-9) 
- (modified) lldb/tools/debugserver/source/MacOSX/MachProcess.h (+2-1) 
- (modified) lldb/tools/debugserver/source/MacOSX/MachProcess.mm (+7-7) 
- (modified) lldb/tools/debugserver/source/RNBRemote.cpp (+4-3) 


``diff
diff --git a/lldb/tools/debugserver/source/DNB.cpp 
b/lldb/tools/debugserver/source/DNB.cpp
index f541134b43a1b..b59218456741f 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -1498,7 +1498,7 @@ nub_bool_t DNBProcessSharedLibrariesUpdated(nub_process_t 
pid) {
 
 std::optional
 DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
- const struct load_command &lc,
+ uint32_t dyld_platform, const struct load_command &lc,
  uint64_t load_command_address, uint32_t &major_version,
  uint32_t &minor_version, uint32_t &patch_version) {
   MachProcessSP procSP;
@@ -1507,8 +1507,8 @@ DNBGetDeploymentInfo(nub_process_t pid, bool 
is_executable,
 // macOS binary) is loaded with the macCatalyst dyld platform
 // override. The image info corrects for this, but qProcessInfo
 // will return what is in the binary.
-auto info =
-procSP->GetDeploymentInfo(lc, load_command_address, is_executable);
+auto info = procSP->GetDeploymentInfo(dyld_platform, lc,
+  load_command_address, is_executable);
 major_version = info.major_version;
 minor_version = info.minor_version;
 patch_version = info.patch_version;
@@ -1521,6 +1521,13 @@ DNBGetDeploymentInfo(nub_process_t pid, bool 
is_executable,
   return {};
 }
 
+uint32_t DNBGetPlatform(nub_process_t pid) {
+  MachProcessSP procSP;
+  if (GetProcessSP(pid, procSP))
+return procSP->GetPlatform();
+  return 0;
+}
+
 // Get the current shared library information for a process. Only return
 // the shared libraries that have changed since the last shared library
 // state changed event if only_changed is non-zero.
diff --git a/lldb/tools/debugserver/source/DNB.h 
b/lldb/tools/debugserver/source/DNB.h
index 10d1f68794355..5475e691c7a93 100644
--- a/lldb/tools/debugserver/source/DNB.h
+++ b/lldb/tools/debugserver/source/DNB.h
@@ -52,15 +52,15 @@ nub_process_t DNBProcessLaunch(
 
 nub_process_t DNBProcessGetPIDByName(const char *name);
 nub_process_t DNBProcessAttach(nub_process_t pid, struct timespec *timeout,
-   const RNBContext::IgnoredExceptions 
-   &ignored_exceptions, 
-   char *err_str,
-   size_t err_len);
+ const RNBContext::IgnoredExceptions 
+&ignored_exceptions,
+ char *err_str,
+size_t err_len);
 nub_process_t DNBProcessAttachByName(const char *name, struct timespec 
*timeout,
- const RNBContext::IgnoredExceptions 
- &ignored_exceptions, 
- char *err_str,
- size_t err_len);
+   const RNBContext::IgnoredExceptions 
+&ignored_exceptions,
+   char *err_str,
+size_t err_len);
 nub_process_t DNBProcessAttachWait(RNBContext *ctx, const char *wait_name,
bool ignore_existing,
struct timespec *timeout,
@@ -137,9 +137,10 @@ DNBProcessGetSharedLibraryInfo(nub_process_t pid, 
nub_bool_t only_changed,
DNBExecutableImageInfo **image_infos) 
DNB_EXPORT;
 std::optional
 DNBGetDeploymentInfo(nub_process_t pid, bool is_executable,
- const struct load_command &lc,
+ uint32_t dyld_platform, const struct load_command &lc,
  uint64_t load_command_address, uint32_t &major_version,
  uint32_t &minor_version, uint32_t &patch_version);
+uint32_t DNBGetPlatform(nub_process_t pid);
 nub_bool_t DNBProcessSetNameToAddressCallback(nub_process_t pid,
   DNBCallbackNameToAddress 
callback,
   void *baton) DNB_EXPORT;
diff --git a/lldb/tools/debu

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

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

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

>From 2ee16e3911bd1c93618f63f5068dcdcaf389e46c Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 18 May 2025 20:56:47 +0200
Subject: [PATCH 1/5] [lldb-dap] Attempt to synchronously wait for breakpoints
 resolve in lldb-dap tests in order to stabilize the tests

---
 .../test/tools/lldb-dap/dap_server.py |  6 +++--
 .../test/tools/lldb-dap/lldbdap_testcase.py   | 26 +--
 .../breakpoint/TestDAP_setBreakpoints.py  |  1 -
 .../TestDAP_setFunctionBreakpoints.py |  1 -
 .../tools/lldb-dap/module/TestDAP_module.py   |  4 ++-
 .../TestDAP_terminatedEvent.py|  6 +++--
 ...TestGetTargetBreakpointsRequestHandler.cpp | 10 +--
 7 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 9937618a2cf54..4676f03eb6bd5 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -1188,7 +1188,7 @@ def request_locations(self, locationReference):
 }
 return self.send_recv(command_dict)
 
-def request_testGetTargetBreakpoints(self):
+def request_testGetTargetBreakpoints(self, only_resolved=False):
 """A request packet used in the LLDB test suite to get all currently
 set breakpoint infos for all breakpoints currently set in the
 target.
@@ -1196,7 +1196,9 @@ def request_testGetTargetBreakpoints(self):
 command_dict = {
 "command": "_testGetTargetBreakpoints",
 "type": "request",
-"arguments": {},
+"arguments": {
+"onlyResolved": only_resolved,
+},
 }
 return self.send_recv(command_dict)
 
diff --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 4028ae4a2525f..67774be7af750 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -48,7 +48,7 @@ def build_and_create_debug_adapter_for_attach(self):
 self.build_and_create_debug_adapter(dictionary={"EXE": unique_name})
 return self.getBuildArtifact(unique_name)
 
-def set_source_breakpoints(self, source_path, lines, data=None):
+def set_source_breakpoints(self, source_path, lines, data=None, 
wait_for_resolve=True):
 """Sets source breakpoints and returns an array of strings containing
 the breakpoint IDs ("1", "2") for each breakpoint that was set.
 Parameter data is array of data objects for breakpoints.
@@ -62,9 +62,11 @@ def set_source_breakpoints(self, source_path, lines, 
data=None):
 breakpoint_ids = []
 for breakpoint in breakpoints:
 breakpoint_ids.append("%i" % (breakpoint["id"]))
+if wait_for_resolve:
+self.wait_for_breakpoints_to_resolve(breakpoint_ids, timeout=10)
 return breakpoint_ids
 
-def set_function_breakpoints(self, functions, condition=None, 
hitCondition=None):
+def set_function_breakpoints(self, functions, condition=None, 
hitCondition=None, wait_for_resolve=True):
 """Sets breakpoints by function name given an array of function names
 and returns an array of strings containing the breakpoint IDs
 ("1", "2") for each breakpoint that was set.
@@ -78,7 +80,27 @@ def set_function_breakpoints(self, functions, 
condition=None, hitCondition=None)
 breakpoint_ids = []
 for breakpoint in breakpoints:
 breakpoint_ids.append("%i" % (breakpoint["id"]))
+if wait_for_resolve:
+self.wait_for_breakpoints_to_resolve(breakpoint_ids, timeout=10)
 return breakpoint_ids
+
+def wait_for_breakpoints_to_resolve(self, breakpoint_ids: list[str], 
timeout: Optional[float] = None):
+unresolved_breakpoints = set(breakpoint_ids)
+
+# Check already resolved breakpoints
+resolved_breakpoints = 
self.dap_server.request_testGetTargetBreakpoints(only_resolved=True)["body"]["breakpoints"]
+for resolved_breakpoint in resolved_breakpoints:
+unresolved_breakpoints.discard(str(resolved_breakpoint["id"]))
+
+while len(unresolved_breakpoints) > 0:
+breakpoint_event = self.dap_server.wait_for_event("breakpoint", 
timeout=timeout)
+if breakpoint_event is None:
+break
+
+if breakpoint_event["body"]["reason"] in ["changed", "new"]:
+
unresolved_breakpoints.discard(str(breakpoint_event["body"]["breakpoint"]["id"]))
+
+self.assertEqual(len(unresolved_breakpoints), 0, f"Expected to resolve 
all breakpoints. Unresolved breakpoint ids: {unresolve

[Lldb-commits] [lldb] [lldb] Don't query the platform for each load command (PR #140853)

2025-05-21 Thread via lldb-commits

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write 
permissions for the repository. In which case you can instead tag reviewers by 
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a 
review by "ping"ing the PR by adding a comment “Ping”. The common courtesy 
"ping" rate is once a week. Please remember that you are asking for valuable 
time from other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

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


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

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


@@ -62,9 +64,13 @@ def set_source_breakpoints(self, source_path, lines, 
data=None):
 breakpoint_ids = []
 for breakpoint in breakpoints:
 breakpoint_ids.append("%i" % (breakpoint["id"]))
+if wait_for_resolve:
+self.wait_for_breakpoints_to_resolve(breakpoint_ids, timeout=10)

eronnen wrote:

:100: 

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


[Lldb-commits] [lldb] [lldb][lldb-dap][tests] Make sure evaluate test exists with no errors. (PR #140788)

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


@@ -45,20 +43,34 @@ def run_test_evaluate_expressions(
 enableAutoVariableSummaries=enableAutoVariableSummaries,
 )
 source = "main.cpp"
-self.set_source_breakpoints(
-source,
-[
-line_number(source, "// breakpoint 1"),
-line_number(source, "// breakpoint 2"),
-line_number(source, "// breakpoint 3"),
-line_number(source, "// breakpoint 4"),
-line_number(source, "// breakpoint 5"),
-line_number(source, "// breakpoint 6"),
-line_number(source, "// breakpoint 7"),
-line_number(source, "// breakpoint 8"),
-],
+breakpoint_lines = [
+line_number(source, "// breakpoint 1"),
+line_number(source, "// breakpoint 2"),
+line_number(source, "// breakpoint 3"),
+line_number(source, "// breakpoint 4"),
+line_number(source, "// breakpoint 5"),
+line_number(source, "// breakpoint 6"),
+line_number(source, "// breakpoint 7"),
+line_number(source, "// breakpoint 8"),
+]
+breakpoint_ids = self.set_source_breakpoints(source, breakpoint_lines)
+
+self.assertEqual(
+len(breakpoint_ids),
+len(breakpoint_lines),
+"Did not resolve all the breakpoints.",
 )
-self.continue_to_next_stop()
+(
+breakpoint_1,
+breakpoint_2,
+breakpoint_3,
+breakpoint_4,
+breakpoint_5,
+breakpoint_6,
+breakpoint_7,
+breakpoint_8,
+) = breakpoint_ids

eronnen wrote:

wouldn't it be simpler to just access by index?

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


[Lldb-commits] [lldb] [lldb] optionally match the `__debug` namespace for libstdc++ containers. (PR #140727)

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


@@ -1731,8 +1737,11 @@ lldb::TypeCategoryImplSP 
CPlusPlusLanguage::GetFormatters() {
 DataVisualization::Categories::GetCategory(ConstString(GetPluginName()),
g_category);
 if (g_category) {
-  LoadLibStdcppFormatters(g_category);
+  // NOTE: the libstdcpp formatters are loaded after libcxx formatters
+  // because of a conflict matching the `__debug`namespace in libstdcpp.

Michael137 wrote:

```suggestion
  // because we don't want to the libcxx formatters to match the potential 
`__debug` inline namespace that libstdcpp may use.
```

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


[Lldb-commits] [lldb] [lldb] optionally match the `__debug` namespace for libstdc++ containers. (PR #140727)

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


@@ -2,10 +2,14 @@
 Test lldb data formatter subsystem.
 """
 
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import add_test_categories, expectedFailureAll, 
skip
+from lldbsuite.test.lldbtest import (
+CURRENT_EXECUTABLE_SET,
+RUN_SUCCEEDED,
+STOPPED_DUE_TO_BREAKPOINT,
+TestBase,
+line_number,
+)

Michael137 wrote:

I'm no Python expert but I'd say lets we revert these back to keep the style as 
we do in all the other tests (and because it's drive-by change)

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


[Lldb-commits] [lldb] [lldb] optionally match the `__debug` namespace for libstdc++ containers. (PR #140727)

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


@@ -1731,8 +1737,11 @@ lldb::TypeCategoryImplSP 
CPlusPlusLanguage::GetFormatters() {
 DataVisualization::Categories::GetCategory(ConstString(GetPluginName()),
g_category);
 if (g_category) {
-  LoadLibStdcppFormatters(g_category);
+  // NOTE: the libstdcpp formatters are loaded after libcxx formatters
+  // because of a conflict matching the `__debug`namespace in libstdcpp.
+  // since lldb priorities the last loaded matching formatter.

Michael137 wrote:

```suggestion
  // since LLDB priortizes the last loaded matching formatter.
```

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


[Lldb-commits] [lldb] [lldb] optionally match the `__debug` namespace for libstdc++ containers. (PR #140727)

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


@@ -48,10 +65,13 @@ def cleanup():
 
 self.runCmd("frame variable ii --show-types")
 
+match = f"std::{namespace}map<"
 self.runCmd(
-'type summary add -x "std::map<" --summary-string "map has 
${svar%#} items" -e'
+f'type summary add -x "{match}" --summary-string "map has 
${{svar%#}} items" -e'
 )
 
+# self.assertFalse(True, match)

Michael137 wrote:

?

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


[Lldb-commits] [lldb] [lldb] optionally match the `__debug` namespace for libstdc++ containers. (PR #140727)

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


@@ -19,9 +23,22 @@ def setUp(self):
 @add_test_categories(["libstdcxx"])
 @expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
 def test_with_run_command(self):
+build_args = {"EXE": "a.out"}
+self.with_run_command("", build_args)
+
+@add_test_categories(["libstdcxx"])
+@expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
+def test_with_run_command_debug(self):
+build_args = {"CXXFLAGS": "-D_GLIBCXX_DEBUG", "EXE": "debug_a.out"}

Michael137 wrote:

Why does the `EXE` need to be different here? I think setting `CXXFLAGS` should 
be sufficient?

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


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

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


@@ -74,9 +74,11 @@ lldb::ChildCacheState GenericOptionalFrontend::Update() {
 
   if (m_stdlib == StdLib::LibCxx)
 engaged_sp = m_backend.GetChildMemberWithName("__engaged_");
-  else if (m_stdlib == StdLib::LibStdcpp)
-engaged_sp = m_backend.GetChildMemberWithName("_M_payload")
- ->GetChildMemberWithName("_M_engaged");
+  else if (m_stdlib == StdLib::LibStdcpp) {
+ValueObjectSP payload = m_backend.GetChildMemberWithName("_M_payload");
+if (payload)

Michael137 wrote:

```suggestion
if (ValueObjectSP payload = m_backend.GetChildMemberWithName("_M_payload"))
```

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


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

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


@@ -379,7 +379,7 @@ LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() 
{
 
 lldb::ValueObjectSP
 LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
-  if (idx == 0)
+  if (idx == 0 && m_ptr_obj)

Michael137 wrote:

```suggestion
  if (!m_ptr_obj)
return nullptr;

  if (idx == 0)
```

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


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

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


@@ -683,14 +683,14 @@ def _get_compilation_command(self, source, obj):
 args.append("-fms-compatibility-version=19")
 args.append("/c")
 
+if self.std:

Michael137 wrote:

Why is this change necessary?

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


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

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


@@ -0,0 +1,57 @@
+// clang-format off
+
+// REQUIRES: target-windows
+// RUN: %build --compiler=clang-cl -o %t.exe --std c++20 -- %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "run" 
-o "fr v" -o c | FileCheck %s
+
+#include 

Michael137 wrote:

Are we not running the data-formatter tests on Windows at all? There's 
definitely tests for all of these elsewhere in the API test-suite

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


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

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

https://github.com/Michael137 commented:

Seems like a fine stop-gap for now to avoid crashing

Just left some clarification questions

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


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

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

Michael137 wrote:

FYI @charles-zablit 

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


[Lldb-commits] [lldb] [lldb][AArch64] Correctly invalidate svg when vg is written (PR #140875)

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

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


[Lldb-commits] [lldb] [lldb][AArch64] Correctly invalidate svg when vg is written (PR #140875)

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

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


[Lldb-commits] [lldb] [lldb][AArch64] Correctly invalidate svg when vg is written (PR #140875)

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

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


[Lldb-commits] [lldb] [LLDB] Ptrace seize dead processes on Linux (PR #137041)

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

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


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

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


@@ -0,0 +1,57 @@
+// clang-format off
+
+// REQUIRES: target-windows
+// RUN: %build --compiler=clang-cl -o %t.exe --std c++20 -- %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "run" 
-o "fr v" -o c | FileCheck %s
+
+#include 

Michael137 wrote:

The tests in `lldb/test/API/functionalities/data-formatter/data-formatter-stl`

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


[Lldb-commits] [lldb] [Demangling] Refactor Demangler range tracking (PR #140762)

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


@@ -59,10 +59,24 @@ struct DemangledNameInfo {
   /// \endcode
   std::pair QualifiersRange;
 
+  /// Indicates the [start, end) of the function's prefix. This is a
+  /// catch-all range for anything that is not tracked by the rest of
+  /// the pairs.
+  std::pair PrefixRange;
+
+  /// Indicates the [start, end) of the function's suffix. This is a
+  /// catch-all range for anything that is not tracked by the rest of
+  /// the pairs.
+  std::pair SuffixRange;
+
   /// Returns \c true if this object holds a valid basename range.
   bool hasBasename() const {
-return BasenameRange.second > BasenameRange.first &&
-   BasenameRange.second > 0;
+return BasenameRange.second > BasenameRange.first;
+  }
+
+  /// Returns \c true if this object holds a valid arguments range.
+  bool hasArguments() const {

Michael137 wrote:

This seems unused?

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


[Lldb-commits] [lldb] [Demangling] Refactor Demangler range tracking (PR #140762)

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


@@ -59,10 +59,24 @@ struct DemangledNameInfo {
   /// \endcode
   std::pair QualifiersRange;
 
+  /// Indicates the [start, end) of the function's prefix. This is a
+  /// catch-all range for anything that is not tracked by the rest of
+  /// the pairs.
+  std::pair PrefixRange;
+
+  /// Indicates the [start, end) of the function's suffix. This is a
+  /// catch-all range for anything that is not tracked by the rest of
+  /// the pairs.
+  std::pair SuffixRange;
+
   /// Returns \c true if this object holds a valid basename range.
   bool hasBasename() const {
-return BasenameRange.second > BasenameRange.first &&
-   BasenameRange.second > 0;
+return BasenameRange.second > BasenameRange.first;

Michael137 wrote:

Can you elaborate why this was needed?

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


[Lldb-commits] [lldb] [lldb][AArch64] Correctly invalidate svg when vg is written (PR #140875)

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

DavidSpickett wrote:

Candidates for how it ever worked:
* Out of bounds write managing to break something else in just the right way. 
Then adding new extension registers meant it was invalidating registers again, 
probably guarded control stack registers.
* LLDB got less aggressive about re-reading registers. As you can "fix" this by 
re-reading svg a few times manually.
* These tests were actually flaky because of this bug and I put that down to 
difficulties running in simulation instead of investigating properly.

In these new patches there are some ptrace changes but nothing in lldb-server 
needed to change, and this mistake is so clear in hindsight, that I don't think 
it's a ptrace ABI difference.

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


[Lldb-commits] [clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)

2025-05-21 Thread Martin Storsjö via lldb-commits

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

LGTM

IIRC @petrhosek had commented on this before, and was generally in favour of 
it, but I'd still leave it open for a couple days if he wants to comment 
further on it.

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


[Lldb-commits] [lldb] [Demangling] Refactor Demangler range tracking (PR #140762)

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


@@ -88,6 +88,7 @@ struct Entry {
 FunctionNameWithArgs,
 FunctionNameNoArgs,
 FunctionMangledName,
+FunctionPrefix,

Michael137 wrote:

If we add a new variable here we will need to update the documentation under 
`lldb/docs/use/formatting.rst`

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


[Lldb-commits] [lldb] [LLDB] Ptrace seize dead processes on Linux (PR #137041)

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

DavidSpickett wrote:

> I added my gist to the description, let me know what you think

This part looks good, that'll be enough to test this / explain why it exists.

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


[Lldb-commits] [lldb] [Demangling] Refactor Demangler range tracking (PR #140762)

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


@@ -6,7 +6,7 @@ add_lldb_unittest(LLDBCoreTests
   DumpDataExtractorTest.cpp
   DumpRegisterInfoTest.cpp
   FormatEntityTest.cpp
-  MangledTest.cpp
+  ItaniumMangledTest.cpp

Michael137 wrote:

I don't mind renaming the file but there are already swift mangling tests in 
this file, so `ItaniumMangled` isn't quite correct. What's the motivation for 
the rename?

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


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

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


@@ -422,8 +431,27 @@ def wait_for_breakpoint_events(self, timeout: 
Optional[float] = None):
 if not event:
 break
 breakpoint_events.append(event)
+
+self._update_verified_breakpoints(

eronnen wrote:

:100: 

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


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

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


@@ -1011,7 +1042,10 @@ def request_setFunctionBreakpoints(self, names, 
condition=None, hitCondition=Non
 "type": "request",
 "arguments": args_dict,
 }
-return self.send_recv(command_dict)
+response = self.send_recv(command_dict)
+breakpoints = response["body"]["breakpoints"]

eronnen wrote:

:100: 

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


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

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


@@ -985,7 +1013,10 @@ def request_setBreakpoints(self, file_path, line_array, 
data=None):
 "type": "request",
 "arguments": args_dict,
 }
-return self.send_recv(command_dict)
+response = self.send_recv(command_dict)
+breakpoints = response["body"]["breakpoints"]

eronnen wrote:

:100: 

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


[Lldb-commits] [lldb] [lldb-dap] fix disassembly request instruction offset handling (PR #140486)

2025-05-21 Thread Med Ismail Bennani via lldb-commits

medismailben wrote:

Hey @eronnen, I think this change broke the macOS lldb incremental bot: 
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/26259/execution/node/106/log/?consoleFull

Let me know if you need help to investigate it or if we should revert it if you 
don't have time to take a look.

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


[Lldb-commits] [lldb] [lldb-dap] Test gardening, enabling tests and improving doc comments. (PR #140777)

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


@@ -1102,3 +1103,28 @@ def is_feature_enabled():
 return "%s is not supported on this system." % feature
 
 return skipTestIfFn(is_feature_enabled)
+
+
+def skipIfBinaryToLarge(path: Optional[str], maxSize: int):
+"""Skip the test if a binary is to large.
+
+We skip this test for debug builds because it takes too long
+parsing lldb's own debug info. Release builds are fine.
+Checking the size of the lldb-dap binary seems to be a decent
+proxy for a quick detection. It should be far less than 1 MB in
+Release builds.
+"""
+
+def check_binary_size():
+if not path or not os.path.exists(path):
+return "invalid path"
+
+try:
+size = os.path.getsize(path)
+if size <= maxSize:
+return None
+return f"binary {path} (size = {size} is to larger than {maxSize}"
+except:
+return f"failed to read size of {path}"
+
+return skipTestIfFn(check_binary_size)

da-viper wrote:

[build_type.txt](https://github.com/user-attachments/files/20377561/build_type.txt)

I created a patch file with the basic build type. you can adjust it to match 
the correct build type. 

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


[Lldb-commits] [lldb] [lldb-dap] attempt to fix test_disassemble (PR #140975)

2025-05-21 Thread Med Ismail Bennani via lldb-commits

medismailben wrote:

That doesn't solve the issue:

```
  File 
"/Users/mib/Developer/open-source/llvm.org/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py",
 line 28, in test_disassemble
self.assertIn("location", pc_assembly, "Source location missing.")
AssertionError: 'location' not found in {'address': '0x10554', 
'instruction': 'ldr w8, [sp, #0x4]', 'instructionBytes': 'e8 07 40 b9'} : 
Source location missing.
```

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


[Lldb-commits] [lldb] [test] Fix dissassemble-entry-point.s for #140187 (PR #140978)

2025-05-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pat Doyle (patdoyle-google)


Changes

similar to #140570

getting this error:

exit status 1
ld.lld: error: section '.text' address (0x8074) is smaller than image base 
(0x1); specify --image-base

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


1 Files Affected:

- (modified) lldb/test/Shell/SymbolFile/dissassemble-entry-point.s (+2-2) 


``diff
diff --git a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s 
b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
index c8059990237a1..2f74f6acad0ed 100644
--- a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
+++ b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
@@ -1,7 +1,7 @@
 # REQUIRES: lld, arm
 
 # RUN: llvm-mc -triple=thumbv7-eabi %s -filetype=obj -o %t.o
-# RUN: ld.lld %t.o -o %t --section-start=.text=0x8074 -e 0x8075 -s
+# RUN: ld.lld %t.o -o %t --image-base=0x8074 --section-start=.text=0x8074 -e 
0x8075 -s
 # RUN: %lldb -x -b -o 'dis -s 0x8074 -e 0x8080' -- %t | FileCheck %s
 # CHECK:  {{.*}}[0x8074] <+0>: movs   r0, #0x2a
 # CHECK-NEXT: {{.*}}[0x8076] <+2>: movs   r7, #0x1
@@ -10,4 +10,4 @@
 _start:
 movs r0, #0x2a
 movs r7, #0x1
-svc #0x0
\ No newline at end of file
+svc #0x0

``




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


[Lldb-commits] [lldb] [test] Fix dissassemble-entry-point.s for #140187 (PR #140978)

2025-05-21 Thread Pat Doyle via lldb-commits

https://github.com/patdoyle-google created 
https://github.com/llvm/llvm-project/pull/140978

similar to #140570

getting this error:

exit status 1
ld.lld: error: section '.text' address (0x8074) is smaller than image base 
(0x1); specify --image-base

>From 0483de4c38c49fbda6a7965d246c0a5423c47b65 Mon Sep 17 00:00:00 2001
From: Pat Doyle 
Date: Wed, 21 May 2025 18:32:59 -0700
Subject: [PATCH] Update dissassemble-entry-point.s

---
 lldb/test/Shell/SymbolFile/dissassemble-entry-point.s | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s 
b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
index c8059990237a1..2f74f6acad0ed 100644
--- a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
+++ b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
@@ -1,7 +1,7 @@
 # REQUIRES: lld, arm
 
 # RUN: llvm-mc -triple=thumbv7-eabi %s -filetype=obj -o %t.o
-# RUN: ld.lld %t.o -o %t --section-start=.text=0x8074 -e 0x8075 -s
+# RUN: ld.lld %t.o -o %t --image-base=0x8074 --section-start=.text=0x8074 -e 
0x8075 -s
 # RUN: %lldb -x -b -o 'dis -s 0x8074 -e 0x8080' -- %t | FileCheck %s
 # CHECK:  {{.*}}[0x8074] <+0>: movs   r0, #0x2a
 # CHECK-NEXT: {{.*}}[0x8076] <+2>: movs   r7, #0x1
@@ -10,4 +10,4 @@
 _start:
 movs r0, #0x2a
 movs r7, #0x1
-svc #0x0
\ No newline at end of file
+svc #0x0

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


[Lldb-commits] [lldb] [test] Fix dissassemble-entry-point.s for #140187 (PR #140978)

2025-05-21 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [test] Fix dissassemble-entry-point.s for #140187 (PR #140978)

2025-05-21 Thread Pat Doyle via lldb-commits

https://github.com/patdoyle-google updated 
https://github.com/llvm/llvm-project/pull/140978

>From 0483de4c38c49fbda6a7965d246c0a5423c47b65 Mon Sep 17 00:00:00 2001
From: Pat Doyle 
Date: Wed, 21 May 2025 18:32:59 -0700
Subject: [PATCH 1/2] Update dissassemble-entry-point.s

---
 lldb/test/Shell/SymbolFile/dissassemble-entry-point.s | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s 
b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
index c8059990237a1..2f74f6acad0ed 100644
--- a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
+++ b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
@@ -1,7 +1,7 @@
 # REQUIRES: lld, arm
 
 # RUN: llvm-mc -triple=thumbv7-eabi %s -filetype=obj -o %t.o
-# RUN: ld.lld %t.o -o %t --section-start=.text=0x8074 -e 0x8075 -s
+# RUN: ld.lld %t.o -o %t --image-base=0x8074 --section-start=.text=0x8074 -e 
0x8075 -s
 # RUN: %lldb -x -b -o 'dis -s 0x8074 -e 0x8080' -- %t | FileCheck %s
 # CHECK:  {{.*}}[0x8074] <+0>: movs   r0, #0x2a
 # CHECK-NEXT: {{.*}}[0x8076] <+2>: movs   r7, #0x1
@@ -10,4 +10,4 @@
 _start:
 movs r0, #0x2a
 movs r7, #0x1
-svc #0x0
\ No newline at end of file
+svc #0x0

>From 8b875c23b335c0c7b33f81ac1b814aa759d5655e Mon Sep 17 00:00:00 2001
From: Pat Doyle 
Date: Wed, 21 May 2025 18:50:08 -0700
Subject: [PATCH 2/2] Update dissassemble-entry-point.s

---
 lldb/test/Shell/SymbolFile/dissassemble-entry-point.s | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s 
b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
index 2f74f6acad0ed..d84374fedaf6a 100644
--- a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
+++ b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
@@ -1,7 +1,7 @@
 # REQUIRES: lld, arm
 
 # RUN: llvm-mc -triple=thumbv7-eabi %s -filetype=obj -o %t.o
-# RUN: ld.lld %t.o -o %t --image-base=0x8074 --section-start=.text=0x8074 -e 
0x8075 -s
+# RUN: ld.lld %t.o -o %t --image-base=0x8000 --section-start=.text=0x8074 -e 
0x8075 -s
 # RUN: %lldb -x -b -o 'dis -s 0x8074 -e 0x8080' -- %t | FileCheck %s
 # CHECK:  {{.*}}[0x8074] <+0>: movs   r0, #0x2a
 # CHECK-NEXT: {{.*}}[0x8076] <+2>: movs   r7, #0x1

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


[Lldb-commits] [lldb] [test] Fix dissassemble-entry-point.s for #140187 (PR #140978)

2025-05-21 Thread Pat Doyle via lldb-commits


@@ -1,7 +1,7 @@
 # REQUIRES: lld, arm
 
 # RUN: llvm-mc -triple=thumbv7-eabi %s -filetype=obj -o %t.o
-# RUN: ld.lld %t.o -o %t --section-start=.text=0x8074 -e 0x8075 -s
+# RUN: ld.lld %t.o -o %t --image-base=0x8074 --section-start=.text=0x8074 -e 
0x8075 -s

patdoyle-google wrote:

done, thanks!

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


[Lldb-commits] [lldb] [test] Fix dissassemble-entry-point.s for #140187 (PR #140978)

2025-05-21 Thread Pat Doyle via lldb-commits

patdoyle-google wrote:

btw I don't have commit access yet so if you could merge for me that would be 
lovely :)

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


[Lldb-commits] [lldb] Fix a bug where using "thread backtrace unique" would switch you to (PR #140993)

2025-05-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (jimingham)


Changes

always using the "frame-format-unique" even when you weren't doing the unique 
backtrace mode.

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


2 Files Affected:

- (modified) lldb/source/Commands/CommandObjectThreadUtil.cpp (+2) 
- (modified) lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py 
(+17-1) 


``diff
diff --git a/lldb/source/Commands/CommandObjectThreadUtil.cpp 
b/lldb/source/Commands/CommandObjectThreadUtil.cpp
index cdc5946547f47..a451de137d702 100644
--- a/lldb/source/Commands/CommandObjectThreadUtil.cpp
+++ b/lldb/source/Commands/CommandObjectThreadUtil.cpp
@@ -37,6 +37,8 @@ void CommandObjectIterateOverThreads::DoExecute(Args &command,
   result.SetStatus(m_success_return);
 
   bool all_threads = false;
+  m_unique_stacks = false;
+
   if (command.GetArgumentCount() == 0) {
 Thread *thread = m_exe_ctx.GetThreadPtr();
 if (thread)
diff --git a/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py 
b/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
index ee9b14f15b6e9..40bc2a175c2f9 100644
--- a/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
+++ b/lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
@@ -132,10 +132,26 @@ def is_thread3(thread):
 # Construct our expected back trace string
 expect_string = "10 thread(s)%s" % (expect_threads)
 
+# There was a bug where if you used 'thread backtrace unique'
+# we would switch all future backtraces to use the
+# "frame-format-unique" not the "frame-format".  Make
+# sure we don't do that...
+setting_data = self.dbg.GetSetting("frame-format-unique")
+setting_str = setting_data.GetStringValue(1000)
+setting_str = "UNIQUE: " + setting_str
+lldb.SBDebugger.SetInternalVariable("frame-format-unique", 
setting_str, self.dbg.GetInstanceName())
 # Now that we are stopped, we should have 10 threads waiting in the
 # thread3 function. All of these threads should show as one stack.
 self.expect(
 "thread backtrace unique",
 "Backtrace with unique stack shown correctly",
-substrs=[expect_string, "main.cpp:%d" % 
self.thread3_before_lock_line],
+substrs=[expect_string, "UNIQUE:", "main.cpp:%d" % 
self.thread3_before_lock_line],
+)
+# Make sure setting the unique flag in the command isn't
+# persistent:
+self.expect(
+"thread backtrace",
+"Backtrace unique is not sticky",
+substrs=["UNIQUE:"],
+matching=False
 )

``




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


[Lldb-commits] [lldb] Fix a bug where using "thread backtrace unique" would switch you to (PR #140993)

2025-05-21 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r HEAD~1...HEAD 
lldb/test/API/functionalities/thread/num_threads/TestNumThreads.py
``





View the diff from darker here.


``diff
--- TestNumThreads.py   2025-05-22 02:44:29.00 +
+++ TestNumThreads.py   2025-05-22 02:47:37.902846 +
@@ -137,21 +137,27 @@
 # "frame-format-unique" not the "frame-format".  Make
 # sure we don't do that...
 setting_data = self.dbg.GetSetting("frame-format-unique")
 setting_str = setting_data.GetStringValue(1000)
 setting_str = "UNIQUE: " + setting_str
-lldb.SBDebugger.SetInternalVariable("frame-format-unique", 
setting_str, self.dbg.GetInstanceName())
+lldb.SBDebugger.SetInternalVariable(
+"frame-format-unique", setting_str, self.dbg.GetInstanceName()
+)
 # Now that we are stopped, we should have 10 threads waiting in the
 # thread3 function. All of these threads should show as one stack.
 self.expect(
 "thread backtrace unique",
 "Backtrace with unique stack shown correctly",
-substrs=[expect_string, "UNIQUE:", "main.cpp:%d" % 
self.thread3_before_lock_line],
+substrs=[
+expect_string,
+"UNIQUE:",
+"main.cpp:%d" % self.thread3_before_lock_line,
+],
 )
 # Make sure setting the unique flag in the command isn't
 # persistent:
 self.expect(
 "thread backtrace",
 "Backtrace unique is not sticky",
 substrs=["UNIQUE:"],
-matching=False
+matching=False,
 )

``




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


[Lldb-commits] [clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)

2025-05-21 Thread Petr Hosek via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Convert Maintainers file from reStructuredText -> Markdown (PR #140958)

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

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

Convert the Maintainers file from reStructuredText to Markdown and include 
links to GitHub and Discouse. The new layout improves readability, makes it 
easier to navigate from GitHub and matches LLVM's Maintainer's file [1].

[1] https://github.com/llvm/llvm-project/blob/main/llvm/Maintainers.md

>From 6992440641da20218e550cc97bd27eb45437423c Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Wed, 21 May 2025 13:03:12 -0700
Subject: [PATCH] [lldb] Convert Maintainers file from reStructuredText ->
 Markdown

Convert the Maintainers file from reStructuredText to Markdown and
include links to GitHub and Discouse. The new layout improves
readability, makes it easier to navigate from GitHub and matches LLVM's
Maintainer's file [1].

[1] https://github.com/llvm/llvm-project/blob/main/llvm/Maintainers.md
---
 lldb/Maintainers.md  | 241 
 lldb/Maintainers.rst | 256 ---
 2 files changed, 241 insertions(+), 256 deletions(-)
 create mode 100644 lldb/Maintainers.md
 delete mode 100644 lldb/Maintainers.rst

diff --git a/lldb/Maintainers.md b/lldb/Maintainers.md
new file mode 100644
index 0..b15c62644f4ba
--- /dev/null
+++ b/lldb/Maintainers.md
@@ -0,0 +1,241 @@
+# LLDB Maintainers
+
+This file is a list of the 
[maintainers](https://llvm.org/docs/DeveloperPolicy.html#maintainers) for LLDB.
+
+## Current Maintainers
+
+The following people are the active maintainers for the project. Please reach 
out to them for code reviews, questions about their area of expertise, or other 
assistance.
+
+### Lead Maintainer
+
+Responsible for project as a whole, and for any areas not covered by a 
specific maintainer.
+
+Jonas Devlieghere
+jo...@devlieghere.com (email), [jdevlieghere](https://github.com/jdevlieghere) 
(GitHub), [jdevlieghere](https://discourse.llvm.org/u/jdevlieghere) 
(Discourse), jdevlieghere (Discord)
+
+### Components
+
+These maintainers are responsible for particular high-level components within 
LLDB.
+
+ ABI
+
+Jason Molenda
+jmole...@apple.com (email), [jasonmolenda](https://github.com/jasonmolenda) 
(GitHub), [jasonmolenda](https://discourse.llvm.org/u/jasonmolenda) 
(Discourse), jasonmolenda (Discord)
+
+David Spickett
+david.spick...@linaro.org (email), 
[DavidSpickett](https://github.com/DavidSpickett) (GitHub), 
[DavidSpickett](https://discourse.llvm.org/u/DavidSpickett) (Discourse), 
davidspickett (Discord)
+
+ Breakpoint
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+ CMake & Build System
+
+Jonas Devlieghere
+jo...@devlieghere.com (email), [jdevlieghere](https://github.com/jdevlieghere) 
(GitHub), [jdevlieghere](https://discourse.llvm.org/u/jdevlieghere) 
(Discourse), jdevlieghere (Discord)
+
+Alex Langford
+alangf...@apple.com (email), [bulbazord](https://github.com/bulbazord) 
(GitHub), [bulbazord](https://discourse.llvm.org/u/bulbazord) (Discourse), 
bulba_zord (Discord)
+
+ Commands
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+ Expression Parser
+
+Michael Buch
+michaelbuc...@gmail.com (email), [Michael137](https://github.com/Michael137) 
(GitHub), [Michael137](https://discourse.llvm.org/u/Michael137) (Discourse)
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+ Interpreter
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+Greg Clayton
+gclay...@fb.com (email), [clayborg](https://github.com/clayborg) (GitHub), 
[clayborg](https://discourse.llvm.org/u/clayborg) (Discourse)
+
+ Lua
+
+Jonas Delvieghere
+jo...@devlieghere.com (email), [jdevlieghere](https://github.com/jdevlieghere) 
(GitHub), [jdevlieghere](https://discourse.llvm.org/u/jdevlieghere) 
(Discourse), jdevlieghere (Discord)
+
+ Python
+
+Med Ismail Bennani
+ism...@bennani.ma (email), [medismailben](https://github.com/medismailben) 
(GitHub), [mib](https://discourse.llvm.org/u/mib) (Discourse), mib#8727 
(Discord)
+
+ Target/Process Control
+
+Med Ismail Bennani
+ism...@bennani.ma (email), [medismailben](https://github.com/medismailben) 
(GitHub), [mib](https://discourse.llvm.org/u/mib) (Discourse), mib#8727 
(Discord)
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+ Test Suite
+
+Jonas Devlieghere
+jo...@devlieghere.com (email), [jdevlieghere](https://github.com/jdevlieghere) 
(GitHub), [jdevlieghere](https://discourse.llvm.org/u/jdevlieghere) 
(Discourse), jdevlieghere (

[Lldb-commits] [lldb] [lldb] Convert Maintainers file from reStructuredText -> Markdown (PR #140958)

2025-05-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Convert the Maintainers file from reStructuredText to Markdown and include 
links to GitHub and Discouse. The new layout improves readability, makes it 
easier to navigate from GitHub and matches LLVM's Maintainer's file [1].

[1] https://github.com/llvm/llvm-project/blob/main/llvm/Maintainers.md

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


2 Files Affected:

- (added) lldb/Maintainers.md (+241) 
- (removed) lldb/Maintainers.rst (-256) 


``diff
diff --git a/lldb/Maintainers.md b/lldb/Maintainers.md
new file mode 100644
index 0..b15c62644f4ba
--- /dev/null
+++ b/lldb/Maintainers.md
@@ -0,0 +1,241 @@
+# LLDB Maintainers
+
+This file is a list of the 
[maintainers](https://llvm.org/docs/DeveloperPolicy.html#maintainers) for LLDB.
+
+## Current Maintainers
+
+The following people are the active maintainers for the project. Please reach 
out to them for code reviews, questions about their area of expertise, or other 
assistance.
+
+### Lead Maintainer
+
+Responsible for project as a whole, and for any areas not covered by a 
specific maintainer.
+
+Jonas Devlieghere
+jo...@devlieghere.com (email), [jdevlieghere](https://github.com/jdevlieghere) 
(GitHub), [jdevlieghere](https://discourse.llvm.org/u/jdevlieghere) 
(Discourse), jdevlieghere (Discord)
+
+### Components
+
+These maintainers are responsible for particular high-level components within 
LLDB.
+
+ ABI
+
+Jason Molenda
+jmole...@apple.com (email), [jasonmolenda](https://github.com/jasonmolenda) 
(GitHub), [jasonmolenda](https://discourse.llvm.org/u/jasonmolenda) 
(Discourse), jasonmolenda (Discord)
+
+David Spickett
+david.spick...@linaro.org (email), 
[DavidSpickett](https://github.com/DavidSpickett) (GitHub), 
[DavidSpickett](https://discourse.llvm.org/u/DavidSpickett) (Discourse), 
davidspickett (Discord)
+
+ Breakpoint
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+ CMake & Build System
+
+Jonas Devlieghere
+jo...@devlieghere.com (email), [jdevlieghere](https://github.com/jdevlieghere) 
(GitHub), [jdevlieghere](https://discourse.llvm.org/u/jdevlieghere) 
(Discourse), jdevlieghere (Discord)
+
+Alex Langford
+alangf...@apple.com (email), [bulbazord](https://github.com/bulbazord) 
(GitHub), [bulbazord](https://discourse.llvm.org/u/bulbazord) (Discourse), 
bulba_zord (Discord)
+
+ Commands
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+ Expression Parser
+
+Michael Buch
+michaelbuc...@gmail.com (email), [Michael137](https://github.com/Michael137) 
(GitHub), [Michael137](https://discourse.llvm.org/u/Michael137) (Discourse)
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+ Interpreter
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+Greg Clayton
+gclay...@fb.com (email), [clayborg](https://github.com/clayborg) (GitHub), 
[clayborg](https://discourse.llvm.org/u/clayborg) (Discourse)
+
+ Lua
+
+Jonas Delvieghere
+jo...@devlieghere.com (email), [jdevlieghere](https://github.com/jdevlieghere) 
(GitHub), [jdevlieghere](https://discourse.llvm.org/u/jdevlieghere) 
(Discourse), jdevlieghere (Discord)
+
+ Python
+
+Med Ismail Bennani
+ism...@bennani.ma (email), [medismailben](https://github.com/medismailben) 
(GitHub), [mib](https://discourse.llvm.org/u/mib) (Discourse), mib#8727 
(Discord)
+
+ Target/Process Control
+
+Med Ismail Bennani
+ism...@bennani.ma (email), [medismailben](https://github.com/medismailben) 
(GitHub), [mib](https://discourse.llvm.org/u/mib) (Discourse), mib#8727 
(Discord)
+
+Jim Ingham
+jing...@apple.com (email), [jimingham](https://github.com/jimingham) (GitHub), 
[jingham](https://discourse.llvm.org/u/jingham) (Discourse)
+
+ Test Suite
+
+Jonas Devlieghere
+jo...@devlieghere.com (email), [jdevlieghere](https://github.com/jdevlieghere) 
(GitHub), [jdevlieghere](https://discourse.llvm.org/u/jdevlieghere) 
(Discourse), jdevlieghere (Discord)
+
+Pavel Labath
+pa...@labath.sk (email), [labath](https://github.com/labath) (GitHub), 
[labath](https://discourse.llvm.org/u/labath) (Discourse)
+
+ Trace
+
+Walter Erquinigo
+a20012...@gmail.com (email), 
[walter-erquinigo](https://github.com/walter-erquinigo) (GitHub), 
[wallace](https://discourse.llvm.org/u/wallace) (Discourse), werquinigo 
(Discord)
+
+ Unwinding
+
+Jason Molenda
+jmole...@apple.com (email), [jasonmolenda](https://github.com/jasonmolenda) 
(GitHub), [jasonmolenda](https://discourse.llvm.org/u/jasonmolenda) 
(Discourse), jasonmolenda (Discord)
+
+ Utility

[Lldb-commits] [lldb] cea8257 - [lldb] Skip TestConsecutiveWatchpoints.py if out of tree debugserver

2025-05-21 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2025-05-21T17:38:35-07:00
New Revision: cea82573bb39230f6ddf47f8ee5a83f85c255025

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

LOG: [lldb] Skip TestConsecutiveWatchpoints.py if out of tree debugserver

The GreenDragon CI bots are currently passing because the installed
Xcode is a bit old, and doesn't have the watchpoint handling
bug that was fixed April with this test being added.

But on other CI running newer Xcode debugservers, this test will
fail.  Skip this test if we're using an out of tree debugserver.

Added: 


Modified: 

lldb/test/API/functionalities/watchpoint/consecutive-watchpoints/TestConsecutiveWatchpoints.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/watchpoint/consecutive-watchpoints/TestConsecutiveWatchpoints.py
 
b/lldb/test/API/functionalities/watchpoint/consecutive-watchpoints/TestConsecutiveWatchpoints.py
index bb73acc8fc35f..a07b297a067a3 100644
--- 
a/lldb/test/API/functionalities/watchpoint/consecutive-watchpoints/TestConsecutiveWatchpoints.py
+++ 
b/lldb/test/API/functionalities/watchpoint/consecutive-watchpoints/TestConsecutiveWatchpoints.py
@@ -22,6 +22,7 @@ def continue_and_report_stop_reason(self, process, iter_str):
 
 # debugserver only gained the ability to watch larger regions
 # with this patch.
+@skipIfOutOfTreeDebugserver
 def test_consecutive_watchpoints(self):
 """Test watchpoint that covers a large region of memory."""
 self.build()



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


[Lldb-commits] [lldb] [lldb-dap] fix disassembly request instruction offset handling (PR #140486)

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

eronnen wrote:

@medismailben Unfortunately I dont own a mac so I can't really test but I think 
maybe this patch should fix it: https://github.com/llvm/llvm-project/pull/140975

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


[Lldb-commits] [lldb] [lldb-dap] In DAP unit tests, add helpers for loading a CoreFile. (PR #140738)

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


@@ -10,8 +10,16 @@ add_lldb_unittest(DAPTests
   VariablesTest.cpp
 
   LINK_LIBS
+liblldb
 lldbDAP
+lldbUtilityHelpers
 LLVMTestingSupport
   LINK_COMPONENTS
 Support
   )
+
+set(test_inputs
+  linux-x86_64.out
+  linux-x86_64.core

ashgti wrote:

I used minidump to make the linux-x86_64.core.yaml file (it starts with `--- 
!minidump`).  I just needed to load the exiting target + core and use `(lldb) 
process save-core --plugin-name=minidump ` to get the file.

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


[Lldb-commits] [lldb] [lldb] Add templated CompilerType::GetTypeSystem (NFC) (PR #140424)

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

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

That looks like a nice improvement!

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


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

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

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

>From 5c1d1854c3f93e081405e27fa0f14a3c02ef7cc7 Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 18 May 2025 20:56:47 +0200
Subject: [PATCH 1/6] [lldb-dap] Attempt to synchronously wait for breakpoints
 resolve in lldb-dap tests in order to stabilize the tests

---
 .../test/tools/lldb-dap/dap_server.py |  6 +++--
 .../test/tools/lldb-dap/lldbdap_testcase.py   | 26 +--
 .../breakpoint/TestDAP_setBreakpoints.py  |  1 -
 .../TestDAP_setFunctionBreakpoints.py |  1 -
 .../tools/lldb-dap/module/TestDAP_module.py   |  4 ++-
 .../TestDAP_terminatedEvent.py|  6 +++--
 ...TestGetTargetBreakpointsRequestHandler.cpp | 10 +--
 7 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index a028381a0a4f9..60ff2f55bc908 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -1216,7 +1216,7 @@ def request_locations(self, locationReference):
 }
 return self.send_recv(command_dict)
 
-def request_testGetTargetBreakpoints(self):
+def request_testGetTargetBreakpoints(self, only_resolved=False):
 """A request packet used in the LLDB test suite to get all currently
 set breakpoint infos for all breakpoints currently set in the
 target.
@@ -1224,7 +1224,9 @@ def request_testGetTargetBreakpoints(self):
 command_dict = {
 "command": "_testGetTargetBreakpoints",
 "type": "request",
-"arguments": {},
+"arguments": {
+"onlyResolved": only_resolved,
+},
 }
 return self.send_recv(command_dict)
 
diff --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 91ae55977046b..27ce8171da630 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -49,7 +49,7 @@ def build_and_create_debug_adapter_for_attach(self):
 self.build_and_create_debug_adapter(dictionary={"EXE": unique_name})
 return self.getBuildArtifact(unique_name)
 
-def set_source_breakpoints(self, source_path, lines, data=None):
+def set_source_breakpoints(self, source_path, lines, data=None, 
wait_for_resolve=True):
 """Sets source breakpoints and returns an array of strings containing
 the breakpoint IDs ("1", "2") for each breakpoint that was set.
 Parameter data is array of data objects for breakpoints.
@@ -65,6 +65,8 @@ def set_source_breakpoints(self, source_path, lines, 
data=None):
 breakpoint_ids = []
 for breakpoint in breakpoints:
 breakpoint_ids.append("%i" % (breakpoint["id"]))
+if wait_for_resolve:
+self.wait_for_breakpoints_to_resolve(breakpoint_ids, timeout=10)
 return breakpoint_ids
 
 def set_source_breakpoints_assembly(self, source_reference, lines, 
data=None):
@@ -81,7 +83,7 @@ def set_source_breakpoints_assembly(self, source_reference, 
lines, data=None):
 breakpoint_ids.append("%i" % (breakpoint["id"]))
 return breakpoint_ids
 
-def set_function_breakpoints(self, functions, condition=None, 
hitCondition=None):
+def set_function_breakpoints(self, functions, condition=None, 
hitCondition=None, wait_for_resolve=True):
 """Sets breakpoints by function name given an array of function names
 and returns an array of strings containing the breakpoint IDs
 ("1", "2") for each breakpoint that was set.
@@ -95,7 +97,27 @@ def set_function_breakpoints(self, functions, 
condition=None, hitCondition=None)
 breakpoint_ids = []
 for breakpoint in breakpoints:
 breakpoint_ids.append("%i" % (breakpoint["id"]))
+if wait_for_resolve:
+self.wait_for_breakpoints_to_resolve(breakpoint_ids, timeout=10)
 return breakpoint_ids
+
+def wait_for_breakpoints_to_resolve(self, breakpoint_ids: list[str], 
timeout: Optional[float] = None):
+unresolved_breakpoints = set(breakpoint_ids)
+
+# Check already resolved breakpoints
+resolved_breakpoints = 
self.dap_server.request_testGetTargetBreakpoints(only_resolved=True)["body"]["breakpoints"]
+for resolved_breakpoint in resolved_breakpoints:
+unresolved_breakpoints.discard(str(resolved_breakpoint["id"]))
+
+while len(unresolved_breakpoints) > 0:
+breakpoint_event = self.dap_server.wait_for_event("breakpoint", 
timeout=timeout)
+if breakpoint_event is None:
+break
+
+if breakpoint_event["

[Lldb-commits] [lldb] e424787 - [lldb] Add templated CompilerType::GetTypeSystem (NFC) (#140424)

2025-05-21 Thread via lldb-commits

Author: Dave Lee
Date: 2025-05-21T12:03:58-07:00
New Revision: e424787a95f2b88ff6f724fd92d87dd0f1cecddc

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

LOG: [lldb] Add templated CompilerType::GetTypeSystem (NFC) (#140424)

Add an overloaded `GetTypeSystem` to specify the expected type system subclass. 
Changes code from  `GetTypeSystem().dyn_cast_or_null()` to 
`GetTypeSystem()`.

Added: 


Modified: 
lldb/include/lldb/Symbol/CompilerType.h
lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUtil.cpp
lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/unittests/ValueObject/DynamicValueObjectLocalBuffer.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index b8badfda92cf3..df8489a7fe582 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -276,6 +276,11 @@ class CompilerType {
   /// TypeSystem::TypeSystemSPWrapper can be compared for equality.
   TypeSystemSPWrapper GetTypeSystem() const;
 
+  template 
+  std::shared_ptr GetTypeSystem() const {
+return GetTypeSystem().dyn_cast_or_null();
+  }
+
   ConstString GetTypeName(bool BaseOnly = false) const;
 
   ConstString GetDisplayTypeName() const;

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
index db9a6dd197b3a..c8c8ba53e3bae 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
@@ -37,7 +37,7 @@ CompilerType ClangASTImporter::CopyType(TypeSystemClang 
&dst_ast,
 const CompilerType &src_type) {
   clang::ASTContext &dst_clang_ast = dst_ast.getASTContext();
 
-  auto src_ast = src_type.GetTypeSystem().dyn_cast_or_null();
+  auto src_ast = src_type.GetTypeSystem();
   if (!src_ast)
 return CompilerType();
 
@@ -307,7 +307,7 @@ CompilerType ClangASTImporter::DeportType(TypeSystemClang 
&dst,
   const CompilerType &src_type) {
   Log *log = GetLog(LLDBLog::Expressions);
 
-  auto src_ctxt = src_type.GetTypeSystem().dyn_cast_or_null();
+  auto src_ctxt = src_type.GetTypeSystem();
   if (!src_ctxt)
 return {};
 

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 34129807277d5..4b52f6aafcb75 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -1477,8 +1477,7 @@ ClangASTImporter::DeclOrigin 
ClangASTSource::GetDeclOrigin(const clang::Decl *de
 }
 
 CompilerType ClangASTSource::GuardedCopyType(const CompilerType &src_type) {
-  auto ts = src_type.GetTypeSystem();
-  auto src_ast = ts.dyn_cast_or_null();
+  auto src_ast = src_type.GetTypeSystem();
   if (!src_ast)
 return {};
 

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 667cb8a900459..db4973b4a4d3e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -219,7 +219,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const 
NamedDecl *decl,
bool is_result,
bool is_lvalue) {
   assert(m_parser_vars.get());
-  auto ast = parser_type.GetTypeSystem().dyn_cast_or_null();
+  auto ast = parser_type.GetTypeSystem();
   if (ast == nullptr)
 return false;
 
@@ -1486,8 +1486,8 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP 
&var,
 return false;
   }
 
-  auto ts = var_type->GetForwardCompilerType().GetTypeSystem();
-  auto clang_ast = ts.dyn_cast_or_null();
+  auto clang_ast =
+  var_type->GetForwardCompilerType().GetTypeSystem();
 
   if (!clang_ast) {
 LLDB_LOG(log, "Skipped a definition because it has no Clang AST");
@@ -1606,8 +1606,7 @@ void ClangExpressio

[Lldb-commits] [lldb] [lldb-dap] In DAP unit tests, add helpers for loading a CoreFile. (PR #140738)

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

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


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


[Lldb-commits] [lldb] [lldb-dap] In DAP unit tests, add helpers for loading a CoreFile. (PR #140738)

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


@@ -10,8 +10,16 @@ add_lldb_unittest(DAPTests
   VariablesTest.cpp
 
   LINK_LIBS
+liblldb
 lldbDAP
+lldbUtilityHelpers
 LLVMTestingSupport
   LINK_COMPONENTS
 Support
   )
+
+set(test_inputs
+  linux-x86_64.out
+  linux-x86_64.core

JDevlieghere wrote:

I assume Pavel's talking about the memory just being bytes. I'd say the YAML 
file is marginally better than the binaries. A minidump would be even better 
but I don't feel like we should block this PR on that.

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


[Lldb-commits] [lldb] [lldb-dap] Assorted small fixes for runInTerminal (PR #140908)

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

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

LGTM

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-21 Thread Pavel Labath via lldb-commits

labath wrote:

The failure is in lldb_private::HostInfoBase::GetArchitecture. To fix this, you 
need to `Initialize()` the HostInfo class.

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


[Lldb-commits] [lldb] [lldb] Show more children of top level values (PR #140938)

2025-05-21 Thread via lldb-commits

jimingham wrote:

This behavior has gotten fairly complicated, you need to describe how it works 
somewhere that users can consult.

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


[Lldb-commits] [lldb] [lldb] Remove unused local variables (NFC) (PR #140989)

2025-05-21 Thread Shilei Tian via lldb-commits

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


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


[Lldb-commits] [lldb] [test] Fix dissassemble-entry-point.s for #140187 (PR #140978)

2025-05-21 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Assorted small fixes for runInTerminal (PR #140908)

2025-05-21 Thread Hu Jialun via lldb-commits

SuibianP wrote:

I still wonder why CI checks (such as 
[this](https://buildkite.com/llvm-project/github-pull-requests/builds/180533#0196e513-330d-4fe5-8ed4-8e96fc5b1a89))
 were `PASS` without catching the errors. I could only guess it is in 
`isTestSupported`.

https://github.com/llvm/llvm-project/blob/94fdeb76864c5c46ee5503ebf34d5778f4c948b8/lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py#L32-L44

Target is of course x86_64 on Linux, and as per buildkite logs Python is 
3.10.12.

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


[Lldb-commits] [lldb] 4fd48ac - [test] Fix dissassemble-entry-point.s for #140187 (#140978)

2025-05-21 Thread via lldb-commits

Author: Pat Doyle
Date: 2025-05-21T20:21:18-07:00
New Revision: 4fd48ac9ae272db07a48a08f99f2101dce2f1eb0

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

LOG: [test] Fix dissassemble-entry-point.s for #140187 (#140978)

similar to #140570

getting this error:

exit status 1
ld.lld: error: section '.text' address (0x8074) is smaller than image
base (0x1); specify --image-base

Added: 


Modified: 
lldb/test/Shell/SymbolFile/dissassemble-entry-point.s

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s 
b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
index c8059990237a1..d84374fedaf6a 100644
--- a/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
+++ b/lldb/test/Shell/SymbolFile/dissassemble-entry-point.s
@@ -1,7 +1,7 @@
 # REQUIRES: lld, arm
 
 # RUN: llvm-mc -triple=thumbv7-eabi %s -filetype=obj -o %t.o
-# RUN: ld.lld %t.o -o %t --section-start=.text=0x8074 -e 0x8075 -s
+# RUN: ld.lld %t.o -o %t --image-base=0x8000 --section-start=.text=0x8074 -e 
0x8075 -s
 # RUN: %lldb -x -b -o 'dis -s 0x8074 -e 0x8080' -- %t | FileCheck %s
 # CHECK:  {{.*}}[0x8074] <+0>: movs   r0, #0x2a
 # CHECK-NEXT: {{.*}}[0x8076] <+2>: movs   r7, #0x1
@@ -10,4 +10,4 @@
 _start:
 movs r0, #0x2a
 movs r7, #0x1
-svc #0x0
\ No newline at end of file
+svc #0x0



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


[Lldb-commits] [lldb] Fix a bug where using "thread backtrace unique" would switch you to (PR #140993)

2025-05-21 Thread Pavel Labath via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb-dap] In DAP unit tests, add helpers for loading a CoreFile. (PR #140738)

2025-05-21 Thread Pavel Labath via lldb-commits


@@ -10,8 +10,16 @@ add_lldb_unittest(DAPTests
   VariablesTest.cpp
 
   LINK_LIBS
+liblldb
 lldbDAP
+lldbUtilityHelpers
 LLVMTestingSupport
   LINK_COMPONENTS
 Support
   )
+
+set(test_inputs
+  linux-x86_64.out
+  linux-x86_64.core

labath wrote:

> I assume Pavel's talking about the memory just being bytes.

No, that's actually the best you can get (without inventing something 
completely new), even with minidumps. With core files you just get nothing 
because they don't fit yaml2obj's model of elf files. elf2yaml's main use case 
is (unlinked) object files produced by the compiler, which have only section 
headers (no program headers). OTOH, core files consist of *only* program 
headers, and the tool just doesn't handle that. These days I *think* it's 
possible to generate a somewhat realistic core file with yaml2obj, but you have 
to write the yaml by hand. obj2yaml won't generate it for you.

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


[Lldb-commits] [lldb] 53a5bea - [lldb] Call Target::ClearAllLoadedSections even earlier (#140228)

2025-05-21 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-05-22T08:32:11+02:00
New Revision: 53a5bea0ad7ebf72d076d00d3e4a8aff18692ec6

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

LOG: [lldb] Call Target::ClearAllLoadedSections even earlier (#140228)

This reapplies https://github.com/llvm/llvm-project/pull/138892, which
was reverted in

https://github.com/llvm/llvm-project/commit/5fb9dca14aeaf12219ff149bf3a4f94c8dc58d8b
due to failures on windows.

Windows loads modules from the Process class, and it does that quite
early, and it kinda makes sense which is why I'm moving the clearing
code even earlier.

The original commit message was:

Minidump files contain explicit information about load addresses of
modules, so it can load them itself. This works on other platforms, but
fails on darwin because DynamicLoaderDarwin nukes the loaded module list
on initialization (which happens after the core file plugin has done its
work).

This used to work until
https://github.com/llvm/llvm-project/pull/109477, which enabled the
dynamic loader
plugins for minidump files in order to get them to provide access to
TLS.

Clearing the load list makes sense, but I think we could do it earlier
in the process, so that both Process and DynamicLoader plugins get a
chance to load modules. This patch does that by calling the function
early in the launch/attach/load core flows.

This fixes TestDynamicValue.py:test_from_core_file on darwin.

Added: 


Modified: 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/source/Target/Process.cpp
lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py

Removed: 




diff  --git 
a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 578ab12268ea3..1270d57423c7b 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -872,7 +872,6 @@ void DynamicLoaderDarwin::PrivateInitialize(Process 
*process) {
StateAsCString(m_process->GetState()));
   Clear(true);
   m_process = process;
-  m_process->GetTarget().ClearAllLoadedSections();
 }
 
 // Member function that gets called when the process state changes.

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 13ff12b4ff953..c377feec86c16 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2675,6 +2675,7 @@ Status Process::LaunchPrivate(ProcessLaunchInfo 
&launch_info, StateType &state,
   m_jit_loaders_up.reset();
   m_system_runtime_up.reset();
   m_os_up.reset();
+  GetTarget().ClearAllLoadedSections();
 
   {
 std::lock_guard guard(m_process_input_reader_mutex);
@@ -2799,6 +2800,7 @@ Status Process::LaunchPrivate(ProcessLaunchInfo 
&launch_info, StateType &state,
 }
 
 Status Process::LoadCore() {
+  GetTarget().ClearAllLoadedSections();
   Status error = DoLoadCore();
   if (error.Success()) {
 ListenerSP listener_sp(
@@ -2984,6 +2986,7 @@ Status Process::Attach(ProcessAttachInfo &attach_info) {
   m_jit_loaders_up.reset();
   m_system_runtime_up.reset();
   m_os_up.reset();
+  GetTarget().ClearAllLoadedSections();
 
   lldb::pid_t attach_pid = attach_info.GetProcessID();
   Status error;

diff  --git a/lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py 
b/lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py
index cd95a9ff3fe8c..faa35421ff60b 100644
--- a/lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py
+++ b/lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py
@@ -282,7 +282,6 @@ def test_from_forward_decl(self):
 
 @no_debug_info_test
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24663")
-@expectedFailureDarwin  # dynamic loader unloads modules
 @expectedFailureAll(archs=["arm"]) # Minidump saving not implemented
 def test_from_core_file(self):
 """Test fetching C++ dynamic values from core files. Specifically, test



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


[Lldb-commits] [lldb] [lldb] Call Target::ClearAllLoadedSections even earlier (PR #140228)

2025-05-21 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Test gardening, enabling tests and improving doc comments. (PR #140777)

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

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

>From e50ea7d279adcb181f68a7156b5fc12d1047f402 Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Tue, 20 May 2025 11:09:35 -0700
Subject: [PATCH] [lldb-dap] Test gardening, enabling tests and improving doc
 comments.

A bit of test gardenining. Enabling tests that were marked as skipped as part 
of https://github.com/llvm/llvm-project/issues/137660.
Fixed up some comments and doc comments and fixed some test helpers.
---
 .../Python/lldbsuite/test/decorators.py   | 26 
 .../attach/TestDAP_attachByPortNum.py | 61 ---
 .../breakpoint/TestDAP_setBreakpoints.py  |  1 -
 .../TestDAP_setExceptionBreakpoints.py|  1 -
 .../TestDAP_setFunctionBreakpoints.py |  1 -
 .../tools/lldb-dap/cancel/TestDAP_cancel.py   |  2 -
 .../tools/lldb-dap/console/TestDAP_console.py | 25 
 .../lldb-dap/coreFile/TestDAP_coreFile.py |  2 -
 .../TestDAP_setDataBreakpoints.py |  2 +-
 .../disassemble/TestDAP_disassemble.py|  2 -
 .../lldb-dap/disconnect/TestDAP_disconnect.py |  1 -
 .../lldb-dap/evaluate/TestDAP_evaluate.py |  3 -
 .../TestDAP_instruction_breakpoint.py | 37 +--
 .../tools/lldb-dap/launch/TestDAP_launch.py   | 19 +++---
 .../lldb-dap/locations/TestDAP_locations.py   |  5 +-
 .../tools/lldb-dap/memory/TestDAP_memory.py   |  2 -
 .../module-event/TestDAP_module_event.py  |  7 ++-
 .../tools/lldb-dap/module/TestDAP_module.py   |  4 +-
 .../lldb-dap/optimized/TestDAP_optimized.py   |  4 +-
 .../tools/lldb-dap/output/TestDAP_output.py   |  2 +-
 .../lldb-dap/progress/TestDAP_Progress.py |  7 +--
 .../repl-mode/TestDAP_repl_mode_detection.py  |  2 -
 .../tools/lldb-dap/restart/TestDAP_restart.py |  2 +-
 .../restart/TestDAP_restart_runInTerminal.py  | 22 +--
 .../runInTerminal/TestDAP_runInTerminal.py| 47 ++
 .../tools/lldb-dap/source/TestDAP_source.py   |  3 -
 .../subtleFrames/TestDAP_subtleFrames.py  | 10 ++-
 .../TestDAP_stackTraceDisassemblyDisplay.py   |  2 +-
 .../TestDAP_stackTraceMissingFunctionName.py  |  2 +-
 .../TestDAP_stackTraceMissingModule.py|  2 +-
 .../API/tools/lldb-dap/step/TestDAP_step.py   |  4 +-
 .../stepInTargets/TestDAP_stepInTargets.py|  9 +--
 .../TestDAP_terminatedEvent.py|  3 -
 .../tools/lldb-dap/threads/TestDAP_threads.py |  3 +-
 .../lldb-dap/variables/TestDAP_variables.py   |  5 +-
 .../children/TestDAP_variables_children.py|  6 +-
 36 files changed, 124 insertions(+), 212 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 895f2a82547a9..5e14dfeda48a8 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -1,5 +1,6 @@
 # System modules
 from functools import wraps
+from typing import Optional
 from packaging import version
 import ctypes
 import locale
@@ -1102,3 +1103,28 @@ def is_feature_enabled():
 return "%s is not supported on this system." % feature
 
 return skipTestIfFn(is_feature_enabled)
+
+
+def skipIfBinaryToLarge(path: Optional[str], maxSize: int):
+"""Skip the test if a binary is to large.
+
+We skip this test for debug builds because it takes too long
+parsing lldb's own debug info. Release builds are fine.
+Checking the size of the lldb-dap binary seems to be a decent
+proxy for a quick detection. It should be far less than 1 MB in
+Release builds.
+"""
+
+def check_binary_size():
+if not path or not os.path.exists(path):
+return "invalid path"
+
+try:
+size = os.path.getsize(path)
+if size <= maxSize:
+return None
+return f"binary {path} (size = {size} is to larger than {maxSize}"
+except:
+return f"failed to read size of {path}"
+
+return skipTestIfFn(check_binary_size)
diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py 
b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
index 7c2b540195d15..edb87a9314d78 100644
--- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
+++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
@@ -2,26 +2,16 @@
 Test lldb-dap "port" configuration to "attach" request
 """
 
-import dap_server
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
 from lldbsuite.test import lldbplatformutil
 from lldbgdbserverutils import Pipe
 import lldbdap_testcase
-import os
-import shutil
-import subprocess
-import tempfile
-import threading
-import sys
-import socket
+import lldb
 
 
-@skip("https://github.com/llvm/llvm-project/issues/138803";)
+@skip(bugnumber="https://github.com/llvm/llvm-project/issues/138803";)
 class TestDAP_attachByPortNum(lldbdap_testcase.DAPTestCaseBase)

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

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


@@ -136,6 +136,7 @@ def __init__(
 self.initialized = False
 self.frame_scopes = {}
 self.init_commands = init_commands
+self.resolved_breakpoints = set([])

eronnen wrote:

:100: 

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


[Lldb-commits] [lldb] [lldb] Add templated CompilerType::GetTypeSystem (NFC) (PR #140424)

2025-05-21 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Convert Maintainers file from reStructuredText -> Markdown (PR #140958)

2025-05-21 Thread Saleem Abdulrasool via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Convert Maintainers file from reStructuredText -> Markdown (PR #140958)

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

JDevlieghere wrote:

Tip: Click on "Display the rich diff" to see the rendered markdown in the Files 
Changed tab.

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


[Lldb-commits] [lldb] [lldb] Convert Maintainers file from reStructuredText -> Markdown (PR #140958)

2025-05-21 Thread Med Ismail Bennani via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb-dap] In DAP unit tests, add helpers for loading a CoreFile. (PR #140738)

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

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


[Lldb-commits] [lldb] [lldb] Call Target::ClearAllLoadedSections even earlier (PR #140228)

2025-05-21 Thread Jason Molenda via lldb-commits

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

OK.

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


[Lldb-commits] [lldb] [lldb-dap] Assorted small fixes for runInTerminal (PR #140908)

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

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


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


[Lldb-commits] [lldb] [lldb-dap] In DAP unit tests, add helpers for loading a CoreFile. (PR #140738)

2025-05-21 Thread Pavel Labath via lldb-commits


@@ -10,8 +10,16 @@ add_lldb_unittest(DAPTests
   VariablesTest.cpp
 
   LINK_LIBS
+liblldb
 lldbDAP
+lldbUtilityHelpers
 LLVMTestingSupport
   LINK_COMPONENTS
 Support
   )
+
+set(test_inputs
+  linux-x86_64.out
+  linux-x86_64.core

labath wrote:

yaml2obj on core files doesn't really work. It should be possible to do that 
with minidump files though.

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


[Lldb-commits] [lldb] [lldb] Disable some unwind plans for discontinuous functions (PR #140927)

2025-05-21 Thread Pavel Labath via lldb-commits

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

Basically, disable everything except the eh_frame unwind plan, as that's the 
only one which supports this right now. The other plans are working with now 
trying the interpret everything in between the function parts as a part of the 
function, which is more likely to produce wrong results than correct ones.

I changed the interface for object file plans, to give the implementations a 
chance to implement this correctly, but I haven't actually converted 
PECallFrameInfo (its only implementation) to handle that. (from the looks of 
things, it should be relatively easy to do, if it becomes necessary)

I'm also deleting UnwindPlan::GetFirstNonPrologueInsn, as it's not used, and it 
doesn't work for discontinuous functions.

>From ccc1e7367bdf8e860af03c756e2b7b612d9cf1be Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Wed, 21 May 2025 17:23:42 +0200
Subject: [PATCH] [lldb] Disable some unwind plans for discontinuous functions

Basically, disable everything except the eh_frame unwind plan, as that's
the only one which supports this right now. The other plans are working
with now trying the interpret everything in between the function parts
as a part of the function, which is more likely to produce wrong results
than correct ones.

I changed the interface for object file plans, to give the
implementations a chance to implement this correctly, but I haven't
actually converted PECallFrameInfo (its only implementation) to handle
that. (from the looks of things, it should be relatively easy to do, if
it becomes necessary)

I'm also deleting UnwindPlan::GetFirstNonPrologueInsn, as it's not used,
and it doesn't work for discontinuous functions.
---
 lldb/include/lldb/Symbol/CallFrameInfo.h  |   6 +-
 lldb/include/lldb/Symbol/FuncUnwinders.h  |   6 -
 .../ObjectFile/PECOFF/PECallFrameInfo.cpp |  35 +++---
 .../ObjectFile/PECOFF/PECallFrameInfo.h   |  14 ++-
 lldb/source/Symbol/FuncUnwinders.cpp  | 105 +++---
 lldb/source/Target/RegisterContextUnwind.cpp  |   7 +-
 .../ObjectFile/PECOFF/TestPECallFrameInfo.cpp |  44 +---
 7 files changed, 100 insertions(+), 117 deletions(-)

diff --git a/lldb/include/lldb/Symbol/CallFrameInfo.h 
b/lldb/include/lldb/Symbol/CallFrameInfo.h
index 7db8722baaf5f..f4c5a5b374871 100644
--- a/lldb/include/lldb/Symbol/CallFrameInfo.h
+++ b/lldb/include/lldb/Symbol/CallFrameInfo.h
@@ -19,8 +19,10 @@ class CallFrameInfo {
 
   virtual bool GetAddressRange(Address addr, AddressRange &range) = 0;
 
-  virtual bool GetUnwindPlan(const Address &addr, UnwindPlan &unwind_plan) = 0;
-  virtual bool GetUnwindPlan(const AddressRange &range, UnwindPlan 
&unwind_plan) = 0;
+  virtual std::unique_ptr
+  GetUnwindPlan(llvm::ArrayRef ranges, const Address &addr) = 0;
+
+  virtual std::unique_ptr GetUnwindPlan(const Address &addr) = 0;
 };
 
 } // namespace lldb_private
diff --git a/lldb/include/lldb/Symbol/FuncUnwinders.h 
b/lldb/include/lldb/Symbol/FuncUnwinders.h
index c21a1af5c56a2..abb0d8abbc21a 100644
--- a/lldb/include/lldb/Symbol/FuncUnwinders.h
+++ b/lldb/include/lldb/Symbol/FuncUnwinders.h
@@ -51,8 +51,6 @@ class FuncUnwinders {
   std::shared_ptr
   GetUnwindPlanArchitectureDefaultAtFunctionEntry(lldb_private::Thread 
&thread);
 
-  Address &GetFirstNonPrologueInsn(Target &target);
-
   const Address &GetFunctionStartAddress() const;
 
   bool ContainsAddress(const Address &addr) const {
@@ -114,10 +112,6 @@ class FuncUnwinders {
   /// The address ranges of the function.
   AddressRanges m_ranges;
 
-  /// The smallest address range covering the entire function.
-  /// DEPRECATED: Use m_ranges instead.
-  AddressRange m_range;
-
   std::recursive_mutex m_mutex;
 
   std::shared_ptr m_unwind_plan_assembly_sp;
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp 
b/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
index a7c2e4f0b8dbc..4b516b2e954bd 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
@@ -455,27 +455,26 @@ bool PECallFrameInfo::GetAddressRange(Address addr, 
AddressRange &range) {
   return true;
 }
 
-bool PECallFrameInfo::GetUnwindPlan(const Address &addr,
-UnwindPlan &unwind_plan) {
-  return GetUnwindPlan(AddressRange(addr, 1), unwind_plan);
-}
-
-bool PECallFrameInfo::GetUnwindPlan(const AddressRange &range,
-UnwindPlan &unwind_plan) {
-  unwind_plan.Clear();
-
-  unwind_plan.SetSourceName("PE EH info");
-  unwind_plan.SetSourcedFromCompiler(eLazyBoolYes);
-  unwind_plan.SetRegisterKind(eRegisterKindLLDB);
+std::unique_ptr PECallFrameInfo::GetUnwindPlan(
+llvm::ArrayRef ranges,
+const lldb_private::Address &addr) {
+  // Only continuous functions are supported.
+  if (ranges.size() != 1)
+return nullptr;
+  const AddressRange &range = ranges[0];
 
   const RuntimeFu

[Lldb-commits] [lldb] [lldb] Disable some unwind plans for discontinuous functions (PR #140927)

2025-05-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)


Changes

Basically, disable everything except the eh_frame unwind plan, as that's the 
only one which supports this right now. The other plans are working with now 
trying the interpret everything in between the function parts as a part of the 
function, which is more likely to produce wrong results than correct ones.

I changed the interface for object file plans, to give the implementations a 
chance to implement this correctly, but I haven't actually converted 
PECallFrameInfo (its only implementation) to handle that. (from the looks of 
things, it should be relatively easy to do, if it becomes necessary)

I'm also deleting UnwindPlan::GetFirstNonPrologueInsn, as it's not used, and it 
doesn't work for discontinuous functions.

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


7 Files Affected:

- (modified) lldb/include/lldb/Symbol/CallFrameInfo.h (+4-2) 
- (modified) lldb/include/lldb/Symbol/FuncUnwinders.h (-6) 
- (modified) lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp (+17-18) 
- (modified) lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.h (+10-4) 
- (modified) lldb/source/Symbol/FuncUnwinders.cpp (+38-67) 
- (modified) lldb/source/Target/RegisterContextUnwind.cpp (+3-4) 
- (modified) lldb/unittests/ObjectFile/PECOFF/TestPECallFrameInfo.cpp (+28-16) 


``diff
diff --git a/lldb/include/lldb/Symbol/CallFrameInfo.h 
b/lldb/include/lldb/Symbol/CallFrameInfo.h
index 7db8722baaf5f..f4c5a5b374871 100644
--- a/lldb/include/lldb/Symbol/CallFrameInfo.h
+++ b/lldb/include/lldb/Symbol/CallFrameInfo.h
@@ -19,8 +19,10 @@ class CallFrameInfo {
 
   virtual bool GetAddressRange(Address addr, AddressRange &range) = 0;
 
-  virtual bool GetUnwindPlan(const Address &addr, UnwindPlan &unwind_plan) = 0;
-  virtual bool GetUnwindPlan(const AddressRange &range, UnwindPlan 
&unwind_plan) = 0;
+  virtual std::unique_ptr
+  GetUnwindPlan(llvm::ArrayRef ranges, const Address &addr) = 0;
+
+  virtual std::unique_ptr GetUnwindPlan(const Address &addr) = 0;
 };
 
 } // namespace lldb_private
diff --git a/lldb/include/lldb/Symbol/FuncUnwinders.h 
b/lldb/include/lldb/Symbol/FuncUnwinders.h
index c21a1af5c56a2..abb0d8abbc21a 100644
--- a/lldb/include/lldb/Symbol/FuncUnwinders.h
+++ b/lldb/include/lldb/Symbol/FuncUnwinders.h
@@ -51,8 +51,6 @@ class FuncUnwinders {
   std::shared_ptr
   GetUnwindPlanArchitectureDefaultAtFunctionEntry(lldb_private::Thread 
&thread);
 
-  Address &GetFirstNonPrologueInsn(Target &target);
-
   const Address &GetFunctionStartAddress() const;
 
   bool ContainsAddress(const Address &addr) const {
@@ -114,10 +112,6 @@ class FuncUnwinders {
   /// The address ranges of the function.
   AddressRanges m_ranges;
 
-  /// The smallest address range covering the entire function.
-  /// DEPRECATED: Use m_ranges instead.
-  AddressRange m_range;
-
   std::recursive_mutex m_mutex;
 
   std::shared_ptr m_unwind_plan_assembly_sp;
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp 
b/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
index a7c2e4f0b8dbc..4b516b2e954bd 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
@@ -455,27 +455,26 @@ bool PECallFrameInfo::GetAddressRange(Address addr, 
AddressRange &range) {
   return true;
 }
 
-bool PECallFrameInfo::GetUnwindPlan(const Address &addr,
-UnwindPlan &unwind_plan) {
-  return GetUnwindPlan(AddressRange(addr, 1), unwind_plan);
-}
-
-bool PECallFrameInfo::GetUnwindPlan(const AddressRange &range,
-UnwindPlan &unwind_plan) {
-  unwind_plan.Clear();
-
-  unwind_plan.SetSourceName("PE EH info");
-  unwind_plan.SetSourcedFromCompiler(eLazyBoolYes);
-  unwind_plan.SetRegisterKind(eRegisterKindLLDB);
+std::unique_ptr PECallFrameInfo::GetUnwindPlan(
+llvm::ArrayRef ranges,
+const lldb_private::Address &addr) {
+  // Only continuous functions are supported.
+  if (ranges.size() != 1)
+return nullptr;
+  const AddressRange &range = ranges[0];
 
   const RuntimeFunction *runtime_function =
   FindRuntimeFunctionIntersectsWithRange(range);
   if (!runtime_function)
-return false;
+return nullptr;
+
+  auto plan_up = std::make_unique(eRegisterKindLLDB);
+  plan_up->SetSourceName("PE EH info");
+  plan_up->SetSourcedFromCompiler(eLazyBoolYes);
 
   EHProgramBuilder builder(m_object_file, runtime_function->UnwindInfoOffset);
   if (!builder.Build())
-return false;
+return nullptr;
 
   std::vector rows;
 
@@ -493,14 +492,14 @@ bool PECallFrameInfo::GetUnwindPlan(const AddressRange 
&range,
   }
 
   for (auto it = rows.rbegin(); it != rows.rend(); ++it)
-unwind_plan.AppendRow(std::move(*it));
+plan_up->AppendRow(std::move(*it));
 
-  unwind_plan.SetPlanValidAddressRanges({AddressRange(
+  plan_up->SetPlanValidAddressRanges({AddressRange(

[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-21 Thread Pavel Labath via lldb-commits


@@ -54,6 +54,12 @@ TEST_F(HostInfoTest, GetHostname) {
   EXPECT_TRUE(HostInfo::GetHostname(s));
 }
 
+TEST_F(HostInfoTest, GetProgramFileSpec) {
+  // Test GetProgramFileSpec()
+  FileSpec filespec = HostInfo::GetProgramFileSpec();
+  EXPECT_FALSE(filespec.GetFilename().IsEmpty());

labath wrote:

Let's make this stronger. We should at least be able to check that it exists.

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (cont..) (PR #138687)

2025-05-21 Thread Pavel Labath via lldb-commits


@@ -54,6 +54,12 @@ TEST_F(HostInfoTest, GetHostname) {
   EXPECT_TRUE(HostInfo::GetHostname(s));
 }
 
+TEST_F(HostInfoTest, GetProgramFileSpec) {
+  // Test GetProgramFileSpec()

labath wrote:

That much is obvious.

```suggestion
```

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


[Lldb-commits] [lldb] [LLDB] Ptrace seize dead processes on Linux (PR #137041)

2025-05-21 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [LLDB] Ptrace seize dead processes on Linux (PR #137041)

2025-05-21 Thread Pavel Labath via lldb-commits

https://github.com/labath commented:

[I'm sorry, this is going to be long]

Most of David's comments are there because you copied the existing attach 
implementation. Even if we go down the path of different attach methods, I 
don't think it's necessary to copy all of that. Actual attaching is a small 
part of that function. The rest of the stuff, which deals with looping, 
gathering thread ids, and error messages, could be handled by common code.

I say *if* because it's not clear to me that we've given up on using the common 
code path we discussed on the rfc thread. I think it could look something like 
this:
```
  ptrace(PTRACE_SEIZE, pid, 0, (void*)(PTRACE_O_TRACEEXIT));
  syscall(SYS_tgkill, pid, pid, SIGSTOP);
  ptrace(PTRACE_INTERRUPT, pid, 0, 0);
  int status;
  waitpid(pid, &status, __WALL);
  if (status>>8 == (SIGTRAP | PTRACE_EVENT_STOP << 8)) {
ptrace(PTRACE_CONT, pid, 0, 0);
waitpid(pid, &status, __WALL);
  }
```

If you run this on a "regular" process you get this sequence of events:

```
ptrace(PTRACE_SEIZE, 31169, NULL, PTRACE_O_TRACEEXIT) = 0
tgkill(31169, 31169, SIGSTOP)   = 0
ptrace(PTRACE_INTERRUPT, 31169) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_TRAPPED, si_pid=31169, si_uid=1000, 
si_status=SIGSTOP, si_utime=0, si_stime=0} ---
wait4(31169, [{WIFSTOPPED(s) && WSTOPSIG(s) == SIGSTOP}], __WALL, NULL) = 31169
```
.. or this one:
```
ptrace(PTRACE_SEIZE, 31169, NULL, PTRACE_O_TRACEEXIT) = 0
tgkill(31169, 31169, SIGSTOP)   = 0
ptrace(PTRACE_INTERRUPT, 31169) = 0
wait4(31169, [{WIFSTOPPED(s) && WSTOPSIG(s) == SIGTRAP}|PTRACE_EVENT_STOP<<16], 
__WALL, NULL) = 31169
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_STOPPED, si_pid=31169, si_uid=1000, 
si_status=0, si_utime=0, si_stime=0} ---
ptrace(PTRACE_CONT, 31169, NULL, 0) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_TRAPPED, si_pid=31169, si_uid=1000, 
si_status=SIGSTOP, si_utime=0, si_stime=0} ---
wait4(31169, [{WIFSTOPPED(s) && WSTOPSIG(s) == SIGSTOP}], __WALL, NULL) = 31169
```

The difference is in whether the kernel is fast enough to notice the SIGSTOP 
before it PTRACE_INTERRUPTS the process (the fact that this results in 
nondeterministic behavior might be worth filing a bug report for the kernel). 
With this simple code, I usually get the second version, but this is really a 
matter of microseconds. Even inserting `usleep(0)` between the SIGSTOP and 
PTRACE_INTERRUPT calls is enough to make the process immediately stop with 
SIGSTOP.

However, that doesn't matter. After this code is done, the process is stopped 
with a SIGSTOP, just like it was in the PTRACE_ATTACH case. For a "dead" 
process, the sequence slightly different:
```
ptrace(PTRACE_SEIZE, 31169, NULL, PTRACE_O_TRACEEXIT) = 0
tgkill(31169, 31169, SIGSTOP)   = 0
ptrace(PTRACE_INTERRUPT, 31169) = 0
wait4(31169, [{WIFSTOPPED(s) && WSTOPSIG(s) == SIGTRAP}|PTRACE_EVENT_EXIT<<16], 
__WALL, NULL) = 31169
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_TRAPPED, si_pid=31169, si_uid=1000, 
si_status=SIGTRAP, si_utime=0, si_stime=0} ---
```
In this case you always get a PTRACE_EVENT_EXIT stop.

The nicest part about this is that could be used to distinguish between the two 
process states -- without the core dumping flag, the proc filesystem, or 
anything else. I think it's theoretically possible to catch a live thread while 
it's exiting and get a PTRACE_EVENT_EXIT, but getting that for *all* threads in 
the process is very unlikely.

Or, instead of making this a process wide-property, we could make this a 
property of a specific thread. We could say that a *thread* that is in an 
"exiting" state is not allowed to run expressions. And this dead process would 
just be a special case of a process which happens to have all threads in the 
exiting state.

And the nicest part about *that* is that this is extremely close to being 
testable. We no longer need a core-dumping process -- we just need a process 
that's stopped in a PTRACE_EVENT_EXIT. Right now, we don't have a way to do 
that, but we're really close to that. One way to do that would be to let the 
user request stopping a thread at exit. If we implement all of the rest, this 
will be mainly a UX question of how we want to expose this to the user. I think 
we could make some sort of an experimental setting for that, or even just some 
secret packet that we send with the `process plugin packet` command.

What do you say to all this? I realize I am sort of asking you my pet feature, 
but I think that by framing your feature (debugging of dead processes) as a 
special case of this (debugging exiting processes), we can avoid most of the 
problematic issues with this PR (divergence of implementation, impossibility of 
testing).

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


[Lldb-commits] [lldb] [LLDB] Ptrace seize dead processes on Linux (PR #137041)

2025-05-21 Thread Pavel Labath via lldb-commits


@@ -312,10 +312,27 @@ NativeProcessLinux::Manager::Attach(
   Log *log = GetLog(POSIXLog::Process);
   LLDB_LOG(log, "pid = {0:x}", pid);
 
-  auto tids_or = NativeProcessLinux::Attach(pid);
-  if (!tids_or)
-return tids_or.takeError();
-  ArrayRef<::pid_t> tids = *tids_or;
+  // This safety check lets us decide if we should
+  // seize or attach.
+  ProcessInstanceInfo process_info;
+  if (!Host::GetProcessInfo(pid, process_info))
+return llvm::make_error("Unable to read process info",
+ llvm::inconvertibleErrorCode());
+
+  std::vector<::pid_t> tids;
+  // IsCoreDumping is an optional, so check for value then true/false.
+  if (process_info.IsCoreDumping() && *process_info.IsCoreDumping()) {

labath wrote:

```suggestion
  if (process_info.IsCoreDumping() == true) {
```

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


[Lldb-commits] [lldb] d219a71 - [lldb][lldb-dap][tests] Make sure evaluate test exists with no errors. (#140788)

2025-05-21 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-05-21T18:17:38+01:00
New Revision: d219a71849f9209b01ee9e71af83747ad44b2a18

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

LOG: [lldb][lldb-dap][tests] Make sure evaluate test exists with no errors. 
(#140788)

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 4028ae4a2525f..3d90715ca7248 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -116,7 +116,7 @@ def verify_breakpoint_hit(self, breakpoint_ids, 
timeout=DEFAULT_TIMEOUT):
 # location.
 description = body["description"]
 for breakpoint_id in breakpoint_ids:
-match_desc = "breakpoint %s." % (breakpoint_id)
+match_desc = f"breakpoint {breakpoint_id}."
 if match_desc in description:
 return
 self.assertTrue(False, f"breakpoint not hit, 
stopped_events={stopped_events}")
@@ -312,6 +312,9 @@ def continue_to_next_stop(self, timeout=DEFAULT_TIMEOUT):
 self.do_continue()
 return self.dap_server.wait_for_stopped(timeout)
 
+def continue_to_breakpoint(self, breakpoint_id: str, 
timeout=DEFAULT_TIMEOUT):
+self.continue_to_breakpoints((breakpoint_id), timeout)
+
 def continue_to_breakpoints(self, breakpoint_ids, timeout=DEFAULT_TIMEOUT):
 self.do_continue()
 self.verify_breakpoint_hit(breakpoint_ids, timeout)

diff  --git a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py 
b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
index 2166e88151986..0d2774b281710 100644
--- a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
+++ b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
@@ -5,10 +5,8 @@
 import re
 
 import lldbdap_testcase
-import dap_server
-from lldbsuite.test import lldbutil
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import skipIfWindows
+from lldbsuite.test.lldbtest import line_number
 
 
 class TestDAP_evaluate(lldbdap_testcase.DAPTestCaseBase):
@@ -45,20 +43,32 @@ def run_test_evaluate_expressions(
 enableAutoVariableSummaries=enableAutoVariableSummaries,
 )
 source = "main.cpp"
-self.set_source_breakpoints(
-source,
-[
-line_number(source, "// breakpoint 1"),
-line_number(source, "// breakpoint 2"),
-line_number(source, "// breakpoint 3"),
-line_number(source, "// breakpoint 4"),
-line_number(source, "// breakpoint 5"),
-line_number(source, "// breakpoint 6"),
-line_number(source, "// breakpoint 7"),
-line_number(source, "// breakpoint 8"),
-],
+breakpoint_lines = [
+line_number(source, "// breakpoint 1"),
+line_number(source, "// breakpoint 2"),
+line_number(source, "// breakpoint 3"),
+line_number(source, "// breakpoint 4"),
+line_number(source, "// breakpoint 5"),
+line_number(source, "// breakpoint 6"),
+line_number(source, "// breakpoint 7"),
+line_number(source, "// breakpoint 8"),
+]
+breakpoint_ids = self.set_source_breakpoints(source, breakpoint_lines)
+
+self.assertEqual(
+len(breakpoint_ids),
+len(breakpoint_lines),
+"Did not resolve all the breakpoints.",
 )
-self.continue_to_next_stop()
+breakpoint_1 = breakpoint_ids[0]
+breakpoint_2 = breakpoint_ids[1]
+breakpoint_3 = breakpoint_ids[2]
+breakpoint_4 = breakpoint_ids[3]
+breakpoint_5 = breakpoint_ids[4]
+breakpoint_6 = breakpoint_ids[5]
+breakpoint_7 = breakpoint_ids[6]
+breakpoint_8 = breakpoint_ids[7]
+self.continue_to_breakpoint(breakpoint_1)
 
 # Expressions at breakpoint 1, which is in main
 self.assertEvaluate("var1", "20")
@@ -124,7 +134,7 @@ def run_test_evaluate_expressions(
 self.assertEvaluateFailure("foo_var")
 
 # Expressions at breakpoint 2, which is an anonymous block
-self.continue_to_next_stop()
+self.continue_to_breakpoint(breakpoint_2)
 self.assertEvaluate("var1", "20")
 self.assertEvaluate("var2", "2")  # 
diff erent var

[Lldb-commits] [lldb] [lldb][lldb-dap][tests] Make sure evaluate test exists with no errors. (PR #140788)

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

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


[Lldb-commits] [lldb] [LLDB] Ptrace seize dead processes on Linux (PR #137041)

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


@@ -444,6 +461,88 @@ NativeProcessLinux::NativeProcessLinux(::pid_t pid, int 
terminal_fd,
   SetState(StateType::eStateStopped, false);
 }
 
+llvm::Expected> NativeProcessLinux::Seize(::pid_t pid) {
+  Log *log = GetLog(POSIXLog::Process);
+
+  uint64_t options = GetDefaultPtraceOpts();
+  Status status;
+  // Use a map to keep track of the threads which we have attached/need to
+  // attach.
+  Host::TidMap tids_to_attach;
+  while (Host::FindProcessThreads(pid, tids_to_attach)) {
+for (Host::TidMap::iterator it = tids_to_attach.begin();
+ it != tids_to_attach.end();) {
+  if (it->second == true) {
+continue;
+  }
+  lldb::tid_t tid = it->first;
+  if ((status = PtraceWrapper(PTRACE_SEIZE, tid, nullptr, (void *)options))
+  .Fail()) {
+// No such thread. The thread may have exited. More error handling
+// may be needed.
+if (status.GetError() == ESRCH) {
+  it = tids_to_attach.erase(it);
+  continue;
+}
+if (status.GetError() == EPERM) {
+  // Depending on the value of ptrace_scope, we can return a
+  // different error that suggests how to fix it.
+  return AddPtraceScopeNote(status.ToError());
+}
+return status.ToError();
+  }
+
+  if ((status = PtraceWrapper(PTRACE_INTERRUPT, tid)).Fail()) {

DavidSpickett wrote:

Shame that we can't do these two PtraceWrapper calls like:
```
if (status = PtraceWrapper(PTRACE_SEIZE).Fail() || status = 
PTraceWrapper(PTRACE_INTERRUPT).Fail())
  
```
Maybe something with `,` could do it, I'm not too familiar with that.

Another way to do it is:
```
status = PTraceWrapper(PPTRACE_SEIZE);
if (!status.Fail())
  status = PTraceWrapper(PTRACE_INTERRUPT)
if (status.Fail())
  
```

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


[Lldb-commits] [lldb] [LLDB] Ptrace seize dead processes on Linux (PR #137041)

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


@@ -444,6 +461,88 @@ NativeProcessLinux::NativeProcessLinux(::pid_t pid, int 
terminal_fd,
   SetState(StateType::eStateStopped, false);
 }
 
+llvm::Expected> NativeProcessLinux::Seize(::pid_t pid) {
+  Log *log = GetLog(POSIXLog::Process);
+
+  uint64_t options = GetDefaultPtraceOpts();
+  Status status;
+  // Use a map to keep track of the threads which we have attached/need to
+  // attach.

DavidSpickett wrote:

In fact why does this say attach a lot. Are we attaching **by** seizing, or are 
seize and attach two different things completely?

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


[Lldb-commits] [lldb] [LLDB] Ptrace seize dead processes on Linux (PR #137041)

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


@@ -444,6 +461,88 @@ NativeProcessLinux::NativeProcessLinux(::pid_t pid, int 
terminal_fd,
   SetState(StateType::eStateStopped, false);
 }
 
+llvm::Expected> NativeProcessLinux::Seize(::pid_t pid) {
+  Log *log = GetLog(POSIXLog::Process);
+
+  uint64_t options = GetDefaultPtraceOpts();
+  Status status;
+  // Use a map to keep track of the threads which we have attached/need to
+  // attach.
+  Host::TidMap tids_to_attach;
+  while (Host::FindProcessThreads(pid, tids_to_attach)) {
+for (Host::TidMap::iterator it = tids_to_attach.begin();
+ it != tids_to_attach.end();) {
+  if (it->second == true) {
+continue;
+  }
+  lldb::tid_t tid = it->first;
+  if ((status = PtraceWrapper(PTRACE_SEIZE, tid, nullptr, (void *)options))
+  .Fail()) {
+// No such thread. The thread may have exited. More error handling
+// may be needed.
+if (status.GetError() == ESRCH) {
+  it = tids_to_attach.erase(it);
+  continue;
+}
+if (status.GetError() == EPERM) {
+  // Depending on the value of ptrace_scope, we can return a
+  // different error that suggests how to fix it.
+  return AddPtraceScopeNote(status.ToError());
+}
+return status.ToError();
+  }
+
+  if ((status = PtraceWrapper(PTRACE_INTERRUPT, tid)).Fail()) {
+// No such thread. The thread may have exited. More error handling
+// may be needed.
+if (status.GetError() == ESRCH) {
+  it = tids_to_attach.erase(it);
+  continue;
+}
+if (status.GetError() == EPERM) {
+  // Depending on the value of ptrace_scope, we can return a
+  // different error that suggests how to fix it.
+  return AddPtraceScopeNote(status.ToError());
+}
+return status.ToError();
+  }
+
+  int wpid =
+  llvm::sys::RetryAfterSignal(-1, ::waitpid, tid, nullptr, __WALL);
+  // Need to use __WALL otherwise we receive an error with errno=ECHLD At
+  // this point we should have a thread stopped if waitpid succeeds.
+  if (wpid < 0) {
+// No such thread. The thread may have exited. More error handling
+// may be needed.
+if (errno == ESRCH) {
+  it = tids_to_attach.erase(it);
+  continue;
+}
+return llvm::errorCodeToError(

DavidSpickett wrote:

If you are about to return, is there any need to update tids_to_attach?

Same applies to the code above. If tids_to_attach is a copy local to this 
function, we don't need to clean it up before returning.

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


  1   2   >