[llvm-branch-commits] [lldb] [lldb] Revise IDE folder structure (PR #89748)

2024-05-21 Thread Jonas Devlieghere via llvm-branch-commits

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


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


[llvm-branch-commits] [lldb] [lldb] Revise IDE folder structure (PR #89748)

2024-04-23 Thread Jonas Devlieghere via llvm-branch-commits


@@ -232,7 +231,7 @@ elseif (LLDB_EXPORT_ALL_SYMBOLS)
   )
 
   add_llvm_symbol_exports(liblldb ${exported_symbol_file})
-  set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
+  set_target_properties(liblldb PROPERTIES FOLDER "LLDB/Misc")

JDevlieghere wrote:

Should this be `LLDB/API`?

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


[llvm-branch-commits] [lldb] [lldb] Revise IDE folder structure (PR #89748)

2024-04-23 Thread Jonas Devlieghere via llvm-branch-commits

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


[llvm-branch-commits] [lldb] [lldb] Revise IDE folder structure (PR #89748)

2024-04-23 Thread Jonas Devlieghere via llvm-branch-commits

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

Thanks for splitting this up. LGTM modulo one folder name. 

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


[llvm-branch-commits] [llvm] release/18.x: [Support] Fix color handling in formatted_raw_ostream (#86700) (PR #86940)

2024-03-28 Thread Jonas Devlieghere via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [lldb] e5b3dd5 - [lldb] Don't set the OS for ARMGetSupportedArchitectureAtIndex

2021-11-05 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-11-05T22:07:54-07:00
New Revision: e5b3dd5e223ef4d99f905ee4ebbf982c266218bd

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

LOG: [lldb] Don't set the OS for ARMGetSupportedArchitectureAtIndex

Don't set the OS when computing supported architectures in
PlatformDarwin::ARMGetSupportedArchitectureAtIndex.

Differential revision: https://reviews.llvm.org/D113159

Added: 


Modified: 
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 2a1f35c5507d..bbf6be646823 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -559,6 +559,15 @@ static llvm::ArrayRef 
GetCompatibleArchs(ArchSpec::Core core) {
   switch (core) {
   default:
 LLVM_FALLTHROUGH;
+  case ArchSpec::eCore_arm_arm64e: {
+static const char *g_arm64e_compatible_archs[] = {
+"arm64e","arm64","armv7","armv7f",   "armv7k",   "armv7s",
+"armv7m","armv7em",  "armv6m",   "armv6","armv5","armv4",
+"arm",   "thumbv7",  "thumbv7f", "thumbv7k", "thumbv7s", 
"thumbv7m",
+"thumbv7em", "thumbv6m", "thumbv6",  "thumbv5",  "thumbv4t", "thumb",
+};
+return {g_arm64e_compatible_archs};
+  }
   case ArchSpec::eCore_arm_arm64: {
 static const char *g_arm64_compatible_archs[] = {
 "arm64","armv7","armv7f",   "armv7k",   "armv7s",   "armv7m",
@@ -654,38 +663,15 @@ const char 
*PlatformDarwin::GetCompatibleArch(ArchSpec::Core core, size_t idx) {
 /// processor.
 bool PlatformDarwin::ARMGetSupportedArchitectureAtIndex(uint32_t idx,
 ArchSpec ) {
-#if TARGET_OS_OSX
-  if (IsHost()) {
-if (idx == 0) {
-  arch.SetTriple("arm64e-apple-macosx");
-  return true;
-} else if (idx == 1) {
-  arch.SetTriple("arm64-apple-macosx");
-  return true;
-}
-arch.Clear();
-return false;
-  }
-#endif
-
-#if defined(TARGET_OS_TV) && TARGET_OS_TV == 1
-#define OSNAME "tvos"
-#elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1
-#define OSNAME "watchos"
-#elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
-#define OSNAME "bridgeos"
-#elif defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1
-#define OSNAME "macosx"
-#else
-#define OSNAME "ios"
-#endif
-
   const ArchSpec system_arch = GetSystemArchitecture();
   const ArchSpec::Core system_core = system_arch.GetCore();
+
   if (const char *compatible_arch = GetCompatibleArch(system_core, idx)) {
-std::string triple =
-llvm::formatv("{0}-apple-" OSNAME, compatible_arch).str();
+llvm::Triple triple;
+triple.setArchName(compatible_arch);
+triple.setVendor(llvm::Triple::VendorType::Apple);
 arch.SetTriple(triple);
+return true;
   }
 
   arch.Clear();



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


[llvm-branch-commits] [lldb] 3a50ed8 - [lldb] FixFileSystem::GetExternalPath for VFS API change

2021-01-22 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-22T15:04:17-08:00
New Revision: 3a50ed84f4823fb0e7b385cc22fef12435dfd376

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

LOG: [lldb] FixFileSystem::GetExternalPath for VFS API change

Added: 


Modified: 
lldb/source/Host/common/FileSystem.cpp

Removed: 




diff  --git a/lldb/source/Host/common/FileSystem.cpp 
b/lldb/source/Host/common/FileSystem.cpp
index 8a6c03f72b6f..9fa8854d950e 100644
--- a/lldb/source/Host/common/FileSystem.cpp
+++ b/lldb/source/Host/common/FileSystem.cpp
@@ -479,7 +479,7 @@ ErrorOr FileSystem::GetExternalPath(const 
llvm::Twine ) {
 
   // If VFS mapped we know the underlying FS is a RedirectingFileSystem.
   ErrorOr E =
-  static_cast(*m_fs).lookupPath(path);
+  static_cast(*m_fs).lookupPath(path.str());
   if (!E) {
 if (E.getError() == llvm::errc::no_such_file_or_directory) {
   return path.str();



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


[llvm-branch-commits] [llvm] 0be9ca7 - [VFS] Fix inconsistencies between relative paths and fallthrough.

2021-01-22 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-22T14:15:48-08:00
New Revision: 0be9ca7c0f9a733f846bb6bc4e8e36d46b518162

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

LOG: [VFS] Fix inconsistencies between relative paths and fallthrough.

This patch addresses inconsistencies in the way fallthrough is handled
in the RedirectingFileSystem. Rather than trying to change the working
directory of the external filesystem, the RedirectingFileSystem will
canonicalize every path before handing it down. This guarantees that
relative paths are resolved relative to the RedirectingFileSystem's
working directory.

This allows us to have a strictly virtual working directory, and still
fallthrough for absolute paths, but not for relative paths that would
get resolved incorrectly at the lower layer (for example, in case of the
RealFileSystem, because the strictly virtual path does not exist).

Differential revision: https://reviews.llvm.org/D95188

Added: 


Modified: 
llvm/include/llvm/Support/VirtualFileSystem.h
llvm/lib/Support/VirtualFileSystem.cpp
llvm/unittests/Support/VirtualFileSystemTest.cpp

Removed: 




diff  --git a/llvm/include/llvm/Support/VirtualFileSystem.h 
b/llvm/include/llvm/Support/VirtualFileSystem.h
index 6547d2cdb629..c6ddbf60efdf 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -651,9 +651,12 @@ class RedirectingFileSystem : public vfs::FileSystem {
   friend class VFSFromYamlDirIterImpl;
   friend class RedirectingFileSystemParser;
 
-  bool shouldUseExternalFS() const {
-return ExternalFSValidWD && IsFallthrough;
-  }
+  bool shouldUseExternalFS() const { return IsFallthrough; }
+
+  /// Canonicalize path by removing ".", "..", "./", components. This is
+  /// a VFS request, do not bother about symlinks in the path components
+  /// but canonicalize in order to perform the correct entry search.
+  std::error_code makeCanonical(SmallVectorImpl ) const;
 
   // In a RedirectingFileSystem, keys can be specified in Posix or Windows
   // style (or even a mixture of both), so this comparison helper allows
@@ -672,9 +675,6 @@ class RedirectingFileSystem : public vfs::FileSystem {
   /// The current working directory of the file system.
   std::string WorkingDirectory;
 
-  /// Whether the current working directory is valid for the external FS.
-  bool ExternalFSValidWD = false;
-
   /// The file system to use for external references.
   IntrusiveRefCntPtr ExternalFS;
 
@@ -722,7 +722,7 @@ class RedirectingFileSystem : public vfs::FileSystem {
 
 public:
   /// Looks up \p Path in \c Roots.
-  ErrorOr lookupPath(const Twine ) const;
+  ErrorOr lookupPath(StringRef Path) const;
 
   /// Parses \p Buffer, which is expected to be in YAML format and
   /// returns a virtual file system representing its contents.

diff  --git a/llvm/lib/Support/VirtualFileSystem.cpp 
b/llvm/lib/Support/VirtualFileSystem.cpp
index c2ce63964f08..05332b00bd1f 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -1016,7 +1016,6 @@ 
RedirectingFileSystem::RedirectingFileSystem(IntrusiveRefCntPtr FS)
 if (auto ExternalWorkingDirectory =
 ExternalFS->getCurrentWorkingDirectory()) {
   WorkingDirectory = *ExternalWorkingDirectory;
-  ExternalFSValidWD = true;
 }
 }
 
@@ -1075,12 +1074,6 @@ RedirectingFileSystem::setCurrentWorkingDirectory(const 
Twine ) {
   if (!exists(Path))
 return errc::no_such_file_or_directory;
 
-  // Always change the external FS but ignore its result.
-  if (ExternalFS) {
-auto EC = ExternalFS->setCurrentWorkingDirectory(Path);
-ExternalFSValidWD = !static_cast(EC);
-  }
-
   SmallString<128> AbsolutePath;
   Path.toVector(AbsolutePath);
   if (std::error_code EC = makeAbsolute(AbsolutePath))
@@ -1089,8 +1082,14 @@ RedirectingFileSystem::setCurrentWorkingDirectory(const 
Twine ) {
   return {};
 }
 
-std::error_code RedirectingFileSystem::isLocal(const Twine ,
+std::error_code RedirectingFileSystem::isLocal(const Twine _,
bool ) {
+  SmallString<256> Path;
+  Path_.toVector(Path);
+
+  if (std::error_code EC = makeCanonical(Path))
+return {};
+
   return ExternalFS->isLocal(Path, Result);
 }
 
@@ -1125,14 +1124,21 @@ std::error_code 
RedirectingFileSystem::makeAbsolute(SmallVectorImpl )
 
 directory_iterator RedirectingFileSystem::dir_begin(const Twine ,
 std::error_code ) {
-  ErrorOr E = lookupPath(Dir);
+  SmallString<256> Path;
+  Dir.toVector(Path);
+
+  EC = makeCanonical(Path);
+  if (EC)
+return {};
+
+  ErrorOr E = lookupPath(Path);
   if (!E) {
 EC = E.getError();
 if (shouldUseExternalFS() && EC 

[llvm-branch-commits] [lldb] baf6c29 - [lldb] Upstream eCore_arm_arm64e enum value in ArchSpec

2021-01-20 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-20T19:39:47-08:00
New Revision: baf6c2987e576e319857c586120e98e917d8b47f

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

LOG: [lldb] Upstream eCore_arm_arm64e enum value in ArchSpec

Upstream the eCore_arm_arm64e enum value in ArchSpec. All the other
arm64e triple changes already landed in LLVM.

Differential revision: https://reviews.llvm.org/D95110

Added: 


Modified: 
lldb/include/lldb/Utility/ArchSpec.h
lldb/source/Utility/ArchSpec.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index b35766d3d9cf..fdfe6aceb033 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -131,6 +131,7 @@ class ArchSpec {
 eCore_arm_arm64,
 eCore_arm_armv8,
 eCore_arm_armv8l,
+eCore_arm_arm64e,
 eCore_arm_arm64_32,
 eCore_arm_aarch64,
 

diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index 8025f37c4b38..c13e2389cfed 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -99,8 +99,10 @@ static const CoreDefinition g_core_definitions[] = {
  ArchSpec::eCore_arm_arm64, "arm64"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
  ArchSpec::eCore_arm_armv8, "armv8"},
-{eByteOrderLittle, 4, 2, 4, llvm::Triple::arm,
- ArchSpec::eCore_arm_armv8l, "armv8l"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv8l,
+ "armv8l"},
+{eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
+ ArchSpec::eCore_arm_arm64e, "arm64e"},
 {eByteOrderLittle, 4, 4, 4, llvm::Triple::aarch64_32,
  ArchSpec::eCore_arm_arm64_32, "arm64_32"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
@@ -288,8 +290,7 @@ static const ArchDefinitionEntry g_macho_arch_entries[] = {
 {ArchSpec::eCore_arm_armv7k,  llvm::MachO::CPU_TYPE_ARM,
llvm::MachO::CPU_SUBTYPE_ARM_V7K,   UINT32_MAX, SUBTYPE_MASK},
 {ArchSpec::eCore_arm_armv7m,  llvm::MachO::CPU_TYPE_ARM,
llvm::MachO::CPU_SUBTYPE_ARM_V7M,   UINT32_MAX, SUBTYPE_MASK},
 {ArchSpec::eCore_arm_armv7em, llvm::MachO::CPU_TYPE_ARM,
llvm::MachO::CPU_SUBTYPE_ARM_V7EM,  UINT32_MAX, SUBTYPE_MASK},
-// FIXME: This should be arm64e once the triple exists.
-{ArchSpec::eCore_arm_arm64,   llvm::MachO::CPU_TYPE_ARM64,  
llvm::MachO::CPU_SUBTYPE_ARM64E,UINT32_MAX, SUBTYPE_MASK},
+{ArchSpec::eCore_arm_arm64e,  llvm::MachO::CPU_TYPE_ARM64,  
llvm::MachO::CPU_SUBTYPE_ARM64E,UINT32_MAX, SUBTYPE_MASK},
 {ArchSpec::eCore_arm_arm64,   llvm::MachO::CPU_TYPE_ARM64,  
llvm::MachO::CPU_SUBTYPE_ARM64_V8,  UINT32_MAX, SUBTYPE_MASK},
 {ArchSpec::eCore_arm_arm64,   llvm::MachO::CPU_TYPE_ARM64,  
llvm::MachO::CPU_SUBTYPE_ARM64_ALL, UINT32_MAX, SUBTYPE_MASK},
 {ArchSpec::eCore_arm_arm64,   llvm::MachO::CPU_TYPE_ARM64,  13,
 UINT32_MAX, SUBTYPE_MASK},
@@ -1198,16 +1199,31 @@ static bool cores_match(const ArchSpec::Core core1, 
const ArchSpec::Core core2,
 return true;
   if (core2 == ArchSpec::eCore_arm_aarch64)
 return true;
+  if (core2 == ArchSpec::eCore_arm_arm64e)
+return true;
   try_inverse = false;
 }
 break;
 
+  case ArchSpec::eCore_arm_arm64e:
+if (!enforce_exact_match) {
+  if (core2 == ArchSpec::eCore_arm_arm64)
+return true;
+  if (core2 == ArchSpec::eCore_arm_aarch64)
+return true;
+  if (core2 == ArchSpec::eCore_arm_armv8)
+return true;
+  try_inverse = false;
+}
+break;
   case ArchSpec::eCore_arm_aarch64:
 if (!enforce_exact_match) {
   if (core2 == ArchSpec::eCore_arm_arm64)
 return true;
   if (core2 == ArchSpec::eCore_arm_armv8)
 return true;
+  if (core2 == ArchSpec::eCore_arm_arm64e)
+return true;
   try_inverse = false;
 }
 break;
@@ -1218,6 +1234,8 @@ static bool cores_match(const ArchSpec::Core core1, const 
ArchSpec::Core core2,
 return true;
   if (core2 == ArchSpec::eCore_arm_armv8)
 return true;
+  if (core2 == ArchSpec::eCore_arm_arm64e)
+return true;
   try_inverse = false;
 }
 break;



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


[llvm-branch-commits] [llvm] f354b87 - [dsymutil] Compare object modification times using second precision

2021-01-20 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-20T18:45:30-08:00
New Revision: f354b87df23799ee0b6c718894140c846eafc82d

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

LOG: [dsymutil] Compare object modification times using second precision

The modification time in the debug map is expressed using second
precision, while the modification time returned by the filesystem could
be more precise. Avoid spurious warnings about timestamp mismatches by
truncating the modification time reported by the system to seconds.

Added: 


Modified: 
llvm/tools/dsymutil/BinaryHolder.cpp

Removed: 




diff  --git a/llvm/tools/dsymutil/BinaryHolder.cpp 
b/llvm/tools/dsymutil/BinaryHolder.cpp
index b401d519718c..f83521346c5b 100644
--- a/llvm/tools/dsymutil/BinaryHolder.cpp
+++ b/llvm/tools/dsymutil/BinaryHolder.cpp
@@ -100,7 +100,8 @@ Error 
BinaryHolder::ObjectEntry::load(IntrusiveRefCntPtr VFS,
 llvm::ErrorOr Stat = VFS->status(Filename);
 if (!Stat)
   return errorCodeToError(Stat.getError());
-if (Timestamp != Stat->getLastModificationTime())
+if (Timestamp != std::chrono::time_point_cast(
+ Stat->getLastModificationTime()))
   WithColor::warning() << Filename
<< ": timestamp mismatch between object file ("
<< Stat->getLastModificationTime()
@@ -192,7 +193,8 @@ BinaryHolder::ArchiveEntry::getObjectEntry(StringRef 
Filename,
 return ModTimeOrErr.takeError();
 
   if (Timestamp != sys::TimePoint<>() &&
-  Timestamp != ModTimeOrErr.get()) {
+  Timestamp != std::chrono::time_point_cast(
+   ModTimeOrErr.get())) {
 if (Verbose)
   WithColor::warning()
   << *NameOrErr



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


[llvm-branch-commits] [llvm] a4b42c6 - [llvm] Protect signpost map with a mutex

2021-01-19 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-19T11:41:54-08:00
New Revision: a4b42c621b9e2009cfd8bc9265bbf970c7231271

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

LOG: [llvm] Protect signpost map with a mutex

Use a mutex to protect concurrent access to the signpost map. This fixes
nondeterministic crashes in LLDB that appeared after using signposts in
the timer implementation.

Differential revision: https://reviews.llvm.org/D94285

Added: 


Modified: 
llvm/lib/Support/Signposts.cpp

Removed: 




diff  --git a/llvm/lib/Support/Signposts.cpp b/llvm/lib/Support/Signposts.cpp
index 91ce909c7dcb..9353e9b294d1 100644
--- a/llvm/lib/Support/Signposts.cpp
+++ b/llvm/lib/Support/Signposts.cpp
@@ -13,6 +13,7 @@
 #include "llvm/Config/config.h"
 #if LLVM_SUPPORT_XCODE_SIGNPOSTS
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/Mutex.h"
 #include 
 #endif // if LLVM_SUPPORT_XCODE_SIGNPOSTS
 
@@ -38,9 +39,11 @@ class SignpostEmitterImpl {
 
   LogPtrTy SignpostLog;
   DenseMap Signposts;
+  sys::SmartMutex Mutex;
 
   LogTy () const { return *SignpostLog; }
   os_signpost_id_t getSignpostForObject(const void *O) {
+sys::SmartScopedLock Lock(Mutex);
 const auto  = Signposts.find(O);
 if (I != Signposts.end())
   return I->second;



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


[llvm-branch-commits] [lldb] 999f5da - [debugserver] Fix inverted if block that resulted in us using the private entitlements

2021-01-15 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-15T17:41:07-08:00
New Revision: 999f5da6b3088fa4c0bb9d05b358d015ca74c71f

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

LOG: [debugserver] Fix inverted if block that resulted in us using the private 
entitlements

Added: 


Modified: 
lldb/tools/debugserver/source/CMakeLists.txt

Removed: 




diff  --git a/lldb/tools/debugserver/source/CMakeLists.txt 
b/lldb/tools/debugserver/source/CMakeLists.txt
index 0318d5051c1f..710e11f8bd8f 100644
--- a/lldb/tools/debugserver/source/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/CMakeLists.txt
@@ -132,9 +132,9 @@ if(LLDB_USE_ENTITLEMENTS)
 set(entitlements 
${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist)
   else()
 if (LLDB_USE_PRIVATE_ENTITLEMENTS)
-  set(entitlements 
${DEBUGSERVER_RESOURCE_DIR}/debugserver-macosx-entitlements.plist)
-else()
   set(entitlements 
${DEBUGSERVER_RESOURCE_DIR}/debugserver-macosx-private-entitlements.plist)
+else()
+  set(entitlements 
${DEBUGSERVER_RESOURCE_DIR}/debugserver-macosx-entitlements.plist)
 endif()
   endif()
 endif()



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


[llvm-branch-commits] [llvm] 48d2068 - [dsymutil] Warn on timestmap mismatch between object file and debug map

2021-01-13 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-13T09:15:30-08:00
New Revision: 48d2068fb738302b9fba91c9bf8e4b051c3909eb

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

LOG: [dsymutil] Warn on timestmap mismatch between object file and debug map

This re-lands e5553b9a6ab9 with two small fixes to the tests:

 - Don't touch the source directory in debug-map-parsing.test but
   instead copy everything over in a temporary directory in
   timestamp-mismatch.test.
 - Don't redirect stderr to stdout to avoid the output getting
   intertwined in extern-alias.test.

Added: 
llvm/test/tools/dsymutil/X86/timestamp-mismatch.test

Modified: 
llvm/test/tools/dsymutil/ARM/extern-alias.test
llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
llvm/test/tools/dsymutil/debug-map-parsing.test
llvm/tools/dsymutil/BinaryHolder.cpp
llvm/tools/dsymutil/BinaryHolder.h
llvm/tools/dsymutil/DwarfLinkerForBinary.cpp

Removed: 




diff  --git a/llvm/test/tools/dsymutil/ARM/extern-alias.test 
b/llvm/test/tools/dsymutil/ARM/extern-alias.test
index 91297ac6ef54..0f0e347ad9d6 100644
--- a/llvm/test/tools/dsymutil/ARM/extern-alias.test
+++ b/llvm/test/tools/dsymutil/ARM/extern-alias.test
@@ -35,8 +35,8 @@ $ xcrun --sdk iphoneos clang -g private_extern.c -c -o 
private_extern.o -target
 $ xcrun --sdk iphoneos clang -g main.c -c -o main.o -target arm64-apple-ios14.0
 $ xcrun --sdk iphoneos clang private_extern.o main.o -target 
arm64-apple-ios14.0 -o private_extern.out -Xlinker -alias_list -Xlinker 
alias_list
 
-RUN: dsymutil -oso-prepend-path %p/../Inputs 
%p/../Inputs/private/tmp/private_extern/private_extern.out -o %t.dSYM --verbose 
2>&1 | FileCheck %s
-RUN: dsymutil -oso-prepend-path %p/../Inputs 
%p/../Inputs/private/tmp/extern/extern.out -o %t.dSYM --verbose 2>&1 | 
FileCheck %s
+RUN: dsymutil -oso-prepend-path %p/../Inputs 
%p/../Inputs/private/tmp/private_extern/private_extern.out -o %t.dSYM --verbose 
| FileCheck %s
+RUN: dsymutil -oso-prepend-path %p/../Inputs 
%p/../Inputs/private/tmp/extern/extern.out -o %t.dSYM --verbose | FileCheck %s
 CHECK-NOT: could not find object file symbol for symbol _baz
 CHECK: { sym: _foo, objAddr: 0x0, binAddr: 0x17F58, size: 0x20 }
 CHECK: { sym: _baz, objAddr: 0x0, binAddr: 0x17F58, size: 0x0 }

diff  --git a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test 
b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
index 626208ff3496..43d930af7128 100644
--- a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
+++ b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
@@ -20,7 +20,7 @@ READOBJ-NEXT: |.|
 DWARFDUMP: __swift_ast
 
 RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 
-no-output -verbose 2>&1 | FileCheck %s --check-prefix=TIMESTAMP
-TIMESTAMP: warning: Timestamp mismatch
+TIMESTAMP: warning: {{.*}}/swift-ast.swiftmodule: timestamp mismatch between 
swift interface file ({{.*}}) and debug map ({{.*}})
 
 RUN: dsymutil -s 
%T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck 
%s --check-prefix=NAST
 NAST-NOT: N_AST

diff  --git a/llvm/test/tools/dsymutil/X86/timestamp-mismatch.test 
b/llvm/test/tools/dsymutil/X86/timestamp-mismatch.test
new file mode 100644
index ..7d41905e7951
--- /dev/null
+++ b/llvm/test/tools/dsymutil/X86/timestamp-mismatch.test
@@ -0,0 +1,10 @@
+RUN: mkdir -p %t/Inputs
+RUN: cp %p/../Inputs/basic.macho.x86_64 %t/Inputs
+RUN: cp %p/../Inputs/basic1.macho.x86_64.o %t/Inputs
+RUN: cp %p/../Inputs/basic2.macho.x86_64.o %t/Inputs
+RUN: cp %p/../Inputs/basic3.macho.x86_64.o %t/Inputs
+RUN: dsymutil -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 
2>&1 | FileCheck %s
+
+CHECK: warning: {{.*}}/Inputs/basic1.macho.x86_64.o: timestamp mismatch 
between object file ({{.*}}) and debug map ({{.*}})
+CHECK: warning: {{.*}}/Inputs/basic2.macho.x86_64.o: timestamp mismatch 
between object file ({{.*}}) and debug map ({{.*}})
+CHECK: warning: {{.*}}/Inputs/basic3.macho.x86_64.o: timestamp mismatch 
between object file ({{.*}}) and debug map ({{.*}})

diff  --git a/llvm/test/tools/dsymutil/debug-map-parsing.test 
b/llvm/test/tools/dsymutil/debug-map-parsing.test
index fb4226093da1..a25e44598b30 100644
--- a/llvm/test/tools/dsymutil/debug-map-parsing.test
+++ b/llvm/test/tools/dsymutil/debug-map-parsing.test
@@ -46,7 +46,7 @@ opening the archive once if mulitple of its members are used).
 CHECK-ARCHIVE:  trying to open {{.*}}basic-archive.macho.x86_64'
 CHECK-ARCHIVE-NEXT:loaded object.
 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/Inputs/basic1.macho.x86_64.o'
-CHECK-ARCHIVE-NEXT:loaded object.
+CHECK-ARCHIVE: loaded object.
 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic2.macho.x86_64.o)'
 CHECK-ARCHIVE-NEXT:loaded archive 

[llvm-branch-commits] [llvm] f1d5cbb - [dsymutil] Add preliminary support for DWARF 5.

2021-01-12 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-12T21:55:41-08:00
New Revision: f1d5cbbdee5526bc86eac0a5652b115d9bc158e5

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

LOG: [dsymutil] Add preliminary support for DWARF 5.

Currently dsymutil will silently fail when processing binaries with
Dwarf 5 debug info. This patch adds rudimentary support for Dwarf 5 in
dsymutil.

 - Recognize relocations in the debug_addr section.
 - Recognize (a subset of) Dwarf 5 form values.
 - Emits valid Dwarf 5 compile unit header chains.

To simplify things (and avoid having to emit indexed sections) I decided
to emit the relocated addresses directly in the debug info section.

 - DW_FORM_strx gets relocated and rewritten to DW_FORM_strp
 - DW_FORM_addrx gets relocated and rewritten to DW_FORM_addr

Obviously there's a lot of work left, but this should be a step in the
right direction.

rdar://62345491

Differential revision: https://reviews.llvm.org/D94323

Added: 
llvm/test/tools/dsymutil/Inputs/private/tmp/dwarf5/dwarf5.o
llvm/test/tools/dsymutil/Inputs/private/tmp/dwarf5/dwarf5.out
llvm/test/tools/dsymutil/X86/dwarf5.test

Modified: 
llvm/include/llvm/DWARFLinker/DWARFLinker.h
llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
llvm/include/llvm/DWARFLinker/DWARFStreamer.h
llvm/lib/DWARFLinker/DWARFLinker.cpp
llvm/lib/DWARFLinker/DWARFLinkerCompileUnit.cpp
llvm/lib/DWARFLinker/DWARFStreamer.cpp
llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
llvm/tools/dsymutil/DwarfLinkerForBinary.h

Removed: 




diff  --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h 
b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
index 97faad6b6180..7281966fc608 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -85,6 +85,9 @@ class AddressesMap {
   virtual bool applyValidRelocs(MutableArrayRef Data, uint64_t 
BaseOffset,
 bool IsLittleEndian) = 0;
 
+  /// Relocate the given address offset if a valid relocation exists.
+  virtual llvm::Expected relocateIndexedAddr(uint64_t Offset) = 0;
+
   /// Returns all valid functions address ranges(i.e., those ranges
   /// which points to sections with code).
   virtual RangesTy () = 0;
@@ -183,7 +186,8 @@ class DwarfEmitter {
   ///
   /// As a side effect, this also switches the current Dwarf version
   /// of the MC layer to the one of U.getOrigUnit().
-  virtual void emitCompileUnitHeader(CompileUnit ) = 0;
+  virtual void emitCompileUnitHeader(CompileUnit ,
+ unsigned DwarfVersion) = 0;
 
   /// Recursively emit the DIE tree rooted at \p Die.
   virtual void emitDIE(DIE ) = 0;

diff  --git a/llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h 
b/llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
index 549a0ce4e4b7..a6310bcb5df1 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
@@ -159,7 +159,7 @@ class CompileUnit {
   /// Compute the end offset for this unit. Must be called after the CU's DIEs
   /// have been cloned.  \returns the next unit offset (which is also the
   /// current debug_info section size).
-  uint64_t computeNextUnitOffset();
+  uint64_t computeNextUnitOffset(uint16_t DwarfVersion);
 
   /// Keep track of a forward reference to DIE \p Die in \p RefUnit by \p
   /// Attr. The attribute should be fixed up later to point to the absolute

diff  --git a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h 
b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
index de58f5dedf24..7b0851159252 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
@@ -64,7 +64,7 @@ class DwarfStreamer : public DwarfEmitter {
   ///
   /// As a side effect, this also switches the current Dwarf version
   /// of the MC layer to the one of U.getOrigUnit().
-  void emitCompileUnitHeader(CompileUnit ) override;
+  void emitCompileUnitHeader(CompileUnit , unsigned DwarfVersion) 
override;
 
   /// Recursively emit the DIE tree rooted at \p Die.
   void emitDIE(DIE ) override;

diff  --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp 
b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index 1595b31cb4f9..a09cbf9c95ea 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -419,7 +419,6 @@ void DWARFLinker::cleanupAuxiliarryData(LinkContext 
) {
   DIEAlloc.Reset();
 }
 
-
 /// Check if a variable describing DIE should be kept.
 /// \returns updated TraversalFlags.
 unsigned DWARFLinker::shouldKeepVariableDIE(AddressesMap ,
@@ -845,9 +844,12 @@ void DWARFLinker::assignAbbrev(DIEAbbrev ) {
 unsigned DWARFLinker::DIECloner::cloneStringAttribute(
 DIE , AttributeSpec AttrSpec, const 

[llvm-branch-commits] [llvm] 35e4998 - [dsymutil] Fix spurious space in REQUIRES: line

2021-01-12 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-12T20:13:44-08:00
New Revision: 35e4998f0c9a2f50567f5d2953db266c32fb1a25

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

LOG: [dsymutil] Fix spurious space in REQUIRES: line

This test is incorrectly running on non-darwin hosts.

Added: 


Modified: 
llvm/test/tools/dsymutil/X86/eh_frame.test

Removed: 




diff  --git a/llvm/test/tools/dsymutil/X86/eh_frame.test 
b/llvm/test/tools/dsymutil/X86/eh_frame.test
index 365fc678f31b..1a349dc983b2 100644
--- a/llvm/test/tools/dsymutil/X86/eh_frame.test
+++ b/llvm/test/tools/dsymutil/X86/eh_frame.test
@@ -1,5 +1,6 @@
+REQUIRES: system-darwin
+
 FIXME: Replace otool with llvm-objcopy --dump-section=__TEXT,__eh_frame.
-REQUIRES : system-darwin
 
 $ cat eh_frame.cpp
 int f1()



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


[llvm-branch-commits] [llvm] ad735ba - [dsymutil] s/dwarfdump/llvm-dwarfdump/ in test

2021-01-12 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-12T19:59:13-08:00
New Revision: ad735badb69f389dd52e3ccef93694a0724e1293

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

LOG: [dsymutil] s/dwarfdump/llvm-dwarfdump/ in test

Added: 


Modified: 
llvm/test/tools/dsymutil/X86/eh_frame.test

Removed: 




diff  --git a/llvm/test/tools/dsymutil/X86/eh_frame.test 
b/llvm/test/tools/dsymutil/X86/eh_frame.test
index 1e31a51cc5c2..365fc678f31b 100644
--- a/llvm/test/tools/dsymutil/X86/eh_frame.test
+++ b/llvm/test/tools/dsymutil/X86/eh_frame.test
@@ -17,7 +17,7 @@ $ clang eh_frame.cpp -g -c -o eh_frame.o
 $ ld -no_compact_unwind eh_frame.o -o eh_frame.out
 
 RUN: dsymutil -oso-prepend-path %p/../Inputs 
%p/../Inputs/private/tmp/eh_frame/eh_frame.out -o %t.dSYM
-RUN: dwarfdump --verify %t.dSYM
+RUN: llvm-dwarfdump --verify %t.dSYM
 RUN: otool -s __TEXT __eh_frame %p/../Inputs/private/tmp/eh_frame/eh_frame.out 
| FileCheck %s
 RUN: otool -s __TEXT __eh_frame %t.dSYM/Contents/Resources/DWARF/eh_frame.out 
| FileCheck %s
 



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


[llvm-branch-commits] [llvm] 8a47d87 - [dsymutil] Copy eh_frame content into the dSYM companion file.

2021-01-12 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-12T19:50:34-08:00
New Revision: 8a47d875b071823455931bbc119ca1e49176

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

LOG: [dsymutil] Copy eh_frame content into the dSYM companion file.

Copy over the __eh_frame from the binary into the dSYM. This helps
kernel developers that are working with only dSYMs (i.e. no binaries)
when debugging a core file. This only kicks in when the __eh_frame
exists in the linked binary. Most of the time ld64 will remove the
section in favor of compact unwind info. When it is emitted, it's
generally small enough and should not bloat the dSYM.

rdar://69774935

Differential revision: https://reviews.llvm.org/D94460

Added: 
llvm/test/tools/dsymutil/Inputs/private/tmp/eh_frame/eh_frame.o
llvm/test/tools/dsymutil/Inputs/private/tmp/eh_frame/eh_frame.out
llvm/test/tools/dsymutil/X86/eh_frame.test

Modified: 
llvm/tools/dsymutil/MachOUtils.cpp

Removed: 




diff  --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/eh_frame/eh_frame.o 
b/llvm/test/tools/dsymutil/Inputs/private/tmp/eh_frame/eh_frame.o
new file mode 100644
index ..45ec4097c6a6
Binary files /dev/null and 
b/llvm/test/tools/dsymutil/Inputs/private/tmp/eh_frame/eh_frame.o 
diff er

diff  --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/eh_frame/eh_frame.out 
b/llvm/test/tools/dsymutil/Inputs/private/tmp/eh_frame/eh_frame.out
new file mode 100755
index ..1b5705db193d
Binary files /dev/null and 
b/llvm/test/tools/dsymutil/Inputs/private/tmp/eh_frame/eh_frame.out 
diff er

diff  --git a/llvm/test/tools/dsymutil/X86/eh_frame.test 
b/llvm/test/tools/dsymutil/X86/eh_frame.test
new file mode 100644
index ..1e31a51cc5c2
--- /dev/null
+++ b/llvm/test/tools/dsymutil/X86/eh_frame.test
@@ -0,0 +1,25 @@
+FIXME: Replace otool with llvm-objcopy --dump-section=__TEXT,__eh_frame.
+REQUIRES : system-darwin
+
+$ cat eh_frame.cpp
+int f1()
+{
+  volatile int i;
+  return i;
+}
+
+int main(int argc, char** argv)
+{
+  return f1();
+}
+
+$ clang eh_frame.cpp -g -c -o eh_frame.o
+$ ld -no_compact_unwind eh_frame.o -o eh_frame.out
+
+RUN: dsymutil -oso-prepend-path %p/../Inputs 
%p/../Inputs/private/tmp/eh_frame/eh_frame.out -o %t.dSYM
+RUN: dwarfdump --verify %t.dSYM
+RUN: otool -s __TEXT __eh_frame %p/../Inputs/private/tmp/eh_frame/eh_frame.out 
| FileCheck %s
+RUN: otool -s __TEXT __eh_frame %t.dSYM/Contents/Resources/DWARF/eh_frame.out 
| FileCheck %s
+
+CHECK: 14 00 00 00 00 00 00 00 01 7a 52 00 01 78 10 01
+CHECK: 10 0c 07 08 90 01 00 00

diff  --git a/llvm/tools/dsymutil/MachOUtils.cpp 
b/llvm/tools/dsymutil/MachOUtils.cpp
index 0f38525e45c2..943af430584d 100644
--- a/llvm/tools/dsymutil/MachOUtils.cpp
+++ b/llvm/tools/dsymutil/MachOUtils.cpp
@@ -239,27 +239,36 @@ getSection(const object::MachOObjectFile ,
 // Transfer \a Segment from \a Obj to the output file. This calls into \a 
Writer
 // to write these load commands directly in the output file at the current
 // position.
+//
 // The function also tries to find a hole in the address map to fit the __DWARF
 // segment of \a DwarfSegmentSize size. \a EndAddress is updated to point at 
the
 // highest segment address.
+//
 // When the __LINKEDIT segment is transferred, its offset and size are set 
resp.
 // to \a LinkeditOffset and \a LinkeditSize.
+//
+// When the eh_frame section is transferred, its offset and size are set resp.
+// to \a EHFrameOffset and \a EHFrameSize.
 template 
 static void transferSegmentAndSections(
 const object::MachOObjectFile::LoadCommandInfo , SegmentTy Segment,
 const object::MachOObjectFile , MachObjectWriter ,
-uint64_t LinkeditOffset, uint64_t LinkeditSize, uint64_t DwarfSegmentSize,
-uint64_t , uint64_t ) {
+uint64_t LinkeditOffset, uint64_t LinkeditSize, uint64_t EHFrameOffset,
+uint64_t EHFrameSize, uint64_t DwarfSegmentSize, uint64_t ,
+uint64_t ) {
   if (StringRef("__DWARF") == Segment.segname)
 return;
 
-  Segment.fileoff = Segment.filesize = 0;
-
-  if (StringRef("__LINKEDIT") == Segment.segname) {
+  if (StringRef("__TEXT") == Segment.segname && EHFrameSize > 0) {
+Segment.fileoff = EHFrameOffset;
+Segment.filesize = EHFrameSize;
+  } else if (StringRef("__LINKEDIT") == Segment.segname) {
 Segment.fileoff = LinkeditOffset;
 Segment.filesize = LinkeditSize;
 // Resize vmsize by rounding to the page size.
 Segment.vmsize = alignTo(LinkeditSize, 0x1000);
+  } else {
+Segment.fileoff = Segment.filesize = 0;
   }
 
   // Check if the end address of the last segment and our current
@@ -280,7 +289,12 @@ static void transferSegmentAndSections(
   Writer.W.OS.write(reinterpret_cast(), sizeof(Segment));
   for (unsigned i = 0; i < nsects; ++i) {
 auto Sect = 

[llvm-branch-commits] [llvm] e5553b9 - [dsymutil] Warn on timestmap mismatch between object file and debug map

2021-01-12 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-12T18:58:10-08:00
New Revision: e5553b9a6ab9f02f382a31cc5117b52c3bfaf77a

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

LOG: [dsymutil] Warn on timestmap mismatch between object file and debug map

Add a warning when the timestmap doesn't match between the object file
and the debug map entry. We were already emitting such warnings for
archive members and swift interface files. This patch also unifies the
warning across all three.

rdar://65614640

Differential revision: https://reviews.llvm.org/D94536

Added: 
llvm/test/tools/dsymutil/Inputs/basic.macho.x86_64.o

Modified: 
llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
llvm/test/tools/dsymutil/debug-map-parsing.test
llvm/tools/dsymutil/BinaryHolder.cpp
llvm/tools/dsymutil/BinaryHolder.h
llvm/tools/dsymutil/DwarfLinkerForBinary.cpp

Removed: 




diff  --git a/llvm/test/tools/dsymutil/Inputs/basic.macho.x86_64.o 
b/llvm/test/tools/dsymutil/Inputs/basic.macho.x86_64.o
new file mode 100644
index ..e69de29bb2d1

diff  --git a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test 
b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
index 626208ff3496..43d930af7128 100644
--- a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
+++ b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
@@ -20,7 +20,7 @@ READOBJ-NEXT: |.|
 DWARFDUMP: __swift_ast
 
 RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 
-no-output -verbose 2>&1 | FileCheck %s --check-prefix=TIMESTAMP
-TIMESTAMP: warning: Timestamp mismatch
+TIMESTAMP: warning: {{.*}}/swift-ast.swiftmodule: timestamp mismatch between 
swift interface file ({{.*}}) and debug map ({{.*}})
 
 RUN: dsymutil -s 
%T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck 
%s --check-prefix=NAST
 NAST-NOT: N_AST

diff  --git a/llvm/test/tools/dsymutil/debug-map-parsing.test 
b/llvm/test/tools/dsymutil/debug-map-parsing.test
index fb4226093da1..703934d38503 100644
--- a/llvm/test/tools/dsymutil/debug-map-parsing.test
+++ b/llvm/test/tools/dsymutil/debug-map-parsing.test
@@ -1,3 +1,4 @@
+RUN: touch %p/Inputs/basic.macho.x86_64.o
 RUN: dsymutil -dump-debug-map -oso-prepend-path=%p 
%p/Inputs/basic.macho.x86_64 | FileCheck %s
 RUN: dsymutil -dump-debug-map -oso-prepend-path=%p 
%p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
 RUN: dsymutil -verbose -dump-debug-map -oso-prepend-path=%p 
%p/Inputs/basic-archive.macho.x86_64 2>&1 | FileCheck %s 
--check-prefix=CHECK-ARCHIVE
@@ -46,6 +47,7 @@ opening the archive once if mulitple of its members are used).
 CHECK-ARCHIVE:  trying to open {{.*}}basic-archive.macho.x86_64'
 CHECK-ARCHIVE-NEXT:loaded object.
 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/Inputs/basic1.macho.x86_64.o'
+CHECK-ARCHIVE-NEXT: warning: {{.*}}/Inputs/basic1.macho.x86_64.o: timestamp 
mismatch between object file ({{.*}}) and debug map ({{.*}})
 CHECK-ARCHIVE-NEXT:loaded object.
 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic2.macho.x86_64.o)'
 CHECK-ARCHIVE-NEXT:loaded archive {{.*}}/libbasic.a'

diff  --git a/llvm/tools/dsymutil/BinaryHolder.cpp 
b/llvm/tools/dsymutil/BinaryHolder.cpp
index df3cb7161a81..b401d519718c 100644
--- a/llvm/tools/dsymutil/BinaryHolder.cpp
+++ b/llvm/tools/dsymutil/BinaryHolder.cpp
@@ -87,7 +87,8 @@ Error 
BinaryHolder::ArchiveEntry::load(IntrusiveRefCntPtr VFS,
 }
 
 Error BinaryHolder::ObjectEntry::load(IntrusiveRefCntPtr VFS,
-  StringRef Filename, bool Verbose) {
+  StringRef Filename, TimestampTy 
Timestamp,
+  bool Verbose) {
   // Try to load regular binary and force it to be memory mapped.
   auto ErrOrBuff = (Filename == "-")
? MemoryBuffer::getSTDIN()
@@ -95,6 +96,17 @@ Error 
BinaryHolder::ObjectEntry::load(IntrusiveRefCntPtr VFS,
   if (auto Err = ErrOrBuff.getError())
 return errorCodeToError(Err);
 
+  if (Filename != "-" && Timestamp != sys::TimePoint<>()) {
+llvm::ErrorOr Stat = VFS->status(Filename);
+if (!Stat)
+  return errorCodeToError(Stat.getError());
+if (Timestamp != Stat->getLastModificationTime())
+  WithColor::warning() << Filename
+   << ": timestamp mismatch between object file ("
+   << Stat->getLastModificationTime()
+   << ") and debug map (" << Timestamp << ")\n";
+  }
+
   MemBuffer = std::move(*ErrOrBuff);
 
   if (Verbose)
@@ -182,7 +194,11 @@ BinaryHolder::ArchiveEntry::getObjectEntry(StringRef 
Filename,
   if (Timestamp != sys::TimePoint<>() &&
   Timestamp != ModTimeOrErr.get()) {
 if (Verbose)
- 

[llvm-branch-commits] [llvm] 04359ee - [DWARFLinker] Link against BinaryFormat

2021-01-08 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-08T18:57:36-08:00
New Revision: 04359eece132d5406be24cddd0df55b0b9bffdc1

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

LOG: [DWARFLinker] Link against BinaryFormat

Added: 


Modified: 
llvm/lib/DWARFLinker/CMakeLists.txt

Removed: 




diff  --git a/llvm/lib/DWARFLinker/CMakeLists.txt 
b/llvm/lib/DWARFLinker/CMakeLists.txt
index f9e375b09000..fd38003f3d65 100644
--- a/llvm/lib/DWARFLinker/CMakeLists.txt
+++ b/llvm/lib/DWARFLinker/CMakeLists.txt
@@ -11,6 +11,7 @@ add_llvm_component_library(LLVMDWARFLinker
   intrinsics_gen
 
   LINK_COMPONENTS
+  BinaryFormat
   DebugInfoDWARF
   AsmPrinter
   CodeGen



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


[llvm-branch-commits] [lldb] 2723551 - [debugserver] Various plist changes

2021-01-08 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-08T18:53:08-08:00
New Revision: 272355128f48089a959215472b645628a48659f2

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

LOG: [debugserver] Various plist changes

 - Remove unused plists that were referenced (but unused) by Xcode.
 - Move all debugserver plists unders tools/debugserver/resources.
 - Add the ability to distinguish between com.apple.security.cs.debugger
   and com.apple.private.cs.debugger.

rdar://66082043

Differential revision: https://reviews.llvm.org/D94320

Added: 
lldb/tools/debugserver/resources/debugserver-entitlements.plist
lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist

lldb/tools/debugserver/resources/debugserver-macosx-private-entitlements.plist

Modified: 
lldb/tools/debugserver/source/CMakeLists.txt

Removed: 
lldb/tools/debugserver/debugnub-exports
lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
lldb/tools/debugserver/source/com.apple.debugserver.applist.plist
lldb/tools/debugserver/source/com.apple.debugserver.internal.plist
lldb/tools/debugserver/source/com.apple.debugserver.plist
lldb/tools/debugserver/source/com.apple.debugserver.posix.internal.plist
lldb/tools/debugserver/source/com.apple.debugserver.posix.plist

lldb/tools/debugserver/source/com.apple.internal.xpc.remote.debugserver.plist
lldb/tools/debugserver/source/debugserver-entitlements.plist
lldb/tools/debugserver/source/debugserver-macosx-entitlements.plist



diff  --git a/lldb/tools/debugserver/debugnub-exports 
b/lldb/tools/debugserver/debugnub-exports
deleted file mode 100644
index 662bf9308a6f..
--- a/lldb/tools/debugserver/debugnub-exports
+++ /dev/null
@@ -1,2 +0,0 @@
-_DNB*
-__DNB*

diff  --git a/lldb/tools/debugserver/source/debugserver-entitlements.plist 
b/lldb/tools/debugserver/resources/debugserver-entitlements.plist
similarity index 100%
rename from lldb/tools/debugserver/source/debugserver-entitlements.plist
rename to lldb/tools/debugserver/resources/debugserver-entitlements.plist

diff  --git 
a/lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist 
b/lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist
new file mode 100644
index ..3d60e8bd0b94
--- /dev/null
+++ b/lldb/tools/debugserver/resources/debugserver-macosx-entitlements.plist
@@ -0,0 +1,8 @@
+
+http://www.apple.com/DTDs/PropertyList-1.0.dtd;>
+
+
+com.apple.security.cs.debugger
+
+
+

diff  --git 
a/lldb/tools/debugserver/source/debugserver-macosx-entitlements.plist 
b/lldb/tools/debugserver/resources/debugserver-macosx-private-entitlements.plist
similarity index 100%
rename from lldb/tools/debugserver/source/debugserver-macosx-entitlements.plist
rename to 
lldb/tools/debugserver/resources/debugserver-macosx-private-entitlements.plist

diff  --git a/lldb/tools/debugserver/source/CMakeLists.txt 
b/lldb/tools/debugserver/source/CMakeLists.txt
index 6977fe734381..0318d5051c1f 100644
--- a/lldb/tools/debugserver/source/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/CMakeLists.txt
@@ -60,7 +60,10 @@ endfunction()
 # llvm dependencies in the current scope to the empty set.
 set(LLVM_COMMON_DEPENDS)
 
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_SOURCE_DIR}/../resources/lldb-debugserver-Info.plist")
+set(DEBUGSERVER_RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../resources")
+set(DEBUGSERVER_INFO_PLIST 
"${DEBUGSERVER_RESOURCE_DIR}/lldb-debugserver-Info.plist")
+
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ 
-Wl,-sectcreate,__TEXT,__info_plist,${DEBUGSERVER_INFO_PLIST}")
 
 check_cxx_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments"
 CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
@@ -128,8 +131,11 @@ if(LLDB_USE_ENTITLEMENTS)
   if(APPLE_EMBEDDED)
 set(entitlements 
${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist)
   else()
-# Same entitlements file as used for lldb-server
-set(entitlements 
${LLDB_SOURCE_DIR}/resources/debugserver-macosx-entitlements.plist)
+if (LLDB_USE_PRIVATE_ENTITLEMENTS)
+  set(entitlements 
${DEBUGSERVER_RESOURCE_DIR}/debugserver-macosx-entitlements.plist)
+else()
+  set(entitlements 
${DEBUGSERVER_RESOURCE_DIR}/debugserver-macosx-private-entitlements.plist)
+endif()
   endif()
 endif()
 

diff  --git 
a/lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist 
b/lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
deleted file mode 100644
index e9a74bd0bf79..
--- a/lldb/tools/debugserver/source/com.apple.debugserver.applist.internal.plist
+++ /dev/null
@@ -1,16 

[llvm-branch-commits] [llvm] 7a20436 - [DWARFLinker] Print the unsupport DWARF form as part of the warning

2021-01-08 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-08T18:51:40-08:00
New Revision: 7a204362f5c6cb97308be543f77ace8d8285ffef

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

LOG: [DWARFLinker] Print the unsupport DWARF form as part of the warning

Added: 


Modified: 
llvm/lib/DWARFLinker/DWARFLinker.cpp

Removed: 




diff  --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp 
b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index e285773dfd5a..1595b31cb4f9 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1217,9 +1217,10 @@ unsigned DWARFLinker::DIECloner::cloneAttribute(
 return cloneScalarAttribute(Die, InputDIE, File, Unit, AttrSpec, Val,
 AttrSize, Info);
   default:
-Linker.reportWarning(
-"Unsupported attribute form in cloneAttribute. Dropping.", File,
-);
+Linker.reportWarning("Unsupported attribute form " +
+ dwarf::FormEncodingString(AttrSpec.Form) +
+ " in cloneAttribute. Dropping.",
+ File, );
   }
 
   return 0;



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


[llvm-branch-commits] [lldb] 311b247 - [lldb] Remove stale LLDB-Info.plist

2021-01-08 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-08T10:12:16-08:00
New Revision: 311b247c9fb58ee476184a7eb8044b8f54f95035

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

LOG: [lldb] Remove stale LLDB-Info.plist

Remove the stale LLDB-Info.plist which was only used by TestHelp.py. The
latter would try to parse the version number from the plist and use that
to verify the version in the help output. Of course this never matched
so it would fall back to matching any arbitrary version.

This patch does *not* change the real LLDB-Info.plist.in file which is
used for the LLDB Framework.

Added: 


Modified: 
lldb/test/API/commands/help/TestHelp.py

Removed: 
lldb/resources/LLDB-Info.plist



diff  --git a/lldb/resources/LLDB-Info.plist b/lldb/resources/LLDB-Info.plist
deleted file mode 100644
index 77330e2929cb..
--- a/lldb/resources/LLDB-Info.plist
+++ /dev/null
@@ -1,24 +0,0 @@
-
-http://www.apple.com/DTDs/PropertyList-1.0.dtd;>
-
-
-   CFBundleDevelopmentRegion
-   English
-   CFBundleExecutable
-   ${EXECUTABLE_NAME}
-   CFBundleIdentifier
-   com.apple.${PRODUCT_NAME}.framework
-   CFBundleInfoDictionaryVersion
-   6.0
-   CFBundlePackageType
-   FMWK
-   CFBundleShortVersionString
-   1.${CURRENT_PROJECT_VERSION}
-   CFBundleSignature
-   
-   CFBundleVersion
-   360.99.0
-   CFBundleName
-   ${EXECUTABLE_NAME}
-
-

diff  --git a/lldb/test/API/commands/help/TestHelp.py 
b/lldb/test/API/commands/help/TestHelp.py
index f671fc7ad5f4..2e849fb768a7 100644
--- a/lldb/test/API/commands/help/TestHelp.py
+++ b/lldb/test/API/commands/help/TestHelp.py
@@ -36,44 +36,6 @@ def test_help_on_help(self):
 substrs=['--hide-aliases',
  '--hide-user-commands'])
 
-@no_debug_info_test
-def version_number_string(self):
-"""Helper function to find the version number string of lldb."""
-plist = os.path.join(
-os.environ["LLDB_SRC"],
-"resources",
-"LLDB-Info.plist")
-try:
-CFBundleVersionSegFound = False
-with open(plist, 'r') as f:
-for line in f:
-if CFBundleVersionSegFound:
-version_line = line.strip()
-import re
-m = re.match("(.*)", version_line)
-if m:
-version = m.group(1)
-return version
-else:
-# Unsuccessful, let's juts break out of the for
-# loop.
-break
-
-if line.find("CFBundleVersion") != -1:
-# Found our match.  The next line contains our version
-# string, for example:
-#
-# 38
-CFBundleVersionSegFound = True
-
-except:
-# Just fallthrough...
-import traceback
-traceback.print_exc()
-
-# Use None to signify that we are not able to grok the version number.
-return None
-
 @no_debug_info_test
 def test_help_arch(self):
 """Test 'help arch' which should list of supported architectures."""
@@ -85,13 +47,8 @@ def test_help_version(self):
 """Test 'help version' and 'version' commands."""
 self.expect("help version",
 substrs=['Show the LLDB debugger version.'])
-import re
-version_str = self.version_number_string()
-match = re.match('[0-9]+', version_str)
-search_regexp = ['lldb( version|-' + (version_str if match else 
'[0-9]+') + ').*\n']
-
 self.expect("version",
-patterns=search_regexp)
+patterns=['lldb( version|-[0-9]+).*\n'])
 
 @no_debug_info_test
 def test_help_should_not_crash_lldb(self):



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


[llvm-branch-commits] [lldb] cb6d53c - [lldb] Bump the required SWIG version to 3

2021-01-08 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-08T08:47:21-08:00
New Revision: cb6d53ccdc7288f1bb62b0d50055545acfb59f77

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

LOG: [lldb] Bump the required SWIG version to 3

Bump the required SWIG version to 3. If my memory serves me well we last
bumped the required SWIG version to 2 for Python 3. At that time SWIG 3
had already been around for a while so everyone I know was already using
that.

It appears that SWIG 3 is the only version that officially supports
C++11 which we're using in the typemap. SWIG 3 was released in 2014 so I
think it's reasonable to make that the minimum required version.

https://bugs.llvm.org/show_bug.cgi?id=48685

Differential revision: https://reviews.llvm.org/D94244

Added: 


Modified: 
lldb/cmake/modules/FindLuaAndSwig.cmake
lldb/cmake/modules/FindPythonAndSwig.cmake
lldb/docs/resources/build.rst

Removed: 




diff  --git a/lldb/cmake/modules/FindLuaAndSwig.cmake 
b/lldb/cmake/modules/FindLuaAndSwig.cmake
index 968f905ef2d3..f6251bbd1042 100644
--- a/lldb/cmake/modules/FindLuaAndSwig.cmake
+++ b/lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -7,7 +7,7 @@
 if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
   set(LUAANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0)
+  find_package(SWIG 3.0)
   if (SWIG_FOUND)
 find_package(Lua 5.3)
 if(LUA_FOUND AND SWIG_FOUND)
@@ -17,7 +17,7 @@ else()
 SWIG_EXECUTABLE)
 endif()
   else()
-message(STATUS "SWIG 2 or later is required for Lua support in LLDB but 
could not be found")
+message(STATUS "SWIG 3 or later is required for Lua support in LLDB but 
could not be found")
   endif()
 
   include(FindPackageHandleStandardArgs)

diff  --git a/lldb/cmake/modules/FindPythonAndSwig.cmake 
b/lldb/cmake/modules/FindPythonAndSwig.cmake
index dcbc386b70dd..3535b548c45f 100644
--- a/lldb/cmake/modules/FindPythonAndSwig.cmake
+++ b/lldb/cmake/modules/FindPythonAndSwig.cmake
@@ -38,11 +38,11 @@ endmacro()
 if(Python3_LIBRARIES AND Python3_INCLUDE_DIRS AND Python3_EXECUTABLE AND 
SWIG_EXECUTABLE)
   set(PYTHONANDSWIG_FOUND TRUE)
 else()
-  find_package(SWIG 2.0)
+  find_package(SWIG 3.0)
   if (SWIG_FOUND)
   FindPython3()
   else()
-message(STATUS "SWIG 2 or later is required for Python support in LLDB but 
could not be found")
+message(STATUS "SWIG 3 or later is required for Python support in LLDB but 
could not be found")
   endif()
 
   get_property(MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

diff  --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index 8aadd126ed0b..825f86459d7f 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -34,7 +34,7 @@ If you want to run the test suite, you'll need to build LLDB 
with Python
 scripting support.
 
 * `Python `_
-* `SWIG `_ 2 or later.
+* `SWIG `_ 3 or later.
 
 Optional Dependencies
 *



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


[llvm-branch-commits] [lldb] 57e0cd3 - [lldb] Make DoReadMemory a protected method.

2021-01-07 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-07T21:06:36-08:00
New Revision: 57e0cd356287321c4847a9e0a9177516dae0cbc1

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

LOG: [lldb] Make DoReadMemory a protected method.

DoReadMemory is LLDB's internal implementation and shouldn't be called
directly.

Differential revision: https://reviews.llvm.org/D94284

Added: 


Modified: 
lldb/include/lldb/Target/Process.h

lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index e8dd8847e87a..6f30787f7e5b 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -1414,35 +1414,6 @@ class Process : public 
std::enable_shared_from_this,
   /// this process.
   virtual bool WarnBeforeDetach() const { return true; }
 
-  /// Actually do the reading of memory from a process.
-  ///
-  /// Subclasses must override this function and can return fewer bytes than
-  /// requested when memory requests are too large. This class will break up
-  /// the memory requests and keep advancing the arguments along as needed.
-  ///
-  /// \param[in] vm_addr
-  /// A virtual load address that indicates where to start reading
-  /// memory from.
-  ///
-  /// \param[in] size
-  /// The number of bytes to read.
-  ///
-  /// \param[out] buf
-  /// A byte buffer that is at least \a size bytes long that
-  /// will receive the memory bytes.
-  ///
-  /// \param[out] error
-  /// An error that indicates the success or failure of this
-  /// operation. If error indicates success (error.Success()),
-  /// then the value returned can be trusted, otherwise zero
-  /// will be returned.
-  ///
-  /// \return
-  /// The number of bytes that were actually read into \a buf.
-  /// Zero is returned in the case of an error.
-  virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
-  Status ) = 0;
-
   /// Read of memory from a process.
   ///
   /// This function will read memory from the current process's address space
@@ -2570,6 +2541,35 @@ void PruneThreadPlans();
 bool trap_exceptions = false);
 
 protected:
+  /// Actually do the reading of memory from a process.
+  ///
+  /// Subclasses must override this function and can return fewer bytes than
+  /// requested when memory requests are too large. This class will break up
+  /// the memory requests and keep advancing the arguments along as needed.
+  ///
+  /// \param[in] vm_addr
+  /// A virtual load address that indicates where to start reading
+  /// memory from.
+  ///
+  /// \param[in] size
+  /// The number of bytes to read.
+  ///
+  /// \param[out] buf
+  /// A byte buffer that is at least \a size bytes long that
+  /// will receive the memory bytes.
+  ///
+  /// \param[out] error
+  /// An error that indicates the success or failure of this
+  /// operation. If error indicates success (error.Success()),
+  /// then the value returned can be trusted, otherwise zero
+  /// will be returned.
+  ///
+  /// \return
+  /// The number of bytes that were actually read into \a buf.
+  /// Zero is returned in the case of an error.
+  virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
+  Status ) = 0;
+
   void SetState(lldb::EventSP _sp);
 
   lldb::StateType GetPrivateState();

diff  --git 
a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp 
b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index d0d5a99b28ed..fd1916d296d5 100644
--- 
a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ 
b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -400,7 +400,7 @@ DynamicLoaderDarwinKernel::ReadMachHeader(addr_t addr, 
Process *process, llvm::M
 *read_error = false;
 
   // Read the mach header and see whether it looks like a kernel
-  if (process->DoReadMemory (addr, , sizeof(header), error) !=
+  if (process->ReadMemory(addr, , sizeof(header), error) !=
   sizeof(header)) {
 if (read_error)
   *read_error = true;
@@ -790,7 +790,7 @@ bool 
DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
 
   // For the kernel, we really do need an on-disk file copy of the binary
   // to do anything useful. This will force a call to dsymForUUID if it
-  // exists, instead of depending on the DebugSymbols preferences 

[llvm-branch-commits] [lldb] f2e0585 - [lldb] Access the ModuleList through iterators where possible (NFC)

2021-01-07 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-07T21:06:36-08:00
New Revision: f2e05855deb39125a30a67b63a5e524792805768

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

LOG: [lldb] Access the ModuleList through iterators where possible (NFC)

Replace uses of GetModuleAtIndexUnlocked and
GetModulePointerAtIndexUnlocked with the ModuleIterable and
ModuleIterableNoLocking where applicable.

Differential revision: https://reviews.llvm.org/D94271

Added: 


Modified: 
lldb/include/lldb/Core/ModuleList.h
lldb/include/lldb/Utility/Iterable.h
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Core/SearchFilter.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/ModuleList.h 
b/lldb/include/lldb/Core/ModuleList.h
index 1609f0f77c56..46a718f08f04 100644
--- a/lldb/include/lldb/Core/ModuleList.h
+++ b/lldb/include/lldb/Core/ModuleList.h
@@ -237,20 +237,6 @@ class ModuleList {
   /// \see ModuleList::GetSize()
   Module *GetModulePointerAtIndex(size_t idx) const;
 
-  /// Get the module pointer for the module at index \a idx without acquiring
-  /// the ModuleList mutex.  This MUST already have been acquired with
-  /// ModuleList::GetMutex and locked for this call to be safe.
-  ///
-  /// \param[in] idx
-  /// An index into this module collection.
-  ///
-  /// \return
-  /// A pointer to a Module which can by nullptr if \a idx is out
-  /// of range.
-  ///
-  /// \see ModuleList::GetSize()
-  Module *GetModulePointerAtIndexUnlocked(size_t idx) const;
-
   /// Find compile units by partial or full path.
   ///
   /// Finds all compile units that match \a path in all of the modules and
@@ -491,11 +477,13 @@ class ModuleList {
   typedef LockingAdaptedIterable
   ModuleIterable;
-  ModuleIterable Modules() { return ModuleIterable(m_modules, GetMutex()); }
+  ModuleIterable Modules() const {
+return ModuleIterable(m_modules, GetMutex());
+  }
 
   typedef AdaptedIterable
   ModuleIterableNoLocking;
-  ModuleIterableNoLocking ModulesNoLocking() {
+  ModuleIterableNoLocking ModulesNoLocking() const {
 return ModuleIterableNoLocking(m_modules);
   }
 };

diff  --git a/lldb/include/lldb/Utility/Iterable.h 
b/lldb/include/lldb/Utility/Iterable.h
index 3f9b8b1e4c57..5c38e46feb92 100644
--- a/lldb/include/lldb/Utility/Iterable.h
+++ b/lldb/include/lldb/Utility/Iterable.h
@@ -170,7 +170,7 @@ template 
 class LockingAdaptedIterable : public AdaptedIterable {
 public:
-  LockingAdaptedIterable(C , MutexType )
+  LockingAdaptedIterable(const C , MutexType )
   : AdaptedIterable(container), m_mutex() {
 m_mutex->lock();
   }

diff  --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index 06d08ecdb3eb..d7bca308ca99 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -508,7 +508,6 @@ void Breakpoint::ModulesChanged(ModuleList _list, 
bool load,
 "delete_locations: %i\n",
 module_list.GetSize(), load, delete_locations);
 
-  std::lock_guard guard(module_list.GetMutex());
   if (load) {
 // The logic for handling new modules is:
 // 1) If the filter rejects this module, then skip it. 2) Run through the
@@ -525,7 +524,7 @@ void Breakpoint::ModulesChanged(ModuleList _list, 
bool load,
 // them after the locations pass.  Have to do it this way because resolving
 // breakpoints will add new locations potentially.
 
-for (ModuleSP module_sp : module_list.ModulesNoLocking()) {
+for (ModuleSP module_sp : module_list.Modules()) {
   bool seen = false;
   if (!m_filter_sp->ModulePasses(module_sp))
 continue;
@@ -589,9 +588,7 @@ void Breakpoint::ModulesChanged(ModuleList _list, 
bool load,
 else
   removed_locations_event = nullptr;
 
-size_t num_modules = module_list.GetSize();
-for (size_t i = 0; i < num_modules; i++) {
-  ModuleSP module_sp(module_list.GetModuleAtIndexUnlocked(i));
+for (ModuleSP module_sp 

[llvm-branch-commits] [lldb] fbc13e9 - [lldb] Skip scoped enum checks with Dwarf <4

2021-01-06 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-06T17:13:33-08:00
New Revision: fbc13e9345c7c9607f0c28e0ccfa9a7baf254f29

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

LOG: [lldb] Skip scoped enum checks with Dwarf <4

The scoped enum tests depend on DW_AT_enum_class which was added in
Dwarf 4.

I made part of the test conditional on the Dwarf version instead of
splitting it into a separate test and using the decorator to avoid the
overhead of setting up the test.

Added: 


Modified: 
lldb/test/API/python_api/type/TestTypeList.py

Removed: 




diff  --git a/lldb/test/API/python_api/type/TestTypeList.py 
b/lldb/test/API/python_api/type/TestTypeList.py
index ff560de2f96f..359dfe8cf5a9 100644
--- a/lldb/test/API/python_api/type/TestTypeList.py
+++ b/lldb/test/API/python_api/type/TestTypeList.py
@@ -145,25 +145,26 @@ def test(self):
 self.DebugSBType(myint_type)
 self.assertTrue(myint_arr_element_type == myint_type)
 
-# Test enum methods.
-enum_type = target.FindFirstType('EnumType')
-self.assertTrue(enum_type)
-self.DebugSBType(enum_type)
-self.assertFalse(enum_type.IsScopedEnumerationType())
-
-scoped_enum_type = target.FindFirstType('ScopedEnumType')
-self.assertTrue(scoped_enum_type)
-self.DebugSBType(scoped_enum_type)
-self.assertTrue(scoped_enum_type.IsScopedEnumerationType())
-int_scoped_enum_type = scoped_enum_type.GetEnumerationIntegerType()
-self.assertTrue(int_scoped_enum_type)
-self.DebugSBType(int_scoped_enum_type)
-self.assertEquals(int_scoped_enum_type.GetName(), 'int')
-
-enum_uchar = target.FindFirstType('EnumUChar')
-self.assertTrue(enum_uchar)
-self.DebugSBType(enum_uchar)
-int_enum_uchar = enum_uchar.GetEnumerationIntegerType()
-self.assertTrue(int_enum_uchar)
-self.DebugSBType(int_enum_uchar)
-self.assertEquals(int_enum_uchar.GetName(), 'unsigned char')
+# Test enum methods. Requires DW_AT_enum_class which was added in 
Dwarf 4.
+if configuration.dwarf_version >= 4:
+enum_type = target.FindFirstType('EnumType')
+self.assertTrue(enum_type)
+self.DebugSBType(enum_type)
+self.assertFalse(enum_type.IsScopedEnumerationType())
+
+scoped_enum_type = target.FindFirstType('ScopedEnumType')
+self.assertTrue(scoped_enum_type)
+self.DebugSBType(scoped_enum_type)
+self.assertTrue(scoped_enum_type.IsScopedEnumerationType())
+int_scoped_enum_type = scoped_enum_type.GetEnumerationIntegerType()
+self.assertTrue(int_scoped_enum_type)
+self.DebugSBType(int_scoped_enum_type)
+self.assertEquals(int_scoped_enum_type.GetName(), 'int')
+
+enum_uchar = target.FindFirstType('EnumUChar')
+self.assertTrue(enum_uchar)
+self.DebugSBType(enum_uchar)
+int_enum_uchar = enum_uchar.GetEnumerationIntegerType()
+self.assertTrue(int_enum_uchar)
+self.DebugSBType(int_enum_uchar)
+self.assertEquals(int_enum_uchar.GetName(), 'unsigned char')



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


[llvm-branch-commits] [lldb] 6d94eea - [lldb] Ad os_signpost support to lldb_private::Timer

2021-01-06 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-06T15:16:09-08:00
New Revision: 6d94eeadd28af4d488b5875778a3ebfa0d749b52

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

LOG: [lldb] Ad os_signpost support to lldb_private::Timer

Emit os_signposts when supported from LLDB's timer class. A vast amount
of performance sensitive places in LLDB are already instrumented with
the Timer class.

By emitting signposts we can examine this information in Instruments. I
recommend looking at Daniel's differential for why this is so powerful:
https://reviews.llvm.org/D52954.

Differential revision: https://reviews.llvm.org/D93657

Added: 


Modified: 
lldb/include/lldb/Utility/Timer.h
lldb/source/Utility/Timer.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Timer.h 
b/lldb/include/lldb/Utility/Timer.h
index 91f9c57c03c1..edc064b23b57 100644
--- a/lldb/include/lldb/Utility/Timer.h
+++ b/lldb/include/lldb/Utility/Timer.h
@@ -25,6 +25,7 @@ class Timer {
   class Category {
   public:
 explicit Category(const char *category_name);
+llvm::StringRef GetName() { return m_name; }
 
   private:
 friend class Timer;

diff  --git a/lldb/source/Utility/Timer.cpp b/lldb/source/Utility/Timer.cpp
index d55c9863117b..7ead51069529 100644
--- a/lldb/source/Utility/Timer.cpp
+++ b/lldb/source/Utility/Timer.cpp
@@ -7,6 +7,8 @@
 
//===--===//
 #include "lldb/Utility/Timer.h"
 #include "lldb/Utility/Stream.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/Signposts.h"
 
 #include 
 #include 
@@ -28,6 +30,9 @@ typedef std::vector TimerStack;
 static std::atomic g_categories;
 } // end of anonymous namespace
 
+/// Allows llvm::Timer to emit signposts when supported.
+static llvm::ManagedStatic Signposts;
+
 std::atomic Timer::g_quiet(true);
 std::atomic Timer::g_display_depth(0);
 static std::mutex () {
@@ -54,6 +59,7 @@ void Timer::SetQuiet(bool value) { g_quiet = value; }
 
 Timer::Timer(Timer::Category , const char *format, ...)
 : m_category(category), m_total_start(std::chrono::steady_clock::now()) {
+  Signposts->startInterval(this, m_category.GetName());
   TimerStack  = GetTimerStackForCurrentThread();
 
   stack.push_back(this);
@@ -80,6 +86,8 @@ Timer::~Timer() {
   auto total_dur = stop_time - m_total_start;
   auto timer_dur = total_dur - m_child_duration;
 
+  Signposts->endInterval(this, m_category.GetName());
+
   TimerStack  = GetTimerStackForCurrentThread();
   if (g_quiet && stack.size() <= g_display_depth) {
 std::lock_guard lock(GetFileMutex());



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


[llvm-branch-commits] [llvm] b37de2a - [Support] Untie the llvm::Signpost interface from llvm::Timer

2021-01-06 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-06T15:16:09-08:00
New Revision: b37de2afa30fe4312aa9b87b11208bd7e05c8fa1

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

LOG: [Support] Untie the llvm::Signpost interface from llvm::Timer

Make llvm::Signpost more generic by untying from llvm::Timer. This
allows signposts to be used in a different context.

My motivation for doing this is being able to use signposts in LLDB.

Differential revision: https://reviews.llvm.org/D93655

Added: 


Modified: 
llvm/include/llvm/Support/Signposts.h
llvm/lib/Support/Signposts.cpp
llvm/lib/Support/Timer.cpp

Removed: 




diff  --git a/llvm/include/llvm/Support/Signposts.h 
b/llvm/include/llvm/Support/Signposts.h
index b5a8c3d61e3e..8036b1f53663 100644
--- a/llvm/include/llvm/Support/Signposts.h
+++ b/llvm/include/llvm/Support/Signposts.h
@@ -17,9 +17,10 @@
 #ifndef LLVM_SUPPORT_SIGNPOSTS_H
 #define LLVM_SUPPORT_SIGNPOSTS_H
 
+#include "llvm/ADT/StringRef.h"
+
 namespace llvm {
 class SignpostEmitterImpl;
-class Timer;
 
 /// Manages the emission of signposts into the recording method supported by
 /// the OS.
@@ -32,10 +33,10 @@ class SignpostEmitter {
 
   bool isEnabled() const;
 
-  /// Begin a signposted interval for the given timer.
-  void startTimerInterval(Timer *T);
-  /// End a signposted interval for the given timer.
-  void endTimerInterval(Timer *T);
+  /// Begin a signposted interval for a given object.
+  void startInterval(const void *O, StringRef Name);
+  /// End a signposted interval for a given object.
+  void endInterval(const void *O, StringRef Name);
 };
 
 } // end namespace llvm

diff  --git a/llvm/lib/Support/Signposts.cpp b/llvm/lib/Support/Signposts.cpp
index aa159e1da2ae..91ce909c7dcb 100644
--- a/llvm/lib/Support/Signposts.cpp
+++ b/llvm/lib/Support/Signposts.cpp
@@ -33,21 +33,20 @@ void LogDeleter(os_log_t *X) {
 
 namespace llvm {
 class SignpostEmitterImpl {
-  using LogPtrTy =
-  std::unique_ptr>;
+  using LogPtrTy = std::unique_ptr>;
   using LogTy = LogPtrTy::element_type;
 
   LogPtrTy SignpostLog;
-  DenseMap Signposts;
+  DenseMap Signposts;
 
   LogTy () const { return *SignpostLog; }
-  os_signpost_id_t getSignpostForTimer(const Timer *T) {
-const auto  = Signposts.find(T);
+  os_signpost_id_t getSignpostForObject(const void *O) {
+const auto  = Signposts.find(O);
 if (I != Signposts.end())
   return I->second;
 
 const auto  = Signposts.insert(
-std::make_pair(T, os_signpost_id_make_with_pointer(getLogger(), T)));
+std::make_pair(O, os_signpost_id_make_with_pointer(getLogger(), O)));
 return Inserted.first->second;
   }
 
@@ -56,20 +55,19 @@ class SignpostEmitterImpl {
 
   bool isEnabled() const { return os_signpost_enabled(*SignpostLog); }
 
-  void startTimerInterval(Timer *T) {
+  void startInterval(const void *O, llvm::StringRef Name) {
 if (isEnabled()) {
-  // Both strings used here are required to be constant literal strings
-  os_signpost_interval_begin(getLogger(), getSignpostForTimer(T),
- "Pass Timers", "Begin %s",
- T->getName().c_str());
+  // Both strings used here are required to be constant literal strings.
+  os_signpost_interval_begin(getLogger(), getSignpostForObject(O),
+ "LLVM Timers", "Begin %s", Name.data());
 }
   }
 
-  void endTimerInterval(Timer *T) {
+  void endInterval(const void *O, llvm::StringRef Name) {
 if (isEnabled()) {
-  // Both strings used here are required to be constant literal strings
-  os_signpost_interval_end(getLogger(), getSignpostForTimer(T),
-   "Pass Timers", "End %s", T->getName().c_str());
+  // Both strings used here are required to be constant literal strings.
+  os_signpost_interval_end(getLogger(), getSignpostForObject(O),
+   "LLVM Timers", "End %s", Name.data());
 }
   }
 };
@@ -85,7 +83,7 @@ class SignpostEmitterImpl {
 SignpostEmitter::SignpostEmitter() {
 #if HAVE_ANY_SIGNPOST_IMPL
   Impl = new SignpostEmitterImpl();
-#else // if HAVE_ANY_SIGNPOST_IMPL
+#else  // if HAVE_ANY_SIGNPOST_IMPL
   Impl = nullptr;
 #endif // if !HAVE_ANY_SIGNPOST_IMPL
 }
@@ -104,18 +102,18 @@ bool SignpostEmitter::isEnabled() const {
 #endif // if !HAVE_ANY_SIGNPOST_IMPL
 }
 
-void SignpostEmitter::startTimerInterval(Timer *T) {
+void SignpostEmitter::startInterval(const void *O, StringRef Name) {
 #if HAVE_ANY_SIGNPOST_IMPL
   if (Impl == nullptr)
 return;
-  return Impl->startTimerInterval(T);
+  return Impl->startInterval(O, Name);
 #endif // if !HAVE_ANY_SIGNPOST_IMPL
 }
 
-void SignpostEmitter::endTimerInterval(Timer *T) {
+void 

[llvm-branch-commits] [lldb] c82beab - [lldb] Add timers to Reproducer::Keep and Reproducer::Discard

2021-01-05 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-05T09:54:31-08:00
New Revision: c82beaba319657d93a62523a65f8969aad9ecab1

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

LOG: [lldb] Add timers to Reproducer::Keep and Reproducer::Discard

Added: 


Modified: 
lldb/source/Utility/Reproducer.cpp

Removed: 




diff  --git a/lldb/source/Utility/Reproducer.cpp 
b/lldb/source/Utility/Reproducer.cpp
index f238a2fabc39..f302cce4436f 100644
--- a/lldb/source/Utility/Reproducer.cpp
+++ b/lldb/source/Utility/Reproducer.cpp
@@ -9,6 +9,7 @@
 #include "lldb/Utility/Reproducer.h"
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/ReproducerProvider.h"
+#include "lldb/Utility/Timer.h"
 
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Threading.h"
@@ -194,6 +195,7 @@ ProviderBase 
*Generator::Register(std::unique_ptr provider) {
 }
 
 void Generator::Keep() {
+  LLDB_SCOPED_TIMER();
   assert(!m_done);
   m_done = true;
 
@@ -204,6 +206,7 @@ void Generator::Keep() {
 }
 
 void Generator::Discard() {
+  LLDB_SCOPED_TIMER();
   assert(!m_done);
   m_done = true;
 



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


[llvm-branch-commits] [lldb] d97e9f1 - [lldb] Simplify ObjectFile::FindPlugin (NFC)

2020-12-23 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-23T14:06:40-08:00
New Revision: d97e9f1a3d8510de036f8fec68cfd5330c9f050c

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

LOG: [lldb] Simplify ObjectFile::FindPlugin (NFC)

Use early return to reduce the levels of indentation. Extract logic to
find object in container into helper function.

Added: 


Modified: 
lldb/source/Symbol/ObjectFile.cpp

Removed: 




diff  --git a/lldb/source/Symbol/ObjectFile.cpp 
b/lldb/source/Symbol/ObjectFile.cpp
index ffe57121391f..f5dcbc5467f7 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -28,141 +28,121 @@ using namespace lldb_private;
 
 char ObjectFile::ID;
 
+static ObjectFileSP
+CreateObjectFromContainer(const lldb::ModuleSP _sp, const FileSpec 
*file,
+  lldb::offset_t file_offset, lldb::offset_t file_size,
+  DataBufferSP _sp, lldb::offset_t _offset) {
+  ObjectContainerCreateInstance callback;
+  for (uint32_t idx = 0;
+   (callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(
+idx)) != nullptr;
+   ++idx) {
+std::unique_ptr object_container_up(callback(
+module_sp, data_sp, data_offset, file, file_offset, file_size));
+if (object_container_up)
+  return object_container_up->GetObjectFile(file);
+  }
+  return {};
+}
+
 ObjectFileSP
 ObjectFile::FindPlugin(const lldb::ModuleSP _sp, const FileSpec *file,
lldb::offset_t file_offset, lldb::offset_t file_size,
DataBufferSP _sp, lldb::offset_t _offset) {
-  ObjectFileSP object_file_sp;
-
-  if (module_sp) {
-LLDB_SCOPED_TIMERF(
-"ObjectFile::FindPlugin (module = %s, file = %p, file_offset = "
-"0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")",
-module_sp->GetFileSpec().GetPath().c_str(),
-static_cast(file), static_cast(file_offset),
-static_cast(file_size));
-if (file) {
-  FileSpec archive_file;
-  ObjectContainerCreateInstance create_object_container_callback;
-
-  if (!data_sp) {
-const bool file_exists = FileSystem::Instance().Exists(*file);
-// We have an object name which most likely means we have a .o file in
-// a static archive (.a file). Try and see if we have a cached archive
-// first without reading any data first
-if (file_exists && module_sp->GetObjectName()) {
-  for (uint32_t idx = 0;
-   (create_object_container_callback =
-PluginManager::GetObjectContainerCreateCallbackAtIndex(
-idx)) != nullptr;
-   ++idx) {
-std::unique_ptr object_container_up(
-create_object_container_callback(module_sp, data_sp,
- data_offset, file, 
file_offset,
- file_size));
-
-if (object_container_up)
-  object_file_sp = object_container_up->GetObjectFile(file);
-
-if (object_file_sp.get())
-  return object_file_sp;
-  }
-}
-// Ok, we didn't find any containers that have a named object, now lets
-// read the first 512 bytes from the file so the object file and object
-// container plug-ins can use these bytes to see if they can parse this
-// file.
-if (file_size > 0) {
-  data_sp = FileSystem::Instance().CreateDataBuffer(file->GetPath(),
-512, file_offset);
-  data_offset = 0;
-}
-  }
+  LLDB_SCOPED_TIMERF(
+  "ObjectFile::FindPlugin (module = %s, file = %p, file_offset = "
+  "0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")",
+  module_sp->GetFileSpec().GetPath().c_str(),
+  static_cast(file), static_cast(file_offset),
+  static_cast(file_size));
+
+  if (!module_sp)
+return {};
+
+  if (!file)
+return {};
+
+  if (!data_sp) {
+const bool file_exists = FileSystem::Instance().Exists(*file);
+// We have an object name which most likely means we have a .o file in
+// a static archive (.a file). Try and see if we have a cached archive
+// first without reading any data first
+if (file_exists && module_sp->GetObjectName()) {
+  ObjectFileSP object_file_sp = CreateObjectFromContainer(
+  module_sp, file, file_offset, file_size, data_sp, data_offset);
+  if (object_file_sp)
+return object_file_sp;
+}
+// Ok, we didn't find any containers that have a named object, now lets
+// read the first 512 bytes from the file so the object file and object
+// container plug-ins can use these bytes to see if they can 

[llvm-branch-commits] [lldb] a944887 - [lldb] Refactor and simplify GetCommandSPExact interface

2020-12-23 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-23T10:43:13-08:00
New Revision: a9448872fec52fc57249934b02a4d4f15f223051

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

LOG: [lldb] Refactor and simplify GetCommandSPExact interface

GetCommandSPExact is called exaclty once with include_aliases set to
true, so make it a default argument. Use early returns to simplify the
implementation.

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Interpreter/CommandInterpreter.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index d35f7e22b9ea..c4f9dd2fdb37 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -265,7 +265,7 @@ class CommandInterpreter : public Broadcaster,
   bool can_replace);
 
   lldb::CommandObjectSP GetCommandSPExact(llvm::StringRef cmd,
-  bool include_aliases) const;
+  bool include_aliases = false) const;
 
   CommandObject *GetCommandObject(llvm::StringRef cmd,
   StringList *matches = nullptr,

diff  --git a/lldb/source/Commands/CommandObjectCommands.cpp 
b/lldb/source/Commands/CommandObjectCommands.cpp
index 0c441dd69c48..3b3cdde6ab9a 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -464,7 +464,7 @@ rather than using a positional placeholder:"
 OptionArgVectorSP(new OptionArgVector);
 
 if (CommandObjectSP cmd_obj_sp =
-m_interpreter.GetCommandSPExact(cmd_obj.GetCommandName(), false)) {
+m_interpreter.GetCommandSPExact(cmd_obj.GetCommandName())) {
   if (m_interpreter.AliasExists(alias_command) ||
   m_interpreter.UserCommandExists(alias_command)) {
 result.AppendWarningWithFormat(
@@ -558,10 +558,9 @@ rather than using a positional placeholder:"
 
 if (!args.empty()) {
   CommandObjectSP tmp_sp =
-  m_interpreter.GetCommandSPExact(cmd_obj->GetCommandName(), false);
+  m_interpreter.GetCommandSPExact(cmd_obj->GetCommandName());
   if (use_subcommand)
-tmp_sp = m_interpreter.GetCommandSPExact(sub_cmd_obj->GetCommandName(),
- false);
+tmp_sp = 
m_interpreter.GetCommandSPExact(sub_cmd_obj->GetCommandName());
 
   args.GetCommandString(args_string);
 }

diff  --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index f5303f6867cd..fb503fe0afb0 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -234,48 +234,48 @@ void CommandInterpreter::Initialize() {
   OptionArgVectorSP alias_arguments_vector_sp(new OptionArgVector);
 
   // Set up some initial aliases.
-  CommandObjectSP cmd_obj_sp = GetCommandSPExact("quit", false);
+  CommandObjectSP cmd_obj_sp = GetCommandSPExact("quit");
   if (cmd_obj_sp) {
 AddAlias("q", cmd_obj_sp);
 AddAlias("exit", cmd_obj_sp);
   }
 
-  cmd_obj_sp = GetCommandSPExact("_regexp-attach", false);
+  cmd_obj_sp = GetCommandSPExact("_regexp-attach");
   if (cmd_obj_sp)
 AddAlias("attach", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
-  cmd_obj_sp = GetCommandSPExact("process detach", false);
+  cmd_obj_sp = GetCommandSPExact("process detach");
   if (cmd_obj_sp) {
 AddAlias("detach", cmd_obj_sp);
   }
 
-  cmd_obj_sp = GetCommandSPExact("process continue", false);
+  cmd_obj_sp = GetCommandSPExact("process continue");
   if (cmd_obj_sp) {
 AddAlias("c", cmd_obj_sp);
 AddAlias("continue", cmd_obj_sp);
   }
 
-  cmd_obj_sp = GetCommandSPExact("_regexp-break", false);
+  cmd_obj_sp = GetCommandSPExact("_regexp-break");
   if (cmd_obj_sp)
 AddAlias("b", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
-  cmd_obj_sp = GetCommandSPExact("_regexp-tbreak", false);
+  cmd_obj_sp = GetCommandSPExact("_regexp-tbreak");
   if (cmd_obj_sp)
 AddAlias("tbreak", cmd_obj_sp)->SetSyntax(cmd_obj_sp->GetSyntax());
 
-  cmd_obj_sp = GetCommandSPExact("thread step-inst", false);
+  cmd_obj_sp = GetCommandSPExact("thread step-inst");
   if (cmd_obj_sp) {
 AddAlias("stepi", cmd_obj_sp);
 AddAlias("si", cmd_obj_sp);
   }
 
-  cmd_obj_sp = GetCommandSPExact("thread step-inst-over", false);
+  cmd_obj_sp = GetCommandSPExact("thread step-inst-over");
   if (cmd_obj_sp) {
 AddAlias("nexti", cmd_obj_sp);
 AddAlias("ni", cmd_obj_sp);
   }
 
-  cmd_obj_sp = GetCommandSPExact("thread step-in", false);
+  cmd_obj_sp = 

[llvm-branch-commits] [lldb] fcf9479 - [lldb] Don't instrument demangling.

2020-12-23 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-23T10:43:13-08:00
New Revision: fcf9479f7d65754cf311d8e5be1046f1ace28945

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

LOG: [lldb] Don't instrument demangling.

Don't instrument demangling calls. These functions are very hot and
instrumenting them quickly results in too much data to be useful.

Added: 


Modified: 
lldb/source/Core/Mangled.cpp

Removed: 




diff  --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index eaad0f3ebf45..627be94a303c 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -14,7 +14,6 @@
 #include "lldb/Utility/Logging.h"
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/Stream.h"
-#include "lldb/Utility/Timer.h"
 #include "lldb/lldb-enumerations.h"
 
 #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
@@ -227,10 +226,6 @@ static char *GetItaniumDemangledStr(const char *M) {
 // makes use of ItaniumPartialDemangler's rich demangle info
 bool Mangled::DemangleWithRichManglingInfo(
 RichManglingContext , SkipMangledNameFn *skip_mangled_name) {
-  // We need to generate and cache the demangled name.
-  LLDB_SCOPED_TIMERF("Mangled::DemangleWithRichNameIndexInfo (m_mangled = %s)",
- m_mangled.GetCString());
-
   // Others are not meant to arrive here. ObjC names or C's main() for example
   // have their names stored in m_demangled, while m_mangled is empty.
   assert(m_mangled);
@@ -296,10 +291,6 @@ ConstString Mangled::GetDemangledName() const {
   // Check to make sure we have a valid mangled name and that we haven't
   // already decoded our mangled name.
   if (m_mangled && m_demangled.IsNull()) {
-// We need to generate and cache the demangled name.
-LLDB_SCOPED_TIMERF("Mangled::GetDemangledName (m_mangled = %s)",
-   m_mangled.GetCString());
-
 // Don't bother running anything that isn't mangled
 const char *mangled_name = m_mangled.GetCString();
 ManglingScheme mangling_scheme = 
GetManglingScheme(m_mangled.GetStringRef());



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


[llvm-branch-commits] [lldb] 1432ae5 - [lldb] Add SBType::GetEnumerationIntegerType method

2020-12-22 Thread Jonas Devlieghere via llvm-branch-commits

Author: Andy Yankovsky
Date: 2020-12-22T10:08:22-08:00
New Revision: 1432ae57bf6e4022b6f4541c9225674ee6b19c23

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

LOG: [lldb] Add SBType::GetEnumerationIntegerType method

Add a method for getting the enumeration underlying type.

Differential revision: https://reviews.llvm.org/D93696

Added: 


Modified: 
lldb/bindings/interface/SBType.i
lldb/include/lldb/API/SBType.h
lldb/include/lldb/Symbol/CompilerType.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/source/API/SBType.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Symbol/CompilerType.cpp
lldb/test/API/python_api/type/TestTypeList.py
lldb/test/API/python_api/type/main.cpp

Removed: 




diff  --git a/lldb/bindings/interface/SBType.i 
b/lldb/bindings/interface/SBType.i
index b65eddb5fe29..2d9a4a4d11d1 100644
--- a/lldb/bindings/interface/SBType.i
+++ b/lldb/bindings/interface/SBType.i
@@ -244,6 +244,9 @@ public:
 lldb::SBType
 GetCanonicalType();
 
+lldb::SBType
+GetEnumerationIntegerType();
+
 lldb::SBType
 GetArrayElementType ();
 

diff  --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 9ac385c492ed..529b4d0eeffc 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -152,6 +152,9 @@ class SBType {
   lldb::SBType GetVectorElementType();
 
   lldb::SBType GetCanonicalType();
+
+  lldb::SBType GetEnumerationIntegerType();
+
   // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
   // type eBasicTypeInvalid will be returned
   lldb::BasicType GetBasicType();

diff  --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index 1e0f520ab959..5a0e8e57200d 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -187,6 +187,8 @@ class CompilerType {
 
   CompilerType GetFullyUnqualifiedType() const;
 
+  CompilerType GetEnumerationIntegerType() const;
+
   /// Returns -1 if this isn't a function of if the function doesn't
   /// have a prototype Returns a value >= 0 if there is a prototype.
   int GetFunctionArgumentCount() const;

diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index b8393b9c39e1..1fad8f61ac37 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -227,6 +227,9 @@ class TypeSystem : public PluginInterface {
 
   virtual CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) = 0;
 
+  virtual CompilerType
+  GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) = 0;
+
   // Returns -1 if this isn't a function of if the function doesn't have a
   // prototype Returns a value >= 0 if there is a prototype.
   virtual int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) = 0;

diff  --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 7d8d4cfeef4f..550c4b065914 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -344,6 +344,16 @@ lldb::SBType SBType::GetCanonicalType() {
   return LLDB_RECORD_RESULT(SBType());
 }
 
+SBType SBType::GetEnumerationIntegerType() {
+  LLDB_RECORD_METHOD_NO_ARGS(lldb::SBType, SBType, GetEnumerationIntegerType);
+
+  if (IsValid()) {
+return LLDB_RECORD_RESULT(
+
SBType(m_opaque_sp->GetCompilerType(true).GetEnumerationIntegerType()));
+  }
+  return LLDB_RECORD_RESULT(SBType());
+}
+
 lldb::BasicType SBType::GetBasicType() {
   LLDB_RECORD_METHOD_NO_ARGS(lldb::BasicType, SBType, GetBasicType);
 
@@ -952,6 +962,7 @@ void RegisterMethods(Registry ) {
GetMemberFunctionAtIndex, (uint32_t));
   LLDB_REGISTER_METHOD(lldb::SBType, SBType, GetUnqualifiedType, ());
   LLDB_REGISTER_METHOD(lldb::SBType, SBType, GetCanonicalType, ());
+  LLDB_REGISTER_METHOD(lldb::SBType, SBType, GetEnumerationIntegerType, ());
   LLDB_REGISTER_METHOD(lldb::BasicType, SBType, GetBasicType, ());
   LLDB_REGISTER_METHOD(lldb::SBType, SBType, GetBasicType, (lldb::BasicType));
   LLDB_REGISTER_METHOD(uint32_t, SBType, GetNumberOfDirectBaseClasses, ());

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index d1a9e9387292..4f55cf7cfa79 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4195,6 +4195,13 @@ 
TypeSystemClang::GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) {
   return CompilerType();
 }
 
+CompilerType
+TypeSystemClang::GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) {
+  if (type)
+return 

[llvm-branch-commits] [lldb] e17a00f - [lldb] Add SBType::IsScopedEnumerationType method

2020-12-22 Thread Jonas Devlieghere via llvm-branch-commits

Author: Andy Yankovsky
Date: 2020-12-22T10:08:21-08:00
New Revision: e17a00fc87bc163cc2438ce10faca51d94b91ab3

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

LOG: [lldb] Add SBType::IsScopedEnumerationType method

Add a method to check if the type is a scoped enumeration (i.e. "enum
class/struct").

Differential revision: https://reviews.llvm.org/D93690

Added: 


Modified: 
lldb/bindings/interface/SBType.i
lldb/include/lldb/API/SBType.h
lldb/include/lldb/Symbol/CompilerType.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/source/API/SBType.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Symbol/CompilerType.cpp
lldb/test/API/python_api/type/TestTypeList.py
lldb/test/API/python_api/type/main.cpp

Removed: 




diff  --git a/lldb/bindings/interface/SBType.i 
b/lldb/bindings/interface/SBType.i
index fd2dda188454..b65eddb5fe29 100644
--- a/lldb/bindings/interface/SBType.i
+++ b/lldb/bindings/interface/SBType.i
@@ -220,6 +220,9 @@ public:
 bool
 IsAnonymousType ();
 
+bool
+IsScopedEnumerationType ();
+
 lldb::SBType
 GetPointerType();
 

diff  --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 5f487aa5d258..9ac385c492ed 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -131,6 +131,8 @@ class SBType {
 
   bool IsAnonymousType();
 
+  bool IsScopedEnumerationType();
+
   lldb::SBType GetPointerType();
 
   lldb::SBType GetPointeeType();

diff  --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index f1cde0ac3084..1e0f520ab959 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -82,6 +82,8 @@ class CompilerType {
 
   bool IsAnonymousType() const;
 
+  bool IsScopedEnumerationType() const;
+
   bool IsBeingDefined() const;
 
   bool IsCharType() const;

diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index 4c51d290ad2c..b8393b9c39e1 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -175,6 +175,8 @@ class TypeSystem : public PluginInterface {
 return false;
   }
 
+  virtual bool IsScopedEnumerationType(lldb::opaque_compiler_type_t type) = 0;
+
   virtual bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
  CompilerType *target_type, // Can pass 
NULL
  bool check_cplusplus, bool check_objc) = 
0;

diff  --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 0a99ac0f2292..7d8d4cfeef4f 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -271,6 +271,14 @@ bool SBType::IsAnonymousType() {
   return m_opaque_sp->GetCompilerType(true).IsAnonymousType();
 }
 
+bool SBType::IsScopedEnumerationType() {
+  LLDB_RECORD_METHOD_NO_ARGS(bool, SBType, IsScopedEnumerationType);
+
+  if (!IsValid())
+return false;
+  return m_opaque_sp->GetCompilerType(true).IsScopedEnumerationType();
+}
+
 lldb::SBType SBType::GetFunctionReturnType() {
   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBType, SBType, GetFunctionReturnType);
 
@@ -935,6 +943,7 @@ void RegisterMethods(Registry ) {
   LLDB_REGISTER_METHOD(bool, SBType, IsPolymorphicClass, ());
   LLDB_REGISTER_METHOD(bool, SBType, IsTypedefType, ());
   LLDB_REGISTER_METHOD(bool, SBType, IsAnonymousType, ());
+  LLDB_REGISTER_METHOD(bool, SBType, IsScopedEnumerationType, ());
   LLDB_REGISTER_METHOD(lldb::SBType, SBType, GetFunctionReturnType, ());
   LLDB_REGISTER_METHOD(lldb::SBTypeList, SBType, GetFunctionArgumentTypes,
());

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 894faa847450..d1a9e9387292 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -3147,6 +3147,20 @@ bool 
TypeSystemClang::IsEnumerationType(lldb::opaque_compiler_type_t type,
   return false;
 }
 
+bool TypeSystemClang::IsScopedEnumerationType(
+lldb::opaque_compiler_type_t type) {
+  if (type) {
+const clang::EnumType *enum_type = llvm::dyn_cast(
+GetCanonicalQualType(type)->getCanonicalTypeInternal());
+
+if (enum_type) {
+  return enum_type->isScopedEnumeralType();
+}
+  }
+
+  return false;
+}
+
 bool TypeSystemClang::IsPointerType(lldb::opaque_compiler_type_t type,
 CompilerType *pointee_type) {
   if (type) {

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 

[llvm-branch-commits] [lldb] 5c1c844 - [lldb] Abstract scoped timer logic behind LLDB_SCOPED_TIMER (NFC)

2020-12-22 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-22T09:10:27-08:00
New Revision: 5c1c8443eb7366e6e5086426b5d8dc7d24afc13b

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

LOG: [lldb] Abstract scoped timer logic behind LLDB_SCOPED_TIMER (NFC)

This patch introduces a LLDB_SCOPED_TIMER macro to hide the needlessly
repetitive creation of scoped timers in LLDB. It's similar to the
LLDB_LOG(F) macro.

Differential revision: https://reviews.llvm.org/D93663

Added: 


Modified: 
lldb/include/lldb/Utility/Timer.h
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/Disassembler.cpp
lldb/source/Core/Mangled.cpp
lldb/source/Core/Module.cpp
lldb/source/Initialization/SystemInitializerCommon.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
lldb/source/Plugins/SymbolVendor/wasm/SymbolVendorWasm.cpp
lldb/source/Symbol/CompileUnit.cpp
lldb/source/Symbol/DWARFCallFrameInfo.cpp
lldb/source/Symbol/LocateSymbolFile.cpp
lldb/source/Symbol/ObjectFile.cpp
lldb/source/Symbol/Symtab.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/TargetList.cpp
lldb/tools/lldb-test/SystemInitializerTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Timer.h 
b/lldb/include/lldb/Utility/Timer.h
index f97315b2db0f..91f9c57c03c1 100644
--- a/lldb/include/lldb/Utility/Timer.h
+++ b/lldb/include/lldb/Utility/Timer.h
@@ -73,4 +73,11 @@ class Timer {
 
 } // namespace lldb_private
 
+#define LLDB_SCOPED_TIMER()
\
+  static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);   
\
+  ::lldb_private::Timer _scoped_timer(_cat, LLVM_PRETTY_FUNCTION)
+#define LLDB_SCOPED_TIMERF(...)
\
+  static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);   
\
+  ::lldb_private::Timer _scoped_timer(_cat, __VA_ARGS__)
+
 #endif // LLDB_UTILITY_TIMER_H

diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index a6421d8f10d0..0530f94580b3 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -69,9 +69,6 @@ llvm::Error SystemInitializerFull::Initialize() {
 }
 
 void SystemInitializerFull::Terminate() {
-  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
-  Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
-
   Debugger::SettingsTerminate();
 
   // Terminate plug-ins in core LLDB

diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index c033493d4196..4bce4e7e0734 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -299,8 +299,7 @@ class CommandObjectTargetCreate : public 
CommandObjectParsed {
   }
 
   const char *file_path = command.GetArgumentAtIndex(0);
-  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
-  Timer scoped_timer(func_cat, "(lldb) target create '%s'", file_path);
+  LLDB_SCOPED_TIMERF("(lldb) target create '%s'", file_path);
   FileSpec file_spec;
 
   if (file_path) {

diff  --git a/lldb/source/Core/Disassembler.cpp 
b/lldb/source/Core/Disassembler.cpp
index 1015eafd252e..3a975d9296f4 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -58,9 +58,7 @@ using namespace lldb_private;
 DisassemblerSP Disassembler::FindPlugin(const ArchSpec ,
 const char *flavor,
 const char *plugin_name) {
-  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
-  Timer scoped_timer(func_cat,
- "Disassembler::FindPlugin (arch = %s, plugin_name = %s)",
+  LLDB_SCOPED_TIMERF("Disassembler::FindPlugin (arch = %s, plugin_name = %s)",
   

[llvm-branch-commits] [lldb] a913a58 - [lldb] Simplify the is_finalized logic in process and make it thread safe.

2020-12-18 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-18T18:41:33-08:00
New Revision: a913a583f00a31c37a1572089fe8898a6c19536c

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

LOG: [lldb] Simplify the is_finalized logic in process and make it thread safe.

This is a speculative fix when looking at the finalization code in
Process. It tackles the following issues:

 - Adds synchronization to prevent races between threads.
 - Marks the process as finalized/invalid as soon as Finalize is called
   rather than at the end.
 - Simplifies the code by using only a single instance variable to track
   finalization.

Differential revision: https://reviews.llvm.org/D93479

Added: 


Modified: 
lldb/include/lldb/Target/Process.h
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index 744deab276c4..e8dd8847e87a 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -594,7 +594,7 @@ class Process : public 
std::enable_shared_from_this,
   /// \return
   /// Returns \b true if this Process has not been finalized
   /// and \b false otherwise.
-  bool IsValid() const { return !m_finalize_called; }
+  bool IsValid() const { return !m_finalizing; }
 
   /// Return a multi-word command object that can be used to expose plug-in
   /// specific commands.
@@ -2831,10 +2831,11 @@ void PruneThreadPlans();
// m_currently_handling_do_on_removals are true,
// Resume will only request a resume, using this
// flag to check.
-  bool m_finalizing; // This is set at the beginning of Process::Finalize() to
- // stop functions from looking up or creating things
- // during a finalize call
-  bool m_finalize_called; // This is set at the end of Process::Finalize()
+
+  /// This is set at the beginning of Process::Finalize() to stop functions
+  /// from looking up or creating things during or after a finalize call.
+  std::atomic m_finalizing;
+
   bool m_clear_thread_plans_on_stop;
   bool m_force_next_event_delivery;
   lldb::StateType m_last_broadcast_state; /// This helps with the Public event
@@ -2938,6 +2939,8 @@ void PruneThreadPlans();
   void LoadOperatingSystemPlugin(bool flush);
 
 private:
+  Status DestroyImpl(bool force_kill);
+
   /// This is the part of the event handling that for a process event. It
   /// decides what to do with the event and returns true if the event needs to
   /// be propagated to the user, and false otherwise. If the event is not

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 14f8326cfcec..a4eab1aa0b41 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -556,7 +556,7 @@ Process::Process(lldb::TargetSP target_sp, ListenerSP 
listener_sp,
   m_profile_data_comm_mutex(), m_profile_data(), m_iohandler_sync(0),
   m_memory_cache(*this), m_allocated_memory_cache(*this),
   m_should_detach(false), m_next_event_action_up(), m_public_run_lock(),
-  m_private_run_lock(), m_finalizing(false), m_finalize_called(false),
+  m_private_run_lock(), m_finalizing(false),
   m_clear_thread_plans_on_stop(false), m_force_next_event_delivery(false),
   m_last_broadcast_state(eStateInvalid), m_destroy_in_process(false),
   m_can_interpret_function_calls(false), m_warnings_issued(),
@@ -632,7 +632,8 @@ const ProcessPropertiesSP ::GetGlobalProperties() {
 }
 
 void Process::Finalize() {
-  m_finalizing = true;
+  if (m_finalizing.exchange(true))
+return;
 
   // Destroy this process if needed
   switch (GetPrivateState()) {
@@ -644,7 +645,7 @@ void Process::Finalize() {
   case eStateStepping:
   case eStateCrashed:
   case eStateSuspended:
-Destroy(false);
+DestroyImpl(false);
 break;
 
   case eStateInvalid:
@@ -707,7 +708,6 @@ void Process::Finalize() {
   m_private_run_lock.TrySetRunning(); // This will do nothing if already locked
   m_private_run_lock.SetStopped();
   m_structured_data_plugin_map.clear();
-  m_finalize_called = true;
 }
 
 void Process::RegisterNotificationCallbacks(const Notifications ) {
@@ -1516,7 +1516,7 @@ bool 
Process::StateChangedIsHijackedForSynchronousResume() {
 StateType Process::GetPrivateState() { return m_private_state.GetValue(); }
 
 void Process::SetPrivateState(StateType new_state) {
-  if (m_finalize_called)
+  if (m_finalizing)
 return;
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |
@@ -1566,11 +1566,7 @@ void Process::SetPrivateState(StateType new_state) {
 StateAsCString(new_state), m_mod_id.GetStopID());
 }
 
-// Use our target to get a shared 

[llvm-branch-commits] [lldb] ac25e86 - [lldb] Deal gracefully with concurrency in the API instrumentation.

2020-12-10 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-10T09:37:49-08:00
New Revision: ac25e8628c443cddd841c6c91d1c9e23e88969e5

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

LOG: [lldb] Deal gracefully with concurrency in the API instrumentation.

Prevent lldb from crashing when multiple threads are concurrently
accessing the SB API with reproducer capture enabled.

The API instrumentation records both the input arguments and the return
value, but it cannot block for the duration of the API call. Therefore
we introduce a sequence number that allows to to correlate the function
with its result and add locking to ensure those two parts are emitted
atomically.

Using the sequence number, we can detect situations where the return
value does not succeed the function call, in which case we print an
error saying that concurrency is not (currently) supported. In the
future we might attempt to be smarter and read ahead until we've found
the return value matching the current call.

Differential revision: https://reviews.llvm.org/D92820

Added: 


Modified: 
lldb/include/lldb/Utility/ReproducerInstrumentation.h
lldb/source/Utility/ReproducerInstrumentation.cpp
lldb/unittests/Utility/ReproducerInstrumentationTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/ReproducerInstrumentation.h 
b/lldb/include/lldb/Utility/ReproducerInstrumentation.h
index e4c31522c4fc..c8a98adf85c7 100644
--- a/lldb/include/lldb/Utility/ReproducerInstrumentation.h
+++ b/lldb/include/lldb/Utility/ReproducerInstrumentation.h
@@ -333,6 +333,7 @@ class Deserializer {
   }
 
   template  const T (const T ) {
+CheckSequence(Deserialize());
 unsigned result = Deserialize();
 if (is_trivially_serializable::value)
   return t;
@@ -342,6 +343,7 @@ class Deserializer {
 
   /// Store the returned value in the index-to-object mapping.
   template  T (T ) {
+CheckSequence(Deserialize());
 unsigned result = Deserialize();
 if (is_trivially_serializable::value)
   return t;
@@ -351,6 +353,7 @@ class Deserializer {
 
   /// Store the returned value in the index-to-object mapping.
   template  T *HandleReplayResult(T *t) {
+CheckSequence(Deserialize());
 unsigned result = Deserialize();
 if (is_trivially_serializable::value)
   return t;
@@ -360,6 +363,7 @@ class Deserializer {
   /// All returned types are recorded, even when the function returns a void.
   /// The latter requires special handling.
   void HandleReplayResultVoid() {
+CheckSequence(Deserialize());
 unsigned result = Deserialize();
 assert(result == 0);
 (void)result;
@@ -369,6 +373,10 @@ class Deserializer {
 return m_index_to_object.GetAllObjects();
   }
 
+  void SetExpectedSequence(unsigned sequence) {
+m_expected_sequence = sequence;
+  }
+
 private:
   template  T Read(ValueTag) {
 assert(HasData(sizeof(T)));
@@ -410,11 +418,17 @@ class Deserializer {
 return *(new UnderlyingT(Deserialize()));
   }
 
+  /// Verify that the given sequence number matches what we expect.
+  void CheckSequence(unsigned sequence);
+
   /// Mapping of indices to objects.
   IndexToObject m_index_to_object;
 
   /// Buffer containing the serialized data.
   llvm::StringRef m_buffer;
+
+  /// The result's expected sequence number.
+  llvm::Optional m_expected_sequence;
 };
 
 /// Partial specialization for C-style strings. We read the string value
@@ -745,12 +759,15 @@ class Recorder {
 if (!ShouldCapture())
   return;
 
+std::lock_guard lock(g_mutex);
+unsigned sequence = GetSequenceNumber();
 unsigned id = registry.GetID(uintptr_t(f));
 
 #ifdef LLDB_REPRO_INSTR_TRACE
 Log(id);
 #endif
 
+serializer.SerializeAll(sequence);
 serializer.SerializeAll(id);
 serializer.SerializeAll(args...);
 
@@ -758,6 +775,7 @@ class Recorder {
 typename std::remove_reference::type>::type>::value) {
   m_result_recorded = false;
 } else {
+  serializer.SerializeAll(sequence);
   serializer.SerializeAll(0);
   m_result_recorded = true;
 }
@@ -771,16 +789,20 @@ class Recorder {
 if (!ShouldCapture())
   return;
 
+std::lock_guard lock(g_mutex);
+unsigned sequence = GetSequenceNumber();
 unsigned id = registry.GetID(uintptr_t(f));
 
 #ifdef LLDB_REPRO_INSTR_TRACE
 Log(id);
 #endif
 
+serializer.SerializeAll(sequence);
 serializer.SerializeAll(id);
 serializer.SerializeAll(args...);
 
 // Record result.
+serializer.SerializeAll(sequence);
 serializer.SerializeAll(0);
 m_result_recorded = true;
   }
@@ -806,7 +828,9 @@ class Recorder {
 if (update_boundary)
   UpdateBoundary();
 if (m_serializer && ShouldCapture()) {
+  std::lock_guard lock(g_mutex);
   

[llvm-branch-commits] [lldb] d6f5e08 - [lldb] Kill the inferior instead of detaching during test suite runs

2020-12-09 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-09T18:40:06-08:00
New Revision: d6f5e08199f6454b488814b618aaf17b4a49c8bf

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

LOG: [lldb] Kill the inferior instead of detaching during test suite runs

Kill (rather than detach) form the inferior if debugserver loses its
connection to lldb to prevent zombie processes.

Differential revision: https://reviews.llvm.org/D92908

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/test/API/types/AbstractBase.py
lldb/test/Shell/lit-lldb-init.in
lldb/tools/lldb-test/lldb-test.cpp

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 53d1aa40d1ca..1f3bc7722290 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -784,6 +784,9 @@ def setUpCommands(cls):
 # Inherit the TCC permissions from the inferior's parent.
 "settings set target.inherit-tcc true",
 
+# Kill rather than detach from the inferior if something goes 
wrong.
+"settings set target.detach-on-error false",
+
 # Disable fix-its by default so that incorrect expressions in 
tests don't
 # pass just because Clang thinks it has a fix-it.
 "settings set target.auto-apply-fixits false",

diff  --git a/lldb/test/API/types/AbstractBase.py 
b/lldb/test/API/types/AbstractBase.py
index 45f469db9908..537c1826d2a4 100644
--- a/lldb/test/API/types/AbstractBase.py
+++ b/lldb/test/API/types/AbstractBase.py
@@ -155,6 +155,9 @@ def generic_type_tester(
 # Inherit TCC permissions. We can leave this set.
 self.runCmd('settings set target.inherit-tcc true')
 
+# Kill rather than detach from the inferior if something goes wrong.
+self.runCmd('settings set target.detach-on-error false')
+
 # And add hooks to restore the settings during tearDown().
 self.addTearDownHook(lambda: self.runCmd(
 "settings set target.inline-breakpoint-strategy headers"))

diff  --git a/lldb/test/Shell/lit-lldb-init.in 
b/lldb/test/Shell/lit-lldb-init.in
index 0fd7cbf1c818..6d3b5fefb3bd 100644
--- a/lldb/test/Shell/lit-lldb-init.in
+++ b/lldb/test/Shell/lit-lldb-init.in
@@ -5,3 +5,4 @@ settings set interpreter.echo-comment-commands false
 settings set symbols.clang-modules-cache-path "@LLDB_TEST_MODULE_CACHE_LLDB@"
 settings set target.auto-apply-fixits false
 settings set target.inherit-tcc true
+settings set target.detach-on-error false

diff  --git a/lldb/tools/lldb-test/lldb-test.cpp 
b/lldb/tools/lldb-test/lldb-test.cpp
index 1035ff530204..842a951f384b 100644
--- a/lldb/tools/lldb-test/lldb-test.cpp
+++ b/lldb/tools/lldb-test/lldb-test.cpp
@@ -1105,6 +1105,9 @@ int main(int argc, const char *argv[]) {
   Dbg->GetCommandInterpreter().HandleCommand(
   "settings set target.inherit-tcc true",
   /*add_to_history*/ eLazyBoolNo, Result);
+  Dbg->GetCommandInterpreter().HandleCommand(
+  "settings set target.detach-on-error false",
+  /*add_to_history*/ eLazyBoolNo, Result);
 
   if (!opts::Log.empty())
 Dbg->EnableLog("lldb", {"all"}, opts::Log, 0, errs());



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


[llvm-branch-commits] [lldb] c59ccc0 - [lldb] Fix -Wformat warning in debugserver unit test

2020-12-08 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-08T20:57:51-08:00
New Revision: c59ccc022265a6a3d70c86c4cf6391ebd70e6497

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

LOG: [lldb] Fix -Wformat warning in debugserver unit test

RNBSocketTest.cpp:31:35: warning: format specifies type 'char *' but the
argument has type 'const void *' [-Wformat]

Added: 


Modified: 
lldb/unittests/debugserver/RNBSocketTest.cpp

Removed: 




diff  --git a/lldb/unittests/debugserver/RNBSocketTest.cpp 
b/lldb/unittests/debugserver/RNBSocketTest.cpp
index 7840c48f82b4..2625a6d36b5c 100644
--- a/lldb/unittests/debugserver/RNBSocketTest.cpp
+++ b/lldb/unittests/debugserver/RNBSocketTest.cpp
@@ -28,7 +28,7 @@ static void ServerCallbackv4(const void *baton, in_port_t 
port) {
   auto child_pid = fork();
   if (child_pid == 0) {
 char addr_buffer[256];
-sprintf(addr_buffer, "%s:%d", baton, port);
+sprintf(addr_buffer, "%s:%d", (const char *)baton, port);
 llvm::Expected> socket_or_err =
 Socket::TcpConnect(addr_buffer, false);
 ASSERT_THAT_EXPECTED(socket_or_err, llvm::Succeeded());



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


[llvm-branch-commits] [lldb] 33e3b07 - [lldb] Include thread id in the reproducer trace (NFC)

2020-12-07 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-07T20:35:34-08:00
New Revision: 33e3b07af3ce9595f49c75a8af559bdec5cc19fa

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

LOG: [lldb] Include thread id in the reproducer trace (NFC)

Include the current thread ID in the reproducer trace during
capture/recording.

Added: 


Modified: 
lldb/include/lldb/Utility/ReproducerInstrumentation.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/ReproducerInstrumentation.h 
b/lldb/include/lldb/Utility/ReproducerInstrumentation.h
index 5fc33ad1a17b..8e319d749231 100644
--- a/lldb/include/lldb/Utility/ReproducerInstrumentation.h
+++ b/lldb/include/lldb/Utility/ReproducerInstrumentation.h
@@ -17,6 +17,7 @@
 #include "llvm/Support/ErrorHandling.h"
 
 #include 
+#include 
 #include 
 
 template  inline std::string 
stringify_args(const Ts &... ts) {
 // is initialized or enabled.
 // #define LLDB_REPRO_INSTR_TRACE
 
+#ifdef LLDB_REPRO_INSTR_TRACE
+inline llvm::raw_ostream _thread_id() {
+  size_t tid = std::hash{}(std::this_thread::get_id());
+  return llvm::errs().write_hex(tid) << " :: ";
+}
+#endif
+
 #define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
\
   R.Register(::record, "",   
\
 #Class, #Class, #Signature)
@@ -600,8 +608,8 @@ class Serializer {
   /// objects (in which case we serialize their index).
   template  void Serialize(T *t) {
 #ifdef LLDB_REPRO_INSTR_TRACE
-llvm::errs() << "Serializing with " << LLVM_PRETTY_FUNCTION << " -> "
- << stringify_args(t) << "\n";
+this_thread_id() << "Serializing with " << LLVM_PRETTY_FUNCTION << " -> "
+ << stringify_args(t) << "\n";
 #endif
 if (std::is_fundamental::value) {
   Serialize(*t);
@@ -616,8 +624,8 @@ class Serializer {
   /// to objects (in which case we serialize their index).
   template  void Serialize(T ) {
 #ifdef LLDB_REPRO_INSTR_TRACE
-llvm::errs() << "Serializing with " << LLVM_PRETTY_FUNCTION << " -> "
- << stringify_args(t) << "\n";
+this_thread_id() << "Serializing with " << LLVM_PRETTY_FUNCTION << " -> "
+ << stringify_args(t) << "\n";
 #endif
 if (is_trivially_serializable::value) {
   m_stream.write(reinterpret_cast(), sizeof(T));
@@ -637,8 +645,8 @@ class Serializer {
 
   void Serialize(const char *t) {
 #ifdef LLDB_REPRO_INSTR_TRACE
-llvm::errs() << "Serializing with " << LLVM_PRETTY_FUNCTION << " -> "
- << stringify_args(t) << "\n";
+this_thread_id() << "Serializing with " << LLVM_PRETTY_FUNCTION << " -> "
+ << stringify_args(t) << "\n";
 #endif
 const size_t size = t ? strlen(t) : std::numeric_limits::max();
 Serialize(size);
@@ -842,8 +850,8 @@ class Recorder {
 
 #ifdef LLDB_REPRO_INSTR_TRACE
   void Log(unsigned id) {
-llvm::errs() << "Recording " << id << ": " << m_pretty_func << " ("
- << m_pretty_args << ")\n";
+this_thread_id() << "Recording " << id << ": " << m_pretty_func << " ("
+ << m_pretty_args << ")\n";
   }
 #endif
 



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


[llvm-branch-commits] [lldb] ee607ed - [debugserver] Call posix_spawnattr_setarchpref_np throught the fn ptr.

2020-12-05 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-05T17:38:42-08:00
New Revision: ee607ed5c36efd8e0536ddbeab1f2025b0e5f045

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

LOG: [debugserver] Call posix_spawnattr_setarchpref_np throught the fn ptr.

Fourth time is the charm? Of course all of these issues don't show up
when the function is available...

Added: 


Modified: 
lldb/tools/debugserver/source/MacOSX/MachProcess.mm

Removed: 




diff  --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm 
b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
index 386c5e42306a..7176a47972bf 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -3279,8 +3279,8 @@ typedef int (*posix_spawnattr_setarchpref_np_t)(
   (posix_spawnattr_setarchpref_np_t)dlsym(
   RTLD_DEFAULT, "posix_spawnattr_setarchpref_np");
   if (posix_spawnattr_setarchpref_np_fn) {
-err.SetError((*posix_spawnattr_setarchpref_np)(, 1, _type,
-   _subtype, ));
+err.SetError((*posix_spawnattr_setarchpref_np_fn)(
+, 1, _type, _subtype, ));
 slice_preference_set = err.Success();
 if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS))
   err.LogThreaded(



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


[llvm-branch-commits] [lldb] 13ee00d - [debugserver] Use dlsym for posix_spawnattr_setarchpref_np

2020-12-05 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-05T14:06:45-08:00
New Revision: 13ee00d0c95a4eede96ba9520146a01930af2a0a

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

LOG: [debugserver] Use dlsym for posix_spawnattr_setarchpref_np

The @available check did not work as I thought it did. Use good old
dlsym instead.

Added: 


Modified: 
lldb/tools/debugserver/source/MacOSX/MachProcess.mm

Removed: 




diff  --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm 
b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
index 232a0d25a38a..386c5e42306a 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -3273,9 +3273,14 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary 
*options,
 bool slice_preference_set = false;
 
 if (cpu_subtype != 0) {
-  if (@available(macOS 10.16, ios 10.14, watchos 7.0, tvos 14.0, *)) {
-err.SetError(posix_spawnattr_setarchpref_np(, 1, _type,
-_subtype, ));
+  typedef int (*posix_spawnattr_setarchpref_np_t)(
+  posix_spawnattr_t *, size_t, cpu_type_t *, cpu_subtype_t *, size_t 
*);
+  posix_spawnattr_setarchpref_np_t posix_spawnattr_setarchpref_np_fn =
+  (posix_spawnattr_setarchpref_np_t)dlsym(
+  RTLD_DEFAULT, "posix_spawnattr_setarchpref_np");
+  if (posix_spawnattr_setarchpref_np_fn) {
+err.SetError((*posix_spawnattr_setarchpref_np)(, 1, _type,
+   _subtype, ));
 slice_preference_set = err.Success();
 if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS))
   err.LogThreaded(



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


[llvm-branch-commits] [lldb] c722096 - [debugserver] Remove bridgeos availability

2020-12-05 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-05T10:18:45-08:00
New Revision: c722096b399695e89f283f0847474ccb038515f2

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

LOG: [debugserver] Remove bridgeos availability

I didn't realize that the 'bridgeos' is not part of the public SDK.

Added: 


Modified: 
lldb/tools/debugserver/source/MacOSX/MachProcess.mm

Removed: 




diff  --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm 
b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
index fad39784b151..232a0d25a38a 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -3273,8 +3273,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary 
*options,
 bool slice_preference_set = false;
 
 if (cpu_subtype != 0) {
-  if (@available(macOS 10.16, ios 10.14, watchos 7.0, tvos 14.0,
- bridgeos 5.0, *)) {
+  if (@available(macOS 10.16, ios 10.14, watchos 7.0, tvos 14.0, *)) {
 err.SetError(posix_spawnattr_setarchpref_np(, 1, _type,
 _subtype, ));
 slice_preference_set = err.Success();



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


[llvm-branch-commits] [lldb] 0db3757 - [debugserver] Honor the cpu sub type if specified

2020-12-04 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-04T20:37:41-08:00
New Revision: 0db37576c1dddbec1021b50320ae84a9d838742c

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

LOG: [debugserver] Honor the cpu sub type if specified

Use the newly added spawnattr API, posix_spawnattr_setarchpref_np, to
select a slice preferences per cpu and subcpu types, instead of just cpu
with posix_spawnattr_setarchpref_np.

rdar://16094957

Differential revision: https://reviews.llvm.org/D92712

Added: 


Modified: 
lldb/tools/debugserver/source/DNB.cpp
lldb/tools/debugserver/source/DNBArch.cpp
lldb/tools/debugserver/source/DNBArch.h
lldb/tools/debugserver/source/MacOSX/MachProcess.h
lldb/tools/debugserver/source/MacOSX/MachProcess.mm

Removed: 




diff  --git a/lldb/tools/debugserver/source/DNB.cpp 
b/lldb/tools/debugserver/source/DNB.cpp
index 2d6516e8c654..a69fc33fc9b0 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -1762,19 +1762,52 @@ nub_bool_t DNBSetArchitecture(const char *arch) {
   if (arch && arch[0]) {
 if (strcasecmp(arch, "i386") == 0)
   return DNBArchProtocol::SetArchitecture(CPU_TYPE_I386);
-else if ((strcasecmp(arch, "x86_64") == 0) ||
- (strcasecmp(arch, "x86_64h") == 0))
-  return DNBArchProtocol::SetArchitecture(CPU_TYPE_X86_64);
-else if (strstr(arch, "arm64_32") == arch || 
+else if (strcasecmp(arch, "x86_64") == 0)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_X86_64,
+  CPU_SUBTYPE_X86_64_ALL);
+else if (strcasecmp(arch, "x86_64h") == 0)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_X86_64,
+  CPU_SUBTYPE_X86_64_H);
+else if (strstr(arch, "arm64_32") == arch ||
  strstr(arch, "aarch64_32") == arch)
   return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM64_32);
 else if (strstr(arch, "arm64e") == arch)
-  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM64);
-else if (strstr(arch, "arm64") == arch || strstr(arch, "armv8") == arch ||
- strstr(arch, "aarch64") == arch)
-  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM64);
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM64,
+  CPU_SUBTYPE_ARM64E);
+else if (strstr(arch, "arm64") == arch || strstr(arch, "aarch64") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM64,
+  CPU_SUBTYPE_ARM64_ALL);
+else if (strstr(arch, "armv8") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM64,
+  CPU_SUBTYPE_ARM64_V8);
+else if (strstr(arch, "armv7em") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM,
+  CPU_SUBTYPE_ARM_V7EM);
+else if (strstr(arch, "armv7m") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM,
+  CPU_SUBTYPE_ARM_V7M);
+else if (strstr(arch, "armv7k") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM,
+  CPU_SUBTYPE_ARM_V7K);
+else if (strstr(arch, "armv7s") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM,
+  CPU_SUBTYPE_ARM_V7S);
+else if (strstr(arch, "armv7") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM, 
CPU_SUBTYPE_ARM_V7);
+else if (strstr(arch, "armv6m") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM,
+  CPU_SUBTYPE_ARM_V6M);
+else if (strstr(arch, "armv6") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM, 
CPU_SUBTYPE_ARM_V6);
+else if (strstr(arch, "armv5") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM,
+  CPU_SUBTYPE_ARM_V5TEJ);
+else if (strstr(arch, "armv4t") == arch)
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM,
+  CPU_SUBTYPE_ARM_V4T);
 else if (strstr(arch, "arm") == arch)
-  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM);
+  return DNBArchProtocol::SetArchitecture(CPU_TYPE_ARM,
+  CPU_SUBTYPE_ARM_ALL);
   }
   return false;
 }

diff  --git a/lldb/tools/debugserver/source/DNBArch.cpp 
b/lldb/tools/debugserver/source/DNBArch.cpp
index 931d623647fa..f3848bc19bf9 100644
--- a/lldb/tools/debugserver/source/DNBArch.cpp
+++ b/lldb/tools/debugserver/source/DNBArch.cpp
@@ -21,6 +21,7 @@
 typedef 

[llvm-branch-commits] [lldb] 315fab4 - [lldb] Remove unused argument to expectedFailure

2020-12-04 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-04T20:37:41-08:00
New Revision: 315fab428d6084b09f82468740df5697ab3bb93b

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

LOG: [lldb] Remove unused argument to expectedFailure

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/decorators.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 07b1d15810ab..2013c5241007 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -86,8 +86,7 @@ def _match_decorator_property(expected, actual):
 else:
 return expected == actual
 
-
-def expectedFailure(func, bugnumber=None):
+def expectedFailure(func):
 return unittest2.expectedFailure(func)
 
 def expectedFailureIfFn(expected_fn, bugnumber=None):



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


[llvm-branch-commits] [lldb] 54710b3 - [lldb] Use the cpu subtype enum values from llvm::MachO in ArchSpec (NFC)

2020-12-03 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-03T15:10:18-08:00
New Revision: 54710b346ce063ee10292c45b9e154195eb45a40

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

LOG: [lldb] Use the cpu subtype enum values from llvm::MachO in ArchSpec (NFC)

Use the cpu subtype enum values from llvm::MachO in the ArchSpec MachO
table. As I'm already cluttering the history, restore the table's
formatting to its original glory.

Differential revision: https://reviews.llvm.org/D92601

Added: 


Modified: 
lldb/source/Utility/ArchSpec.cpp

Removed: 




diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index 5bbe59034c04..b0cbb269b18b 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -265,132 +265,73 @@ void ArchSpec::AutoComplete(CompletionRequest ) {
 // allows the precedence to be set when the table is built.
 #define SUBTYPE_MASK 0x00FFu
 
+// clang-format off
 static const ArchDefinitionEntry g_macho_arch_entries[] = {
-{ArchSpec::eCore_arm_generic, llvm::MachO::CPU_TYPE_ARM, CPU_ANY,
- UINT32_MAX, UINT32_MAX},
-{ArchSpec::eCore_arm_generic, llvm::MachO::CPU_TYPE_ARM, 0, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv4, llvm::MachO::CPU_TYPE_ARM, 5, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv4t, llvm::MachO::CPU_TYPE_ARM, 5, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv6, llvm::MachO::CPU_TYPE_ARM, 6, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv6m, llvm::MachO::CPU_TYPE_ARM, 14, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv5, llvm::MachO::CPU_TYPE_ARM, 7, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv5e, llvm::MachO::CPU_TYPE_ARM, 7, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv5t, llvm::MachO::CPU_TYPE_ARM, 7, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_xscale, llvm::MachO::CPU_TYPE_ARM, 8, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv7, llvm::MachO::CPU_TYPE_ARM, 9, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv7f, llvm::MachO::CPU_TYPE_ARM, 10, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv7s, llvm::MachO::CPU_TYPE_ARM, 11, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv7k, llvm::MachO::CPU_TYPE_ARM, 12, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv7m, llvm::MachO::CPU_TYPE_ARM, 15, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_armv7em, llvm::MachO::CPU_TYPE_ARM, 16, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_arm64, llvm::MachO::CPU_TYPE_ARM64, 2, UINT32_MAX,
- SUBTYPE_MASK}, // FIXME: This should be arm64e once the triple exists.
-{ArchSpec::eCore_arm_arm64, llvm::MachO::CPU_TYPE_ARM64, 1, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_arm64, llvm::MachO::CPU_TYPE_ARM64, 0, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_arm64, llvm::MachO::CPU_TYPE_ARM64, 13, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_arm_arm64_32, llvm::MachO::CPU_TYPE_ARM64_32, 0,
- UINT32_MAX, SUBTYPE_MASK},
-{ArchSpec::eCore_arm_arm64_32, llvm::MachO::CPU_TYPE_ARM64_32, 1,
- UINT32_MAX, SUBTYPE_MASK},
-{ArchSpec::eCore_arm_arm64, llvm::MachO::CPU_TYPE_ARM64, CPU_ANY,
- UINT32_MAX, SUBTYPE_MASK},
-{ArchSpec::eCore_thumb, llvm::MachO::CPU_TYPE_ARM, 0, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv4t, llvm::MachO::CPU_TYPE_ARM, 5, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv5, llvm::MachO::CPU_TYPE_ARM, 7, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv5e, llvm::MachO::CPU_TYPE_ARM, 7, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv6, llvm::MachO::CPU_TYPE_ARM, 6, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv6m, llvm::MachO::CPU_TYPE_ARM, 14, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv7, llvm::MachO::CPU_TYPE_ARM, 9, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv7f, llvm::MachO::CPU_TYPE_ARM, 10, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv7s, llvm::MachO::CPU_TYPE_ARM, 11, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv7k, llvm::MachO::CPU_TYPE_ARM, 12, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv7m, llvm::MachO::CPU_TYPE_ARM, 15, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_thumbv7em, llvm::MachO::CPU_TYPE_ARM, 16, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_ppc_generic, llvm::MachO::CPU_TYPE_POWERPC, CPU_ANY,
- UINT32_MAX, UINT32_MAX},
-{ArchSpec::eCore_ppc_generic, llvm::MachO::CPU_TYPE_POWERPC, 0, UINT32_MAX,
- SUBTYPE_MASK},
-{ArchSpec::eCore_ppc_ppc601, llvm::MachO::CPU_TYPE_POWERPC, 1, UINT32_MAX,
- SUBTYPE_MASK},

[llvm-branch-commits] [lldb] 99ea2c4 - [lldb] Refactor the Symbolicator initializer

2020-12-03 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-03T14:31:59-08:00
New Revision: 99ea2c461d140c5a6b7da91061daa1cd9b3ec9b9

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

LOG: [lldb] Refactor the Symbolicator initializer

We found out that we have clients relying on the old signature of the
Symbolicator initializer. Make the signature compatible again and
provide a factory method to initialize the class correctly based on
whether you have a target or want the symbolicator to create one for
you.

Differential revision: D92601

Added: 


Modified: 
lldb/examples/python/symbolication.py

Removed: 




diff  --git a/lldb/examples/python/symbolication.py 
b/lldb/examples/python/symbolication.py
index c6caa7021b1c..70f2ff3bb27c 100755
--- a/lldb/examples/python/symbolication.py
+++ b/lldb/examples/python/symbolication.py
@@ -437,18 +437,22 @@ def create_target(self, debugger):
 
 class Symbolicator:
 
-def __init__(self, debugger):
-"""A class the represents the information needed to symbolicate 
addresses in a program"""
+def __init__(self, debugger=None, target=None, images=list()):
+"""A class the represents the information needed to symbolicate
+addresses in a program.
+
+Do not call this initializer directly, but rather use the factory
+methods.
+"""
 self.debugger = debugger
-self.target = None
-self.images = list()  # a list of images to be used when symbolicating
+self.target = target
+self.images = images  # a list of images to be used when symbolicating
 self.addr_mask = 0x
 
 @classmethod
 def InitWithSBTarget(cls, target):
-obj = cls()
-obj.target = target
-obj.images = list()
+"""Initialize a new Symbolicator with an existing SBTarget."""
+obj = cls(target=target)
 triple = target.triple
 if triple:
 arch = triple.split('-')[0]
@@ -460,6 +464,13 @@ def InitWithSBTarget(cls, target):
 obj.images.append(image)
 return obj
 
+@classmethod
+def InitWithSBDebugger(cls, debugger, images):
+"""Initialize a new Symbolicator with an existing debugger and list of
+images. The Symbolicator will create the target."""
+obj = cls(debugger=debugger, images=images)
+return obj
+
 def __str__(self):
 s = "Symbolicator:\n"
 if self.target:



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


[llvm-branch-commits] [lldb] 9d9959e - [lldb] Recognize MachO cpu sub-type 2 as arm64

2020-12-03 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-03T13:31:31-08:00
New Revision: 9d9959eeacd777b9a4ea82a2f59c2bdec5f7

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

LOG: [lldb] Recognize MachO cpu sub-type 2 as arm64

Make sure we recognize cpu sub-type 2 as arm64. In reality it's arm64e,
but we don't have the triple for that. Without this patch, we fall back
to unknown-apple-macosx- for the default architecture, which breaks
things like running expressions without a target.

Differential revision: https://reviews.llvm.org/D92603

Added: 


Modified: 
lldb/source/Utility/ArchSpec.cpp

Removed: 




diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index c7b56a8385f7..5bbe59034c04 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -298,6 +298,8 @@ static const ArchDefinitionEntry g_macho_arch_entries[] = {
  SUBTYPE_MASK},
 {ArchSpec::eCore_arm_armv7em, llvm::MachO::CPU_TYPE_ARM, 16, UINT32_MAX,
  SUBTYPE_MASK},
+{ArchSpec::eCore_arm_arm64, llvm::MachO::CPU_TYPE_ARM64, 2, UINT32_MAX,
+ SUBTYPE_MASK}, // FIXME: This should be arm64e once the triple exists.
 {ArchSpec::eCore_arm_arm64, llvm::MachO::CPU_TYPE_ARM64, 1, UINT32_MAX,
  SUBTYPE_MASK},
 {ArchSpec::eCore_arm_arm64, llvm::MachO::CPU_TYPE_ARM64, 0, UINT32_MAX,



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


[llvm-branch-commits] [lldb] dd2054d - [lldb] Treat remote macOS debugging like any other remote darwin platform

2020-12-02 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-02T17:03:22-08:00
New Revision: dd2054d38a848a75fe84fb68d9c3a97e5ade6753

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

LOG: [lldb] Treat remote macOS debugging like any other remote darwin platform

Extract remote debugging logic from PlatformMacOSX and move it into
PlatformRemoteMacOSX so it can benefit from all the logic necessary for
remote debugging.

Until now, remote macOS debugging was treated almost identical to local
macOS debugging. By moving in into its own class, we can have it inherit
from PlatformRemoteDarwinDevice and all the functionality it provides,
such as looking at the correct DeviceSupport directory.

rdar://68167374

Differential revision: https://reviews.llvm.org/D92452

Added: 
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
lldb/test/API/commands/platform/sdk/Makefile
lldb/test/API/commands/platform/sdk/TestPlatformSDK.py
lldb/test/API/commands/platform/sdk/main.c

Modified: 
lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
lldb/unittests/Process/ProcessEventDataTest.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt 
b/lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt
index 8b5be337f45b..bd9343773b3c 100644
--- a/lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt
+++ b/lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt
@@ -10,11 +10,12 @@ list(APPEND PLUGIN_PLATFORM_MACOSX_SOURCES
   PlatformDarwin.cpp
   PlatformDarwinKernel.cpp
   PlatformMacOSX.cpp
-  PlatformRemoteiOS.cpp
+  PlatformRemoteAppleBridge.cpp
   PlatformRemoteAppleTV.cpp
   PlatformRemoteAppleWatch.cpp
   PlatformRemoteDarwinDevice.cpp
-  PlatformRemoteAppleBridge.cpp
+  PlatformRemoteMacOSX.cpp
+  PlatformRemoteiOS.cpp
   )
 
 list(APPEND PLUGIN_PLATFORM_MACOSX_DARWIN_ONLY_SOURCES

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index a139d4a2c454..24df03e18dda 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "PlatformMacOSX.h"
+#include "PlatformRemoteMacOSX.h"
 #include "PlatformRemoteiOS.h"
 #if defined(__APPLE__)
 #include "PlatformAppleSimulator.h"
@@ -44,6 +45,7 @@ static uint32_t g_initialize_count = 0;
 void PlatformMacOSX::Initialize() {
   PlatformDarwin::Initialize();
   PlatformRemoteiOS::Initialize();
+  PlatformRemoteMacOSX::Initialize();
 #if defined(__APPLE__)
   PlatformAppleSimulator::Initialize();
   PlatformDarwinKernel::Initialize();
@@ -54,12 +56,12 @@ void PlatformMacOSX::Initialize() {
 
   if (g_initialize_count++ == 0) {
 #if defined(__APPLE__)
-PlatformSP default_platform_sp(new PlatformMacOSX(true));
+PlatformSP default_platform_sp(new PlatformMacOSX());
 default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
 Platform::SetHostPlatform(default_platform_sp);
 #endif
-PluginManager::RegisterPlugin(PlatformMacOSX::GetPluginNameStatic(false),
-  PlatformMacOSX::GetDescriptionStatic(false),
+PluginManager::RegisterPlugin(PlatformMacOSX::GetPluginNameStatic(),
+  PlatformMacOSX::GetDescriptionStatic(),
   PlatformMacOSX::CreateInstance);
   }
 }
@@ -78,98 +80,28 @@ void PlatformMacOSX::Terminate() {
   PlatformDarwinKernel::Terminate();
   PlatformAppleSimulator::Terminate();
 #endif
+  PlatformRemoteMacOSX::Initialize();
   PlatformRemoteiOS::Terminate();
   PlatformDarwin::Terminate();
 }
 
-PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) {
-  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log) {
-const char *arch_name;
-if (arch && arch->GetArchitectureName())
-  arch_name = arch->GetArchitectureName();
-else
-  arch_name = "";
-
-const char *triple_cstr =
-arch ? arch->GetTriple().getTriple().c_str() : "";
-
-LLDB_LOGF(log, "PlatformMacOSX::%s(force=%s, arch={%s,%s})", __FUNCTION__,
-  force ? "true" : "false", arch_name, triple_cstr);
-  }
-
-  // The only time we create an instance is when we are creating a remote
-  // macosx platform
-  const bool is_host = false;
-
-  bool create = force;
-  if (!create && arch && arch->IsValid()) {
-const llvm::Triple  = arch->GetTriple();
-switch (triple.getVendor()) {
-case llvm::Triple::Apple:
-  create = true;
-  break;

[llvm-branch-commits] [lldb] dcdd231 - [lldb] Return the original path when tilde expansion fails.

2020-12-02 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-12-02T16:01:30-08:00
New Revision: dcdd231df6c7b6f4a635fe7941c1f87955328183

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

LOG: [lldb] Return the original path when tilde expansion fails.

Differential revision: https://reviews.llvm.org/D92513

Added: 


Modified: 
lldb/source/Utility/TildeExpressionResolver.cpp
lldb/unittests/Utility/TildeExpressionResolverTest.cpp

Removed: 




diff  --git a/lldb/source/Utility/TildeExpressionResolver.cpp 
b/lldb/source/Utility/TildeExpressionResolver.cpp
index c8a0800cb807..75d9c47e656d 100644
--- a/lldb/source/Utility/TildeExpressionResolver.cpp
+++ b/lldb/source/Utility/TildeExpressionResolver.cpp
@@ -75,9 +75,8 @@ bool 
StandardTildeExpressionResolver::ResolvePartial(StringRef Expr,
 
 bool TildeExpressionResolver::ResolveFullPath(
 StringRef Expr, llvm::SmallVectorImpl ) {
-  Output.clear();
   if (!Expr.startswith("~")) {
-Output.append(Expr.begin(), Expr.end());
+Output.assign(Expr.begin(), Expr.end());
 return false;
   }
 
@@ -85,8 +84,10 @@ bool TildeExpressionResolver::ResolveFullPath(
   StringRef Left =
   Expr.take_until([](char c) { return path::is_separator(c); });
 
-  if (!ResolveExact(Left, Output))
+  if (!ResolveExact(Left, Output)) {
+Output.assign(Expr.begin(), Expr.end());
 return false;
+  }
 
   Output.append(Expr.begin() + Left.size(), Expr.end());
   return true;

diff  --git a/lldb/unittests/Utility/TildeExpressionResolverTest.cpp 
b/lldb/unittests/Utility/TildeExpressionResolverTest.cpp
index bc1ca7a44811..bcb7fdb8604d 100644
--- a/lldb/unittests/Utility/TildeExpressionResolverTest.cpp
+++ b/lldb/unittests/Utility/TildeExpressionResolverTest.cpp
@@ -31,6 +31,9 @@ TEST(TildeExpressionResolver, ResolveFullPath) {
   EXPECT_EQ("/lars", Result);
 
   ASSERT_FALSE(Resolver.ResolveFullPath("~Jaso", Result));
+  EXPECT_EQ("~Jaso", Result);
   ASSERT_FALSE(Resolver.ResolveFullPath("", Result));
+  EXPECT_EQ("", Result);
   ASSERT_FALSE(Resolver.ResolveFullPath("Jason", Result));
+  EXPECT_EQ("Jason", Result);
 }



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


[llvm-branch-commits] [lldb] 173bb3c - [lldb] Refactor GetDeviceSupportDirectoryNames and GetPlatformName (NFC)

2020-11-30 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-11-30T19:37:12-08:00
New Revision: 173bb3c2eb094920708ab8f61dae2fe22d331773

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

LOG: [lldb] Refactor GetDeviceSupportDirectoryNames and GetPlatformName (NFC)

Both functions are effectively returning a single string literal. Change
the interface to return a llvm::StringRef instead of populating a vector
of std::strings or returning a std::string respectively.

Added: 


Modified: 
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h

Removed: 




diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
index 1cb8b9c37031..f3ee92a9d27b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
@@ -172,15 +172,10 @@ bool 
PlatformRemoteAppleBridge::GetSupportedArchitectureAtIndex(uint32_t idx,
   return false;
 }
 
-
-void PlatformRemoteAppleBridge::GetDeviceSupportDirectoryNames 
(std::vector ) 
-{
-dirnames.clear();
-dirnames.push_back("BridgeOS DeviceSupport");
+llvm::StringRef PlatformRemoteAppleBridge::GetDeviceSupportDirectoryName() {
+  return "BridgeOS DeviceSupport";
 }
 
-std::string PlatformRemoteAppleBridge::GetPlatformName ()
-{
-return "BridgeOS.platform";
+llvm::StringRef PlatformRemoteAppleBridge::GetPlatformName() {
+  return "BridgeOS.platform";
 }
-

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h 
b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
index 5e7420e2508b..2d574894a283 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
@@ -48,12 +48,8 @@ class PlatformRemoteAppleBridge : public 
PlatformRemoteDarwinDevice {
lldb_private::ArchSpec ) override;
 
 protected:
-
-  // lldb_private::PlatformRemoteDarwinDevice functions
-
-  void GetDeviceSupportDirectoryNames (std::vector ) 
override;
-
-  std::string GetPlatformName () override;
+  llvm::StringRef GetDeviceSupportDirectoryName() override;
+  llvm::StringRef GetPlatformName() override;
 };
 
 #endif // LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMREMOTEAPPLEBRIDGE_H

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
index 082ddcc0f568..15e91b239a35 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
@@ -223,15 +223,10 @@ bool 
PlatformRemoteAppleTV::GetSupportedArchitectureAtIndex(uint32_t idx,
   return false;
 }
 
-
-void PlatformRemoteAppleTV::GetDeviceSupportDirectoryNames 
(std::vector ) 
-{
-dirnames.clear();
-dirnames.push_back("tvOS DeviceSupport");
+llvm::StringRef PlatformRemoteAppleTV::GetDeviceSupportDirectoryName() {
+  return "tvOS DeviceSupport";
 }
 
-std::string PlatformRemoteAppleTV::GetPlatformName ()
-{
-return "AppleTVOS.platform";
+llvm::StringRef PlatformRemoteAppleTV::GetPlatformName() {
+  return "AppleTVOS.platform";
 }
-

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h 
b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
index c556476340fc..15be923cca46 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
@@ -48,12 +48,8 @@ class PlatformRemoteAppleTV : public 
PlatformRemoteDarwinDevice {
lldb_private::ArchSpec ) override;
 
 protected:
-
-  // lldb_private::PlatformRemoteDarwinDevice functions
-
-  void GetDeviceSupportDirectoryNames (std::vector ) 
override;
-
-  std::string GetPlatformName () override;
+  llvm::StringRef GetDeviceSupportDirectoryName() override;
+  llvm::StringRef GetPlatformName() override;
 };
 
 #endif // LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMREMOTEAPPLETV_H

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp 

[llvm-branch-commits] [lldb] 1b9f214 - [lldb] Give TestDefaultTemplateArgs a unique class name

2020-11-30 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2020-11-30T14:41:35-08:00
New Revision: 1b9f214efca7d5855f4e3dd1969c4cbe77078f97

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

LOG: [lldb] Give TestDefaultTemplateArgs a unique class name

Multiple tests cannot share the same test class name.

Added: 


Modified: 
lldb/test/API/lang/cpp/default-template-args/TestDefaultTemplateArgs.py

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/default-template-args/TestDefaultTemplateArgs.py 
b/lldb/test/API/lang/cpp/default-template-args/TestDefaultTemplateArgs.py
index 970c3522a175..e009b23d5b63 100644
--- a/lldb/test/API/lang/cpp/default-template-args/TestDefaultTemplateArgs.py
+++ b/lldb/test/API/lang/cpp/default-template-args/TestDefaultTemplateArgs.py
@@ -7,7 +7,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-class TestCase(TestBase):
+class TestDefaultTemplateArgs(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 



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