[Lldb-commits] [lldb] [lldb] Add ability to detect darwin host linker version to xfail tests (PR #83941)

2024-03-07 Thread Alex Langford via lldb-commits

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


[Lldb-commits] [lldb] d93a126 - [lldb] Add ability to detect darwin host linker version to xfail tests (#83941)

2024-03-07 Thread via lldb-commits

Author: Alex Langford
Date: 2024-03-07T18:04:42-05:00
New Revision: d93a126090b6e772d3b96f201cdd44ea0d6360ef

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

LOG: [lldb] Add ability to detect darwin host linker version to xfail tests 
(#83941)

When Apple released its new linker, it had a subtle bug that caused
LLDB's TLS tests to fail. Unfortunately this means that TLS tests are
not going to work on machines that have affected versions of the linker,
so we should annotate the tests so that they only work when we are
confident the linker has the required fix.

I'm not completely satisfied with this implementation. That being said,
I believe that adding suport for linker versions in general is a
non-trivial change that would require far more thought. There are a few
challenges involved:
- LLDB's testing infra takes an argument to change the compiler, but
there's no way to switch out the linker.
- There's no standard way to ask a compiler what linker it will use.
- There's no standard way to ask a linker what its version is. Many
platforms have the same name for their linker (ld).
- Some platforms automatically switch out the linker underneath you. We
do this for Windows tests (where we use LLD no matter what).

Given that this is affecting the tests on our CI, I think this is an
acceptable solution in the interim.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index c4d063d3cc77ef..187d16aa1baa68 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -3,6 +3,7 @@
 
 # System modules
 import itertools
+import json
 import re
 import subprocess
 import sys
@@ -16,6 +17,7 @@
 from . import lldbtest_config
 import lldbsuite.test.lldbplatform as lldbplatform
 from lldbsuite.test.builders import get_builder
+from lldbsuite.test.lldbutil import is_exe
 
 
 def check_first_register_readable(test_case):
@@ -333,3 +335,28 @@ def expectedCompiler(compilers):
 return True
 
 return False
+
+
+# This is a helper function to determine if a specific version of Xcode's 
linker
+# contains a TLS bug. We want to skip TLS tests if they contain this bug, but
+# adding a linker/linker_version conditions to a decorator is challenging due 
to
+# the number of ways linkers can enter the build process.
+def xcode15LinkerBug():
+"""Returns true iff a test is running on a darwin platform and the host 
linker is between versions 1000 and 1109."""
+darwin_platforms = lldbplatform.translate(lldbplatform.darwin_all)
+if getPlatform() not in darwin_platforms:
+return False
+
+try:
+raw_version_details = subprocess.check_output(
+("xcrun", "ld", "-version_details")
+)
+version_details = json.loads(raw_version_details)
+version = version_details.get("version", "0")
+version_tuple = tuple(int(x) for x in version.split("."))
+if (1000,) <= version_tuple <= (1109,):
+return True
+except:
+pass
+
+return False

diff  --git a/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py 
b/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
index dfe29b451df0a6..2bffd2eea123a6 100644
--- a/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
+++ b/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
@@ -40,6 +40,7 @@ def setUp(self):
 @skipIfWindows
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])
 @skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"]))
+@expectedFailureIf(lldbplatformutil.xcode15LinkerBug())
 def test(self):
 """Test thread-local storage."""
 self.build()



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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Saleem Abdulrasool via lldb-commits

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


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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Saleem Abdulrasool via lldb-commits


@@ -168,8 +168,8 @@ class ConstString {
   // Implicitly convert \class ConstString instances to \class StringRef.
   operator llvm::StringRef() const { return GetStringRef(); }
 
-  // Implicitly convert \class ConstString instances to \class 
std::string_view.
-  operator std::string_view() const {
+  // Explicitly convert \class ConstString instances to \class 
std::string_view.
+  explicit operator std::string_view() const {

compnerd wrote:

:(

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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Hiroshi Yamauchi via lldb-commits


@@ -168,8 +168,8 @@ class ConstString {
   // Implicitly convert \class ConstString instances to \class StringRef.
   operator llvm::StringRef() const { return GetStringRef(); }
 
-  // Implicitly convert \class ConstString instances to \class 
std::string_view.
-  operator std::string_view() const {
+  // Explicitly convert \class ConstString instances to \class 
std::string_view.
+  explicit operator std::string_view() const {

hjyamauchi wrote:

Okay, I tried this to an extent and yeah it's a pretty large change :) I'll 
stick with the current way.

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


[Lldb-commits] [lldb] [PAC][lldb][Dwarf] Support `__ptrauth`-qualified types in user expressions (PR #84387)

2024-03-07 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Daniil Kovalev (kovdan01)


Changes

Depends on #84384 

This adds support for `DW_TAG_LLVM_ptrauth_type` entries corresponding
to explicitly signed types (e.g. free function pointers) in lldb user
expressions. Applies PR https://github.com/apple/llvm-project/pull/8239 from
Apple's downstream and also adds tests and related code.

Co-authored-by: Jonas Devlieghere 


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


10 Files Affected:

- (modified) lldb/include/lldb/Symbol/CompilerType.h (+13) 
- (modified) lldb/include/lldb/Symbol/Type.h (+3-1) 
- (modified) lldb/include/lldb/Symbol/TypeSystem.h (+17) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (+57) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+47) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h (+8) 
- (modified) lldb/source/Symbol/CompilerType.cpp (+32) 
- (modified) lldb/source/Symbol/Type.cpp (+7-1) 
- (modified) lldb/source/Symbol/TypeSystem.cpp (+7) 
- (modified) lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp 
(+135) 


``diff
diff --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index 414c44275aaafc..a0ed6999548f87 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -262,6 +262,12 @@ class CompilerType {
   size_t GetPointerByteSize() const;
   /// \}
 
+  unsigned GetPtrAuthKey() const;
+
+  unsigned GetPtrAuthDiscriminator() const;
+
+  bool GetPtrAuthAddressDiversity() const;
+
   /// Accessors.
   /// \{
 
@@ -369,6 +375,13 @@ class CompilerType {
 
   /// Create related types using the current type's AST
   CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const;
+
+  /// Return a new CompilerType adds a ptrauth modifier with given parameters 
to
+  /// this type if this type is valid and the type system supports ptrauth
+  /// modifiers, else return an invalid type. Note that this does not check if
+  /// this type is a pointer.
+  CompilerType AddPtrAuthModifier(unsigned key, bool isAddressDiscriminated,
+  unsigned extraDiscriminator) const;
   /// \}
 
   /// Exploring the type.
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index acd1a769f13cd6..d55280b58bc4f7 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -401,7 +401,9 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
 /// This type is the synthetic type whose UID is m_encoding_uid.
-eEncodingIsSyntheticUID
+eEncodingIsSyntheticUID,
+/// This type is a signed pointer.
+eEncodingIsLLVMPtrAuthUID
   };
 
   enum class ResolveState : unsigned char {
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index 63829131556e87..ecb92c62821dcd 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -216,6 +216,16 @@ class TypeSystem : public PluginInterface,
 
   virtual uint32_t GetPointerByteSize() = 0;
 
+  // TODO: are we allowed to insert virtual functions in the middle of the 
class
+  // interface and break ABI?
+  virtual unsigned GetPtrAuthKey(lldb::opaque_compiler_type_t type) = 0;
+
+  virtual unsigned
+  GetPtrAuthDiscriminator(lldb::opaque_compiler_type_t type) = 0;
+
+  virtual bool
+  GetPtrAuthAddressDiversity(lldb::opaque_compiler_type_t type) = 0;
+
   // Accessors
 
   virtual ConstString GetTypeName(lldb::opaque_compiler_type_t type,
@@ -280,6 +290,13 @@ class TypeSystem : public PluginInterface,
 
   virtual CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type);
 
+  // TODO: are we allowed to insert virtual functions in the middle of the 
class
+  // interface and break ABI?
+  virtual CompilerType AddPtrAuthModifier(lldb::opaque_compiler_type_t type,
+  unsigned key,
+  bool isAddressDiscriminated,
+  unsigned extraDiscriminator);
+
   /// \param opaque_payload  The m_payload field of Type, which may
   /// carry TypeSystem-specific extra information.
   virtual CompilerType CreateTypedef(lldb::opaque_compiler_type_t type,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 54d06b1115a229..1e13962aadd43e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -495,6 +495,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const 
SymbolContext &sc,
   case DW_TAG_const_type:
   case DW_TAG_restrict_type:
   case DW_TAG_volatile_type:
+  case D

[Lldb-commits] [lldb] [PAC][lldb][Dwarf] Support `__ptrauth`-qualified types in user expressions (PR #84387)

2024-03-07 Thread Daniil Kovalev via lldb-commits

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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-07 Thread via lldb-commits

jimingham wrote:

> > I would say this differently.  Many clients of the GetNumChildren API are 
> > planning to respond the same way to an error and a number of children == 0.
> 
> I haven't done a complete audit, but my expectation for this patch is that 
> the vast majority of users of this API will want to bubble up the error. So 
> I'm seeing this as a transition state, with the goal being to convert all 
> functions that currently use the ValueOr function to also return an Expected.

Cool!  If that ends up not being the case then it would be good to have 
something that says the distinction doesn't matter, but if this construct 
vanishes, all the better!

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


[Lldb-commits] [lldb] [PAC][lldb][Dwarf] Support `__ptrauth`-qualified types in user expressions (PR #84387)

2024-03-07 Thread Daniil Kovalev via lldb-commits

https://github.com/kovdan01 updated 
https://github.com/llvm/llvm-project/pull/84387

>From 728f5644aebfafd2114e7e47a9b83ef057423997 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Tue, 20 Feb 2024 10:57:54 -0800
Subject: [PATCH 1/4] Upstream ptrauth changes to DWARFASTParserClang

---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 57 +++
 1 file changed, 57 insertions(+)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 54d06b1115a229..67fe830e1aa70d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -495,6 +495,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const 
SymbolContext &sc,
   case DW_TAG_const_type:
   case DW_TAG_restrict_type:
   case DW_TAG_volatile_type:
+  case DW_TAG_LLVM_ptrauth_type:
   case DW_TAG_atomic_type:
   case DW_TAG_unspecified_type: {
 type_sp = ParseTypeModifier(sc, die, attrs);
@@ -676,6 +677,62 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext 
&sc,
   case DW_TAG_volatile_type:
 encoding_data_type = Type::eEncodingIsVolatileUID;
 break;
+  case DW_TAG_LLVM_ptrauth_type: {
+DWARFDIE ptr_die = die.GetReferencedDIE(DW_AT_type);
+// FIXME: Fully resolving the type here may affect performance.
+Type *res_type = dwarf->ResolveType(ptr_die);
+if (!res_type)
+  break;
+attrs.type.Clear();
+encoding_data_type = Type::eEncodingIsUID;
+resolve_state = Type::ResolveState::Full;
+
+// Apply the ptrauth qualifier to the resolved type.
+auto *ptr_type =
+(clang::Type *)res_type->GetForwardCompilerType().GetOpaqueQualType();
+auto getAttr = [&](llvm::dwarf::Attribute Attr, unsigned defaultValue = 0) 
{
+  return die.GetAttributeValueAsUnsigned(Attr, defaultValue);
+};
+const unsigned key = getAttr(DW_AT_LLVM_ptrauth_key);
+const bool addr_disc = getAttr(DW_AT_LLVM_ptrauth_address_discriminated);
+const unsigned extra = getAttr(DW_AT_LLVM_ptrauth_extra_discriminator);
+const bool isapointer = getAttr(DW_AT_LLVM_ptrauth_isa_pointer);
+const bool authenticates_null_values =
+getAttr(DW_AT_LLVM_ptrauth_authenticates_null_values, 0);
+const bool is_restricted_integral = !ptr_type->isPointerType();
+const unsigned authentication_mode_int = getAttr(
+DW_AT_LLVM_ptrauth_authentication_mode,
+static_cast(clang::PointerAuthenticationMode::SignAndAuth));
+clang::PointerAuthenticationMode authentication_mode =
+clang::PointerAuthenticationMode::SignAndAuth;
+if (authentication_mode_int >=
+static_cast(clang::PointerAuthenticationMode::None) &&
+authentication_mode_int <=
+static_cast(
+clang::PointerAuthenticationMode::SignAndAuth)) {
+  authentication_mode = static_cast(
+  authentication_mode_int);
+} else {
+  dwarf->GetObjectFile()->GetModule()->ReportError(
+  "[{0:x16}]: invalid pointer authentication mode method {1:x4}",
+  die.GetOffset(), authentication_mode_int);
+}
+
+// FIXME: Use these variables when PointerAuthQualifier is more complete
+// upstream.
+(void)is_restricted_integral;
+
+clang::Qualifiers qualifiers;
+auto ptr_auth = clang::PointerAuthQualifier::Create(
+key, addr_disc, extra, authentication_mode, isapointer,
+authenticates_null_values);
+qualifiers.setPointerAuth(ptr_auth);
+auto &ctx = m_ast.getASTContext();
+auto qual_type = ctx.getQualifiedType(ptr_type, qualifiers);
+clang_type =
+CompilerType(m_ast.weak_from_this(), qual_type.getAsOpaquePtr());
+break;
+  }
   case DW_TAG_atomic_type:
 encoding_data_type = Type::eEncodingIsAtomicUID;
 break;

>From 8aa1ba0b05362b8960faac1945bb25c68ecb4b98 Mon Sep 17 00:00:00 2001
From: Daniil Kovalev 
Date: Thu, 7 Mar 2024 16:34:09 +0300
Subject: [PATCH 2/4] [PAC][lldb] Use `eEncodingIsLLVMPtrAuthUID` for
 `__ptrauth`-qualified types

---
 lldb/include/lldb/Symbol/Type.h   | 4 +++-
 .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp  | 2 +-
 lldb/source/Symbol/Type.cpp   | 8 +++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index acd1a769f13cd6..d55280b58bc4f7 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -401,7 +401,9 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
 /// This type is the synthetic type whose UID is m_encoding_uid.
-eEncodingIsSyntheticUID
+eEncodingIsSyntheticUID,
+/// This type is a signed pointer.
+eEncodingIsLLVMPtrAuthUID
   };
 
   enum class ResolveState : unsi

[Lldb-commits] [lldb] [PAC][lldb][Dwarf] Support `__ptrauth`-qualified types in user expressions (PR #84387)

2024-03-07 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 9cf9cb271bf86bda4996be9a31fa413381f2f5e3 
8d05d535a1c9f091e5c90af0a2e6969c57e26405 -- 
lldb/include/lldb/Symbol/CompilerType.h lldb/include/lldb/Symbol/Type.h 
lldb/include/lldb/Symbol/TypeSystem.h 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
lldb/source/Symbol/CompilerType.cpp lldb/source/Symbol/Type.cpp 
lldb/source/Symbol/TypeSystem.cpp 
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 6fa08236c1..60ad7bc029 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -484,11 +484,11 @@ std::optional 
Type::GetByteSize(ExecutionContextScope *exe_scope) {
 case eEncodingIsLValueReferenceUID:
 case eEncodingIsRValueReferenceUID:
 case eEncodingIsLLVMPtrAuthUID: {
-if (ArchSpec arch = m_symbol_file->GetObjectFile()->GetArchitecture()) {
-  m_byte_size = arch.GetAddressByteSize();
-  m_byte_size_has_value = true;
-  return static_cast(m_byte_size);
-}
+  if (ArchSpec arch = m_symbol_file->GetObjectFile()->GetArchitecture()) {
+m_byte_size = arch.GetAddressByteSize();
+m_byte_size_has_value = true;
+return static_cast(m_byte_size);
+  }
 } break;
   }
   return {};

``




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


[Lldb-commits] [lldb] [PAC][lldb][Dwarf] Support `__ptrauth`-qualified types in user expressions (PR #84387)

2024-03-07 Thread Daniil Kovalev via lldb-commits

https://github.com/kovdan01 created 
https://github.com/llvm/llvm-project/pull/84387

Depends on #84384 

This adds support for `DW_TAG_LLVM_ptrauth_type` entries corresponding
to explicitly signed types (e.g. free function pointers) in lldb user
expressions. Applies PR https://github.com/apple/llvm-project/pull/8239 from
Apple's downstream and also adds tests and related code.

Co-authored-by: Jonas Devlieghere 


>From 728f5644aebfafd2114e7e47a9b83ef057423997 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Tue, 20 Feb 2024 10:57:54 -0800
Subject: [PATCH 1/4] Upstream ptrauth changes to DWARFASTParserClang

---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 57 +++
 1 file changed, 57 insertions(+)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 54d06b1115a229..67fe830e1aa70d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -495,6 +495,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const 
SymbolContext &sc,
   case DW_TAG_const_type:
   case DW_TAG_restrict_type:
   case DW_TAG_volatile_type:
+  case DW_TAG_LLVM_ptrauth_type:
   case DW_TAG_atomic_type:
   case DW_TAG_unspecified_type: {
 type_sp = ParseTypeModifier(sc, die, attrs);
@@ -676,6 +677,62 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext 
&sc,
   case DW_TAG_volatile_type:
 encoding_data_type = Type::eEncodingIsVolatileUID;
 break;
+  case DW_TAG_LLVM_ptrauth_type: {
+DWARFDIE ptr_die = die.GetReferencedDIE(DW_AT_type);
+// FIXME: Fully resolving the type here may affect performance.
+Type *res_type = dwarf->ResolveType(ptr_die);
+if (!res_type)
+  break;
+attrs.type.Clear();
+encoding_data_type = Type::eEncodingIsUID;
+resolve_state = Type::ResolveState::Full;
+
+// Apply the ptrauth qualifier to the resolved type.
+auto *ptr_type =
+(clang::Type *)res_type->GetForwardCompilerType().GetOpaqueQualType();
+auto getAttr = [&](llvm::dwarf::Attribute Attr, unsigned defaultValue = 0) 
{
+  return die.GetAttributeValueAsUnsigned(Attr, defaultValue);
+};
+const unsigned key = getAttr(DW_AT_LLVM_ptrauth_key);
+const bool addr_disc = getAttr(DW_AT_LLVM_ptrauth_address_discriminated);
+const unsigned extra = getAttr(DW_AT_LLVM_ptrauth_extra_discriminator);
+const bool isapointer = getAttr(DW_AT_LLVM_ptrauth_isa_pointer);
+const bool authenticates_null_values =
+getAttr(DW_AT_LLVM_ptrauth_authenticates_null_values, 0);
+const bool is_restricted_integral = !ptr_type->isPointerType();
+const unsigned authentication_mode_int = getAttr(
+DW_AT_LLVM_ptrauth_authentication_mode,
+static_cast(clang::PointerAuthenticationMode::SignAndAuth));
+clang::PointerAuthenticationMode authentication_mode =
+clang::PointerAuthenticationMode::SignAndAuth;
+if (authentication_mode_int >=
+static_cast(clang::PointerAuthenticationMode::None) &&
+authentication_mode_int <=
+static_cast(
+clang::PointerAuthenticationMode::SignAndAuth)) {
+  authentication_mode = static_cast(
+  authentication_mode_int);
+} else {
+  dwarf->GetObjectFile()->GetModule()->ReportError(
+  "[{0:x16}]: invalid pointer authentication mode method {1:x4}",
+  die.GetOffset(), authentication_mode_int);
+}
+
+// FIXME: Use these variables when PointerAuthQualifier is more complete
+// upstream.
+(void)is_restricted_integral;
+
+clang::Qualifiers qualifiers;
+auto ptr_auth = clang::PointerAuthQualifier::Create(
+key, addr_disc, extra, authentication_mode, isapointer,
+authenticates_null_values);
+qualifiers.setPointerAuth(ptr_auth);
+auto &ctx = m_ast.getASTContext();
+auto qual_type = ctx.getQualifiedType(ptr_type, qualifiers);
+clang_type =
+CompilerType(m_ast.weak_from_this(), qual_type.getAsOpaquePtr());
+break;
+  }
   case DW_TAG_atomic_type:
 encoding_data_type = Type::eEncodingIsAtomicUID;
 break;

>From f2a2cdc1ef3d4722a0b336ec484ef0200a0f1ee9 Mon Sep 17 00:00:00 2001
From: Daniil Kovalev 
Date: Thu, 7 Mar 2024 16:34:09 +0300
Subject: [PATCH 2/4] [PAC][lldb] Use `eEncodingIsLLVMPtrAuthUID` for
 `__ptrauth`-qualified types

---
 lldb/include/lldb/Symbol/Type.h|  4 +++-
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp   |  2 +-
 lldb/source/Symbol/Type.cpp| 18 --
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index acd1a769f13cd6..d55280b58bc4f7 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -401,7 +401,9 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 /// This type is the type wh

[Lldb-commits] [lldb] [lldb][test] Enforce `pexpect` system availability by default (PR #84270)

2024-03-07 Thread Daniel Thornburgh via lldb-commits

mysterymath wrote:

> @mysterymath do you run the API test suites with that custom python, i.e. 
> `ninja check-lldb-api`? If so, would you be able to add bundle `pexpect` for 
> your tests even if it's not in what you ship?

We do run the tests with the Python we ship, since we don't have direct control 
of the version that is present on our builders, and Python doesn't have ABI 
compatibility sufficient for LLDB's purposes across major versions. We've 
generally tried to keep our builds hermetic and not build anything against host 
libraries unless absolutely necessary.

We could possibly add `pexpect` to our shipped Python, but I haven't scoped 
what that would entail yet; there may be some bureaucratic hoops to jump 
through. I wouldn't expect much sympathy on that front of course, but it does 
seem like adding deps to the Python used by LLDB's test suite does make it more 
difficult to package a hermetic distribution of LLVM+LLDB.

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


[Lldb-commits] [lldb] [lldb] Add ability to detect darwin host linker version to xfail tests (PR #83941)

2024-03-07 Thread Dave Lee via lldb-commits

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

looks good

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


[Lldb-commits] [lldb] [lldb] Add ability to detect darwin host linker version to xfail tests (PR #83941)

2024-03-07 Thread Alex Langford via lldb-commits

https://github.com/bulbazord updated 
https://github.com/llvm/llvm-project/pull/83941

>From 89d1c201636403bb26f12cf9681cbaf86b5c943b Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Mon, 4 Mar 2024 14:17:20 -0800
Subject: [PATCH] [lldb] Add ability to detect darwin host linker version to
 xfail tests

When Apple released its new linker, it had a subtle bug that caused
LLDB's TLS tests to fail. Unfortunately this means that TLS tests
are not going to work on machines that have affected versions of the
linker, so we should annotate the tests so that they only work when we
are confident the linker has the required fix.

I'm not completely satisfied with this implementation. That being said,
I believe that adding suport for linker versions in general is a
non-trivial change that would require far more thought. There are a few
challenges involved:
- LLDB's testing infra takes an argument to change the compiler, but
  there's no way to switch out the linker.
- There's no standard way to ask a compiler what linker it will use.
- There's no standard way to ask a linker what its version is. Many
  platforms have the same name for their linker (ld).
- Some platforms automatically switch out the linker underneath you. We
  do this for Windows tests (where we use LLD no matter what).

Given that this is affecting the tests on our CI, I think this is an
acceptable solution in the interim.
---
 .../Python/lldbsuite/test/lldbplatformutil.py | 27 +++
 .../API/lang/c/tls_globals/TestTlsGlobals.py  |  1 +
 2 files changed, 28 insertions(+)

diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index c4d063d3cc77ef..187d16aa1baa68 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -3,6 +3,7 @@
 
 # System modules
 import itertools
+import json
 import re
 import subprocess
 import sys
@@ -16,6 +17,7 @@
 from . import lldbtest_config
 import lldbsuite.test.lldbplatform as lldbplatform
 from lldbsuite.test.builders import get_builder
+from lldbsuite.test.lldbutil import is_exe
 
 
 def check_first_register_readable(test_case):
@@ -333,3 +335,28 @@ def expectedCompiler(compilers):
 return True
 
 return False
+
+
+# This is a helper function to determine if a specific version of Xcode's 
linker
+# contains a TLS bug. We want to skip TLS tests if they contain this bug, but
+# adding a linker/linker_version conditions to a decorator is challenging due 
to
+# the number of ways linkers can enter the build process.
+def xcode15LinkerBug():
+"""Returns true iff a test is running on a darwin platform and the host 
linker is between versions 1000 and 1109."""
+darwin_platforms = lldbplatform.translate(lldbplatform.darwin_all)
+if getPlatform() not in darwin_platforms:
+return False
+
+try:
+raw_version_details = subprocess.check_output(
+("xcrun", "ld", "-version_details")
+)
+version_details = json.loads(raw_version_details)
+version = version_details.get("version", "0")
+version_tuple = tuple(int(x) for x in version.split("."))
+if (1000,) <= version_tuple <= (1109,):
+return True
+except:
+pass
+
+return False
diff --git a/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py 
b/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
index dfe29b451df0a6..2bffd2eea123a6 100644
--- a/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
+++ b/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
@@ -40,6 +40,7 @@ def setUp(self):
 @skipIfWindows
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])
 @skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"]))
+@expectedFailureIf(lldbplatformutil.xcode15LinkerBug())
 def test(self):
 """Test thread-local storage."""
 self.build()

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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Alex Langford via lldb-commits


@@ -168,8 +168,8 @@ class ConstString {
   // Implicitly convert \class ConstString instances to \class StringRef.
   operator llvm::StringRef() const { return GetStringRef(); }
 
-  // Implicitly convert \class ConstString instances to \class 
std::string_view.
-  operator std::string_view() const {
+  // Explicitly convert \class ConstString instances to \class 
std::string_view.
+  explicit operator std::string_view() const {

bulbazord wrote:

I think that would be nice to do. FWIW, I tried making the StringRef conversion 
operator explicit a few months ago and found that it was a pretty large change. 
We use the implicitness of the conversion in a lot of places.

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


[Lldb-commits] [lldb] [lldb] Add ability to detect darwin host linker version to xfail tests (PR #83941)

2024-03-07 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 
a41226b05510a6f40d99fc622d78853460dc5599...a72d9d259b441c338399340d630ed7a64c1e228a
 lldb/packages/Python/lldbsuite/test/lldbplatformutil.py 
lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
``





View the diff from darker here.


``diff
--- packages/Python/lldbsuite/test/lldbplatformutil.py  2024-03-07 
21:07:47.00 +
+++ packages/Python/lldbsuite/test/lldbplatformutil.py  2024-03-07 
21:10:29.730620 +
@@ -346,11 +346,13 @@
 darwin_platforms = lldbplatform.translate(lldbplatform.darwin_all)
 if getPlatform() not in darwin_platforms:
 return False
 
 try:
-raw_version_details = subprocess.check_output(("xcrun", "ld", 
"-version_details"))
+raw_version_details = subprocess.check_output(
+("xcrun", "ld", "-version_details")
+)
 version_details = json.loads(raw_version_details)
 version = version_details.get("version", "0")
 version_tuple = tuple(int(x) for x in version.split("."))
 if (1000,) <= version_tuple <= (1109,):
 return True

``




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


[Lldb-commits] [lldb] [lldb] Add ability to detect darwin host linker version to xfail tests (PR #83941)

2024-03-07 Thread Alex Langford via lldb-commits

https://github.com/bulbazord updated 
https://github.com/llvm/llvm-project/pull/83941

>From a72d9d259b441c338399340d630ed7a64c1e228a Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Mon, 4 Mar 2024 14:17:20 -0800
Subject: [PATCH] [lldb] Add ability to detect darwin host linker version to
 xfail tests

When Apple released its new linker, it had a subtle bug that caused
LLDB's TLS tests to fail. Unfortunately this means that TLS tests
are not going to work on machines that have affected versions of the
linker, so we should annotate the tests so that they only work when we
are confident the linker has the required fix.

I'm not completely satisfied with this implementation. That being said,
I believe that adding suport for linker versions in general is a
non-trivial change that would require far more thought. There are a few
challenges involved:
- LLDB's testing infra takes an argument to change the compiler, but
  there's no way to switch out the linker.
- There's no standard way to ask a compiler what linker it will use.
- There's no standard way to ask a linker what its version is. Many
  platforms have the same name for their linker (ld).
- Some platforms automatically switch out the linker underneath you. We
  do this for Windows tests (where we use LLD no matter what).

Given that this is affecting the tests on our CI, I think this is an
acceptable solution in the interim.
---
 .../Python/lldbsuite/test/lldbplatformutil.py | 25 +++
 .../API/lang/c/tls_globals/TestTlsGlobals.py  |  1 +
 2 files changed, 26 insertions(+)

diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index c4d063d3cc77ef..03e28fe6ba7795 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -3,6 +3,7 @@
 
 # System modules
 import itertools
+import json
 import re
 import subprocess
 import sys
@@ -16,6 +17,7 @@
 from . import lldbtest_config
 import lldbsuite.test.lldbplatform as lldbplatform
 from lldbsuite.test.builders import get_builder
+from lldbsuite.test.lldbutil import is_exe
 
 
 def check_first_register_readable(test_case):
@@ -333,3 +335,26 @@ def expectedCompiler(compilers):
 return True
 
 return False
+
+
+# This is a helper function to determine if a specific version of Xcode's 
linker
+# contains a TLS bug. We want to skip TLS tests if they contain this bug, but
+# adding a linker/linker_version conditions to a decorator is challenging due 
to
+# the number of ways linkers can enter the build process.
+def xcode15LinkerBug():
+"""Returns true iff a test is running on a darwin platform and the host 
linker is between versions 1000 and 1109."""
+darwin_platforms = lldbplatform.translate(lldbplatform.darwin_all)
+if getPlatform() not in darwin_platforms:
+return False
+
+try:
+raw_version_details = subprocess.check_output(("xcrun", "ld", 
"-version_details"))
+version_details = json.loads(raw_version_details)
+version = version_details.get("version", "0")
+version_tuple = tuple(int(x) for x in version.split("."))
+if (1000,) <= version_tuple <= (1109,):
+return True
+except:
+pass
+
+return False
diff --git a/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py 
b/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
index dfe29b451df0a6..2bffd2eea123a6 100644
--- a/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
+++ b/lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py
@@ -40,6 +40,7 @@ def setUp(self):
 @skipIfWindows
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])
 @skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"]))
+@expectedFailureIf(lldbplatformutil.xcode15LinkerBug())
 def test(self):
 """Test thread-local storage."""
 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] Add ability to detect darwin host linker version to xfail tests (PR #83941)

2024-03-07 Thread Dave Lee via lldb-commits


@@ -333,3 +335,41 @@ def expectedCompiler(compilers):
 return True
 
 return False
+
+
+# This is a helper function to determine if a specific version of Xcode's 
linker
+# contains a TLS bug. We want to skip TLS tests if they contain this bug, but
+# adding a linker/linker_version conditions to a decorator is challenging due 
to
+# the number of ways linkers can enter the build process.
+def darwinLinkerHasTLSBug():
+"""Returns true iff a test is running on a darwin platform and the host 
linker is between versions 1000 and 1109."""
+darwin_platforms = lldbplatform.translate(lldbplatform.darwin_all)
+if getPlatform() not in darwin_platforms:
+return False
+
+linker_path = (
+subprocess.check_output(["xcrun", "--find", 
"ld"]).rstrip().decode("utf-8")
+)
+if not is_exe(linker_path):
+return False
+
+raw_linker_info = (
+subprocess.check_output([linker_path, "-version_details"])
+.rstrip()
+.decode("utf-8")
+)
+parsed_linker_info = json.loads(raw_linker_info)
+if "version" not in parsed_linker_info:
+return False
+
+raw_version = parsed_linker_info["version"]
+version = None
+try:
+version = int(raw_version)

kastiglione wrote:

`float` also isn't sufficient, since some versions can contain 3 separate 
numbers (ie `100.5.8`).

In my related PR, I used this:

```py
version_tuple = tuple(int(x) for x in version.split("."))
if (1000,) <= version_tuple <= (1109,):
# handle bug
```

Comparisons of tuples appear to behave as desired.

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


[Lldb-commits] [lldb] ecf7db8 - [lldb] Disable shell tests affected by ld_new bug (#84246)

2024-03-07 Thread via lldb-commits

Author: Dave Lee
Date: 2024-03-07T12:55:13-08:00
New Revision: ecf7db8b52d7061ef8f14c1f7b6fcc370072d087

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

LOG: [lldb] Disable shell tests affected by ld_new bug (#84246)

Equivalent to the changes made in 
https://github.com/llvm/llvm-project/pull/83941, 
except to support shell tests.

Added: 


Modified: 
lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
lldb/test/Shell/lit.cfg.py

Removed: 




diff  --git a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test 
b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
index 3df9906394f432..7b5d6650fe2f75 100644
--- a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
+++ b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
@@ -1,7 +1,7 @@
 # Test handing of dwarf expressions specifying the location of registers, if
 # those expressions refer to the frame's CFA value.
 
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld_new-bug
 # REQUIRES: target-x86_64, native
 
 # RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/eh-frame-dwarf-unwind.s -o %t

diff  --git a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test 
b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
index 682b0e5332b1c5..9bc7c78f79b26b 100644
--- a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -2,7 +2,7 @@
 # points to non-executable memory.
 
 # REQUIRES: target-x86_64
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld_new-bug
 
 # RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp 
%p/Inputs/thread-step-out-ret-addr-check.s -o %t
 # RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s

diff  --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index d75c1f532e147f..31afe5151c0661 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -1,5 +1,6 @@
 # -*- Python -*-
 
+import json
 import os
 import platform
 import re
@@ -179,3 +180,18 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
+
+# Determine if a specific version of Xcode's linker contains a bug. We want to
+# skip affected tests if they contain this bug.
+if platform.system() == "Darwin":
+try:
+raw_version_details = subprocess.check_output(
+("xcrun", "ld", "-version_details")
+)
+version_details = json.loads(raw_version_details)
+version = version_details.get("version", "0")
+version_tuple = tuple(int(x) for x in version.split("."))
+if (1000,) <= version_tuple <= (1109,):
+config.available_features.add("ld_new-bug")
+except:
+pass



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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld_new bug (PR #84246)

2024-03-07 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-07 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

> I would say this differently.  Many clients of the GetNumChildren API are 
> planning to respond the same way to an error and a number of children == 0.

I haven't done a complete audit, but my expectation for this patch is that the 
vast majority of users of this API will want to bubble up the error. So I'm 
seeing this as a transition state, with the goal being to convert all functions 
that currently use the ValueOr function to also return an Expected.

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld_new bug (PR #84246)

2024-03-07 Thread Jonas Devlieghere via lldb-commits

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

🚀

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


[Lldb-commits] [lldb] [lldb] Do some gardening in ProgressReportTest (NFC) (PR #84278)

2024-03-07 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] 4586366 - [lldb] Do some gardening in ProgressReportTest (NFC) (#84278)

2024-03-07 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-03-07T12:41:06-08:00
New Revision: 458636690afdd223ffa72f49164f30449b588892

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

LOG: [lldb] Do some gardening in ProgressReportTest (NFC) (#84278)

- Factor our common setup code.
- Split the ProgressManager test into separate tests as they test
separate things.
- Fix usage of EXPECT (which continues on failure) and ASSERT (which
halts on failure). We must use the latter when calling GetEvent as
otherwise we'll try to dereference a null EventSP.

Added: 


Modified: 
lldb/unittests/Core/ProgressReportTest.cpp

Removed: 




diff  --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
index e0253cbc4ec59b..1f993180fd8392 100644
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -22,9 +22,29 @@
 using namespace lldb;
 using namespace lldb_private;
 
+static std::chrono::milliseconds TIMEOUT(100);
+
 class ProgressReportTest : public ::testing::Test {
-  SubsystemRAII subsystems;
+public:
+  ListenerSP CreateListenerFor(uint32_t bit) {
+// Set up the debugger, make sure that was done properly.
+ArchSpec arch("x86_64-apple-macosx-");
+Platform::SetHostPlatform(
+PlatformRemoteMacOSX::CreateInstance(true, &arch));
+
+m_debugger_sp = Debugger::CreateInstance();
+
+// Get the debugger's broadcaster.
+Broadcaster &broadcaster = m_debugger_sp->GetBroadcaster();
+
+// Create a listener, make sure it can receive events and that it's
+// listening to the correct broadcast bit.
+m_listener_sp = Listener::MakeListener("progress-listener");
+m_listener_sp->StartListeningForEvents(&broadcaster, bit);
+return m_listener_sp;
+  }
 
+protected:
   // The debugger's initialization function can't be called with no arguments
   // so calling it using SubsystemRAII will cause the test build to fail as
   // SubsystemRAII will call Initialize with no arguments. As such we set it up
@@ -33,30 +53,14 @@ class ProgressReportTest : public ::testing::Test {
 std::call_once(TestUtilities::g_debugger_initialize_flag,
[]() { Debugger::Initialize(nullptr); });
   };
+
+  DebuggerSP m_debugger_sp;
+  ListenerSP m_listener_sp;
+  SubsystemRAII subsystems;
 };
 
 TEST_F(ProgressReportTest, TestReportCreation) {
-  std::chrono::milliseconds timeout(100);
-
-  // Set up the debugger, make sure that was done properly.
-  ArchSpec arch("x86_64-apple-macosx-");
-  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
-
-  DebuggerSP debugger_sp = Debugger::CreateInstance();
-  ASSERT_TRUE(debugger_sp);
-
-  // Get the debugger's broadcaster.
-  Broadcaster &broadcaster = debugger_sp->GetBroadcaster();
-
-  // Create a listener, make sure it can receive events and that it's
-  // listening to the correct broadcast bit.
-  ListenerSP listener_sp = Listener::MakeListener("progress-listener");
-
-  listener_sp->StartListeningForEvents(&broadcaster,
-   Debugger::eBroadcastBitProgress);
-  EXPECT_TRUE(
-  broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
-
+  ListenerSP listener_sp = CreateListenerFor(Debugger::eBroadcastBitProgress);
   EventSP event_sp;
   const ProgressEventData *data;
 
@@ -73,82 +77,64 @@ TEST_F(ProgressReportTest, TestReportCreation) {
   // in this order:
   // Starting progress: 1, 2, 3
   // Ending progress: 3, 2, 1
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT));
   data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
 
-  ASSERT_EQ(data->GetDetails(), "Starting report 1");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
+  EXPECT_EQ(data->GetDetails(), "Starting report 1");
+  EXPECT_FALSE(data->IsFinite());
+  EXPECT_FALSE(data->GetCompleted());
+  EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
+  EXPECT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
 
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT));
   data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
 
-  ASSERT_EQ(data->GetDetails(), "Starting report 2");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 2: Starting report 2");
+  EXPECT_EQ(data->GetDetails(), "Starting report 2");
+  EXPECT_FALSE(data->IsFinite());
+  EXPE

[Lldb-commits] [lldb] [lldb] Do some gardening in ProgressReportTest (NFC) (PR #84278)

2024-03-07 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/84278

>From 8b85a2dd23e29cd9eca807d70ffb95bc4b1dcc82 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Wed, 6 Mar 2024 21:54:45 -0800
Subject: [PATCH] [lldb] Do some gardening in ProgressReportTest (NFC)

 - Factor our common setup code.
 - Split the ProgressManager test into separate tests as they test
   separate things.
 - Fix usage of EXPECT (which continues on failure) and ASSERT (which
   halts on failure). We must use the latter when calling GetEvent as
   otherwise we'll try to dereference a null EventSP.
---
 lldb/unittests/Core/ProgressReportTest.cpp | 199 ++---
 1 file changed, 96 insertions(+), 103 deletions(-)

diff --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
index e0253cbc4ec59b..1f993180fd8392 100644
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -22,9 +22,29 @@
 using namespace lldb;
 using namespace lldb_private;
 
+static std::chrono::milliseconds TIMEOUT(100);
+
 class ProgressReportTest : public ::testing::Test {
-  SubsystemRAII subsystems;
+public:
+  ListenerSP CreateListenerFor(uint32_t bit) {
+// Set up the debugger, make sure that was done properly.
+ArchSpec arch("x86_64-apple-macosx-");
+Platform::SetHostPlatform(
+PlatformRemoteMacOSX::CreateInstance(true, &arch));
+
+m_debugger_sp = Debugger::CreateInstance();
+
+// Get the debugger's broadcaster.
+Broadcaster &broadcaster = m_debugger_sp->GetBroadcaster();
+
+// Create a listener, make sure it can receive events and that it's
+// listening to the correct broadcast bit.
+m_listener_sp = Listener::MakeListener("progress-listener");
+m_listener_sp->StartListeningForEvents(&broadcaster, bit);
+return m_listener_sp;
+  }
 
+protected:
   // The debugger's initialization function can't be called with no arguments
   // so calling it using SubsystemRAII will cause the test build to fail as
   // SubsystemRAII will call Initialize with no arguments. As such we set it up
@@ -33,30 +53,14 @@ class ProgressReportTest : public ::testing::Test {
 std::call_once(TestUtilities::g_debugger_initialize_flag,
[]() { Debugger::Initialize(nullptr); });
   };
+
+  DebuggerSP m_debugger_sp;
+  ListenerSP m_listener_sp;
+  SubsystemRAII subsystems;
 };
 
 TEST_F(ProgressReportTest, TestReportCreation) {
-  std::chrono::milliseconds timeout(100);
-
-  // Set up the debugger, make sure that was done properly.
-  ArchSpec arch("x86_64-apple-macosx-");
-  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
-
-  DebuggerSP debugger_sp = Debugger::CreateInstance();
-  ASSERT_TRUE(debugger_sp);
-
-  // Get the debugger's broadcaster.
-  Broadcaster &broadcaster = debugger_sp->GetBroadcaster();
-
-  // Create a listener, make sure it can receive events and that it's
-  // listening to the correct broadcast bit.
-  ListenerSP listener_sp = Listener::MakeListener("progress-listener");
-
-  listener_sp->StartListeningForEvents(&broadcaster,
-   Debugger::eBroadcastBitProgress);
-  EXPECT_TRUE(
-  broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
-
+  ListenerSP listener_sp = CreateListenerFor(Debugger::eBroadcastBitProgress);
   EventSP event_sp;
   const ProgressEventData *data;
 
@@ -73,82 +77,64 @@ TEST_F(ProgressReportTest, TestReportCreation) {
   // in this order:
   // Starting progress: 1, 2, 3
   // Ending progress: 3, 2, 1
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT));
   data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
 
-  ASSERT_EQ(data->GetDetails(), "Starting report 1");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
+  EXPECT_EQ(data->GetDetails(), "Starting report 1");
+  EXPECT_FALSE(data->IsFinite());
+  EXPECT_FALSE(data->GetCompleted());
+  EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
+  EXPECT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
 
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT));
   data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
 
-  ASSERT_EQ(data->GetDetails(), "Starting report 2");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 2: Starting report 2");
+  EXPECT_EQ(data->GetDetails(), "Starting report 2");
+  EXPECT_FALSE(data->IsFinite());
+  EXPECT_FALSE(data->GetCompleted());
+  EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
+  EXPECT_

[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld_new bug (PR #84246)

2024-03-07 Thread Dave Lee via lldb-commits

https://github.com/kastiglione updated 
https://github.com/llvm/llvm-project/pull/84246

>From 1fb13a2d034dbea1d1ba2ef87354199a815f3788 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Wed, 6 Mar 2024 14:23:05 -0800
Subject: [PATCH 1/3] [lldb] Disable shell tests affected by ld64 bug

---
 lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test|  2 +-
 .../Shell/Unwind/thread-step-out-ret-addr-check.test |  2 +-
 lldb/test/Shell/lit.cfg.py   | 12 
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test 
b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
index 3df9906394f432..783bfd45c4669a 100644
--- a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
+++ b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
@@ -1,7 +1,7 @@
 # Test handing of dwarf expressions specifying the location of registers, if
 # those expressions refer to the frame's CFA value.
 
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 # REQUIRES: target-x86_64, native
 
 # RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/eh-frame-dwarf-unwind.s -o %t
diff --git a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test 
b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
index 682b0e5332b1c5..a2b5ae8a9e3e5f 100644
--- a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -2,7 +2,7 @@
 # points to non-executable memory.
 
 # REQUIRES: target-x86_64
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 
 # RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp 
%p/Inputs/thread-step-out-ret-addr-check.s -o %t
 # RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index d75c1f532e147f..6d41dc7d8d7325 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -1,5 +1,6 @@
 # -*- Python -*-
 
+import json
 import os
 import platform
 import re
@@ -179,3 +180,14 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
+
+# Determine if a specific version of Xcode's linker contains a TLS bug. We want
+# to skip TLS tests if they contain this bug.
+try:
+raw_version_details = subprocess.check_output(("xcrun", "ld", 
"-version_details"))
+version_details = json.loads(raw_version_details)
+version = version_details.get("version", "0")
+if 1000 <= float(version) <= 1109:
+config.available_features.add("ld64-tls-bug")
+except:
+pass

>From 92f29840ba8df95b0fb8fa7fd2bf9a679e749849 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 7 Mar 2024 10:10:22 -0800
Subject: [PATCH 2/3] The bug is not TLS specific

---
 lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test  | 2 +-
 lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test | 2 +-
 lldb/test/Shell/lit.cfg.py | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test 
b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
index 783bfd45c4669a..7b5d6650fe2f75 100644
--- a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
+++ b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
@@ -1,7 +1,7 @@
 # Test handing of dwarf expressions specifying the location of registers, if
 # those expressions refer to the frame's CFA value.
 
-# UNSUPPORTED: system-windows, ld64-tls-bug
+# UNSUPPORTED: system-windows, ld_new-bug
 # REQUIRES: target-x86_64, native
 
 # RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/eh-frame-dwarf-unwind.s -o %t
diff --git a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test 
b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
index a2b5ae8a9e3e5f..9bc7c78f79b26b 100644
--- a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -2,7 +2,7 @@
 # points to non-executable memory.
 
 # REQUIRES: target-x86_64
-# UNSUPPORTED: system-windows, ld64-tls-bug
+# UNSUPPORTED: system-windows, ld_new-bug
 
 # RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp 
%p/Inputs/thread-step-out-ret-addr-check.s -o %t
 # RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index 6d41dc7d8d7325..1362dfcf7c4354 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -181,13 +181,13 @@ def calculate_arch_features(arch_string):
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
 
-# Determine if a specific version of Xcode's linker contains a TLS bug. We want
-# to skip TLS tests if they contain this bug.
+# Determine if a specific version of Xcode's linker contains a bug. We want to
+# skip affected tests if they contain this bug.
 try:
 raw_version_details = subprocess.check_outpu

[Lldb-commits] [lldb] [lldb][test] Enforce `pexpect` system availability by default (PR #84270)

2024-03-07 Thread Jordan Rupprecht via lldb-commits

rupprecht wrote:

@mysterymath do you run the API test suites with that custom python, i.e. 
`ninja check-lldb-api`? If so, would you be able to add bundle `pexpect` for 
your tests even if it's not in what you ship?

The goal is to be able to delete 
https://github.com/llvm/llvm-project/tree/main/lldb/third_party/Python/module/pexpect-4.6.
 This library is only used in the API tests.

The goal of the cmake check here is to be able to have an ~immediate feedback 
loop that `pexpect` needs to be installed, instead of waiting a long time until 
`ninja check-lldb-api` runs the tests and discovers that `import pexpect` 
fails. If you don't run these tests, but the cmake warning is still blocking 
you, maybe we should just remove the check. 
`LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS` serves essentially the same purpose but 
is opt-in.

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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Saleem Abdulrasool via lldb-commits


@@ -168,8 +168,8 @@ class ConstString {
   // Implicitly convert \class ConstString instances to \class StringRef.
   operator llvm::StringRef() const { return GetStringRef(); }
 
-  // Implicitly convert \class ConstString instances to \class 
std::string_view.
-  operator std::string_view() const {
+  // Explicitly convert \class ConstString instances to \class 
std::string_view.
+  explicit operator std::string_view() const {

compnerd wrote:

How about flipping this to make `llvm::StringRef` the explicit conversion and 
leave `std::string_view` the implicit one? This seems like it would be better 
as we tend towards the standard types, which would make the eventual removal of 
`StringRef` easier.

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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Hiroshi Yamauchi via lldb-commits

hjyamauchi wrote:

CC @compnerd 

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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Hiroshi Yamauchi via lldb-commits

hjyamauchi wrote:

CC @compnerd 

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


[Lldb-commits] [lldb] [lldb][test] Enforce `pexpect` system availability by default (PR #84270)

2024-03-07 Thread Daniel Thornburgh via lldb-commits

mysterymath wrote:

Chiming in on behalf of Fuchsia, since this did break us. 

We build and ship a custom Python with our LLDB, since we're intended to be a 
portable distribution. That Python doesn't have pexpect. I'm not very familiar 
with what pexpect is used for, or the states of the world before and after this 
change. Would it be possible to get a bit of background on this change so we 
can figure out how to move forward?

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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Hiroshi Yamauchi via lldb-commits

hjyamauchi wrote:

This demonstrates the Clang vs MSVC behavior difference: 
https://godbolt.org/z/GvsdEM5r7

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld_new bug (PR #84246)

2024-03-07 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

LGTM with the check behind `if platform.system() == "Darwin"`. 

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld_new bug (PR #84246)

2024-03-07 Thread Jonas Devlieghere via lldb-commits


@@ -179,3 +180,14 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
+

JDevlieghere wrote:

I think that's obvious to us, but someone not familiar with our platform might 
wonder why they don't have `xcrun`. I'd throw it behind a check for Darwin. 

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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Hiroshi Yamauchi (hjyamauchi)


Changes

MSVC fails when there is ambiguity (multiple options) around implicit type 
conversion operators.

Make ConstString's conversion operator to string_view explicit to avoid 
ambiguity with one to StringRef and remove an unused local variable that MSVC 
also fails on.

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


3 Files Affected:

- (modified) lldb/include/lldb/Utility/ConstString.h (+2-2) 
- (modified) lldb/source/Core/Mangled.cpp (+7-5) 
- (modified) lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (-1) 


``diff
diff --git a/lldb/include/lldb/Utility/ConstString.h 
b/lldb/include/lldb/Utility/ConstString.h
index 470a554ca04869..f7f7ec7605eba4 100644
--- a/lldb/include/lldb/Utility/ConstString.h
+++ b/lldb/include/lldb/Utility/ConstString.h
@@ -168,8 +168,8 @@ class ConstString {
   // Implicitly convert \class ConstString instances to \class StringRef.
   operator llvm::StringRef() const { return GetStringRef(); }
 
-  // Implicitly convert \class ConstString instances to \class 
std::string_view.
-  operator std::string_view() const {
+  // Explicitly convert \class ConstString instances to \class 
std::string_view.
+  explicit operator std::string_view() const {
 return std::string_view(m_string, GetLength());
   }
 
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index 23ae3913093faf..b167c51fdce247 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -125,7 +125,7 @@ void Mangled::SetValue(ConstString name) {
 }
 
 // Local helpers for different demangling implementations.
-static char *GetMSVCDemangledStr(std::string_view M) {
+static char *GetMSVCDemangledStr(llvm::StringRef M) {
   char *demangled_cstr = llvm::microsoftDemangle(
   M, nullptr, nullptr,
   llvm::MSDemangleFlags(
@@ -169,27 +169,29 @@ static char *GetItaniumDemangledStr(const char *M) {
   return demangled_cstr;
 }
 
-static char *GetRustV0DemangledStr(std::string_view M) {
+static char *GetRustV0DemangledStr(llvm::StringRef M) {
   char *demangled_cstr = llvm::rustDemangle(M);
 
   if (Log *log = GetLog(LLDBLog::Demangle)) {
 if (demangled_cstr && demangled_cstr[0])
   LLDB_LOG(log, "demangled rustv0: {0} -> \"{1}\"", M, demangled_cstr);
 else
-  LLDB_LOG(log, "demangled rustv0: {0} -> error: failed to demangle", M);
+  LLDB_LOG(log, "demangled rustv0: {0} -> error: failed to demangle",
+   static_cast(M));
   }
 
   return demangled_cstr;
 }
 
-static char *GetDLangDemangledStr(std::string_view M) {
+static char *GetDLangDemangledStr(llvm::StringRef M) {
   char *demangled_cstr = llvm::dlangDemangle(M);
 
   if (Log *log = GetLog(LLDBLog::Demangle)) {
 if (demangled_cstr && demangled_cstr[0])
   LLDB_LOG(log, "demangled dlang: {0} -> \"{1}\"", M, demangled_cstr);
 else
-  LLDB_LOG(log, "demangled dlang: {0} -> error: failed to demangle", M);
+  LLDB_LOG(log, "demangled dlang: {0} -> error: failed to demangle",
+   static_cast(M));
   }
 
   return demangled_cstr;
diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp 
b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
index 6a2ea8c4a41b1c..f237dd63ab1cce 100644
--- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -527,7 +527,6 @@ TEST_F(SymbolFilePDBTests, TestTypedefs) {
   SymbolFilePDB *symfile =
   static_cast(module->GetSymbolFile());
   llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-  TypeMap results;
 
   const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef",
"FuncPointerTypedef",

``




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


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Hiroshi Yamauchi via lldb-commits

https://github.com/hjyamauchi created 
https://github.com/llvm/llvm-project/pull/84362

MSVC fails when there is ambiguity (multiple options) around implicit type 
conversion operators.

Make ConstString's conversion operator to string_view explicit to avoid 
ambiguity with one to StringRef and remove an unused local variable that MSVC 
also fails on.

>From 34a0f3745913d4ade74ffe4f0d508aaf861fe948 Mon Sep 17 00:00:00 2001
From: Hiroshi Yamauchi 
Date: Thu, 7 Mar 2024 11:04:47 -0800
Subject: [PATCH] Fix MSVC build issues

MSVC fails when there is ambiguity (multiple options) around implicit
type conversion operators.

Make ConstString's conversion operator to string_view explicit to
avoid ambiguity with one to StringRef and remove an unused local
variable that MSVC also fails on.
---
 lldb/include/lldb/Utility/ConstString.h  |  4 ++--
 lldb/source/Core/Mangled.cpp | 12 +++-
 lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp |  1 -
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/lldb/include/lldb/Utility/ConstString.h 
b/lldb/include/lldb/Utility/ConstString.h
index 470a554ca04869..f7f7ec7605eba4 100644
--- a/lldb/include/lldb/Utility/ConstString.h
+++ b/lldb/include/lldb/Utility/ConstString.h
@@ -168,8 +168,8 @@ class ConstString {
   // Implicitly convert \class ConstString instances to \class StringRef.
   operator llvm::StringRef() const { return GetStringRef(); }
 
-  // Implicitly convert \class ConstString instances to \class 
std::string_view.
-  operator std::string_view() const {
+  // Explicitly convert \class ConstString instances to \class 
std::string_view.
+  explicit operator std::string_view() const {
 return std::string_view(m_string, GetLength());
   }
 
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index 23ae3913093faf..b167c51fdce247 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -125,7 +125,7 @@ void Mangled::SetValue(ConstString name) {
 }
 
 // Local helpers for different demangling implementations.
-static char *GetMSVCDemangledStr(std::string_view M) {
+static char *GetMSVCDemangledStr(llvm::StringRef M) {
   char *demangled_cstr = llvm::microsoftDemangle(
   M, nullptr, nullptr,
   llvm::MSDemangleFlags(
@@ -169,27 +169,29 @@ static char *GetItaniumDemangledStr(const char *M) {
   return demangled_cstr;
 }
 
-static char *GetRustV0DemangledStr(std::string_view M) {
+static char *GetRustV0DemangledStr(llvm::StringRef M) {
   char *demangled_cstr = llvm::rustDemangle(M);
 
   if (Log *log = GetLog(LLDBLog::Demangle)) {
 if (demangled_cstr && demangled_cstr[0])
   LLDB_LOG(log, "demangled rustv0: {0} -> \"{1}\"", M, demangled_cstr);
 else
-  LLDB_LOG(log, "demangled rustv0: {0} -> error: failed to demangle", M);
+  LLDB_LOG(log, "demangled rustv0: {0} -> error: failed to demangle",
+   static_cast(M));
   }
 
   return demangled_cstr;
 }
 
-static char *GetDLangDemangledStr(std::string_view M) {
+static char *GetDLangDemangledStr(llvm::StringRef M) {
   char *demangled_cstr = llvm::dlangDemangle(M);
 
   if (Log *log = GetLog(LLDBLog::Demangle)) {
 if (demangled_cstr && demangled_cstr[0])
   LLDB_LOG(log, "demangled dlang: {0} -> \"{1}\"", M, demangled_cstr);
 else
-  LLDB_LOG(log, "demangled dlang: {0} -> error: failed to demangle", M);
+  LLDB_LOG(log, "demangled dlang: {0} -> error: failed to demangle",
+   static_cast(M));
   }
 
   return demangled_cstr;
diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp 
b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
index 6a2ea8c4a41b1c..f237dd63ab1cce 100644
--- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -527,7 +527,6 @@ TEST_F(SymbolFilePDBTests, TestTypedefs) {
   SymbolFilePDB *symfile =
   static_cast(module->GetSymbolFile());
   llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-  TypeMap results;
 
   const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef",
"FuncPointerTypedef",

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld_new bug (PR #84246)

2024-03-07 Thread Dave Lee via lldb-commits


@@ -179,3 +180,14 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
+
+# Determine if a specific version of Xcode's linker contains a bug. We want to
+# skip affected tests if they contain this bug.
+try:
+raw_version_details = subprocess.check_output(("xcrun", "ld", 
"-version_details"))
+version_details = json.loads(raw_version_details)
+version = version_details.get("version", "0")
+if 1000 <= float(version) <= 1109:

kastiglione wrote:

float will be insufficient, this will need to handle versions such as `1100.1.1`

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


[Lldb-commits] [lldb] 7fc583c - Change Get|SetNumChildren to use unint32_t

2024-03-07 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2024-03-07T10:58:34-08:00
New Revision: 7fc583c9a5ddf447b2b53007778cb034a186d4b5

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

LOG: Change Get|SetNumChildren to use unint32_t

Added: 


Modified: 
lldb/include/lldb/Core/ValueObject.h
lldb/source/Core/ValueObject.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index 757ae0601c2466..b4d2c8098edc71 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -476,7 +476,7 @@ class ValueObject {
 
   virtual size_t GetIndexOfChildWithName(llvm::StringRef name);
 
-  size_t GetNumChildren(uint32_t max = UINT32_MAX);
+  uint32_t GetNumChildren(uint32_t max = UINT32_MAX);
 
   const Value &GetValue() const { return m_value; }
 
@@ -960,7 +960,7 @@ class ValueObject {
   /// Should only be called by ValueObject::GetNumChildren().
   virtual uint32_t CalculateNumChildren(uint32_t max = UINT32_MAX) = 0;
 
-  void SetNumChildren(size_t num_children);
+  void SetNumChildren(uint32_t num_children);
 
   void SetValueDidChange(bool value_changed) {
 m_flags.m_value_did_change = value_changed;

diff  --git a/lldb/source/Core/ValueObject.cpp 
b/lldb/source/Core/ValueObject.cpp
index dcf7ccadef8801..0ed7f03be25c16 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -440,7 +440,7 @@ ValueObjectSP 
ValueObject::GetChildMemberWithName(llvm::StringRef name,
   return child_sp;
 }
 
-size_t ValueObject::GetNumChildren(uint32_t max) {
+uint32_t ValueObject::GetNumChildren(uint32_t max) {
   UpdateValueIfNeeded();
 
   if (max < UINT32_MAX) {
@@ -470,7 +470,7 @@ bool ValueObject::MightHaveChildren() {
 }
 
 // Should only be called by ValueObject::GetNumChildren()
-void ValueObject::SetNumChildren(size_t num_children) {
+void ValueObject::SetNumChildren(uint32_t num_children) {
   m_flags.m_children_count_valid = true;
   m_children.SetChildrenCount(num_children);
 }



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


[Lldb-commits] [lldb] Change the return type of CalculateNumChildren to uint32_t. (PR #83501)

2024-03-07 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

Merged in 
https://github.com/llvm/llvm-project/commit/e710523e408ce64c15fddf9f7dbe1248795c20d7

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


[Lldb-commits] [lldb] Change the return type of CalculateNumChildren to uint32_t. (PR #83501)

2024-03-07 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-07 Thread via lldb-commits

jimingham wrote:

I would say this differently.  Many clients of the GetNumChildren API are 
planning to respond the same way to an error and a number of children == 0.  
Having to embed this "i'm not actually checking the error, I'm just converting 
it to num-children = 0" snippet looks odd, like "Why are you bothering with 
errors when you just discard them immediately for "value is 0".

A better title for this use of GetNumChildren would be something like 
GetNumChildrenErrorsAreZero.  That has the virtue of saying what's going on 
explicitly.

Jim

> On Mar 7, 2024, at 10:45 AM, Jonas Devlieghere ***@***.***> wrote:
> 
> 
> @JDevlieghere requested changes on this pull request.
> 
> I'm worried about making it too easy to ignore errors. The whole point of the 
> llvm::Error class is that you have to check it. There might be a legitimate 
> reason you don't about the error the call site, but it should very explicit 
> and easily auditable. If none of the callers care about the error, then it 
> shouldn't be an Error/Expected in the first place. We have plenty of examples 
> of that in LLVM.
> 
> I totally understand the need for this as a transitional tool, but I want to 
> make sure nobody writes new code using this. I can see two ways to make 
> discourage that:
> 
> Mark the helper as deprecated. This might generate a lot off noise though.
> Make it really obvious in the name that this is a temporary or that we're 
> purposely dropping the error. Either something like FIX_ERROR_HANDLING or 
> LLDB_DROP_ERROR or something. Logging to the verbose log is better than 
> nothing, but it doesn't constitute error handling.
> PS: The current implementation wraps the LLDB_LOG_* which uses #line and 
> #file information. Now all those errors will get attributed to this helper 
> function.
> 
> —
> Reply to this email directly, view it on GitHub 
> ,
>  or unsubscribe 
> .
> You are receiving this because you are on a team that was mentioned.
> 



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


[Lldb-commits] [lldb] e710523 - Change GetChildAtIndex to take a uint32_t

2024-03-07 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2024-03-07T10:55:02-08:00
New Revision: e710523e408ce64c15fddf9f7dbe1248795c20d7

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

LOG: Change GetChildAtIndex to take a uint32_t

Added: 


Modified: 
lldb/include/lldb/Core/ValueObject.h
lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/include/lldb/DataFormatters/TypeSynthetic.h
lldb/include/lldb/DataFormatters/VectorIterator.h
lldb/source/Core/ValueObject.cpp
lldb/source/Core/ValueObjectSyntheticFilter.cpp
lldb/source/DataFormatters/TypeSynthetic.cpp
lldb/source/DataFormatters/VectorType.cpp
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
lldb/source/Plugins/Language/CPlusPlus/Coroutines.h
lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
lldb/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/source/Plugins/Language/ObjC/NSArray.cpp
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/source/Plugins/Language/ObjC/NSError.cpp
lldb/source/Plugins/Language/ObjC/NSException.cpp
lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
lldb/source/Plugins/Language/ObjC/NSSet.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index 05dd64f5634fda..757ae0601c2466 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -465,7 +465,7 @@ class ValueObject {
   /// Returns a unique id for this ValueObject.
   lldb::user_id_t GetID() const { return m_id.GetID(); }
 
-  virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx,
+  virtual lldb::ValueObjectSP GetChildAtIndex(uint32_t idx,
   bool can_create = true);
 
   // The method always creates missing children in the path, if necessary.
@@ -791,7 +791,7 @@ class ValueObject {
   return (m_children.find(idx) != m_children.end());
 }
 
-ValueObject *GetChildAtIndex(size_t idx) {
+ValueObject *GetChildAtIndex(uint32_t idx) {
   std::lock_guard guard(m_mutex);
   const auto iter = m_children.find(idx);
   return ((iter == m_children.end()) ? nullptr : iter->second);

diff  --git a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h 
b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
index 57794072ff9229..1e54babc94f395 100644
--- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -51,7 +51,7 @@ class ValueObjectSynthetic : public ValueObject {
 
   lldb::ValueType GetValueType() const override;
 
-  lldb::ValueObjectSP GetChildAtIndex(size_t idx,
+  lldb::ValueObjectSP GetChildAtIndex(uint32_t idx,
   bool can_create = true) override;
 
   lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name,

diff  --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h 
b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index 7bb011c1579449..38f3ce0fa5f011 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -45,7 +45,7 @@ class SyntheticChildrenFrontEnd {
 return count <= max ? count : max;
   }
 
-  virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx) = 0;
+  virtual lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) = 0;
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
@@ -111,7 +111,7 @@ class SyntheticValueProviderFrontEnd : public 
SyntheticChildrenFrontEnd {
 
   uint32_t CalculateNumChildren() override { return 0; }
 
-  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { return nullpt

[Lldb-commits] [lldb] 3d7c5b8 - Change the return type of SyntheticFrontend::CalculateNumChildren to int32_t

2024-03-07 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2024-03-07T10:55:02-08:00
New Revision: 3d7c5b80e38b01223811eb557a5e9953cfa2154d

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

LOG: Change the return type of SyntheticFrontend::CalculateNumChildren to 
int32_t

This way it is consistent with ValueObject and TypeSystem.

Added: 


Modified: 
lldb/include/lldb/DataFormatters/TypeSynthetic.h
lldb/include/lldb/DataFormatters/VectorIterator.h
lldb/source/Core/ValueObjectSyntheticFilter.cpp
lldb/source/DataFormatters/TypeSynthetic.cpp
lldb/source/DataFormatters/VectorType.cpp
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
lldb/source/Plugins/Language/CPlusPlus/Coroutines.h
lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
lldb/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/source/Plugins/Language/ObjC/NSArray.cpp
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/source/Plugins/Language/ObjC/NSError.cpp
lldb/source/Plugins/Language/ObjC/NSException.cpp
lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
lldb/source/Plugins/Language/ObjC/NSSet.cpp

Removed: 




diff  --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h 
b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index 23cc054b399a67..7bb011c1579449 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -38,9 +38,9 @@ class SyntheticChildrenFrontEnd {
 
   virtual ~SyntheticChildrenFrontEnd() = default;
 
-  virtual size_t CalculateNumChildren() = 0;
+  virtual uint32_t CalculateNumChildren() = 0;
 
-  virtual size_t CalculateNumChildren(uint32_t max) {
+  virtual uint32_t CalculateNumChildren(uint32_t max) {
 auto count = CalculateNumChildren();
 return count <= max ? count : max;
   }
@@ -109,7 +109,7 @@ class SyntheticValueProviderFrontEnd : public 
SyntheticChildrenFrontEnd {
 
   ~SyntheticValueProviderFrontEnd() override = default;
 
-  size_t CalculateNumChildren() override { return 0; }
+  uint32_t CalculateNumChildren() override { return 0; }
 
   lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { return nullptr; }
 
@@ -322,7 +322,7 @@ class TypeFilterImpl : public SyntheticChildren {
 
 ~FrontEnd() override = default;
 
-size_t CalculateNumChildren() override { return filter->GetCount(); }
+uint32_t CalculateNumChildren() override { return filter->GetCount(); }
 
 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
   if (idx >= filter->GetCount())
@@ -426,9 +426,9 @@ class ScriptedSyntheticChildren : public SyntheticChildren {
 
 bool IsValid();
 
-size_t CalculateNumChildren() override;
+uint32_t CalculateNumChildren() override;
 
-size_t CalculateNumChildren(uint32_t max) override;
+uint32_t CalculateNumChildren(uint32_t max) override;
 
 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
 

diff  --git a/lldb/include/lldb/DataFormatters/VectorIterator.h 
b/lldb/include/lldb/DataFormatters/VectorIterator.h
index 5f774bb72c3a3a..88500b0bfdd400 100644
--- a/lldb/include/lldb/DataFormatters/VectorIterator.h
+++ b/lldb/include/lldb/DataFormatters/VectorIterator.h
@@ -24,7 +24,7 @@ class VectorIteratorSyntheticFrontEnd : public 
SyntheticChildrenFrontEnd {
   VectorIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp,
   llvm::ArrayRef item_names);
 
-  size_t CalculateNumChildren() override;
+  uint32_t CalculateNumChildren() override;
 
   lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
 

diff  --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp

[Lldb-commits] [lldb] 54c955b - Change the return type of ValueObject::CalculateNumChildren to uint32_t.

2024-03-07 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2024-03-07T10:55:02-08:00
New Revision: 54c955b828bbdcf46586556339cbd3cf8f205b4f

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

LOG: Change the return type of ValueObject::CalculateNumChildren to uint32_t.

In the end this value comes from TypeSystem::GetNumChildren which
returns a uint32_t, so ValueObject should be consistent with that.

Added: 


Modified: 
lldb/include/lldb/Core/ValueObject.h
lldb/include/lldb/Core/ValueObjectCast.h
lldb/include/lldb/Core/ValueObjectChild.h
lldb/include/lldb/Core/ValueObjectConstResult.h
lldb/include/lldb/Core/ValueObjectDynamicValue.h
lldb/include/lldb/Core/ValueObjectMemory.h
lldb/include/lldb/Core/ValueObjectRegister.h
lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/include/lldb/Core/ValueObjectVTable.h
lldb/include/lldb/Core/ValueObjectVariable.h
lldb/include/lldb/Target/StackFrameRecognizer.h
lldb/source/Core/ValueObjectCast.cpp
lldb/source/Core/ValueObjectChild.cpp
lldb/source/Core/ValueObjectConstResult.cpp
lldb/source/Core/ValueObjectDynamicValue.cpp
lldb/source/Core/ValueObjectMemory.cpp
lldb/source/Core/ValueObjectRegister.cpp
lldb/source/Core/ValueObjectSyntheticFilter.cpp
lldb/source/Core/ValueObjectVTable.cpp
lldb/source/Core/ValueObjectVariable.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index 4c0b0b2dae6cd4..05dd64f5634fda 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -958,7 +958,7 @@ class ValueObject {
   int32_t synthetic_index);
 
   /// Should only be called by ValueObject::GetNumChildren().
-  virtual size_t CalculateNumChildren(uint32_t max = UINT32_MAX) = 0;
+  virtual uint32_t CalculateNumChildren(uint32_t max = UINT32_MAX) = 0;
 
   void SetNumChildren(size_t num_children);
 

diff  --git a/lldb/include/lldb/Core/ValueObjectCast.h 
b/lldb/include/lldb/Core/ValueObjectCast.h
index fe053c12d9c343..51c647680d5227 100644
--- a/lldb/include/lldb/Core/ValueObjectCast.h
+++ b/lldb/include/lldb/Core/ValueObjectCast.h
@@ -33,7 +33,7 @@ class ValueObjectCast : public ValueObject {
 
   std::optional GetByteSize() override;
 
-  size_t CalculateNumChildren(uint32_t max) override;
+  uint32_t CalculateNumChildren(uint32_t max) override;
 
   lldb::ValueType GetValueType() const override;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectChild.h 
b/lldb/include/lldb/Core/ValueObjectChild.h
index 46b14e6840f0dc..47a13be08bb83b 100644
--- a/lldb/include/lldb/Core/ValueObjectChild.h
+++ b/lldb/include/lldb/Core/ValueObjectChild.h
@@ -39,7 +39,7 @@ class ValueObjectChild : public ValueObject {
 
   lldb::ValueType GetValueType() const override;
 
-  size_t CalculateNumChildren(uint32_t max) override;
+  uint32_t CalculateNumChildren(uint32_t max) override;
 
   ConstString GetTypeName() override;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectConstResult.h 
b/lldb/include/lldb/Core/ValueObjectConstResult.h
index d61df859bebce4..9f1246cf2a7874 100644
--- a/lldb/include/lldb/Core/ValueObjectConstResult.h
+++ b/lldb/include/lldb/Core/ValueObjectConstResult.h
@@ -67,7 +67,7 @@ class ValueObjectConstResult : public ValueObject {
 
   lldb::ValueType GetValueType() const override;
 
-  size_t CalculateNumChildren(uint32_t max) override;
+  uint32_t CalculateNumChildren(uint32_t max) override;
 
   ConstString GetTypeName() override;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h 
b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
index 2758b4e5bb564d..21a9b409fd5bd7 100644
--- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
@@ -43,7 +43,7 @@ class ValueObjectDynamicValue : public ValueObject {
 
   ConstString GetDisplayTypeName() override;
 
-  size_t CalculateNumChildren(uint32_t max) override;
+  uint32_t CalculateNumChildren(uint32_t max) override;
 
   lldb::ValueType GetValueType() const override;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectMemory.h 
b/lldb/include/lldb/Core/ValueObjectMemory.h
index 3c01df388d2e6d..a74b325546b03c 100644
--- a/lldb/include/lldb/Core/ValueObjectMemory.h
+++ b/lldb/include/lldb/Core/ValueObjectMemory.h
@@ -47,7 +47,7 @@ class ValueObjectMemory : public ValueObject {
 
   ConstString GetDisplayTypeName() override;
 
-  size_t CalculateNumChildren(uint32_t max) override;
+  uint32_t CalculateNumChildren(uint32_t max) override;
 
   lldb::ValueType GetValueType() const override;
 

diff  --git a/lldb/include/lldb/Core/ValueObjectRegister.h 
b/lldb/include/lldb/Core/ValueObjectRegister.h
index 2e47eee3d7f793..6c470c1a686503 100644
--- a/lldb/include/ll

[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld_new bug (PR #84246)

2024-03-07 Thread Dave Lee via lldb-commits

kastiglione wrote:

I think this should be merged, and if either end of the version range proves to 
be too limited, we can increase the range.

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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-07 Thread Jonas Devlieghere via lldb-commits

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

I'm worried about making it too easy to ignore errors. The whole point of the 
llvm::Error class is that you have to check it. There might be a legitimate 
reason you don't about the error the call site, but it should very explicit and 
easily auditable. If none of the callers care about the error, then it 
shouldn't be an Error/Expected in the first place. We have plenty of examples 
of that in LLVM. 

I totally understand the need for this as a transitional tool, but I want to 
make sure nobody writes new code using this. I can see two ways to make 
discourage that:

 - Mark the helper as deprecated. This might generate a lot off noise though. 
 - Make it really obvious in the name that this is a temporary or that we're 
purposely dropping the error. Either something like `FIX_ERROR_HANDLING` or 
`LLDB_DROP_ERROR` or something. Logging to the verbose log is better than 
nothing, but it doesn't constitute error handling. 

PS: The current implementation wraps the `LLDB_LOG_*` which uses #line and 
#file information. Now all those errors will get attributed to this helper 
function.

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


[Lldb-commits] [lldb] Change the return type of CalculateNumChildren to uint32_t. (PR #83501)

2024-03-07 Thread Jonas Devlieghere via lldb-commits

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

🚢 it!

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld_new bug (PR #84246)

2024-03-07 Thread Alex Langford via lldb-commits

bulbazord wrote:

> Called it `ld_new-bug`. If it's not the TLS bug, I wonder if the version 
> range is correct.

The TLS bug in the new linker is explicitly from versions 1000 to 1109. If this 
isn't related to TLS, we'll need to confirm with the linker folks on our side.

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


[Lldb-commits] [lldb] [lldb] Minor cleanup in StoringDiagnosticConsumer (PR #84263)

2024-03-07 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] 6515930 - [lldb] Minor cleanup in StoringDiagnosticConsumer (#84263)

2024-03-07 Thread via lldb-commits

Author: Dave Lee
Date: 2024-03-07T10:13:14-08:00
New Revision: 6515930b0cc4aa2e11e75728ef6cbeecbe5caec2

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

LOG: [lldb] Minor cleanup in StoringDiagnosticConsumer (#84263)

Removes an unused field. Retypes unshared smart pointers to `unique_ptr`.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 2d778e410b0e73..024fc75a5dd590 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -67,12 +67,11 @@ class StoringDiagnosticConsumer : public 
clang::DiagnosticConsumer {
   std::vector m_diagnostics;
   /// The DiagnosticPrinter used for creating the full diagnostic messages
   /// that are stored in m_diagnostics.
-  std::shared_ptr m_diag_printer;
+  std::unique_ptr m_diag_printer;
   /// Output stream of m_diag_printer.
-  std::shared_ptr m_os;
+  std::unique_ptr m_os;
   /// Output string filled by m_os. Will be reused for 
diff erent diagnostics.
   std::string m_output;
-  Log *m_log;
   /// A Progress with explicitly managed lifetime.
   std::unique_ptr m_current_progress_up;
   std::vector m_module_build_stack;
@@ -134,12 +133,10 @@ class ClangModulesDeclVendorImpl : public 
ClangModulesDeclVendor {
 } // anonymous namespace
 
 StoringDiagnosticConsumer::StoringDiagnosticConsumer() {
-  m_log = GetLog(LLDBLog::Expressions);
-
-  clang::DiagnosticOptions *m_options = new clang::DiagnosticOptions();
-  m_os = std::make_shared(m_output);
+  auto *options = new clang::DiagnosticOptions();
+  m_os = std::make_unique(m_output);
   m_diag_printer =
-  std::make_shared(*m_os, m_options);
+  std::make_unique(*m_os, options);
 }
 
 void StoringDiagnosticConsumer::HandleDiagnostic(



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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld_new bug (PR #84246)

2024-03-07 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-07 Thread Dave Lee via lldb-commits

kastiglione wrote:

Called it `ld_new-bug`. If it's not the TLS bug, I wonder if the version range 
is correct.

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-07 Thread Dave Lee via lldb-commits

https://github.com/kastiglione updated 
https://github.com/llvm/llvm-project/pull/84246

>From 1fb13a2d034dbea1d1ba2ef87354199a815f3788 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Wed, 6 Mar 2024 14:23:05 -0800
Subject: [PATCH 1/2] [lldb] Disable shell tests affected by ld64 bug

---
 lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test|  2 +-
 .../Shell/Unwind/thread-step-out-ret-addr-check.test |  2 +-
 lldb/test/Shell/lit.cfg.py   | 12 
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test 
b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
index 3df9906394f432..783bfd45c4669a 100644
--- a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
+++ b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
@@ -1,7 +1,7 @@
 # Test handing of dwarf expressions specifying the location of registers, if
 # those expressions refer to the frame's CFA value.
 
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 # REQUIRES: target-x86_64, native
 
 # RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/eh-frame-dwarf-unwind.s -o %t
diff --git a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test 
b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
index 682b0e5332b1c5..a2b5ae8a9e3e5f 100644
--- a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -2,7 +2,7 @@
 # points to non-executable memory.
 
 # REQUIRES: target-x86_64
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 
 # RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp 
%p/Inputs/thread-step-out-ret-addr-check.s -o %t
 # RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index d75c1f532e147f..6d41dc7d8d7325 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -1,5 +1,6 @@
 # -*- Python -*-
 
+import json
 import os
 import platform
 import re
@@ -179,3 +180,14 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
+
+# Determine if a specific version of Xcode's linker contains a TLS bug. We want
+# to skip TLS tests if they contain this bug.
+try:
+raw_version_details = subprocess.check_output(("xcrun", "ld", 
"-version_details"))
+version_details = json.loads(raw_version_details)
+version = version_details.get("version", "0")
+if 1000 <= float(version) <= 1109:
+config.available_features.add("ld64-tls-bug")
+except:
+pass

>From 92f29840ba8df95b0fb8fa7fd2bf9a679e749849 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 7 Mar 2024 10:10:22 -0800
Subject: [PATCH 2/2] The bug is not TLS specific

---
 lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test  | 2 +-
 lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test | 2 +-
 lldb/test/Shell/lit.cfg.py | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test 
b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
index 783bfd45c4669a..7b5d6650fe2f75 100644
--- a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
+++ b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
@@ -1,7 +1,7 @@
 # Test handing of dwarf expressions specifying the location of registers, if
 # those expressions refer to the frame's CFA value.
 
-# UNSUPPORTED: system-windows, ld64-tls-bug
+# UNSUPPORTED: system-windows, ld_new-bug
 # REQUIRES: target-x86_64, native
 
 # RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/eh-frame-dwarf-unwind.s -o %t
diff --git a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test 
b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
index a2b5ae8a9e3e5f..9bc7c78f79b26b 100644
--- a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -2,7 +2,7 @@
 # points to non-executable memory.
 
 # REQUIRES: target-x86_64
-# UNSUPPORTED: system-windows, ld64-tls-bug
+# UNSUPPORTED: system-windows, ld_new-bug
 
 # RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp 
%p/Inputs/thread-step-out-ret-addr-check.s -o %t
 # RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index 6d41dc7d8d7325..1362dfcf7c4354 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -181,13 +181,13 @@ def calculate_arch_features(arch_string):
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
 
-# Determine if a specific version of Xcode's linker contains a TLS bug. We want
-# to skip TLS tests if they contain this bug.
+# Determine if a specific version of Xcode's linker contains a bug. We want to
+# skip affected tests if they contain this bug.
 try:
 raw_version_details = subprocess.check_outpu

[Lldb-commits] [lldb] [lldb] Do some gardening in ProgressReportTest (NFC) (PR #84278)

2024-03-07 Thread Chelsea Cassanova via lldb-commits

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

LGTM!

https://github.com/llvm/llvm-project/pull/84278
___
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 report all progress event as completed. (PR #84281)

2024-03-07 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] ea49e04 - [lldb] Don't report all progress event as completed. (#84281)

2024-03-07 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-03-07T09:55:00-08:00
New Revision: ea49e04b35bc8e4bed7ee4db4074d201f780a15c

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

LOG: [lldb] Don't report all progress event as completed. (#84281)

Currently, progress events reported by the ProgressManager and broadcast
to eBroadcastBitProgressCategory always specify they're complete. The
problem is that the ProgressManager reports kNonDeterministicTotal for
both the total and the completed number of (sub)events. Because the
values are the same, the event reports itself as complete.

This patch fixes the issue by reporting 0 as the completed value for the
start event and kNonDeterministicTotal for the end event.

Added: 


Modified: 
lldb/include/lldb/Core/Progress.h
lldb/source/Core/Progress.cpp
lldb/unittests/Core/ProgressReportTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Progress.h 
b/lldb/include/lldb/Core/Progress.h
index c6fc861fb71d86..c38f6dd0a140ed 100644
--- a/lldb/include/lldb/Core/Progress.h
+++ b/lldb/include/lldb/Core/Progress.h
@@ -148,9 +148,14 @@ class ProgressManager {
 
   static ProgressManager &Instance();
 
-  static void ReportProgress(const Progress::ProgressData &);
-
 private:
+  enum class EventType {
+Begin,
+End,
+  };
+  static void ReportProgress(const Progress::ProgressData &progress_data,
+ EventType type);
+
   llvm::StringMap>
   m_progress_category_map;
   std::mutex m_progress_map_mutex;

diff  --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index 9dcd7cf75ae057..b4b5e98b7ba493 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -97,7 +97,7 @@ void ProgressManager::Increment(const Progress::ProgressData 
&progress_data) {
   // initial progress report.
   if (!m_progress_category_map.contains(progress_data.title)) {
 m_progress_category_map[progress_data.title].second = progress_data;
-ReportProgress(progress_data);
+ReportProgress(progress_data, EventType::Begin);
   }
   m_progress_category_map[progress_data.title].first++;
 }
@@ -110,7 +110,7 @@ void ProgressManager::Decrement(const 
Progress::ProgressData &progress_data) {
 return;
 
   if (pos->second.first <= 1) {
-ReportProgress(pos->second.second);
+ReportProgress(pos->second.second, EventType::End);
 m_progress_category_map.erase(progress_data.title);
   } else {
 --pos->second.first;
@@ -118,12 +118,14 @@ void ProgressManager::Decrement(const 
Progress::ProgressData &progress_data) {
 }
 
 void ProgressManager::ReportProgress(
-const Progress::ProgressData &progress_data) {
+const Progress::ProgressData &progress_data, EventType type) {
   // The category bit only keeps track of when progress report categories have
   // started and ended, so clear the details and reset other fields when
   // broadcasting to it since that bit doesn't need that information.
-  Debugger::ReportProgress(
-  progress_data.progress_id, progress_data.title, "",
-  Progress::kNonDeterministicTotal, Progress::kNonDeterministicTotal,
-  progress_data.debugger_id, Debugger::eBroadcastBitProgressCategory);
+  const uint64_t completed =
+  (type == EventType::Begin) ? 0 : Progress::kNonDeterministicTotal;
+  Debugger::ReportProgress(progress_data.progress_id, progress_data.title, "",
+   completed, Progress::kNonDeterministicTotal,
+   progress_data.debugger_id,
+   Debugger::eBroadcastBitProgressCategory);
 }

diff  --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
index 98cbc475ce2835..e0253cbc4ec59b 100644
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -168,7 +168,7 @@ TEST_F(ProgressReportTest, TestProgressManager) {
 
   ASSERT_EQ(data->GetDetails(), "");
   ASSERT_FALSE(data->IsFinite());
-  ASSERT_TRUE(data->GetCompleted());
+  ASSERT_FALSE(data->GetCompleted());
   ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
   ASSERT_EQ(data->GetMessage(), "Progress report 1");
 
@@ -199,7 +199,7 @@ TEST_F(ProgressReportTest, TestProgressManager) {
 
   ASSERT_EQ(data->GetDetails(), "");
   ASSERT_FALSE(data->IsFinite());
-  ASSERT_TRUE(data->GetCompleted());
+  ASSERT_FALSE(data->GetCompleted());
   ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
   ASSERT_EQ(data->GetMessage(), "Overlapping report 1");
 



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


[Lldb-commits] [lldb] Report back errors in GetNumChildren() (PR #84265)

2024-03-07 Thread via lldb-commits

jimingham wrote:

>From looking at the code, it seems like there are two clear classes of users, 
>those that need to check the error, and those that, in the error case, 0 is 
>just as good as the error.  The latter appears not infrequently as:

`llvm::expectedToStdOptional(value_sp->GetNumChildren(max)).value_or(0)`

which is a bit ugly, but also by embedding this everywhere inline it isn't easy 
to see who is checking errors and who doesn't need to.

Might be useful to have a GetNumChildrenUnchecked that returns 0 for the error, 
and use that in place of sprinkling this construct about.

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


[Lldb-commits] [lldb] Fix vfork test strcmp buildbot failure (PR #84224)

2024-03-07 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (jeffreytan81)


Changes

The buildbot seems to complain about `strcmp` function not available in the 
vfork patch (https://github.com/llvm/llvm-project/pull/81564):
https://lab.llvm.org/buildbot/#/builders/68/builds/70093/steps/6/logs/stdio 

Unfortunately, I can't reproduce the failure on my linux machine so this is a 
guessing fix. If anyone has a way to reproduce and very this fix, please feel 
free to merge this change. 

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


1 Files Affected:

- (modified) lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp (+1) 


``diff
diff --git a/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp 
b/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
index b0a4446ba01581..40cb63755ee8a5 100644
--- a/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
+++ b/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
@@ -1,6 +1,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

``




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


[Lldb-commits] [lldb] Fix vfork test strcmp buildbot failure (PR #84224)

2024-03-07 Thread via lldb-commits

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


[Lldb-commits] [lldb] 36f866c - Fix vfork test strcmp buildbot failure (#84224)

2024-03-07 Thread via lldb-commits

Author: jeffreytan81
Date: 2024-03-07T09:37:27-08:00
New Revision: 36f866c6ec3f6671fd4178ed4e49fd632a335cc2

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

LOG: Fix vfork test strcmp buildbot failure (#84224)

The buildbot seems to complain about `strcmp` function not available in
the vfork patch (https://github.com/llvm/llvm-project/pull/81564):

https://lab.llvm.org/buildbot/#/builders/68/builds/70093/steps/6/logs/stdio

Unfortunately, I can't reproduce the failure on my linux machine so this
is a guessing fix. If anyone has a way to reproduce and very this fix,
please feel free to merge this change.

Co-authored-by: jeffreytan81 

Added: 


Modified: 
lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp

Removed: 




diff  --git a/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp 
b/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
index 2f3a95dc5c6eef..d72051e4ee84d9 100644
--- a/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
+++ b/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
@@ -2,6 +2,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



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


[Lldb-commits] [lldb] Fix vfork test strcmp buildbot failure (PR #84224)

2024-03-07 Thread via lldb-commits

jeffreytan81 wrote:

I guess it is no harm to land it.

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


[Lldb-commits] [lldb] Fix vfork test strcmp buildbot failure (PR #84224)

2024-03-07 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Allow languages to filter breakpoints set by line (PR #83908)

2024-03-07 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

address review comments from Adrian.
I think I have a better name for the target option and language method now

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


[Lldb-commits] [lldb] [lldb] Allow languages to filter breakpoints set by line (PR #83908)

2024-03-07 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan updated 
https://github.com/llvm/llvm-project/pull/83908

>From 51307b548d09c34ee06037ccf459110e451970a9 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Mon, 4 Mar 2024 09:56:18 -0800
Subject: [PATCH 1/4] [lldb] Allow languages to filter breakpoints set by line

Some languages may create artificial functions that have no real user code, even
though there is line table information for them. One such case is with coroutine
code that receives the CoroSplitter transformation in LLVM IR. That code
transformation creates many different Functions, cloning one Instruction into
many Instructions in many different Functions and copying the associated debug
locations.

It would be difficult to make that pass delete debug locations of cloned
instructions in a language agnostic way (is it even possible?), but LLDB can
ignore certain locations by querying its Language APIs and having it decide
based on, for example, mangling information.
---
 lldb/include/lldb/Target/Language.h   |  4 
 lldb/source/Breakpoint/BreakpointResolver.cpp | 12 
 2 files changed, 16 insertions(+)

diff --git a/lldb/include/lldb/Target/Language.h 
b/lldb/include/lldb/Target/Language.h
index 0cbd8a32dccd54..957c40eb7c0772 100644
--- a/lldb/include/lldb/Target/Language.h
+++ b/lldb/include/lldb/Target/Language.h
@@ -339,6 +339,10 @@ class Language : public PluginInterface {
 
   virtual llvm::StringRef GetInstanceVariableName() { return {}; }
 
+  virtual bool IsInterestingCtxForLineBreakpoint(const SymbolContext &) const {
+return true;
+  }
+
 protected:
   // Classes that inherit from Language can see and modify these
 
diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp 
b/lldb/source/Breakpoint/BreakpointResolver.cpp
index bc6348716ef418..876b30c6d76d55 100644
--- a/lldb/source/Breakpoint/BreakpointResolver.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolver.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
@@ -199,6 +200,15 @@ bool operator<(const SourceLoc lhs, const SourceLoc rhs) {
 }
 } // namespace
 
+static void
+ApplyLanguageFilters(llvm::SmallVectorImpl &sc_list) {
+  llvm::erase_if(sc_list, [](SymbolContext &sc) {
+if (Language *lang = Language::FindPlugin(sc.GetLanguage()))
+  return !lang->IsInterestingCtxForLineBreakpoint(sc);
+return false;
+  });
+}
+
 void BreakpointResolver::SetSCMatchesByLine(
 SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue,
 llvm::StringRef log_ident, uint32_t line, std::optional column) {
@@ -206,6 +216,8 @@ void BreakpointResolver::SetSCMatchesByLine(
   for (uint32_t i = 0; i < sc_list.GetSize(); ++i)
 all_scs.push_back(sc_list[i]);
 
+  ApplyLanguageFilters(all_scs);
+
   while (all_scs.size()) {
 uint32_t closest_line = UINT32_MAX;
 

>From 7ea76d6c04d063d50da52756179639f2037aa793 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Tue, 5 Mar 2024 18:47:51 -0800
Subject: [PATCH 2/4] fixup! add target option

---
 lldb/include/lldb/Target/Language.h   |  9 ++--
 lldb/include/lldb/Target/Target.h |  2 ++
 lldb/source/Breakpoint/BreakpointResolver.cpp | 23 +--
 lldb/source/Target/Target.cpp |  8 +++
 lldb/source/Target/TargetProperties.td|  3 +++
 5 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/lldb/include/lldb/Target/Language.h 
b/lldb/include/lldb/Target/Language.h
index 957c40eb7c0772..9db9f4e297e114 100644
--- a/lldb/include/lldb/Target/Language.h
+++ b/lldb/include/lldb/Target/Language.h
@@ -339,8 +339,13 @@ class Language : public PluginInterface {
 
   virtual llvm::StringRef GetInstanceVariableName() { return {}; }
 
-  virtual bool IsInterestingCtxForLineBreakpoint(const SymbolContext &) const {
-return true;
+  // Returns true if this SymbolContext should be used when setting breakpoints
+  // by line (number or regex). This is useful for languages that create
+  // artificial functions without any meaningful user code associated with them
+  // (e.g. code that gets expanded in late compilation stages, like by
+  // CoroSplitter).
+  virtual bool IsArtificialCtxForLineBreakpoint(const SymbolContext &) const {
+return false;
   }
 
 protected:
diff --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index 8f57358981d4d2..ab04aa57f17300 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -258,6 +258,8 @@ class TargetProperties : public Properties {
 
   bool GetDebugUtilityExpression() const;
 
+  bool GetIgnoreBreakpointsFromLanguageArtificialLocations() const;
+
 private:
   // Callbacks for m_launch_info.
   void Arg0ValueChangedCallback();
diff --git a/lldb/source/Breakpoint/

[Lldb-commits] [lldb] [lldb] Don't report all progress event as completed. (PR #84281)

2024-03-07 Thread Chelsea Cassanova via lldb-commits

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

LGTM!

https://github.com/llvm/llvm-project/pull/84281
___
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 report all progress event as completed. (PR #84281)

2024-03-07 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/84281

>From 57908c4924fbb339309e2a4c297178b2a3689bef Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Wed, 6 Mar 2024 22:28:14 -0800
Subject: [PATCH] [lldb] Don't report all progress event as completed.

Currently, progress events reported by the ProgressManager and broadcast
to eBroadcastBitProgressCategory always specify they're complete. The
problem is that the ProgressManager reports kNonDeterministicTotal for
both the total and the completed number of (sub)events. Because the
values are the same, the event reports itself as complete.

This patch fixes the issue by reporting 0 as the completed value for the
start event and kNonDeterministicTotal for the end event.
---
 lldb/include/lldb/Core/Progress.h  |  9 +++--
 lldb/source/Core/Progress.cpp  | 16 +---
 lldb/unittests/Core/ProgressReportTest.cpp |  4 ++--
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/lldb/include/lldb/Core/Progress.h 
b/lldb/include/lldb/Core/Progress.h
index c6fc861fb71d86..c38f6dd0a140ed 100644
--- a/lldb/include/lldb/Core/Progress.h
+++ b/lldb/include/lldb/Core/Progress.h
@@ -148,9 +148,14 @@ class ProgressManager {
 
   static ProgressManager &Instance();
 
-  static void ReportProgress(const Progress::ProgressData &);
-
 private:
+  enum class EventType {
+Begin,
+End,
+  };
+  static void ReportProgress(const Progress::ProgressData &progress_data,
+ EventType type);
+
   llvm::StringMap>
   m_progress_category_map;
   std::mutex m_progress_map_mutex;
diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index 9dcd7cf75ae057..b4b5e98b7ba493 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -97,7 +97,7 @@ void ProgressManager::Increment(const Progress::ProgressData 
&progress_data) {
   // initial progress report.
   if (!m_progress_category_map.contains(progress_data.title)) {
 m_progress_category_map[progress_data.title].second = progress_data;
-ReportProgress(progress_data);
+ReportProgress(progress_data, EventType::Begin);
   }
   m_progress_category_map[progress_data.title].first++;
 }
@@ -110,7 +110,7 @@ void ProgressManager::Decrement(const 
Progress::ProgressData &progress_data) {
 return;
 
   if (pos->second.first <= 1) {
-ReportProgress(pos->second.second);
+ReportProgress(pos->second.second, EventType::End);
 m_progress_category_map.erase(progress_data.title);
   } else {
 --pos->second.first;
@@ -118,12 +118,14 @@ void ProgressManager::Decrement(const 
Progress::ProgressData &progress_data) {
 }
 
 void ProgressManager::ReportProgress(
-const Progress::ProgressData &progress_data) {
+const Progress::ProgressData &progress_data, EventType type) {
   // The category bit only keeps track of when progress report categories have
   // started and ended, so clear the details and reset other fields when
   // broadcasting to it since that bit doesn't need that information.
-  Debugger::ReportProgress(
-  progress_data.progress_id, progress_data.title, "",
-  Progress::kNonDeterministicTotal, Progress::kNonDeterministicTotal,
-  progress_data.debugger_id, Debugger::eBroadcastBitProgressCategory);
+  const uint64_t completed =
+  (type == EventType::Begin) ? 0 : Progress::kNonDeterministicTotal;
+  Debugger::ReportProgress(progress_data.progress_id, progress_data.title, "",
+   completed, Progress::kNonDeterministicTotal,
+   progress_data.debugger_id,
+   Debugger::eBroadcastBitProgressCategory);
 }
diff --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
index 98cbc475ce2835..e0253cbc4ec59b 100644
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -168,7 +168,7 @@ TEST_F(ProgressReportTest, TestProgressManager) {
 
   ASSERT_EQ(data->GetDetails(), "");
   ASSERT_FALSE(data->IsFinite());
-  ASSERT_TRUE(data->GetCompleted());
+  ASSERT_FALSE(data->GetCompleted());
   ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
   ASSERT_EQ(data->GetMessage(), "Progress report 1");
 
@@ -199,7 +199,7 @@ TEST_F(ProgressReportTest, TestProgressManager) {
 
   ASSERT_EQ(data->GetDetails(), "");
   ASSERT_FALSE(data->IsFinite());
-  ASSERT_TRUE(data->GetCompleted());
+  ASSERT_FALSE(data->GetCompleted());
   ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
   ASSERT_EQ(data->GetMessage(), "Overlapping report 1");
 

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-07 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

I was just wondering, is this actually the TLS bug? I looked at the test and I 
don't see it doing anything with thread local storage. This might be another 
"new ld" bug. Maybe the feature should be called `ld-prime-bug`? 

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-07 Thread Dave Lee via lldb-commits


@@ -179,3 +180,14 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
+

kastiglione wrote:

my thinking is that the darwin check is baked into the invocation of xcrun. If 
you think it's better to check for darwin explicitly, I will make that change 
it.

https://github.com/llvm/llvm-project/pull/84246
___
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 report all progress event as completed. (PR #84281)

2024-03-07 Thread Adrian Prantl via lldb-commits


@@ -110,20 +110,22 @@ void ProgressManager::Decrement(const 
Progress::ProgressData &progress_data) {
 return;
 
   if (pos->second.first <= 1) {
-ReportProgress(pos->second.second);
+ReportProgress(pos->second.second, EventType::End);
 m_progress_category_map.erase(progress_data.title);
   } else {
 --pos->second.first;
   }
 }
 
 void ProgressManager::ReportProgress(
-const Progress::ProgressData &progress_data) {
-  // The category bit only keeps track of when progress report categories have
+const Progress::ProgressData &progress_data, EventType type) {
+  // the category bit only keeps track of when progress report categories have

adrian-prantl wrote:

```suggestion
  // The category bit only keeps track of when progress report categories have
```

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-07 Thread Adrian Prantl via lldb-commits


@@ -179,3 +180,14 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
+

adrian-prantl wrote:

I guess it fails gracefully, but should this check whether we're on Darwin 
first?

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


[Lldb-commits] [lldb] [lldb] Minor cleanup in StoringDiagnosticConsumer (PR #84263)

2024-03-07 Thread Adrian Prantl via lldb-commits

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


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


[Lldb-commits] [lldb] 03588a2 - [lldb][test][FreeBSD] xfail TestPlatformConnect on AArch64

2024-03-07 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2024-03-07T14:54:30Z
New Revision: 03588a27261f7ebea15af49268d2ec901fe1979e

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

LOG: [lldb][test][FreeBSD] xfail TestPlatformConnect on AArch64

Details in the linked issue. Might fail on other architectures
but I can't confirm, they can add to this if it does.

Added: 


Modified: 
lldb/test/API/commands/platform/connect/TestPlatformConnect.py

Removed: 




diff  --git a/lldb/test/API/commands/platform/connect/TestPlatformConnect.py 
b/lldb/test/API/commands/platform/connect/TestPlatformConnect.py
index 6a0f036c007079..fc6c2ee98df44d 100644
--- a/lldb/test/API/commands/platform/connect/TestPlatformConnect.py
+++ b/lldb/test/API/commands/platform/connect/TestPlatformConnect.py
@@ -13,6 +13,13 @@ class TestPlatformProcessConnect(TestBase):
 @expectedFailureAll(hostoslist=["windows"], triple=".*-android")
 @skipIfDarwin  # lldb-server not found correctly
 @expectedFailureAll(oslist=["windows"])  # process modules not loaded
+# lldb-server platform times out waiting for the gdbserver port number to 
be
+# written to the pipe, yet it seems the gdbserver already has written it.
+@expectedFailureAll(
+archs=["aarch64"],
+oslist=["freebsd"],
+bugnumber="https://github.com/llvm/llvm-project/issues/84327";,
+)
 @add_test_categories(["lldb-server"])
 def test_platform_process_connect(self):
 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][test] Enforce `pexpect` system availability by default (PR #84270)

2024-03-07 Thread Jordan Rupprecht via lldb-commits

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


[Lldb-commits] [lldb] 3239b4d - [lldb][test] Enforce `pexpect` system availability by default (#84270)

2024-03-07 Thread via lldb-commits

Author: Jordan Rupprecht
Date: 2024-03-07T08:53:18-06:00
New Revision: 3239b4dcfebbaa3eeaff9258893a6674050d8354

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

LOG: [lldb][test] Enforce `pexpect` system availability by default (#84270)

This switches the default of `LLDB_TEST_USE_VENDOR_PACKAGES` from `ON`
to `OFF` in preparation for eventually deleting it. All known LLDB
buildbots have this package installed, so flipping the default will
uncover any other users.

If this breaks anything, the preferred fix is to install `pexpect` on
the host system. The second fix is to build with cmake option
`-DLLDB_TEST_USE_VENDOR_PACKAGES=ON` as a temporary measure until
`pexpect` can be installed. If neither of those work, reverting this
patch is OK.

Added: 


Modified: 
lldb/cmake/modules/LLDBConfig.cmake
lldb/test/CMakeLists.txt

Removed: 




diff  --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 93c8ffe4b7d8a0..5d62213c3f5838 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -68,7 +68,7 @@ option(LLDB_SKIP_DSYM "Whether to skip generating a dSYM when 
installing lldb."
 option(LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
   "Fail to configure if certain requirements are not met for testing." OFF)
 option(LLDB_TEST_USE_VENDOR_PACKAGES
-  "Use packages from lldb/third_party/Python/module instead of system deps." 
ON)
+  "Use packages from lldb/third_party/Python/module instead of system deps." 
OFF)
 
 set(LLDB_GLOBAL_INIT_DIRECTORY "" CACHE STRING
   "Path to the global lldbinit directory. Relative paths are resolved relative 
to the

diff  --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index 950643a5b8cc8e..0ef2eb1c42ce06 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -34,7 +34,9 @@ endif()
 # The "pexpect" package should come from the system environment, not from the
 # LLDB tree. However, we delay the deletion of it from the tree in case
 # users/buildbots don't have the package yet and need some time to install it.
-if (NOT LLDB_TEST_USE_VENDOR_PACKAGES)
+# Windows is configured to skip all pexpect tests, and guards all
+# "import pexpect" calls, so we do not need pexpect installed there.
+if (NOT LLDB_TEST_USE_VENDOR_PACKAGES AND NOT WIN32)
   unset(PY_pexpect_FOUND CACHE)
   lldb_find_python_module(pexpect)
   if (NOT PY_pexpect_FOUND)



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


[Lldb-commits] [clang] [lldb] [NFC][Clang] Improve const correctness for IdentifierInfo (PR #79365)

2024-03-07 Thread via lldb-commits

cor3ntin wrote:

@bwendling feel free to fix the conflicts and merge

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


[Lldb-commits] [lldb] [lldb] Address mask sbprocess apis and new mask invalid const (PR #83663)

2024-03-07 Thread David Spickett via lldb-commits

DavidSpickett wrote:

We could have ABI plugins limit the mask to the known maximum address size, or 
set all the upper bits to 1. Though I think `0...0` is less 
confusing. But it's only fixing what you might call a visual issue, the mask 
will have upper 32 bits preserved, but at runtime no address will have anything 
there to preserve, so the result is still correct. We've been storing 32 bit 
addresses in a 64 bit addr_t for the lifetime of lldb, so if we had problems in 
this area we'd know already.

I'm inclined to keep it as is (it's simpler) and if people find the current 
behaviour confusing we can always make some of the plugins fix up the mask just 
so it looks correct.

(and also, what is correct, top 32 bits of 1s because you can't store them in a 
32 bit address, or 0s because there are no bits to preserve anyway :shrug: )

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