[Lldb-commits] [lldb] r366983 - cli-wrapper-mpxtable.cpp: fix file header

2019-07-24 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Wed Jul 24 22:15:50 2019
New Revision: 366983

URL: http://llvm.org/viewvc/llvm-project?rev=366983=rev
Log:
cli-wrapper-mpxtable.cpp: fix file header

Modified:
lldb/trunk/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp

Modified: lldb/trunk/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp?rev=366983=366982=366983=diff
==
--- lldb/trunk/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp 
(original)
+++ lldb/trunk/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp Wed Jul 
24 22:15:50 2019
@@ -1,5 +1,4 @@
-//===-- cli-wrapper-mpxtable.cpp--*- C++
-//-*-===//
+//===-- cli-wrapper-mpxtable.cpp *- C++ 
-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.


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


[Lldb-commits] [lldb] r366982 - [TableGen] Fix comments/headers referencing clang (NFC)

2019-07-24 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Jul 24 21:38:46 2019
New Revision: 366982

URL: http://llvm.org/viewvc/llvm-project?rev=366982=rev
Log:
[TableGen] Fix comments/headers referencing clang (NFC)

Remove references to clang's TableGen implementation. Presumably these
files were originally copied over.

Modified:
lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp
lldb/trunk/utils/TableGen/LLDBTableGen.cpp
lldb/trunk/utils/TableGen/LLDBTableGenBackends.h

Modified: lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp?rev=366982=366981=366982=diff
==
--- lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp (original)
+++ lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp Wed Jul 24 21:38:46 2019
@@ -1,4 +1,4 @@
-//===- TableGen.cpp - Top-Level TableGen implementation for Clang 
-===//
+//===- LLDBOptionDefEmitter.cpp 
---===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

Modified: lldb/trunk/utils/TableGen/LLDBTableGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBTableGen.cpp?rev=366982=366981=366982=diff
==
--- lldb/trunk/utils/TableGen/LLDBTableGen.cpp (original)
+++ lldb/trunk/utils/TableGen/LLDBTableGen.cpp Wed Jul 24 21:38:46 2019
@@ -1,4 +1,4 @@
-//===- TableGen.cpp - Top-Level TableGen implementation for Clang 
-===//
+//===- LLDBTableGen.cpp - Top-Level TableGen implementation for LLDB 
--===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
 //
 
//===--===//
 //
-// This file contains the main function for Clang's TableGen.
+// This file contains the main function for LLDB's TableGen.
 //
 
//===--===//
 

Modified: lldb/trunk/utils/TableGen/LLDBTableGenBackends.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBTableGenBackends.h?rev=366982=366981=366982=diff
==
--- lldb/trunk/utils/TableGen/LLDBTableGenBackends.h (original)
+++ lldb/trunk/utils/TableGen/LLDBTableGenBackends.h Wed Jul 24 21:38:46 2019
@@ -1,4 +1,4 @@
-//===- TableGen.cpp - Top-Level TableGen implementation for Clang 
-===//
+//===- LLDBTableGenBackends.h ---*- C++ 
-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -7,8 +7,9 @@
 
//===--===//
 //
 // This file contains the declarations for all of the LLDB TableGen
-// backends. A "TableGen backend" is just a function. See
-// "$LLVM_ROOT/utils/TableGen/TableGenBackends.h" for more info.
+// backends. A "TableGen backend" is just a function.
+//
+// See "$LLVM_ROOT/utils/TableGen/TableGenBackends.h" for more info.
 //
 
//===--===//
 


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


[Lldb-commits] [PATCH] D64013: Correctly use GetLoadedModuleList to take advantage of libraries-svr4

2019-07-24 Thread António Afonso via Phabricator via lldb-commits
aadsm updated this revision to Diff 211661.
aadsm added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64013/new/

https://reviews.llvm.org/D64013

Files:
  lldb/include/lldb/Target/Process.h
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -200,9 +200,9 @@
 
   llvm::VersionTuple GetHostOSVersion() override;
 
-  size_t LoadModules(LoadedModuleInfoList _list) override;
+  llvm::Error LoadModules() override;
 
-  size_t LoadModules() override;
+  llvm::Expected GetLoadedModuleList() override;
 
   Status GetFileLoadAddress(const FileSpec , bool _loaded,
 lldb::addr_t _addr) override;
@@ -391,9 +391,6 @@
   // Query remote GDBServer for register information
   bool GetGDBServerRegisterInfo(ArchSpec );
 
-  // Query remote GDBServer for a detailed loaded library list
-  Status GetLoadedModuleList(LoadedModuleInfoList &);
-
   lldb::ModuleSP LoadModuleAtAddress(const FileSpec ,
  lldb::addr_t link_map,
  lldb::addr_t base_addr,
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2390,7 +2390,12 @@
 ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
 description = ostr.GetString();
   } else if (key.compare("library") == 0) {
-LoadModules();
+auto error = LoadModules();
+if (error) {
+  Log *log(
+  ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+  LLDB_LOG_ERROR(log, std::move(error), "Failed to load modules: {0}");
+}
   } else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1])) {
 uint32_t reg = UINT32_MAX;
 if (!key.getAsInteger(16, reg))
@@ -2742,9 +2747,13 @@
 
   // the loaded module list can also provides a link map address
   if (addr == LLDB_INVALID_ADDRESS) {
-LoadedModuleInfoList list;
-if (GetLoadedModuleList(list).Success())
-  addr = list.m_link_map;
+llvm::Expected list = GetLoadedModuleList();
+if (!list) {
+  Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+  LLDB_LOG_ERROR(log, list.takeError(), "Failed to read module list: {0}");
+} else {
+  addr = list->m_link_map;
+}
   }
 
   return addr;
@@ -4682,39 +4691,43 @@
   return m_register_info.GetNumRegisters() > 0;
 }
 
-Status ProcessGDBRemote::GetLoadedModuleList(LoadedModuleInfoList ) {
+llvm::Expected ProcessGDBRemote::GetLoadedModuleList() {
   // Make sure LLDB has an XML parser it can use first
   if (!XMLDocument::XMLEnabled())
-return Status(0, ErrorType::eErrorTypeGeneric);
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   "XML parsing not available");
 
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS);
   LLDB_LOGF(log, "ProcessGDBRemote::%s", __FUNCTION__);
 
+  LoadedModuleInfoList list;
   GDBRemoteCommunicationClient  = m_gdb_comm;
   bool can_use_svr4 = GetGlobalPluginProperties()->GetUseSVR4();
 
   // check that we have extended feature read support
   if (can_use_svr4 && comm.GetQXferLibrariesSVR4ReadSupported()) {
-list.clear();
-
 // request the loaded library list
 std::string raw;
 lldb_private::Status lldberr;
 
 if (!comm.ReadExtFeature(ConstString("libraries-svr4"), ConstString(""),
  raw, lldberr))
-  return Status(0, ErrorType::eErrorTypeGeneric);
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Error in libraries-svr4 packet");
 
 // parse the xml file in memory
 LLDB_LOGF(log, "parsing: %s", raw.c_str());
 XMLDocument doc;
 
 if (!doc.ParseMemory(raw.c_str(), raw.size(), "noname.xml"))
-  return Status(0, ErrorType::eErrorTypeGeneric);
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Error reading noname.xml");
 
 XMLNode root_element = doc.GetRootElement("library-list-svr4");
 if (!root_element)
-  return Status();
+  return llvm::createStringError(
+  

[Lldb-commits] [PATCH] D65207: LLGS: fix tracking execve on linux

2019-07-24 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.

LGTM.  I don't think the use of the posix_spawn API are important for the test 
case to exercise.  If posix_spawn had a problem on darwin systems, 
lldb/debugserver's process launching would turn it up pretty quick.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65207/new/

https://reviews.llvm.org/D65207



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


[Lldb-commits] [lldb] r366975 - [FileCollector] Remove LLDB shim around llvm::FileCollector (NFC)

2019-07-24 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Jul 24 18:08:10 2019
New Revision: 366975

URL: http://llvm.org/viewvc/llvm-project?rev=366975=rev
Log:
[FileCollector] Remove LLDB shim around llvm::FileCollector (NFC)

The FileCollector got lifted into LLVM and a shim was introduced in LLDB
to keep the old API that takes FileSpecs. This patch removes that shim
and converts the arguments in place.

Removed:
lldb/trunk/include/lldb/Utility/FileCollector.h
Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/include/lldb/Utility/Reproducer.h
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=366975=366974=366975=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Jul 24 18:08:10 2019
@@ -11,12 +11,12 @@
 
 #include "lldb/Host/File.h"
 #include "lldb/Utility/DataBufferLLVM.h"
-#include "lldb/Utility/FileCollector.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
 
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/Chrono.h"
+#include "llvm/Support/FileCollector.h"
 #include "llvm/Support/VirtualFileSystem.h"
 
 #include "lldb/lldb-types.h"
@@ -34,7 +34,7 @@ public:
   FileSystem()
   : m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr),
 m_mapped(false) {}
-  FileSystem(FileCollector )
+  FileSystem(llvm::FileCollector )
   : m_fs(llvm::vfs::getRealFileSystem()), m_collector(),
 m_mapped(false) {}
   FileSystem(llvm::IntrusiveRefCntPtr fs,
@@ -47,7 +47,7 @@ public:
   static FileSystem ();
 
   static void Initialize();
-  static void Initialize(FileCollector );
+  static void Initialize(llvm::FileCollector );
   static llvm::Error Initialize(const FileSpec );
   static void Initialize(llvm::IntrusiveRefCntPtr fs);
   static void Terminate();
@@ -188,7 +188,7 @@ public:
 private:
   static llvm::Optional ();
   llvm::IntrusiveRefCntPtr m_fs;
-  FileCollector *m_collector;
+  llvm::FileCollector *m_collector;
   bool m_mapped;
 };
 } // namespace lldb_private

Removed: lldb/trunk/include/lldb/Utility/FileCollector.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileCollector.h?rev=366974=auto
==
--- lldb/trunk/include/lldb/Utility/FileCollector.h (original)
+++ lldb/trunk/include/lldb/Utility/FileCollector.h (removed)
@@ -1,41 +0,0 @@
-//===-- FileCollector.h -*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLDB_UTILITY_FILE_COLLECTOR_H
-#define LLDB_UTILITY_FILE_COLLECTOR_H
-
-#include "lldb/Utility/FileSpec.h"
-
-#include "llvm/Support/FileCollector.h"
-
-namespace lldb_private {
-
-/// Collects files into a directory and generates a mapping that can be used by
-/// the VFS.
-class FileCollector : public llvm::FileCollector {
-public:
-  FileCollector(const FileSpec , const FileSpec ) :
-llvm::FileCollector(root.GetPath(), overlay.GetPath()) {}
-
-  using llvm::FileCollector::addFile;
-
-  void addFile(const FileSpec ) {
-std::string path = file.GetPath();
-llvm::FileCollector::addFile(path);
-  }
-
-  /// Write the yaml mapping (for the VFS) to the given file.
-  std::error_code writeMapping(const FileSpec _file) {
-std::string path = mapping_file.GetPath();
-return llvm::FileCollector::writeMapping(path);
-  }
-};
-
-} // namespace lldb_private
-
-#endif // LLDB_UTILITY_FILE_COLLECTOR_H

Modified: lldb/trunk/include/lldb/Utility/Reproducer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=366975=366974=366975=diff
==
--- lldb/trunk/include/lldb/Utility/Reproducer.h (original)
+++ lldb/trunk/include/lldb/Utility/Reproducer.h Wed Jul 24 18:08:10 2019
@@ -9,11 +9,11 @@
 #ifndef LLDB_UTILITY_REPRODUCER_H
 #define LLDB_UTILITY_REPRODUCER_H
 
-#include "lldb/Utility/FileCollector.h"
 #include "lldb/Utility/FileSpec.h"
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/FileCollector.h"
 #include "llvm/Support/YAMLTraits.h"
 
 #include 
@@ -91,23 +91,23 @@ public:
 
   FileProvider(const FileSpec )
   : Provider(directory),
-m_collector(directory.CopyByAppendingPathComponent("root"), directory) 
{
-  }
+m_collector(directory.CopyByAppendingPathComponent("root").GetPath(),
+

[Lldb-commits] [lldb] r366974 - [FileSystem] Fix ambiguous symbol on Windows.

2019-07-24 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Jul 24 17:56:31 2019
New Revision: 366974

URL: http://llvm.org/viewvc/llvm-project?rev=366974=rev
Log:
[FileSystem] Fix ambiguous symbol on Windows.

The using declarations make FileCollector ambiguous. Specify that
FileSystem takes an lldb_private::FileCollector.

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

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=366974=366973=366974=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Wed Jul 24 17:56:31 2019
@@ -49,7 +49,7 @@ void FileSystem::Initialize() {
   InstanceImpl().emplace();
 }
 
-void FileSystem::Initialize(FileCollector ) {
+void FileSystem::Initialize(lldb_private::FileCollector ) {
   lldbassert(!InstanceImpl() && "Already initialized.");
   InstanceImpl().emplace(collector);
 }


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


[Lldb-commits] [lldb] r366966 - [FileCollector] Change coding style from LLDB to LLVM (NFC)

2019-07-24 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Jul 24 17:17:39 2019
New Revision: 366966

URL: http://llvm.org/viewvc/llvm-project?rev=366966=rev
Log:
[FileCollector] Change coding style from LLDB to LLVM (NFC)

This patch changes the coding style of the FileCollector from the LLDB
to the LLVM coding style. Alex recently lifted it into LLVM and I
volunteered to do the conversion.

Modified:
lldb/trunk/include/lldb/Utility/FileCollector.h
lldb/trunk/include/lldb/Utility/Reproducer.h
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h

Modified: lldb/trunk/include/lldb/Utility/FileCollector.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileCollector.h?rev=366966=366965=366966=diff
==
--- lldb/trunk/include/lldb/Utility/FileCollector.h (original)
+++ lldb/trunk/include/lldb/Utility/FileCollector.h Wed Jul 24 17:17:39 2019
@@ -22,17 +22,17 @@ public:
   FileCollector(const FileSpec , const FileSpec ) :
 llvm::FileCollector(root.GetPath(), overlay.GetPath()) {}
 
-  using llvm::FileCollector::AddFile;
+  using llvm::FileCollector::addFile;
 
-  void AddFile(const FileSpec ) {
-  std::string path = file.GetPath();
-  llvm::FileCollector::AddFile(path);
+  void addFile(const FileSpec ) {
+std::string path = file.GetPath();
+llvm::FileCollector::addFile(path);
   }
 
   /// Write the yaml mapping (for the VFS) to the given file.
-  std::error_code WriteMapping(const FileSpec _file) {
+  std::error_code writeMapping(const FileSpec _file) {
 std::string path = mapping_file.GetPath();
-return llvm::FileCollector::WriteMapping(path);
+return llvm::FileCollector::writeMapping(path);
   }
 };
 

Modified: lldb/trunk/include/lldb/Utility/Reproducer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=366966=366965=366966=diff
==
--- lldb/trunk/include/lldb/Utility/Reproducer.h (original)
+++ lldb/trunk/include/lldb/Utility/Reproducer.h Wed Jul 24 17:17:39 2019
@@ -99,9 +99,9 @@ public:
   void Keep() override {
 auto mapping = GetRoot().CopyByAppendingPathComponent(Info::file);
 // Temporary files that are removed during execution can cause copy errors.
-if (auto ec = m_collector.CopyFiles(/*stop_on_error=*/false))
+if (auto ec = m_collector.copyFiles(/*stop_on_error=*/false))
   return;
-m_collector.WriteMapping(mapping);
+m_collector.writeMapping(mapping);
   }
 
   static char ID;

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=366966=366965=366966=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Wed Jul 24 17:17:39 2019
@@ -280,7 +280,7 @@ std::shared_ptr
 FileSystem::CreateDataBuffer(const llvm::Twine , uint64_t size,
  uint64_t offset) {
   if (m_collector)
-m_collector->AddFile(path);
+m_collector->addFile(path);
 
   const bool is_volatile = !IsLocal(path);
   const ErrorOr external_path = GetExternalPath(path);
@@ -418,7 +418,7 @@ static mode_t GetOpenMode(uint32_t permi
 Status FileSystem::Open(File , const FileSpec _spec, uint32_t 
options,
 uint32_t permissions, bool should_close_fd) {
   if (m_collector)
-m_collector->AddFile(file_spec);
+m_collector->addFile(file_spec);
 
   if (File.IsValid())
 File.Close();

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h?rev=366966=366965=366966=diff
==
--- 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h 
(original)
+++ 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h 
Wed Jul 24 17:17:39 2019
@@ -23,7 +23,7 @@ public:
 
   void addFile(llvm::StringRef Filename,
llvm::StringRef FileDst = {}) override {
-m_file_collector.AddFile(Filename);
+m_file_collector.addFile(Filename);
   }
 
   bool insertSeen(llvm::StringRef Filename) override { return false; }


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


[Lldb-commits] [PATCH] D65249: [NFC] use C++11 in AlignOf.h

2019-07-24 Thread JF Bastien via Phabricator via lldb-commits
jfb created this revision.
jfb added a reviewer: chandlerc.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, dexonsmith, 
jkorous, hiraditya, javed.absar.
Herald added projects: clang, LLDB, LLVM.
jfb added a comment.

This is the main event: https://reviews.llvm.org/D65249#change-IWk6CtRl45h6
The rest is side-show.


Two things in this patch:

- Use std::aligned_storage instead of AlignedCharArray. Note: template 
parameters are swapped.
- Use variadic templates in the implementation of AlignedCharArrayUnion.

The other files are changed accordingly:

- Use std::aligned_storage.
- The buffer is no longer implicitly a character array, requiring casting in 
some cases.

This should be fine since our current minimum MSVC version is now Visual Studio
2017 version 15.0.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65249

Files:
  clang/include/clang/AST/APValue.h
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/ASTTypeTraits.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/Sema/Overload.h
  clang/lib/AST/APValue.cpp
  clang/lib/CodeGen/CGCleanup.cpp
  clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
  clang/lib/Frontend/PrecompiledPreamble.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/TypeLocBuilder.cpp
  clang/lib/Sema/TypeLocBuilder.h
  lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
  llvm/include/llvm/ADT/DenseMap.h
  llvm/include/llvm/ADT/IntervalMap.h
  llvm/include/llvm/CodeGen/DIE.h
  llvm/include/llvm/Support/AlignOf.h
  llvm/include/llvm/Support/Endian.h
  llvm/include/llvm/Support/Error.h
  llvm/include/llvm/Support/ErrorOr.h
  llvm/include/llvm/Support/JSON.h
  llvm/include/llvm/Support/TrailingObjects.h
  llvm/lib/Support/JSON.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/unittests/Support/AlignOfTest.cpp

Index: llvm/unittests/Support/AlignOfTest.cpp
===
--- llvm/unittests/Support/AlignOfTest.cpp
+++ llvm/unittests/Support/AlignOfTest.cpp
@@ -233,16 +233,5 @@
 #ifndef _MSC_VER
   EXPECT_EQ(sizeof(V8), sizeof(AlignedCharArrayUnion));
 #endif
-
-  EXPECT_EQ(1u, (alignof(AlignedCharArray<1, 1>)));
-  EXPECT_EQ(2u, (alignof(AlignedCharArray<2, 1>)));
-  EXPECT_EQ(4u, (alignof(AlignedCharArray<4, 1>)));
-  EXPECT_EQ(8u, (alignof(AlignedCharArray<8, 1>)));
-  EXPECT_EQ(16u, (alignof(AlignedCharArray<16, 1>)));
-
-  EXPECT_EQ(1u, sizeof(AlignedCharArray<1, 1>));
-  EXPECT_EQ(7u, sizeof(AlignedCharArray<1, 7>));
-  EXPECT_EQ(2u, sizeof(AlignedCharArray<2, 2>));
-  EXPECT_EQ(16u, sizeof(AlignedCharArray<2, 16>));
 }
 } // end anonymous namespace
Index: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
===
--- llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
@@ -81,11 +81,13 @@
   private:
 bool insaneIntVal(int V) { return V > 4 || V < -4; }
 
-APFloat *getFpValPtr()
-  { return reinterpret_cast([0]); }
+APFloat *getFpValPtr() {
+  return reinterpret_cast();
+}
 
-const APFloat *getFpValPtr() const
-  { return reinterpret_cast([0]); }
+const APFloat *getFpValPtr() const {
+  return reinterpret_cast();
+}
 
 const APFloat () const {
   assert(IsFp && BufHasFpVal && "Incorret state");
Index: llvm/lib/Support/JSON.cpp
===
--- llvm/lib/Support/JSON.cpp
+++ llvm/lib/Support/JSON.cpp
@@ -106,7 +106,7 @@
   case T_Boolean:
   case T_Double:
   case T_Integer:
-memcpy(Union.buffer, M.Union.buffer, sizeof(Union.buffer));
+memcpy(, , sizeof(Union.buffer));
 break;
   case T_StringRef:
 create(M.as());
@@ -130,7 +130,7 @@
   case T_Boolean:
   case T_Double:
   case T_Integer:
-memcpy(Union.buffer, M.Union.buffer, sizeof(Union.buffer));
+memcpy(, , sizeof(Union.buffer));
 break;
   case T_StringRef:
 create(M.as());
Index: llvm/include/llvm/Support/TrailingObjects.h
===
--- llvm/include/llvm/Support/TrailingObjects.h
+++ llvm/include/llvm/Support/TrailingObjects.h
@@ -369,7 +369,7 @@
   template  struct FixedSizeStorage {
 template  struct with_counts {
   enum { Size = totalSizeToAlloc(Counts...) };
-  typedef llvm::AlignedCharArray type;
+  using type = typename std::aligned_storage::type;
 };
   };
 
Index: llvm/include/llvm/Support/JSON.h
===
--- llvm/include/llvm/Support/JSON.h
+++ llvm/include/llvm/Support/JSON.h
@@ -451,12 +451,12 @@
   friend class Object;
 
   template  void create(U &&... V) {
-new (reinterpret_cast(Union.buffer)) T(std::forward(V)...);
+new (reinterpret_cast()) T(std::forward(V)...);
   }
   template  T () 

[Lldb-commits] [PATCH] D65249: [NFC] use C++11 in AlignOf.h

2019-07-24 Thread JF Bastien via Phabricator via lldb-commits
jfb added a comment.

This is the main event: https://reviews.llvm.org/D65249#change-IWk6CtRl45h6
The rest is side-show.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65249/new/

https://reviews.llvm.org/D65249



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


[Lldb-commits] [PATCH] D65237: [Support] move FileCollector from LLDB to llvm/Support

2019-07-24 Thread Alex Lorenz via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366956: [Support] move FileCollector from LLDB to 
llvm/Support (authored by arphaman, committed by ).
Herald added a subscriber: kristina.

Changed prior to commit:
  https://reviews.llvm.org/D65237?vs=211603=211624#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65237/new/

https://reviews.llvm.org/D65237

Files:
  lldb/trunk/include/lldb/Utility/FileCollector.h
  lldb/trunk/source/Utility/CMakeLists.txt
  lldb/trunk/source/Utility/FileCollector.cpp
  lldb/trunk/unittests/Utility/CMakeLists.txt
  lldb/trunk/unittests/Utility/FileCollectorTest.cpp
  llvm/trunk/include/llvm/Support/FileCollector.h
  llvm/trunk/lib/Support/CMakeLists.txt
  llvm/trunk/lib/Support/FileCollector.cpp
  llvm/trunk/unittests/Support/CMakeLists.txt
  llvm/trunk/unittests/Support/FileCollectorTest.cpp

Index: llvm/trunk/include/llvm/Support/FileCollector.h
===
--- llvm/trunk/include/llvm/Support/FileCollector.h
+++ llvm/trunk/include/llvm/Support/FileCollector.h
@@ -0,0 +1,74 @@
+//===-- FileCollector.h -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLVM_SUPPORT_FILE_COLLECTOR_H
+#define LLVM_SUPPORT_FILE_COLLECTOR_H
+
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSet.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/VirtualFileSystem.h"
+
+#include 
+
+namespace llvm {
+
+/// Collects files into a directory and generates a mapping that can be used by
+/// the VFS.
+class FileCollector {
+public:
+  FileCollector(std::string root, std::string overlay);
+
+  void AddFile(const Twine );
+
+  /// Write the yaml mapping (for the VFS) to the given file.
+  std::error_code WriteMapping(StringRef mapping_file);
+
+  /// Copy the files into the root directory.
+  ///
+  /// When stop_on_error is true (the default) we abort as soon as one file
+  /// cannot be copied. This is relatively common, for example when a file was
+  /// removed after it was added to the mapping.
+  std::error_code CopyFiles(bool stop_on_error = true);
+
+private:
+  void AddFileImpl(StringRef src_path);
+
+  bool MarkAsSeen(StringRef path) { return m_seen.insert(path).second; }
+
+  bool GetRealPath(StringRef src_path,
+   SmallVectorImpl );
+
+  void AddFileToMapping(StringRef virtual_path,
+StringRef real_path) {
+m_vfs_writer.addFileMapping(virtual_path, real_path);
+  }
+
+  /// Synchronizes adding files.
+  std::mutex m_mutex;
+
+  /// The root directory where files are copied.
+  std::string m_root;
+
+  /// The root directory where the VFS overlay lives.
+  std::string m_overlay_root;
+
+  /// Tracks already seen files so they can be skipped.
+  StringSet<> m_seen;
+
+  /// The yaml mapping writer.
+  vfs::YAMLVFSWriter m_vfs_writer;
+
+  /// Caches real_path calls when resolving symlinks.
+  StringMap m_symlink_map;
+};
+
+} // end namespace llvm
+
+#endif // LLVM_SUPPORT_FILE_COLLECTOR_H
Index: llvm/trunk/lib/Support/CMakeLists.txt
===
--- llvm/trunk/lib/Support/CMakeLists.txt
+++ llvm/trunk/lib/Support/CMakeLists.txt
@@ -89,6 +89,7 @@
   Error.cpp
   ErrorHandling.cpp
   FileCheck.cpp
+  FileCollector.cpp
   FileUtilities.cpp
   FileOutputBuffer.cpp
   FoldingSet.cpp
Index: llvm/trunk/lib/Support/FileCollector.cpp
===
--- llvm/trunk/lib/Support/FileCollector.cpp
+++ llvm/trunk/lib/Support/FileCollector.cpp
@@ -0,0 +1,177 @@
+//===-- FileCollector.cpp ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "llvm/Support/FileCollector.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
+
+using namespace llvm;
+
+static bool IsCaseSensitivePath(StringRef path) {
+  SmallString<256> tmp_dest = path, upper_dest, real_dest;
+
+  // Remove component traversals, links, etc.
+  if (!sys::fs::real_path(path, tmp_dest))
+return true; // Current default value in vfs.yaml
+  path = tmp_dest;
+
+  // Change path to all upper case and ask for its real path, if the latter
+  // exists and is equal to path, it's not case sensitive. Default to case
+  // 

[Lldb-commits] [PATCH] D64917: Add offsetof support to expression evaluator.

2019-07-24 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

Thanks for fixing this one!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64917/new/

https://reviews.llvm.org/D64917



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


Re: [Lldb-commits] [lldb] r366879 - [lldb] Remove Xcode project legacy

2019-07-24 Thread Greg Clayton via lldb-commits
How are we updating the sources in LLDB.framework these days? Using cmake? When 
making the LLDB.framework, we must fix up the header includes in any header 
files that are copies over into LLDB.framework from:

#include "lldb/API/SB*"

to a framework like include:

#inclue 

I am mentioning this as I am seeing "sed-sources" being removed here.

Greg

> On Jul 24, 2019, at 2:20 AM, Stefan Granitz via lldb-commits 
>  wrote:
> 
> Author: stefan.graenitz
> Date: Wed Jul 24 02:20:14 2019
> New Revision: 366879
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=366879=rev
> Log:
> [lldb] Remove Xcode project legacy
> 
> Summary: Since D65109 removed the manually maintained Xcode project, there's 
> a few things we don't need anymore. Anything here we should keep or anything 
> more to remove?
> 
> Reviewers: JDevlieghere, jasonmolenda, clayborg, jingham, lanza, teemperor
> 
> Subscribers: mgorny, lldb-commits, #lldb
> 
> Tags: #lldb
> 
> Differential Revision: https://reviews.llvm.org/D65155
> 
> Removed:
>lldb/trunk/cmake/XcodeHeaderGenerator/
>lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
>lldb/trunk/scripts/Xcode/
>lldb/trunk/scripts/build-lldb-llvm-clang
>lldb/trunk/scripts/checkpoint-llvm.pl
>lldb/trunk/scripts/finish-swig-wrapper-classes.sh
>lldb/trunk/scripts/install-lldb.sh
>lldb/trunk/scripts/sed-sources
> 
> Removed: lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh?rev=366878=auto
> ==
> --- lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (original)
> +++ lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (removed)
> @@ -1,309 +0,0 @@
> -#!/bin/sh
> -
> -# finish-swig-Python.sh
> -#
> -# For the Python script interpreter (external to liblldb) to be able to 
> import
> -# and use the lldb module, there must be two files, lldb.py and _lldb.so, 
> that
> -# it can find. lldb.py is generated by SWIG at the same time it generates the
> -# C++ file.  _lldb.so is actually a symlink file that points to the
> -# LLDB shared library/framework.
> -#
> -# The Python script interpreter needs to be able to automatically find
> -# these two files. On Darwin systems it searches in the LLDB.framework, as
> -# well as in all the normal Python search paths.  On non-Darwin systems
> -# these files will need to be put someplace where Python will find them.
> -#
> -# This shell script creates the _lldb.so symlink in the appropriate place,
> -# and copies the lldb.py (and embedded_interpreter.py) file to the correct
> -# directory.
> -#
> -
> -# SRC_ROOT is the root of the lldb source tree.
> -# TARGET_DIR is where the lldb framework/shared library gets put.
> -# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh  shell script
> -#   put the lldb.py file it was generated from running SWIG.
> -# PYTHON_INSTALL_DIR is where non-Darwin systems want to put the .py and .so
> -#   files so that Python can find them automatically.
> -# debug_flag (optional) determines whether or not this script outputs
> -#   additional information when running.
> -
> -SRC_ROOT=$1
> -TARGET_DIR=$2
> -CONFIG_BUILD_DIR=$3
> -PYTHON_INSTALL_DIR=$4
> -debug_flag=$5
> -makefile_flag=$6
> -
> -# If we don't want Python, then just do nothing here.
> -# Note, at present iOS doesn't have Python, so if you're building for iOS be 
> sure to
> -# set LLDB_DISABLE_PYTHON to 1.
> -
> -if [ ! "$LLDB_DISABLE_PYTHON" = "1" ] ; then
> -
> -if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ]
> -then
> -Debug=1
> -else
> -Debug=0
> -fi
> -
> -if [ -n "$makefile_flag" -a "$makefile_flag" = "-m" ]
> -then
> -MakefileCalled=1
> -else
> -MakefileCalled=0
> -fi
> -
> -OS_NAME=`uname -s`
> -PYTHON=${PYTHON_EXECUTABLE:-/usr/bin/env python}
> -PYTHON_VERSION=`${PYTHON} -c 'import sys; 
> print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
> -
> -if [ $Debug -eq 1 ]
> -then
> -echo "The current OS is $OS_NAME"
> -echo "The Python version is $PYTHON_VERSION"
> -fi
> -
> -if [ ${OS_NAME} = "Darwin" ]
> -then
> -SOEXT=".dylib"
> -else
> -SOEXT=".so"
> -fi
> -
> -#
> -#  Determine where to put the files.
> -
> -if [ $MakefileCalled -eq 0 ]
> -then
> -# We are being built by Xcode, so all the lldb Python files can go
> -# into the LLDB.framework/Resources/Python subdirectory.
> -
> -if [ ! -d "${TARGET_DIR}/LLDB.framework" ]
> -then
> -echo "Error:  Unable to find LLDB.framework" >&2
> -exit 1
> -else
> -if [ $Debug -eq 1 ]
> -then
> -echo "Found ${TARGET_DIR}/LLDB.framework."
> -fi
> -fi
> -
> -# Make the Python directory in the framework if it doesn't already exist
> -
> -framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb"
> -else
> -# We are being built by LLVM, so use 

[Lldb-commits] [PATCH] D65171: [LLDB] Find debugserver in Command Line Tools as well

2019-07-24 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

Find with me as long as we default to using the installed Xcode, and then check 
for the command line tools if that fails. Many people keep Xcode up to date, 
but might not always update the installed command line tools.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65171/new/

https://reviews.llvm.org/D65171



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


[Lldb-commits] [PATCH] D65207: LLGS: fix tracking execve on linux

2019-07-24 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Is this not going to be racy on other platforms? Or do all platforms stop at 
entry point once a program has been exec'ed? I am worried we might miss the 
breakpoint.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65207/new/

https://reviews.llvm.org/D65207



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


[Lldb-commits] [PATCH] D65165: [Symbol] Fix some botched logic in Variable::GetLanguage

2019-07-24 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366950: [Symbol] Fix some botched logic in 
Variable::GetLanguage (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65165/new/

https://reviews.llvm.org/D65165

Files:
  lldb/trunk/source/Symbol/Variable.cpp


Index: lldb/trunk/source/Symbol/Variable.cpp
===
--- lldb/trunk/source/Symbol/Variable.cpp
+++ lldb/trunk/source/Symbol/Variable.cpp
@@ -59,12 +59,12 @@
 return lang;
 
   if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
-if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+if ((lang = func->GetLanguage()) != lldb::eLanguageTypeUnknown)
+  return lang;
+  } else if (auto *comp_unit =
+ m_owner_scope->CalculateSymbolContextCompileUnit()) {
+if ((lang = comp_unit->GetLanguage()) != lldb::eLanguageTypeUnknown)
   return lang;
-else if (auto *comp_unit =
- m_owner_scope->CalculateSymbolContextCompileUnit())
-  if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
-return lang;
   }
 
   return lldb::eLanguageTypeUnknown;


Index: lldb/trunk/source/Symbol/Variable.cpp
===
--- lldb/trunk/source/Symbol/Variable.cpp
+++ lldb/trunk/source/Symbol/Variable.cpp
@@ -59,12 +59,12 @@
 return lang;
 
   if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
-if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+if ((lang = func->GetLanguage()) != lldb::eLanguageTypeUnknown)
+  return lang;
+  } else if (auto *comp_unit =
+ m_owner_scope->CalculateSymbolContextCompileUnit()) {
+if ((lang = comp_unit->GetLanguage()) != lldb::eLanguageTypeUnknown)
   return lang;
-else if (auto *comp_unit =
- m_owner_scope->CalculateSymbolContextCompileUnit())
-  if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
-return lang;
   }
 
   return lldb::eLanguageTypeUnknown;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65165: [Symbol] Fix some botched logic in Variable::GetLanguage

2019-07-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 211607.
xiaobai added a comment.

Implement suggestion


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65165/new/

https://reviews.llvm.org/D65165

Files:
  source/Symbol/Variable.cpp


Index: source/Symbol/Variable.cpp
===
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -59,12 +59,12 @@
 return lang;
 
   if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
-if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+if ((lang = func->GetLanguage()) != lldb::eLanguageTypeUnknown)
+  return lang;
+  } else if (auto *comp_unit =
+ m_owner_scope->CalculateSymbolContextCompileUnit()) {
+if ((lang = comp_unit->GetLanguage()) != lldb::eLanguageTypeUnknown)
   return lang;
-else if (auto *comp_unit =
- m_owner_scope->CalculateSymbolContextCompileUnit())
-  if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
-return lang;
   }
 
   return lldb::eLanguageTypeUnknown;


Index: source/Symbol/Variable.cpp
===
--- source/Symbol/Variable.cpp
+++ source/Symbol/Variable.cpp
@@ -59,12 +59,12 @@
 return lang;
 
   if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
-if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+if ((lang = func->GetLanguage()) != lldb::eLanguageTypeUnknown)
+  return lang;
+  } else if (auto *comp_unit =
+ m_owner_scope->CalculateSymbolContextCompileUnit()) {
+if ((lang = comp_unit->GetLanguage()) != lldb::eLanguageTypeUnknown)
   return lang;
-else if (auto *comp_unit =
- m_owner_scope->CalculateSymbolContextCompileUnit())
-  if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
-return lang;
   }
 
   return lldb::eLanguageTypeUnknown;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r366950 - [Symbol] Fix some botched logic in Variable::GetLanguage

2019-07-24 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Wed Jul 24 15:12:02 2019
New Revision: 366950

URL: http://llvm.org/viewvc/llvm-project?rev=366950=rev
Log:
[Symbol] Fix some botched logic in Variable::GetLanguage

Summary:
I messed up the logic for this. Fixing with some improvements suggested
by Pavel.

Reviewers: labath, jdoerfert

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D65165

Modified:
lldb/trunk/source/Symbol/Variable.cpp

Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=366950=366949=366950=diff
==
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Wed Jul 24 15:12:02 2019
@@ -59,12 +59,12 @@ lldb::LanguageType Variable::GetLanguage
 return lang;
 
   if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
-if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+if ((lang = func->GetLanguage()) != lldb::eLanguageTypeUnknown)
+  return lang;
+  } else if (auto *comp_unit =
+ m_owner_scope->CalculateSymbolContextCompileUnit()) {
+if ((lang = comp_unit->GetLanguage()) != lldb::eLanguageTypeUnknown)
   return lang;
-else if (auto *comp_unit =
- m_owner_scope->CalculateSymbolContextCompileUnit())
-  if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
-return lang;
   }
 
   return lldb::eLanguageTypeUnknown;


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


[Lldb-commits] [PATCH] D65230: [CMake] Loosen Python version check and ignore patch version

2019-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 211606.
JDevlieghere added a comment.

Use lowercase variables for locals.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65230/new/

https://reviews.llvm.org/D65230

Files:
  lldb/cmake/modules/LLDBConfig.cmake


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -199,9 +199,23 @@
 find_package(PythonLibs REQUIRED)
   endif()
 
-  if (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING AND
-  NOT CMAKE_CROSSCOMPILING)
-message(FATAL_ERROR "Found incompatible Python interpreter 
(${PYTHON_VERSION_STRING}) and Python libraries (${PYTHONLIBS_VERSION_STRING})")
+  if (NOT CMAKE_CROSSCOMPILING)
+# Manually split PYTHON_VERSION_STRING because find_python_libs_windows
+# doesn't set PYTHON_VERSION_MAJOR or PYTHON_VERSION_MINOR.
+string(REPLACE "." ";" python_version_list ${PYTHON_VERSION_STRING})
+string(REPLACE "." ";" pythonlibs_version_list 
${PYTHONLIBS_VERSION_STRING})
+list(GET python_version_list 0 python_major)
+list(GET python_version_list 1 python_minor)
+list(GET pythonlibs_version_list 0 pythonlibs_major)
+list(GET pythonlibs_version_list 1 pythonlibs_minor)
+
+# Ignore the patch version. Some versions of macOS report a different patch
+# version for the system provided interpreter and libraries.
+if (NOT python_major VERSION_EQUAL pythonlibs_major OR
+NOT python_minor VERSION_EQUAL pythonlibs_minor)
+  message(FATAL_ERROR "Found incompatible Python interpreter 
(${python_major}.${python_minor})"
+  " and Python libraries 
(${pythonlibs_major}.${pythonlibs_minor})")
+endif()
   endif()
 
   if (PYTHON_INCLUDE_DIR)


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -199,9 +199,23 @@
 find_package(PythonLibs REQUIRED)
   endif()
 
-  if (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING AND
-  NOT CMAKE_CROSSCOMPILING)
-message(FATAL_ERROR "Found incompatible Python interpreter (${PYTHON_VERSION_STRING}) and Python libraries (${PYTHONLIBS_VERSION_STRING})")
+  if (NOT CMAKE_CROSSCOMPILING)
+# Manually split PYTHON_VERSION_STRING because find_python_libs_windows
+# doesn't set PYTHON_VERSION_MAJOR or PYTHON_VERSION_MINOR.
+string(REPLACE "." ";" python_version_list ${PYTHON_VERSION_STRING})
+string(REPLACE "." ";" pythonlibs_version_list ${PYTHONLIBS_VERSION_STRING})
+list(GET python_version_list 0 python_major)
+list(GET python_version_list 1 python_minor)
+list(GET pythonlibs_version_list 0 pythonlibs_major)
+list(GET pythonlibs_version_list 1 pythonlibs_minor)
+
+# Ignore the patch version. Some versions of macOS report a different patch
+# version for the system provided interpreter and libraries.
+if (NOT python_major VERSION_EQUAL pythonlibs_major OR
+NOT python_minor VERSION_EQUAL pythonlibs_minor)
+  message(FATAL_ERROR "Found incompatible Python interpreter (${python_major}.${python_minor})"
+  " and Python libraries (${pythonlibs_major}.${pythonlibs_minor})")
+endif()
   endif()
 
   if (PYTHON_INCLUDE_DIR)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65237: [Support] move FileCollector from LLDB to llvm/Support

2019-07-24 Thread Alex Lorenz via Phabricator via lldb-commits
arphaman updated this revision to Diff 211603.
arphaman added a comment.

Use `private` as suggested by Jan.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65237/new/

https://reviews.llvm.org/D65237

Files:
  lldb/include/lldb/Utility/FileCollector.h
  lldb/source/Utility/CMakeLists.txt
  lldb/source/Utility/FileCollector.cpp
  lldb/unittests/Utility/CMakeLists.txt
  lldb/unittests/Utility/FileCollectorTest.cpp
  llvm/include/llvm/Support/FileCollector.h
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/FileCollector.cpp
  llvm/unittests/Support/CMakeLists.txt
  llvm/unittests/Support/FileCollectorTest.cpp

Index: llvm/unittests/Support/FileCollectorTest.cpp
===
--- llvm/unittests/Support/FileCollectorTest.cpp
+++ llvm/unittests/Support/FileCollectorTest.cpp
@@ -9,13 +9,10 @@
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
-#include "lldb/Utility/FileCollector.h"
-#include "lldb/Utility/FileSpec.h"
-
+#include "llvm/Support/FileCollector.h"
 #include "llvm/Support/FileSystem.h"
 
 using namespace llvm;
-using namespace lldb_private;
 
 namespace llvm {
 namespace vfs {
@@ -35,8 +32,8 @@
   using FileCollector::m_symlink_map;
   using FileCollector::m_vfs_writer;
 
-  bool HasSeen(FileSpec fs) {
-return m_seen.find(fs.GetPath()) != m_seen.end();
+  bool HasSeen(StringRef fs) {
+return m_seen.find(fs) != m_seen.end();
   }
 };
 
@@ -104,23 +101,23 @@
 
 TEST(FileCollectorTest, AddFile) {
   ScopedDir root("add_file_root", true);
-  FileSpec root_fs(root.Path);
+  std::string root_fs = root.Path.str();
   TestingFileCollector file_collector(root_fs, root_fs);
 
-  file_collector.AddFile(FileSpec("/path/to/a"));
-  file_collector.AddFile(FileSpec("/path/to/b"));
-  file_collector.AddFile(FileSpec("/path/to/c"));
+  file_collector.AddFile("/path/to/a");
+  file_collector.AddFile("/path/to/b");
+  file_collector.AddFile("/path/to/c");
 
   // Make sure the root is correct.
   EXPECT_EQ(file_collector.m_root, root_fs);
 
   // Make sure we've seen all the added files.
-  EXPECT_TRUE(file_collector.HasSeen(FileSpec("/path/to/a")));
-  EXPECT_TRUE(file_collector.HasSeen(FileSpec("/path/to/b")));
-  EXPECT_TRUE(file_collector.HasSeen(FileSpec("/path/to/c")));
+  EXPECT_TRUE(file_collector.HasSeen("/path/to/a"));
+  EXPECT_TRUE(file_collector.HasSeen("/path/to/b"));
+  EXPECT_TRUE(file_collector.HasSeen("/path/to/c"));
 
   // Make sure we've only seen the added files.
-  EXPECT_FALSE(file_collector.HasSeen(FileSpec("/path/to/d")));
+  EXPECT_FALSE(file_collector.HasSeen("/path/to/d"));
 }
 
 TEST(FileCollectorTest, CopyFiles) {
@@ -131,7 +128,7 @@
 
   // Create file collector and add files.
   ScopedDir root("copy_files_root", true);
-  FileSpec root_fs(root.Path);
+  std::string root_fs = root.Path.str();
   TestingFileCollector file_collector(root_fs, root_fs);
   file_collector.AddFile(a.Path);
   file_collector.AddFile(b.Path);
@@ -173,7 +170,7 @@
 
   // Root where files are copied to.
   ScopedDir reproducer_root("reproducer_root", true);
-  FileSpec root_fs(reproducer_root.Path);
+  std::string root_fs = reproducer_root.Path.str();
   TestingFileCollector file_collector(root_fs, root_fs);
 
   // Add all the files to the collector.
Index: llvm/unittests/Support/CMakeLists.txt
===
--- llvm/unittests/Support/CMakeLists.txt
+++ llvm/unittests/Support/CMakeLists.txt
@@ -30,6 +30,7 @@
   ErrorOrTest.cpp
   ErrorTest.cpp
   FileCheckTest.cpp
+  FileCollectorTest.cpp
   FileOutputBufferTest.cpp
   FormatVariadicTest.cpp
   GlobPatternTest.cpp
Index: llvm/lib/Support/FileCollector.cpp
===
--- llvm/lib/Support/FileCollector.cpp
+++ llvm/lib/Support/FileCollector.cpp
@@ -6,14 +6,12 @@
 //
 //===--===//
 
-#include "lldb/Utility/FileCollector.h"
-
+#include "llvm/Support/FileCollector.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 
-using namespace lldb_private;
 using namespace llvm;
 
 static bool IsCaseSensitivePath(StringRef path) {
@@ -34,9 +32,9 @@
   return true;
 }
 
-FileCollector::FileCollector(const FileSpec , const FileSpec _root)
-: m_root(root), m_overlay_root(overlay_root) {
-  sys::fs::create_directories(m_root.GetPath(), true);
+FileCollector::FileCollector(std::string root, std::string overlay_root)
+: m_root(std::move(root)), m_overlay_root(std::move(overlay_root)) {
+  sys::fs::create_directories(this->m_root, true);
 }
 
 bool FileCollector::GetRealPath(StringRef src_path,
@@ -71,8 +69,6 @@
 }
 
 void FileCollector::AddFileImpl(StringRef src_path) {
-  std::string root = m_root.GetPath();
-
   // We need an absolute src path to append to the root.
   SmallString<256> absolute_src = src_path;
   

[Lldb-commits] [PATCH] D65237: [Support] move FileCollector from LLDB to llvm/Support

2019-07-24 Thread Jan Korous via Phabricator via lldb-commits
jkorous added inline comments.



Comment at: llvm/include/llvm/Support/FileCollector.h:40
+
+protected:
+  void AddFileImpl(StringRef src_path);

TLDR: private?

I'm just wondering if we could make the class safer or the correct use more 
obvious for classes deriving from it (if we want to support that).

The couple protected members and methods seem suggesting it's fine to use these 
from a derived class implementation. IIUC `m_mutex` is guarding `m_vfs_writer`, 
`m_seen ` and `m_symlink_map` and while it is being locked in implementation of 
public method `AddFile`, protected methods seem to be assuming their callers 
lock the mutex. Specifically there's a potential for a data race in 
`AddFileImpl` (calling `GetRealPath` which uses `m_symlink_map`) and in 
`AddFileToMapping` if either is called directly from a derived class.

Since `lldb_private::FileCollector` seems to be using only the public interface 
we might just declare the above private (and maybe add a doc comment when 
caller of a method is expected to lock the mutex)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65237/new/

https://reviews.llvm.org/D65237



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


[Lldb-commits] [PATCH] D65237: [Support] move FileCollector from LLDB to llvm/Support

2019-07-24 Thread Alex Lorenz via Phabricator via lldb-commits
arphaman updated this revision to Diff 211591.
arphaman added a comment.
Herald added a subscriber: ormris.

Small bug fix.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65237/new/

https://reviews.llvm.org/D65237

Files:
  lldb/include/lldb/Utility/FileCollector.h
  lldb/source/Utility/CMakeLists.txt
  lldb/source/Utility/FileCollector.cpp
  lldb/unittests/Utility/CMakeLists.txt
  lldb/unittests/Utility/FileCollectorTest.cpp
  llvm/include/llvm/Support/FileCollector.h
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/FileCollector.cpp
  llvm/unittests/Support/CMakeLists.txt
  llvm/unittests/Support/FileCollectorTest.cpp

Index: llvm/unittests/Support/FileCollectorTest.cpp
===
--- llvm/unittests/Support/FileCollectorTest.cpp
+++ llvm/unittests/Support/FileCollectorTest.cpp
@@ -9,13 +9,10 @@
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
-#include "lldb/Utility/FileCollector.h"
-#include "lldb/Utility/FileSpec.h"
-
+#include "llvm/Support/FileCollector.h"
 #include "llvm/Support/FileSystem.h"
 
 using namespace llvm;
-using namespace lldb_private;
 
 namespace llvm {
 namespace vfs {
@@ -35,8 +32,8 @@
   using FileCollector::m_symlink_map;
   using FileCollector::m_vfs_writer;
 
-  bool HasSeen(FileSpec fs) {
-return m_seen.find(fs.GetPath()) != m_seen.end();
+  bool HasSeen(StringRef fs) {
+return m_seen.find(fs) != m_seen.end();
   }
 };
 
@@ -104,23 +101,23 @@
 
 TEST(FileCollectorTest, AddFile) {
   ScopedDir root("add_file_root", true);
-  FileSpec root_fs(root.Path);
+  std::string root_fs = root.Path.str();
   TestingFileCollector file_collector(root_fs, root_fs);
 
-  file_collector.AddFile(FileSpec("/path/to/a"));
-  file_collector.AddFile(FileSpec("/path/to/b"));
-  file_collector.AddFile(FileSpec("/path/to/c"));
+  file_collector.AddFile("/path/to/a");
+  file_collector.AddFile("/path/to/b");
+  file_collector.AddFile("/path/to/c");
 
   // Make sure the root is correct.
   EXPECT_EQ(file_collector.m_root, root_fs);
 
   // Make sure we've seen all the added files.
-  EXPECT_TRUE(file_collector.HasSeen(FileSpec("/path/to/a")));
-  EXPECT_TRUE(file_collector.HasSeen(FileSpec("/path/to/b")));
-  EXPECT_TRUE(file_collector.HasSeen(FileSpec("/path/to/c")));
+  EXPECT_TRUE(file_collector.HasSeen("/path/to/a"));
+  EXPECT_TRUE(file_collector.HasSeen("/path/to/b"));
+  EXPECT_TRUE(file_collector.HasSeen("/path/to/c"));
 
   // Make sure we've only seen the added files.
-  EXPECT_FALSE(file_collector.HasSeen(FileSpec("/path/to/d")));
+  EXPECT_FALSE(file_collector.HasSeen("/path/to/d"));
 }
 
 TEST(FileCollectorTest, CopyFiles) {
@@ -131,7 +128,7 @@
 
   // Create file collector and add files.
   ScopedDir root("copy_files_root", true);
-  FileSpec root_fs(root.Path);
+  std::string root_fs = root.Path.str();
   TestingFileCollector file_collector(root_fs, root_fs);
   file_collector.AddFile(a.Path);
   file_collector.AddFile(b.Path);
@@ -173,7 +170,7 @@
 
   // Root where files are copied to.
   ScopedDir reproducer_root("reproducer_root", true);
-  FileSpec root_fs(reproducer_root.Path);
+  std::string root_fs = reproducer_root.Path.str();
   TestingFileCollector file_collector(root_fs, root_fs);
 
   // Add all the files to the collector.
Index: llvm/unittests/Support/CMakeLists.txt
===
--- llvm/unittests/Support/CMakeLists.txt
+++ llvm/unittests/Support/CMakeLists.txt
@@ -30,6 +30,7 @@
   ErrorOrTest.cpp
   ErrorTest.cpp
   FileCheckTest.cpp
+  FileCollectorTest.cpp
   FileOutputBufferTest.cpp
   FormatVariadicTest.cpp
   GlobPatternTest.cpp
Index: llvm/lib/Support/FileCollector.cpp
===
--- llvm/lib/Support/FileCollector.cpp
+++ llvm/lib/Support/FileCollector.cpp
@@ -6,14 +6,12 @@
 //
 //===--===//
 
-#include "lldb/Utility/FileCollector.h"
-
+#include "llvm/Support/FileCollector.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 
-using namespace lldb_private;
 using namespace llvm;
 
 static bool IsCaseSensitivePath(StringRef path) {
@@ -34,9 +32,9 @@
   return true;
 }
 
-FileCollector::FileCollector(const FileSpec , const FileSpec _root)
-: m_root(root), m_overlay_root(overlay_root) {
-  sys::fs::create_directories(m_root.GetPath(), true);
+FileCollector::FileCollector(std::string root, std::string overlay_root)
+: m_root(std::move(root)), m_overlay_root(std::move(overlay_root)) {
+  sys::fs::create_directories(this->m_root, true);
 }
 
 bool FileCollector::GetRealPath(StringRef src_path,
@@ -71,8 +69,6 @@
 }
 
 void FileCollector::AddFileImpl(StringRef src_path) {
-  std::string root = m_root.GetPath();
-
   // We need an absolute src path to append to the root.
   

[Lldb-commits] [PATCH] D65230: [CMake] Loosen Python version check and ignore patch version

2019-07-24 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

Interesting way to get from version to list! :)

Cosmetics: It looks like `PYTHON_VERSION_STRING` and 
`PYTHONLIBS_VERSION_STRING` are global and all others are local variables? 
Using lowercase names for locals makes it easier to see. As names are 
case-sensitive, it would also avoid the collision with the actual 
`PYTHON_MAJOR/MINOR`.




Comment at: lldb/cmake/modules/LLDBConfig.cmake:205
+# doesn't set PYTHON_VERSION_MAJOR or PYTHON_VERSION_MINOR. Use the LLDB
+# prefix to not shadow the actual variables.
+string(REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHON_VERSION_STRING})

I think CMake would not shadow, but overwrite them in directory scope (which is 
root here, so everywhere except the cache).


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65230/new/

https://reviews.llvm.org/D65230



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


[Lldb-commits] [PATCH] D65237: [Support] move FileCollector from LLDB to llvm/Support

2019-07-24 Thread Alex Lorenz via Phabricator via lldb-commits
arphaman created this revision.
arphaman added a reviewer: JDevlieghere.
Herald added subscribers: dexonsmith, jkorous, hiraditya, mgorny.
Herald added projects: LLDB, LLVM.

The file collector class is useful for creating reproducers, not just for LLDB, 
but for other tools. That's why it should live in LLVM. I'm planning to use it 
in Clang to generate reproducers for `clang-scan-deps`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65237

Files:
  lldb/include/lldb/Utility/FileCollector.h
  lldb/source/Utility/CMakeLists.txt
  lldb/source/Utility/FileCollector.cpp
  lldb/unittests/Utility/CMakeLists.txt
  lldb/unittests/Utility/FileCollectorTest.cpp
  llvm/include/llvm/Support/FileCollector.h
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/FileCollector.cpp
  llvm/unittests/Support/CMakeLists.txt
  llvm/unittests/Support/FileCollectorTest.cpp

Index: llvm/unittests/Support/FileCollectorTest.cpp
===
--- llvm/unittests/Support/FileCollectorTest.cpp
+++ llvm/unittests/Support/FileCollectorTest.cpp
@@ -9,13 +9,10 @@
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
-#include "lldb/Utility/FileCollector.h"
-#include "lldb/Utility/FileSpec.h"
-
+#include "llvm/Support/FileCollector.h"
 #include "llvm/Support/FileSystem.h"
 
 using namespace llvm;
-using namespace lldb_private;
 
 namespace llvm {
 namespace vfs {
@@ -35,8 +32,8 @@
   using FileCollector::m_symlink_map;
   using FileCollector::m_vfs_writer;
 
-  bool HasSeen(FileSpec fs) {
-return m_seen.find(fs.GetPath()) != m_seen.end();
+  bool HasSeen(StringRef fs) {
+return m_seen.find(fs) != m_seen.end();
   }
 };
 
@@ -104,23 +101,23 @@
 
 TEST(FileCollectorTest, AddFile) {
   ScopedDir root("add_file_root", true);
-  FileSpec root_fs(root.Path);
+  std::string root_fs = root.Path.str();
   TestingFileCollector file_collector(root_fs, root_fs);
 
-  file_collector.AddFile(FileSpec("/path/to/a"));
-  file_collector.AddFile(FileSpec("/path/to/b"));
-  file_collector.AddFile(FileSpec("/path/to/c"));
+  file_collector.AddFile("/path/to/a");
+  file_collector.AddFile("/path/to/b");
+  file_collector.AddFile("/path/to/c");
 
   // Make sure the root is correct.
   EXPECT_EQ(file_collector.m_root, root_fs);
 
   // Make sure we've seen all the added files.
-  EXPECT_TRUE(file_collector.HasSeen(FileSpec("/path/to/a")));
-  EXPECT_TRUE(file_collector.HasSeen(FileSpec("/path/to/b")));
-  EXPECT_TRUE(file_collector.HasSeen(FileSpec("/path/to/c")));
+  EXPECT_TRUE(file_collector.HasSeen("/path/to/a"));
+  EXPECT_TRUE(file_collector.HasSeen("/path/to/b"));
+  EXPECT_TRUE(file_collector.HasSeen("/path/to/c"));
 
   // Make sure we've only seen the added files.
-  EXPECT_FALSE(file_collector.HasSeen(FileSpec("/path/to/d")));
+  EXPECT_FALSE(file_collector.HasSeen("/path/to/d"));
 }
 
 TEST(FileCollectorTest, CopyFiles) {
@@ -131,7 +128,7 @@
 
   // Create file collector and add files.
   ScopedDir root("copy_files_root", true);
-  FileSpec root_fs(root.Path);
+  std::string root_fs = root.Path.str();
   TestingFileCollector file_collector(root_fs, root_fs);
   file_collector.AddFile(a.Path);
   file_collector.AddFile(b.Path);
@@ -173,7 +170,7 @@
 
   // Root where files are copied to.
   ScopedDir reproducer_root("reproducer_root", true);
-  FileSpec root_fs(reproducer_root.Path);
+  std::string root_fs = reproducer_root.Path.str();
   TestingFileCollector file_collector(root_fs, root_fs);
 
   // Add all the files to the collector.
Index: llvm/unittests/Support/CMakeLists.txt
===
--- llvm/unittests/Support/CMakeLists.txt
+++ llvm/unittests/Support/CMakeLists.txt
@@ -30,6 +30,7 @@
   ErrorOrTest.cpp
   ErrorTest.cpp
   FileCheckTest.cpp
+  FileCollectorTest.cpp
   FileOutputBufferTest.cpp
   FormatVariadicTest.cpp
   GlobPatternTest.cpp
Index: llvm/lib/Support/FileCollector.cpp
===
--- llvm/lib/Support/FileCollector.cpp
+++ llvm/lib/Support/FileCollector.cpp
@@ -6,14 +6,12 @@
 //
 //===--===//
 
-#include "lldb/Utility/FileCollector.h"
-
+#include "llvm/Support/FileCollector.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 
-using namespace lldb_private;
 using namespace llvm;
 
 static bool IsCaseSensitivePath(StringRef path) {
@@ -34,9 +32,9 @@
   return true;
 }
 
-FileCollector::FileCollector(const FileSpec , const FileSpec _root)
-: m_root(root), m_overlay_root(overlay_root) {
-  sys::fs::create_directories(m_root.GetPath(), true);
+FileCollector::FileCollector(std::string root, std::string overlay_root)
+: m_root(std::move(root)), m_overlay_root(std::move(overlay_root)) {
+  sys::fs::create_directories(this->m_root, true);
 }
 
 bool 

[Lldb-commits] [PATCH] D65165: [Symbol] Fix some botched logic in Variable::GetLanguage

2019-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

LGTM with Pavel's suggestion.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65165/new/

https://reviews.llvm.org/D65165



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


[Lldb-commits] [PATCH] D65128: [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

2019-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366936: [Logging] Replace Log::Printf with LLDB_LOG macro 
(NFC) (authored by JDevlieghere, committed by ).
Herald added subscribers: llvm-commits, jrtc27.
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D65128?vs=211350=211565#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65128/new/

https://reviews.llvm.org/D65128

Files:
  lldb/trunk/include/lldb/Utility/Log.h
  lldb/trunk/source/API/SBDebugger.cpp
  lldb/trunk/source/API/SBFrame.cpp
  lldb/trunk/source/API/SBTarget.cpp
  lldb/trunk/source/Breakpoint/Breakpoint.cpp
  lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
  lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
  lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp
  lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Core/AddressResolverFileLine.cpp
  lldb/trunk/source/Core/Communication.cpp
  lldb/trunk/source/Core/FormatEntity.cpp
  lldb/trunk/source/Core/Mangled.cpp
  lldb/trunk/source/Core/Module.cpp
  lldb/trunk/source/Core/ModuleList.cpp
  lldb/trunk/source/Core/ValueObject.cpp
  lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
  lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
  lldb/trunk/source/DataFormatters/FormatManager.cpp
  lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp
  lldb/trunk/source/Expression/DWARFExpression.cpp
  lldb/trunk/source/Expression/ExpressionVariable.cpp
  lldb/trunk/source/Expression/FunctionCaller.cpp
  lldb/trunk/source/Expression/IRExecutionUnit.cpp
  lldb/trunk/source/Expression/IRInterpreter.cpp
  lldb/trunk/source/Expression/IRMemoryMap.cpp
  lldb/trunk/source/Expression/LLVMUserExpression.cpp
  lldb/trunk/source/Expression/Materializer.cpp
  lldb/trunk/source/Expression/UserExpression.cpp
  lldb/trunk/source/Host/common/Host.cpp
  lldb/trunk/source/Host/common/HostInfoBase.cpp
  lldb/trunk/source/Host/common/HostNativeThreadBase.cpp
  lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
  lldb/trunk/source/Host/common/NativeRegisterContext.cpp
  lldb/trunk/source/Host/common/Socket.cpp
  lldb/trunk/source/Host/common/TCPSocket.cpp
  lldb/trunk/source/Host/common/UDPSocket.cpp
  lldb/trunk/source/Host/linux/HostInfoLinux.cpp
  lldb/trunk/source/Host/macosx/objcxx/Host.mm
  lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm
  lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp
  lldb/trunk/source/Interpreter/CommandInterpreter.cpp
  lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
  lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
  lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
  lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
  lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
  lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
  lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
  lldb/trunk/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
  lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
  lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  

[Lldb-commits] [lldb] r366936 - [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

2019-07-24 Thread Jonas Devlieghere via lldb-commits
Modified: lldb/trunk/source/Target/Thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=366936=366935=366936=diff
==
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Wed Jul 24 10:56:10 2019
@@ -256,9 +256,8 @@ Thread::Thread(Process , lldb::t
   m_override_should_notify(eLazyBoolCalculate),
   m_extended_info_fetched(false), m_extended_info() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-log->Printf("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")",
-static_cast(this), GetID());
+  LLDB_LOGF(log, "%p Thread::Thread(tid = 0x%4.4" PRIx64 ")",
+static_cast(this), GetID());
 
   CheckInWithManager();
 
@@ -267,9 +266,8 @@ Thread::Thread(Process , lldb::t
 
 Thread::~Thread() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-log->Printf("%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")",
-static_cast(this), GetID());
+  LLDB_LOGF(log, "%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")",
+static_cast(this), GetID());
   /// If you hit this assert, it means your derived class forgot to call
   /// DoDestroy in its destructor.
   assert(m_destroy_called);
@@ -490,11 +488,10 @@ void Thread::SetStopInfo(const lldb::Sto
   else
 m_stop_info_stop_id = UINT32_MAX;
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-log->Printf("%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)",
-static_cast(this), GetID(),
-stop_info_sp ? stop_info_sp->GetDescription() : "",
-m_stop_info_stop_id);
+  LLDB_LOGF(log, "%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)",
+static_cast(this), GetID(),
+stop_info_sp ? stop_info_sp->GetDescription() : "",
+m_stop_info_stop_id);
 }
 
 void Thread::SetShouldReportStop(Vote vote) {
@@ -721,18 +718,18 @@ bool Thread::ShouldStop(Event *event_ptr
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
   if (GetResumeState() == eStateSuspended) {
-if (log)
-  log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
-  ", should_stop = 0 (ignore since thread was suspended)",
-  __FUNCTION__, GetID(), GetProtocolID());
+LLDB_LOGF(log,
+  "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+  ", should_stop = 0 (ignore since thread was suspended)",
+  __FUNCTION__, GetID(), GetProtocolID());
 return false;
   }
 
   if (GetTemporaryResumeState() == eStateSuspended) {
-if (log)
-  log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
-  ", should_stop = 0 (ignore since thread was suspended)",
-  __FUNCTION__, GetID(), GetProtocolID());
+LLDB_LOGF(log,
+  "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+  ", should_stop = 0 (ignore since thread was suspended)",
+  __FUNCTION__, GetID(), GetProtocolID());
 return false;
   }
 
@@ -740,28 +737,28 @@ bool Thread::ShouldStop(Event *event_ptr
   // thread caused the process to stop. NOTE: this must take place before the
   // plan is moved from the current plan stack to the completed plan stack.
   if (!ThreadStoppedForAReason()) {
-if (log)
-  log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
-  ", pc = 0x%16.16" PRIx64
-  ", should_stop = 0 (ignore since no stop reason)",
-  __FUNCTION__, GetID(), GetProtocolID(),
-  GetRegisterContext() ? GetRegisterContext()->GetPC()
-   : LLDB_INVALID_ADDRESS);
+LLDB_LOGF(log,
+  "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+  ", pc = 0x%16.16" PRIx64
+  ", should_stop = 0 (ignore since no stop reason)",
+  __FUNCTION__, GetID(), GetProtocolID(),
+  GetRegisterContext() ? GetRegisterContext()->GetPC()
+   : LLDB_INVALID_ADDRESS);
 return false;
   }
 
   if (log) {
-log->Printf("Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
-", pc = 0x%16.16" PRIx64,
-__FUNCTION__, static_cast(this), GetID(),
-GetProtocolID(),
-GetRegisterContext() ? GetRegisterContext()->GetPC()
- : LLDB_INVALID_ADDRESS);
-log->Printf(" Thread::ShouldStop Begin ");
+LLDB_LOGF(log,
+  "Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+  ", pc = 0x%16.16" PRIx64,
+  __FUNCTION__, static_cast(this), GetID(), 
GetProtocolID(),
+  GetRegisterContext() ? GetRegisterContext()->GetPC()
+

[Lldb-commits] [PATCH] D65208: SymbolVendor: Move Symtab construction into the SymbolFile

2019-07-24 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

So the original idea behind the symbol vendor was that if you have more than 
one binary: stripped installed binary, and unstripped debug info binary with 
symbols, that the symbol table could be generated by using one or more object 
files. It would be nice to ensure we can still do this somehow.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65208/new/

https://reviews.llvm.org/D65208



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


[Lldb-commits] [PATCH] D65230: [CMake] Loosen Python version check and ignore patch version

2019-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: shafik, arphaman, sgraenitz, davide.
JDevlieghere added a project: LLDB.
Herald added subscribers: dexonsmith, mgorny.

Some versions of macOS report a different patch version for the system provided 
interpreter and libraries.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65230

Files:
  lldb/cmake/modules/LLDBConfig.cmake


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -199,9 +199,24 @@
 find_package(PythonLibs REQUIRED)
   endif()
 
-  if (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING AND
-  NOT CMAKE_CROSSCOMPILING)
-message(FATAL_ERROR "Found incompatible Python interpreter 
(${PYTHON_VERSION_STRING}) and Python libraries (${PYTHONLIBS_VERSION_STRING})")
+  if (NOT CMAKE_CROSSCOMPILING)
+# Manually split PYTHON_VERSION_STRING because find_python_libs_windows
+# doesn't set PYTHON_VERSION_MAJOR or PYTHON_VERSION_MINOR. Use the LLDB
+# prefix to not shadow the actual variables.
+string(REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHON_VERSION_STRING})
+string(REPLACE "." ";" PYTHONLIBS_VERSION_LIST 
${PYTHONLIBS_VERSION_STRING})
+list(GET PYTHON_VERSION_LIST 0 LLDB_PYTHON_MAJOR)
+list(GET PYTHON_VERSION_LIST 1 LLDB_PYTHON_MINOR)
+list(GET PYTHONLIBS_VERSION_LIST 0 LLDB_PYTHONLIBS_MAJOR)
+list(GET PYTHONLIBS_VERSION_LIST 1 LLDB_PYTHONLIBS_MINOR)
+
+# Ignore the patch version. Some versions of macOS report a different patch
+# version for the system provided interpreter and libraries.
+if (NOT LLDB_PYTHON_MAJOR VERSION_EQUAL LLDB_PYTHONLIBS_MAJOR OR
+NOT LLDB_PYTHON_MINOR VERSION_EQUAL LLDB_PYTHONLIBS_MINOR)
+  message(FATAL_ERROR "Found incompatible Python interpreter 
(${LLDB_PYTHON_MAJOR}.${LLDB_PYTHON_MINOR})"
+  " and Python libraries 
(${LLDB_PYTHONLIBS_MAJOR}.${LLDB_PYTHONLIBS_MINOR})")
+endif()
   endif()
 
   if (PYTHON_INCLUDE_DIR)


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -199,9 +199,24 @@
 find_package(PythonLibs REQUIRED)
   endif()
 
-  if (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING AND
-  NOT CMAKE_CROSSCOMPILING)
-message(FATAL_ERROR "Found incompatible Python interpreter (${PYTHON_VERSION_STRING}) and Python libraries (${PYTHONLIBS_VERSION_STRING})")
+  if (NOT CMAKE_CROSSCOMPILING)
+# Manually split PYTHON_VERSION_STRING because find_python_libs_windows
+# doesn't set PYTHON_VERSION_MAJOR or PYTHON_VERSION_MINOR. Use the LLDB
+# prefix to not shadow the actual variables.
+string(REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHON_VERSION_STRING})
+string(REPLACE "." ";" PYTHONLIBS_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
+list(GET PYTHON_VERSION_LIST 0 LLDB_PYTHON_MAJOR)
+list(GET PYTHON_VERSION_LIST 1 LLDB_PYTHON_MINOR)
+list(GET PYTHONLIBS_VERSION_LIST 0 LLDB_PYTHONLIBS_MAJOR)
+list(GET PYTHONLIBS_VERSION_LIST 1 LLDB_PYTHONLIBS_MINOR)
+
+# Ignore the patch version. Some versions of macOS report a different patch
+# version for the system provided interpreter and libraries.
+if (NOT LLDB_PYTHON_MAJOR VERSION_EQUAL LLDB_PYTHONLIBS_MAJOR OR
+NOT LLDB_PYTHON_MINOR VERSION_EQUAL LLDB_PYTHONLIBS_MINOR)
+  message(FATAL_ERROR "Found incompatible Python interpreter (${LLDB_PYTHON_MAJOR}.${LLDB_PYTHON_MINOR})"
+  " and Python libraries (${LLDB_PYTHONLIBS_MAJOR}.${LLDB_PYTHONLIBS_MINOR})")
+endif()
   endif()
 
   if (PYTHON_INCLUDE_DIR)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r366932 - [lldb] Configure debugserver_vers.c from CMake

2019-07-24 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Wed Jul 24 10:28:24 2019
New Revision: 366932

URL: http://llvm.org/viewvc/llvm-project?rev=366932=rev
Log:
[lldb] Configure debugserver_vers.c from CMake

Added:
lldb/trunk/tools/debugserver/source/debugserver_vers.c.in
Modified:
lldb/trunk/tools/debugserver/source/CMakeLists.txt

Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=366932=366931=366932=diff
==
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Wed Jul 24 10:28:24 2019
@@ -139,6 +139,8 @@ add_custom_command(OUTPUT ${generated_ma
 
 set(DEBUGSERVER_VERS_GENERATED_FILE 
${CMAKE_CURRENT_BINARY_DIR}/debugserver_vers.c)
 set_source_files_properties(${DEBUGSERVER_VERS_GENERATED_FILE} PROPERTIES 
GENERATED 1)
+configure_file(debugserver_vers.c.in
+   ${DEBUGSERVER_VERS_GENERATED_FILE} @ONLY)
 
 set(lldbDebugserverCommonSources
   DNBArch.cpp

Added: lldb/trunk/tools/debugserver/source/debugserver_vers.c.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver_vers.c.in?rev=366932=auto
==
--- lldb/trunk/tools/debugserver/source/debugserver_vers.c.in (added)
+++ lldb/trunk/tools/debugserver/source/debugserver_vers.c.in Wed Jul 24 
10:28:24 2019
@@ -0,0 +1,2 @@
+const unsigned char debugserverVersionString[] __attribute__ ((used)) = 
"@(#)PROGRAM:LLDB  
PROJECT:lldb-@LLDB_VERSION_MAJOR@.@LLDB_VERSION_MINOR@.@LLDB_VERSION_PATCH@" 
"\n";
+const double debugserverVersionNumber __attribute__ ((used)) = 
(double)@LLDB_VERSION_MAJOR@.@LLDB_VERSION_MINOR@;


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


[Lldb-commits] [PATCH] D65109: [LLDB] Remove the Xcode project

2019-07-24 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D65109#1598695 , @sgraenitz wrote:

> > We discussed this and came to an agreement only a few hours before in the 
> > team meeting
>
> After all, LLVM is open-source and has a community. Making preemptive 
> decisions in internal team meetings sounds concerning.
>
> > As far as we know, Greg was the only user of the Xcode project outside of 
> > Apple, and he gave the thumbs up.
>
> I was a user of the Xcode project before Apple.
>
> > I don't think removing it was especially controversial
>
> That's right. And still, it would be appreciated to give folks in other time 
> zones at least a chance to take part. Thks


To be fair, I think we would have taken more time to discuss this if it weren't 
 for the fact that Raphael's tablegen'ifying of command options had broken the 
current Xcode project in a way that was not straightforward to fix.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65109/new/

https://reviews.llvm.org/D65109



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


[Lldb-commits] [PATCH] D65165: [Symbol] Fix some botched logic in Variable::GetLanguage

2019-07-24 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D65165#1598553 , @labath wrote:

> Thanks for responding quickly. LGTM, with one comment..


Don't use checks that assume eLanguageTypeUnknown == 0, that seems really 
confusing and we don't use that practice anywhere else.  Pavel's suggestion 
seems fine.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65165/new/

https://reviews.llvm.org/D65165



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


[Lldb-commits] [PATCH] D65185: Let tablegen generate property definitions

2019-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D65185#1599262 , @labath wrote:

> .def files can omit fields too: `#define BOOL_PROPERTY(name, global, default, 
> desc) PROPERTY(name, OptionValue::eTypeBoolean, global, default, nullptr, {}, 
> desc)`. Some sanity checking sounds like it could be useful, but I'm not 
> exactly sure what kind of checks you have in mind. Being able to change the 
> representation is nice, but I expect most of those changes would also be 
> achievable with the def files. More radical changes (like the variable thing 
> I mentioned) would probably require changes regardless of how the properties 
> are generated...


I agree with you and I'm not opposed to def-files at all. I think tablegen and 
`.def` files have different trade-offs and while the latter could probably work 
for properties, I have the feeling that tablegen is a better fit. The things 
are mentioned before are just a few things that came to mind.

To give an example of sanity checking: this isn't in the patch (yet) but with 
tablegen we can ensure that every option has either a default unsigned or 
string value. In the table you can't differentiate between a default `0` and an 
explicit default value of `0`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65185/new/

https://reviews.llvm.org/D65185



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


[Lldb-commits] [PATCH] D65185: Let tablegen generate property definitions

2019-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 211528.
JDevlieghere added a comment.

Have separate tablegen files for plugins.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65185/new/

https://reviews.llvm.org/D65185

Files:
  lldb/CMakeLists.txt
  lldb/include/lldb/Core/CMakeLists.txt
  lldb/include/lldb/Core/Properties.td
  lldb/include/lldb/Core/PropertiesBase.td
  lldb/source/Core/CMakeLists.txt
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/Properties.td
  lldb/source/Plugins/JITLoader/GDB/CMakeLists.txt
  lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  lldb/source/Plugins/JITLoader/GDB/Properties.td
  lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  lldb/source/Plugins/Platform/MacOSX/Properties.td
  lldb/source/Plugins/Process/MacOSX-Kernel/CMakeLists.txt
  lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  lldb/source/Plugins/Process/MacOSX-Kernel/Properties.td
  lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/Properties.td
  lldb/source/Plugins/StructuredData/DarwinLog/CMakeLists.txt
  lldb/source/Plugins/StructuredData/DarwinLog/Properties.td
  lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/Properties.td
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/Thread.cpp
  lldb/utils/TableGen/CMakeLists.txt
  lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp
  lldb/utils/TableGen/LLDBTableGen.cpp
  lldb/utils/TableGen/LLDBTableGenBackends.h

Index: lldb/utils/TableGen/LLDBTableGenBackends.h
===
--- lldb/utils/TableGen/LLDBTableGenBackends.h
+++ lldb/utils/TableGen/LLDBTableGenBackends.h
@@ -28,6 +28,8 @@
 namespace lldb_private {
 
 void EmitOptionDefs(RecordKeeper , raw_ostream );
+void EmitPropertyDefs(RecordKeeper , raw_ostream );
+void EmitPropertyEnumDefs(RecordKeeper , raw_ostream );
 
 } // namespace lldb_private
 
Index: lldb/utils/TableGen/LLDBTableGen.cpp
===
--- lldb/utils/TableGen/LLDBTableGen.cpp
+++ lldb/utils/TableGen/LLDBTableGen.cpp
@@ -25,6 +25,8 @@
   PrintRecords,
   DumpJSON,
   GenOptionDefs,
+  GenPropertyDefs,
+  GenPropertyEnumDefs,
 };
 
 static cl::opt
@@ -34,7 +36,11 @@
   clEnumValN(DumpJSON, "dump-json",
  "Dump all records as machine-readable JSON"),
   clEnumValN(GenOptionDefs, "gen-lldb-option-defs",
- "Generate lldb option definitions")));
+ "Generate lldb option definitions"),
+  clEnumValN(GenPropertyDefs, "gen-lldb-property-defs",
+ "Generate lldb property definitions"),
+  clEnumValN(GenPropertyEnumDefs, "gen-lldb-property-enum-defs",
+ "Generate lldb property enum definitions")));
 
 static bool LLDBTableGenMain(raw_ostream , RecordKeeper ) {
   switch (Action) {
@@ -47,6 +53,12 @@
   case GenOptionDefs:
 EmitOptionDefs(Records, OS);
 break;
+  case GenPropertyDefs:
+EmitPropertyDefs(Records, OS);
+break;
+  case GenPropertyEnumDefs:
+EmitPropertyEnumDefs(Records, OS);
+break;
   }
   return false;
 }
Index: lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp
===
--- /dev/null
+++ lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp
@@ -0,0 +1,165 @@
+//===- LLDBPropertyDefEmitter.cpp -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// These tablegen backends emits LLDB's PropertyDefinition values.
+//
+//===--===//
+
+#include "LLDBTableGenBackends.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/StringMatcher.h"
+#include "llvm/TableGen/TableGenBackend.h"
+#include 
+#include 
+
+using namespace llvm;
+
+/// Map of properties definitions to their associated records. Also makes sure
+/// our 

[Lldb-commits] [PATCH] D65185: Let tablegen generate property definitions

2019-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D65185#1599215 , @JDevlieghere 
wrote:

> In D65185#1598586 , @labath wrote:
>
> > My dream is to one day be able to define a property by simply declaring a 
> > variable somewhere (say: `Property Foo(ParentProperty, "foo", 
> > "description of foo", DefaultValue);`), and that one could just get/set 
> > them via something like `context[Foo] = new_value`. In that world, to 
> > tablegenning would hopefully be necessary, but that world is still pretty 
> > far away, and your approach does help with eliminating the redundancy, so 
> > maybe it's worth doing anyway... I dunno...
> >
> > Regarding the patch itself, I have two questions/comments:
> >
> > - you put all property definitions into a single file, including those 
> > coming from "plugins". This is kind of bad as the knowledge of plugin 
> > internals leaks out. It may not be too bad, if the same effect could be 
> > achieved by just putting the definitions into a separate file and running 
> > tablegen twice, and this is just a way of avoiding that. It looks like that 
> > is the case here, but I'm not 100% sure. It's something to keep an eye on, 
> > at least, particularly, if we ever want to make "real" plugins.
>
>
> Yep, but I'm also happy to have separate files for the plugins. They have 
> only a few options, so maybe tablegen is fast enough that it doesn't really 
> matter.


Cool. Glad we're on the same page.

> 
> 
>> - I'm wondering if the same effect could not be achieved in a more low-cost 
>> way via a `.def` header file. I believe @aprantl had a patch like that at 
>> one point. The .def file could just contain something like: 
>> `LLDB_PROPERTY(eFoo, "foo", "description", default)`. When you want to 
>> define the enum, you just have the macro expand to "eFoo", when you define 
>> the property itself, you have it expand to the whole `{eFoo, ...}` blurb... 
>> The advantage of tablegen is that it allows you to define the property list 
>> via some non-trivial algorithm, but it's not clear to me whether this is 
>> needed/useful here...
> 
> The `def` file is really nice when everything has the exact same structure, 
> like things in `Dwarf.def`. The advantage of using tablegen here is that you 
> can omit fields, like the default string value when they're not needed and do 
> some sanity checking. It also has the advantage we can change the 
> representation down the road, without having to modify the tablegen files.

.def files can omit fields too: `#define BOOL_PROPERTY(name, global, default, 
desc) PROPERTY(name, OptionValue::eTypeBoolean, global, default, nullptr, {}, 
desc)`. Some sanity checking sounds like it could be useful, but I'm not 
exactly sure what kind of checks you have in mind. Being able to change the 
representation is nice, but I expect most of those changes would also be 
achievable with the def files. More radical changes (like the variable thing I 
mentioned) would probably require changes regardless of how the properties are 
generated...


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65185/new/

https://reviews.llvm.org/D65185



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


[Lldb-commits] [PATCH] D64251: Don't depend on psutil on AIX

2019-07-24 Thread David Tenty via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366912: [AIX][lit] Dont depend on psutil on AIX 
(authored by daltenty, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D64251?vs=211104=211511#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64251/new/

https://reviews.llvm.org/D64251

Files:
  libcxx/trunk/utils/libcxx/util.py
  lldb/trunk/lit/lit.cfg.py
  llvm/trunk/utils/lit/lit/LitConfig.py
  llvm/trunk/utils/lit/lit/util.py
  llvm/trunk/utils/lit/tests/googletest-timeout.py
  llvm/trunk/utils/lit/tests/lit.cfg
  llvm/trunk/utils/lit/tests/shtest-timeout.py

Index: llvm/trunk/utils/lit/lit/LitConfig.py
===
--- llvm/trunk/utils/lit/lit/LitConfig.py
+++ llvm/trunk/utils/lit/lit/LitConfig.py
@@ -1,6 +1,7 @@
 from __future__ import absolute_import
 import inspect
 import os
+import platform
 import sys
 
 import lit.Test
@@ -76,6 +77,19 @@
 """
 return self._maxIndividualTestTime
 
+@property
+def maxIndividualTestTimeIsSupported(self):
+"""
+Returns a tuple ( , )
+where
+`` is True if setting maxIndividualTestTime is supported
+on the current host, returns False otherwise.
+`` is an empty string if `` is True,
+otherwise is contains a string describing why setting
+maxIndividualTestTime is not supported.
+"""
+return lit.util.killProcessAndChildrenIsSupported()
+
 @maxIndividualTestTime.setter
 def maxIndividualTestTime(self, value):
 """
@@ -86,16 +100,13 @@
 self.fatal('maxIndividualTestTime must set to a value of type int.')
 self._maxIndividualTestTime = value
 if self.maxIndividualTestTime > 0:
-# The current implementation needs psutil to set
+# The current implementation needs psutil on some platforms to set
 # a timeout per test. Check it's available.
 # See lit.util.killProcessAndChildren()
-try:
-import psutil  # noqa: F401
-except ImportError:
-self.fatal("Setting a timeout per test requires the"
-   " Python psutil module but it could not be"
-   " found. Try installing it via pip or via"
-   " your operating system's package manager.")
+supported, errormsg = self.maxIndividualTestTimeIsSupported
+if not supported:
+self.fatal('Setting a timeout per test not supported. ' +
+   errormsg)
 elif self.maxIndividualTestTime < 0:
 self.fatal('The timeout per test must be >= 0 seconds')
 
Index: llvm/trunk/utils/lit/lit/util.py
===
--- llvm/trunk/utils/lit/lit/util.py
+++ llvm/trunk/utils/lit/lit/util.py
@@ -423,34 +423,56 @@
 return out.decode()
 return None
 
+def killProcessAndChildrenIsSupported():
+"""
+Returns a tuple ( , )
+where
+`` is True if `killProcessAndChildren()` is supported on
+the current host, returns False otherwise.
+`` is an empty string if `` is True,
+otherwise is contains a string describing why the function is
+not supported.
+"""
+if platform.system() == 'AIX':
+return (True, "")
+try:
+import psutil  # noqa: F401
+return (True, "")
+except ImportError:
+return (False,  "Requires the Python psutil module but it could"
+" not be found. Try installing it via pip or via"
+" your operating system's package manager.")
 
 def killProcessAndChildren(pid):
 """This function kills a process with ``pid`` and all its running children
-(recursively). It is currently implemented using the psutil module which
-provides a simple platform neutral implementation.
+(recursively). It is currently implemented using the psutil module on some
+platforms which provides a simple platform neutral implementation.
 
-TODO: Reimplement this without using psutil so we can   remove
-our dependency on it.
+TODO: Reimplement this without using psutil on all platforms so we can
+remove our dependency on it.
 
 """
-import psutil
-try:
-psutilProc = psutil.Process(pid)
-# Handle the different psutil API versions
+if platform.system() == 'AIX':
+subprocess.call('kill -kill $(ps -o pid= -L{})'.format(pid), shell=True)
+else:
+import psutil
 try:
-# psutil >= 2.x
-children_iterator = psutilProc.children(recursive=True)
-except AttributeError:
-# 

[Lldb-commits] [PATCH] D65185: Let tablegen generate property definitions

2019-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D65185#1598586 , @labath wrote:

> My dream is to one day be able to define a property by simply declaring a 
> variable somewhere (say: `Property Foo(ParentProperty, "foo", "description 
> of foo", DefaultValue);`), and that one could just get/set them via something 
> like `context[Foo] = new_value`. In that world, to tablegenning would 
> hopefully be necessary, but that world is still pretty far away, and your 
> approach does help with eliminating the redundancy, so maybe it's worth doing 
> anyway... I dunno...
>
> Regarding the patch itself, I have two questions/comments:
>
> - you put all property definitions into a single file, including those coming 
> from "plugins". This is kind of bad as the knowledge of plugin internals 
> leaks out. It may not be too bad, if the same effect could be achieved by 
> just putting the definitions into a separate file and running tablegen twice, 
> and this is just a way of avoiding that. It looks like that is the case here, 
> but I'm not 100% sure. It's something to keep an eye on, at least, 
> particularly, if we ever want to make "real" plugins.


Yep, but I'm also happy to have separate files for the plugins. They have only 
a few options, so maybe tablegen is fast enough that it doesn't really matter.

> - I'm wondering if the same effect could not be achieved in a more low-cost 
> way via a `.def` header file. I believe @aprantl had a patch like that at one 
> point. The .def file could just contain something like: `LLDB_PROPERTY(eFoo, 
> "foo", "description", default)`. When you want to define the enum, you just 
> have the macro expand to "eFoo", when you define the property itself, you 
> have it expand to the whole `{eFoo, ...}` blurb... The advantage of tablegen 
> is that it allows you to define the property list via some non-trivial 
> algorithm, but it's not clear to me whether this is needed/useful here...

The `def` file is really nice when everything has the exact same structure, 
like things in `Dwarf.def`. The advantage of using tablegen here is that you 
can omit fields, like the default string value when they're not needed and do 
some sanity checking. It also has the advantage we can change the 
representation down the road, without having to modify the tablegen files.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65185/new/

https://reviews.llvm.org/D65185



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


[Lldb-commits] [PATCH] D65208: SymbolVendor: Move Symtab construction into the SymbolFile

2019-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, JDevlieghere, jingham.
Herald added subscribers: MaskRay, arichardson, mgorny, emaste.
Herald added a reviewer: espindola.
labath added a parent revision: D65135: SymbolVendor: Remove the type list 
member.

Instead of having SymbolVendor coordinate Symtab construction between
Symbol and Object files, make the SymbolVendor function a passthrough,
and put all of the logic into the SymbolFile.


https://reviews.llvm.org/D65208

Files:
  include/lldb/Symbol/SymbolFile.h
  include/lldb/Symbol/SymbolVendor.h
  source/Symbol/SymbolFile.cpp
  source/Symbol/SymbolVendor.cpp
  unittests/Core/CMakeLists.txt
  unittests/Core/MangledTest.cpp
  unittests/ObjectFile/ELF/CMakeLists.txt
  unittests/ObjectFile/ELF/TestObjectFileELF.cpp
  unittests/Symbol/CMakeLists.txt
  unittests/Symbol/TestDWARFCallFrameInfo.cpp
  unittests/Target/CMakeLists.txt
  unittests/Target/ModuleCacheTest.cpp

Index: unittests/Target/ModuleCacheTest.cpp
===
--- unittests/Target/ModuleCacheTest.cpp
+++ unittests/Target/ModuleCacheTest.cpp
@@ -5,6 +5,7 @@
 #include "llvm/Support/Path.h"
 
 #include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
+#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
 #include "TestingSupport/TestUtilities.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
@@ -69,12 +70,14 @@
   FileSystem::Initialize();
   HostInfo::Initialize();
   ObjectFileELF::Initialize();
+  SymbolFileSymtab::Initialize();
 
   s_cache_dir = HostInfo::GetProcessTempDir();
   s_test_executable = GetInputFilePath(module_name);
 }
 
 void ModuleCacheTest::TearDownTestCase() {
+  SymbolFileSymtab::Terminate();
   ObjectFileELF::Terminate();
   HostInfo::Terminate();
   FileSystem::Terminate();
Index: unittests/Target/CMakeLists.txt
===
--- unittests/Target/CMakeLists.txt
+++ unittests/Target/CMakeLists.txt
@@ -10,6 +10,7 @@
   lldbSymbol
   lldbUtility
   lldbPluginObjectFileELF
+  lldbPluginSymbolFileSymtab
   lldbUtilityHelpers
 LINK_COMPONENTS
   Support
Index: unittests/Symbol/TestDWARFCallFrameInfo.cpp
===
--- unittests/Symbol/TestDWARFCallFrameInfo.cpp
+++ unittests/Symbol/TestDWARFCallFrameInfo.cpp
@@ -11,6 +11,7 @@
 
 #include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
 #include "Plugins/Process/Utility/RegisterContext_x86.h"
+#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
 #include "TestingSupport/TestUtilities.h"
 
 #include "lldb/Core/Module.h"
@@ -36,9 +37,11 @@
 FileSystem::Initialize();
 HostInfo::Initialize();
 ObjectFileELF::Initialize();
+SymbolFileSymtab::Initialize();
   }
 
   void TearDown() override {
+SymbolFileSymtab::Terminate();
 ObjectFileELF::Terminate();
 HostInfo::Terminate();
 FileSystem::Terminate();
Index: unittests/Symbol/CMakeLists.txt
===
--- unittests/Symbol/CMakeLists.txt
+++ unittests/Symbol/CMakeLists.txt
@@ -13,6 +13,7 @@
 lldbPluginObjectFileELF
 lldbPluginObjectFileMachO
 lldbPluginSymbolFileDWARF
+lldbPluginSymbolFileSymtab
 LLVMTestingSupport
   )
 
Index: unittests/ObjectFile/ELF/TestObjectFileELF.cpp
===
--- unittests/ObjectFile/ELF/TestObjectFileELF.cpp
+++ unittests/ObjectFile/ELF/TestObjectFileELF.cpp
@@ -8,7 +8,7 @@
 //===--===//
 
 #include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
-#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
+#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
 #include "TestingSupport/TestUtilities.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
@@ -34,11 +34,11 @@
 FileSystem::Initialize();
 HostInfo::Initialize();
 ObjectFileELF::Initialize();
-SymbolVendorELF::Initialize();
+SymbolFileSymtab::Initialize();
   }
 
   void TearDown() override {
-SymbolVendorELF::Terminate();
+SymbolFileSymtab::Terminate();
 ObjectFileELF::Terminate();
 HostInfo::Terminate();
 FileSystem::Terminate();
Index: unittests/ObjectFile/ELF/CMakeLists.txt
===
--- unittests/ObjectFile/ELF/CMakeLists.txt
+++ unittests/ObjectFile/ELF/CMakeLists.txt
@@ -3,7 +3,7 @@
 
   LINK_LIBS
 lldbPluginObjectFileELF
-lldbPluginSymbolVendorELF
+lldbPluginSymbolFileSymtab
 lldbCore
 lldbUtilityHelpers
 LLVMTestingSupport
Index: unittests/Core/MangledTest.cpp
===
--- unittests/Core/MangledTest.cpp
+++ unittests/Core/MangledTest.cpp
@@ -7,7 +7,7 @@
 //===--===//
 
 #include 

[Lldb-commits] [PATCH] D65207: LLGS: fix tracking execve on linux

2019-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, jasonmolenda.

Due to a logic error, lldb-server ended up asserting/crashing every time
the debugged process attempted an execve(). This fixes the error, and
extends TestExec to work on other platforms too. The "extension"
consists of avoiding non-standard posix_spawn extensions and using the
classic execve() call, which should be available on any platform that
actually supports re-execing. I change the test decorator from
@skipUnlessDarwin to @skipIfWindows.


https://reviews.llvm.org/D65207

Files:
  packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
  packages/Python/lldbsuite/test/functionalities/exec/main.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp

Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -599,12 +599,9 @@
 // which only copies the main thread.
 LLDB_LOG(log, "exec received, stop tracking all but main thread");
 
-for (auto i = m_threads.begin(); i != m_threads.end();) {
-  if ((*i)->GetID() == GetID())
-i = m_threads.erase(i);
-  else
-++i;
-}
+llvm::erase_if(m_threads, [&](std::unique_ptr ) {
+  return t->GetID() != GetID();
+});
 assert(m_threads.size() == 1);
 auto *main_thread = static_cast(m_threads[0].get());
 
Index: packages/Python/lldbsuite/test/functionalities/exec/main.cpp
===
--- packages/Python/lldbsuite/test/functionalities/exec/main.cpp
+++ packages/Python/lldbsuite/test/functionalities/exec/main.cpp
@@ -1,76 +1,16 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
 #include 
+#include 
 
-static void
-exit_with_errno (int err, const char *prefix)
-{
-if (err)
-{
-fprintf (stderr,
- "%s%s",
- prefix ? prefix : "",
- strerror(err));
-exit (err);
-}
-}
-
-static pid_t
-spawn_process (const char *progname,
-   const char **argv,
-   const char **envp,
-   int )
-{
-pid_t pid = 0;
-
-const posix_spawn_file_actions_t *file_actions = NULL;
-posix_spawnattr_t attr;
-err = posix_spawnattr_init ();
-if (err)
-return pid;
-
-short flags = POSIX_SPAWN_SETEXEC | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK;
-err = posix_spawnattr_setflags (, flags);
-if (err == 0)
-{
-// Use the default signal masks
-sigset_t no_signals;
-sigset_t all_signals;
-sigemptyset (_signals);
-sigfillset (_signals);
-posix_spawnattr_setsigmask(, _signals);
-posix_spawnattr_setsigdefault(, _signals);
-
-err = posix_spawn (,
-   progname,
-   file_actions,
-   ,
-   (char * const *)argv,
-   (char * const *)envp);
-
-posix_spawnattr_destroy();
-}
-return pid;
-}
-
-int 
-main (int argc, char const **argv)
-{
-char *buf = (char*) malloc (strlen (argv[0]) + 12);
-strlcpy (buf, argv[0], strlen (argv[0]) + 1);
-std::string directory_name (::dirname (buf));
+int main(int argc, char const **argv) {
+  char *buf = strdup(argv[0]); // Set breakpoint 1 here
+  std::string directory_name(::dirname(buf));
 
-std::string other_program = directory_name + "/secondprog";
-int err = 0;// Set breakpoint 1 here
-spawn_process (other_program.c_str(), argv, NULL, err);
-if (err)
-exit_with_errno (err, "posix_spawn x86_64 error");
-return 0;
+  std::string other_program = directory_name + "/secondprog";
+  execve(other_program.c_str(), const_cast(argv), nullptr);
+  perror("execve");
+  abort();
 }
Index: packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
===
--- packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
+++ packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
@@ -18,17 +18,17 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-@skipUnlessDarwin
 @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
 @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems
 @skipIfSanitized # rdar://problem/43756823
+@skipIfWindows
 def test_hitting_exec (self):
 self.do_test(False)
 
-@skipUnlessDarwin
 @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
 @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios 

[Lldb-commits] [lldb] r366903 - Fix @skipIfSanitized decorator

2019-07-24 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Jul 24 06:05:56 2019
New Revision: 366903

URL: http://llvm.org/viewvc/llvm-project?rev=366903=rev
Log:
Fix @skipIfSanitized decorator

To run the test the decorator function should return None, not False.
Returning anything other than None skips the test.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=366903=366902=366903=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Wed Jul 24 06:05:56 
2019
@@ -827,6 +827,8 @@ def skipUnlessFeature(feature):
 def skipIfSanitized(func):
 """Skip this test if the environment is set up to run LLDB itself under 
ASAN."""
 def is_sanitized():
-return (('DYLD_INSERT_LIBRARIES' in os.environ) and
-'libclang_rt.asan' in os.environ['DYLD_INSERT_LIBRARIES'])
+if (('DYLD_INSERT_LIBRARIES' in os.environ) and
+'libclang_rt.asan' in os.environ['DYLD_INSERT_LIBRARIES']):
+return "ASAN unsupported"
+return None
 return skipTestIfFn(is_sanitized)(func)


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


[Lldb-commits] [lldb] r366892 - [lldb] Fix build errors from tablegenify platform commit

2019-07-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Wed Jul 24 05:08:08 2019
New Revision: 366892

URL: http://llvm.org/viewvc/llvm-project?rev=366892=rev
Log:
[lldb] Fix build errors from tablegenify platform commit

Forgot to stage some changes...

Modified:
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=366892=366891=366892=diff
==
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Wed Jul 24 05:08:08 
2019
@@ -60,7 +60,7 @@ static mode_t ParsePermissionString(llvm
 
 static constexpr OptionDefinition g_permissions_options[] = {
 #define LLDB_OPTIONS_permissions
-#include "CommandObject.inc"
+#include "CommandOptions.inc"
 };
 
 class OptionPermissions : public OptionGroup {

Modified: lldb/trunk/source/Commands/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/Options.td?rev=366892=366891=366892=diff
==
--- lldb/trunk/source/Commands/Options.td (original)
+++ lldb/trunk/source/Commands/Options.td Wed Jul 24 05:08:08 2019
@@ -430,27 +430,27 @@ let Command = "platform process list" in
 Arg<"RegularExpression">, Required,
 Desc<"Find processes with executable basenames that match a regular "
 "expression.">;
-  def platform_process_list_parent : Option<"parent", "P">, OptionRange<2, 6>,
+  def platform_process_list_parent : Option<"parent", "P">, GroupRange<2, 6>,
 Arg<"Pid">, Desc<"Find processes that have a matching parent process ID.">;
-  def platform_process_list_uid : Option<"uid", "u">, OptionRange<2, 6>,
+  def platform_process_list_uid : Option<"uid", "u">, GroupRange<2, 6>,
 Arg<"UnsignedInteger">,
 Desc<"Find processes that have a matching user ID.">;
-  def platform_process_list_euid : Option<"euid", "U">, OptionRange<2, 6>,
+  def platform_process_list_euid : Option<"euid", "U">, GroupRange<2, 6>,
 Arg<"UnsignedInteger">,
 Desc<"Find processes that have a matching effective user ID.">;
-  def platform_process_list_gid : Option<"gid", "g">, OptionRange<2, 6>,
+  def platform_process_list_gid : Option<"gid", "g">, GroupRange<2, 6>,
 Arg<"UnsignedInteger">,
 Desc<"Find processes that have a matching group ID.">;
-  def platform_process_list_egid : Option<"egid", "G">, OptionRange<2, 6>,
+  def platform_process_list_egid : Option<"egid", "G">, GroupRange<2, 6>,
 Arg<"UnsignedInteger">,
 Desc<"Find processes that have a matching effective group ID.">;
-  def platform_process_list_arch : Option<"arch", "a">, OptionRange<2, 6>,
+  def platform_process_list_arch : Option<"arch", "a">, GroupRange<2, 6>,
 Arg<"Architecture">,
 Desc<"Find processes that have a matching architecture.">;
   def platform_process_list_show_args : Option<"show-args", "A">,
-OptionRange<1, 6>,
+GroupRange<1, 6>,
 Desc<"Show process arguments instead of the process executable basename.">;
-  def platform_process_list_verbose : Option<"verbose", "v">, OptionRange<1, 
6>,
+  def platform_process_list_verbose : Option<"verbose", "v">, GroupRange<1, 6>,
 Desc<"Enable verbose output.">;
 }
 


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


[Lldb-commits] [lldb] r366891 - [lldb][NFC] Tablegenify platform

2019-07-24 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Wed Jul 24 05:05:42 2019
New Revision: 366891

URL: http://llvm.org/viewvc/llvm-project?rev=366891=rev
Log:
[lldb][NFC] Tablegenify platform

Modified:
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=366891=366890=366891=diff
==
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Wed Jul 24 05:05:42 
2019
@@ -59,19 +59,8 @@ static mode_t ParsePermissionString(llvm
 }
 
 static constexpr OptionDefinition g_permissions_options[] = {
-// clang-format off
-  {LLDB_OPT_SET_ALL, false, "permissions-value",   'v', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePermissionsNumber, 
"Give out the numeric value for permissions (e.g. 757)"},
-  {LLDB_OPT_SET_ALL, false, "permissions-string",  's', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePermissionsString, 
"Give out the string value for permissions (e.g. rwxr-xr--)."},
-  {LLDB_OPT_SET_ALL, false, "user-read",   'r', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,  
"Allow user to read."},
-  {LLDB_OPT_SET_ALL, false, "user-write",  'w', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,  
"Allow user to write."},
-  {LLDB_OPT_SET_ALL, false, "user-exec",   'x', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,  
"Allow user to execute."},
-  {LLDB_OPT_SET_ALL, false, "group-read",  'R', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,  
"Allow group to read."},
-  {LLDB_OPT_SET_ALL, false, "group-write", 'W', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,  
"Allow group to write."},
-  {LLDB_OPT_SET_ALL, false, "group-exec",  'X', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,  
"Allow group to execute."},
-  {LLDB_OPT_SET_ALL, false, "world-read",  'd', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,  
"Allow world to read."},
-  {LLDB_OPT_SET_ALL, false, "world-write", 't', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,  
"Allow world to write."},
-  {LLDB_OPT_SET_ALL, false, "world-exec",  'e', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,  
"Allow world to execute."},
-// clang-format on
+#define LLDB_OPTIONS_permissions
+#include "CommandObject.inc"
 };
 
 class OptionPermissions : public OptionGroup {
@@ -586,10 +575,8 @@ public:
 // "platform fread"
 
 static constexpr OptionDefinition g_platform_fread_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, 
nullptr, {}, 0, eArgTypeIndex, "Offset into the file at which to start 
reading." },
-  { LLDB_OPT_SET_1, false, "count",  'c', OptionParser::eRequiredArgument, 
nullptr, {}, 0, eArgTypeCount, "Number of bytes to read from the file." },
-// clang-format on
+#define LLDB_OPTIONS_platform_fread
+#include "CommandOptions.inc"
 };
 
 class CommandObjectPlatformFRead : public CommandObjectParsed {
@@ -679,10 +666,8 @@ protected:
 // "platform fwrite"
 
 static constexpr OptionDefinition g_platform_fwrite_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, 
nullptr, {}, 0, eArgTypeIndex, "Offset into the file at which to start 
reading." },
-  { LLDB_OPT_SET_1, false, "data",   'd', OptionParser::eRequiredArgument, 
nullptr, {}, 0, eArgTypeValue, "Text to write to the file." },
-// clang-format on
+#define LLDB_OPTIONS_platform_fwrite
+#include "CommandOptions.inc"
 };
 
 class CommandObjectPlatformFWrite : public CommandObjectParsed {
@@ -1057,22 +1042,8 @@ protected:
 // "platform process list"
 
 static OptionDefinition g_platform_process_list_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "pid", 'p', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePid,   
"List the process info for a specific process ID." },
-  { LLDB_OPT_SET_2, true,  "name",'n', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeProcessName,   
"Find processes with executable basenames that match a string." },
-  { LLDB_OPT_SET_3, true,  "ends-with",   'e', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeProcessName,   
"Find processes with executable basenames that end with a string." },
-  { LLDB_OPT_SET_4, true,  "starts-with", 's', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeProcessName,   
"Find processes with executable 

[Lldb-commits] [lldb] r366889 - Revert "Revert "[lldb] [Process/NetBSD] Fix constructor after r363707""

2019-07-24 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Wed Jul 24 04:44:43 2019
New Revision: 366889

URL: http://llvm.org/viewvc/llvm-project?rev=366889=rev
Log:
Revert "Revert "[lldb] [Process/NetBSD] Fix constructor after r363707""

The relevant changes have been reapplied, and broke build again.

Modified:
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp

Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp?rev=366889=366888=366889=diff
==
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp Wed Jul 24 
04:44:43 2019
@@ -140,7 +140,7 @@ NativeProcessNetBSD::NativeProcessNetBSD
  NativeDelegate ,
  const ArchSpec ,
  MainLoop )
-: NativeProcessProtocol(pid, terminal_fd, delegate), m_arch(arch) {
+: NativeProcessELF(pid, terminal_fd, delegate), m_arch(arch) {
   if (m_terminal_fd != -1) {
 Status status = EnsureFDFlags(m_terminal_fd, O_NONBLOCK);
 assert(status.Success());


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


[Lldb-commits] [PATCH] D65109: [LLDB] Remove the Xcode project

2019-07-24 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

> We discussed this and came to an agreement only a few hours before in the 
> team meeting

After all, LLVM is open-source and has a community. Making preemptive decisions 
in internal team meetings sounds concerning.

> As far as we know, Greg was the only user of the Xcode project outside of 
> Apple, and he gave the thumbs up.

I was a user of the Xcode project before Apple.

> I don't think removing it was especially controversial

That's right. And still, it would be appreciated to give folks in other time 
zones at least a chance to take part. Thks


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65109/new/

https://reviews.llvm.org/D65109



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


[Lldb-commits] [PATCH] D65155: [lldb] Remove Xcode project legacy

2019-07-24 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366879: [lldb] Remove Xcode project legacy (authored by 
stefan.graenitz, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65155?vs=211309=211447#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65155/new/

https://reviews.llvm.org/D65155

Files:
  lldb/trunk/cmake/XcodeHeaderGenerator/CMakeLists.txt
  lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
  lldb/trunk/scripts/Xcode/build-llvm.py
  lldb/trunk/scripts/Xcode/lldbbuild.py
  lldb/trunk/scripts/Xcode/package-clang-resource-headers.py
  lldb/trunk/scripts/Xcode/prepare-gtest-run-dir.sh
  lldb/trunk/scripts/Xcode/repo.py
  lldb/trunk/scripts/Xcode/repos/FALLBACK
  lldb/trunk/scripts/Xcode/repos/svn-trunk.json
  lldb/trunk/scripts/build-lldb-llvm-clang
  lldb/trunk/scripts/checkpoint-llvm.pl
  lldb/trunk/scripts/finish-swig-wrapper-classes.sh
  lldb/trunk/scripts/install-lldb.sh
  lldb/trunk/scripts/sed-sources

Index: lldb/trunk/cmake/XcodeHeaderGenerator/CMakeLists.txt
===
--- lldb/trunk/cmake/XcodeHeaderGenerator/CMakeLists.txt
+++ lldb/trunk/cmake/XcodeHeaderGenerator/CMakeLists.txt
@@ -1,14 +0,0 @@
-cmake_minimum_required(VERSION 3.4.3)
-
-project(XcodeConfig C CXX)
-
-set(CMAKE_MODULE_PATH
-  ${CMAKE_MODULE_PATH}
-  "${CMAKE_CURRENT_SOURCE_DIR}/.."
-  "${CMAKE_CURRENT_SOURCE_DIR}/../modules"
-  )
-
-set(LLDB_CONFIG_HEADER_INPUT
-${CMAKE_CURRENT_SOURCE_DIR}/../../include/lldb/Host/Config.h.cmake)
-
-include(LLDBGenerateConfig)
Index: lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
===
--- lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
+++ lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
@@ -1,309 +0,0 @@
-#!/bin/sh
-
-# finish-swig-Python.sh
-#
-# For the Python script interpreter (external to liblldb) to be able to import
-# and use the lldb module, there must be two files, lldb.py and _lldb.so, that
-# it can find. lldb.py is generated by SWIG at the same time it generates the
-# C++ file.  _lldb.so is actually a symlink file that points to the
-# LLDB shared library/framework.
-#
-# The Python script interpreter needs to be able to automatically find
-# these two files. On Darwin systems it searches in the LLDB.framework, as
-# well as in all the normal Python search paths.  On non-Darwin systems
-# these files will need to be put someplace where Python will find them.
-#
-# This shell script creates the _lldb.so symlink in the appropriate place,
-# and copies the lldb.py (and embedded_interpreter.py) file to the correct
-# directory.
-#
-
-# SRC_ROOT is the root of the lldb source tree.
-# TARGET_DIR is where the lldb framework/shared library gets put.
-# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh  shell script
-#   put the lldb.py file it was generated from running SWIG.
-# PYTHON_INSTALL_DIR is where non-Darwin systems want to put the .py and .so
-#   files so that Python can find them automatically.
-# debug_flag (optional) determines whether or not this script outputs
-#   additional information when running.
-
-SRC_ROOT=$1
-TARGET_DIR=$2
-CONFIG_BUILD_DIR=$3
-PYTHON_INSTALL_DIR=$4
-debug_flag=$5
-makefile_flag=$6
-
-# If we don't want Python, then just do nothing here.
-# Note, at present iOS doesn't have Python, so if you're building for iOS be sure to
-# set LLDB_DISABLE_PYTHON to 1.
-
-if [ ! "$LLDB_DISABLE_PYTHON" = "1" ] ; then
-
-if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ]
-then
-Debug=1
-else
-Debug=0
-fi
-
-if [ -n "$makefile_flag" -a "$makefile_flag" = "-m" ]
-then
-MakefileCalled=1
-else
-MakefileCalled=0
-fi
-
-OS_NAME=`uname -s`
-PYTHON=${PYTHON_EXECUTABLE:-/usr/bin/env python}
-PYTHON_VERSION=`${PYTHON} -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
-
-if [ $Debug -eq 1 ]
-then
-echo "The current OS is $OS_NAME"
-echo "The Python version is $PYTHON_VERSION"
-fi
-
-if [ ${OS_NAME} = "Darwin" ]
-then
-SOEXT=".dylib"
-else
-SOEXT=".so"
-fi
-
-#
-#  Determine where to put the files.
-
-if [ $MakefileCalled -eq 0 ]
-then
-# We are being built by Xcode, so all the lldb Python files can go
-# into the LLDB.framework/Resources/Python subdirectory.
-
-if [ ! -d "${TARGET_DIR}/LLDB.framework" ]
-then
-echo "Error:  Unable to find LLDB.framework" >&2
-exit 1
-else
-if [ $Debug -eq 1 ]
-then
-echo "Found ${TARGET_DIR}/LLDB.framework."
-fi
-fi
-
-# Make the Python directory in the framework if it doesn't already exist
-
-framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb"
-else
-# We are being built by LLVM, so use the PYTHON_INSTALL_DIR argument,
-

[Lldb-commits] [lldb] r366879 - [lldb] Remove Xcode project legacy

2019-07-24 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Wed Jul 24 02:20:14 2019
New Revision: 366879

URL: http://llvm.org/viewvc/llvm-project?rev=366879=rev
Log:
[lldb] Remove Xcode project legacy

Summary: Since D65109 removed the manually maintained Xcode project, there's a 
few things we don't need anymore. Anything here we should keep or anything more 
to remove?

Reviewers: JDevlieghere, jasonmolenda, clayborg, jingham, lanza, teemperor

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D65155

Removed:
lldb/trunk/cmake/XcodeHeaderGenerator/
lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
lldb/trunk/scripts/Xcode/
lldb/trunk/scripts/build-lldb-llvm-clang
lldb/trunk/scripts/checkpoint-llvm.pl
lldb/trunk/scripts/finish-swig-wrapper-classes.sh
lldb/trunk/scripts/install-lldb.sh
lldb/trunk/scripts/sed-sources

Removed: lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh?rev=366878=auto
==
--- lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (removed)
@@ -1,309 +0,0 @@
-#!/bin/sh
-
-# finish-swig-Python.sh
-#
-# For the Python script interpreter (external to liblldb) to be able to import
-# and use the lldb module, there must be two files, lldb.py and _lldb.so, that
-# it can find. lldb.py is generated by SWIG at the same time it generates the
-# C++ file.  _lldb.so is actually a symlink file that points to the
-# LLDB shared library/framework.
-#
-# The Python script interpreter needs to be able to automatically find
-# these two files. On Darwin systems it searches in the LLDB.framework, as
-# well as in all the normal Python search paths.  On non-Darwin systems
-# these files will need to be put someplace where Python will find them.
-#
-# This shell script creates the _lldb.so symlink in the appropriate place,
-# and copies the lldb.py (and embedded_interpreter.py) file to the correct
-# directory.
-#
-
-# SRC_ROOT is the root of the lldb source tree.
-# TARGET_DIR is where the lldb framework/shared library gets put.
-# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh  shell script
-#   put the lldb.py file it was generated from running SWIG.
-# PYTHON_INSTALL_DIR is where non-Darwin systems want to put the .py and .so
-#   files so that Python can find them automatically.
-# debug_flag (optional) determines whether or not this script outputs
-#   additional information when running.
-
-SRC_ROOT=$1
-TARGET_DIR=$2
-CONFIG_BUILD_DIR=$3
-PYTHON_INSTALL_DIR=$4
-debug_flag=$5
-makefile_flag=$6
-
-# If we don't want Python, then just do nothing here.
-# Note, at present iOS doesn't have Python, so if you're building for iOS be 
sure to
-# set LLDB_DISABLE_PYTHON to 1.
-
-if [ ! "$LLDB_DISABLE_PYTHON" = "1" ] ; then
-
-if [ -n "$debug_flag" -a "$debug_flag" = "-debug" ]
-then
-Debug=1
-else
-Debug=0
-fi
-
-if [ -n "$makefile_flag" -a "$makefile_flag" = "-m" ]
-then
-MakefileCalled=1
-else
-MakefileCalled=0
-fi
-
-OS_NAME=`uname -s`
-PYTHON=${PYTHON_EXECUTABLE:-/usr/bin/env python}
-PYTHON_VERSION=`${PYTHON} -c 'import sys; 
print("{}.{}".format(sys.version_info.major, sys.version_info.minor))'`
-
-if [ $Debug -eq 1 ]
-then
-echo "The current OS is $OS_NAME"
-echo "The Python version is $PYTHON_VERSION"
-fi
-
-if [ ${OS_NAME} = "Darwin" ]
-then
-SOEXT=".dylib"
-else
-SOEXT=".so"
-fi
-
-#
-#  Determine where to put the files.
-
-if [ $MakefileCalled -eq 0 ]
-then
-# We are being built by Xcode, so all the lldb Python files can go
-# into the LLDB.framework/Resources/Python subdirectory.
-
-if [ ! -d "${TARGET_DIR}/LLDB.framework" ]
-then
-echo "Error:  Unable to find LLDB.framework" >&2
-exit 1
-else
-if [ $Debug -eq 1 ]
-then
-echo "Found ${TARGET_DIR}/LLDB.framework."
-fi
-fi
-
-# Make the Python directory in the framework if it doesn't already exist
-
-framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb"
-else
-# We are being built by LLVM, so use the PYTHON_INSTALL_DIR argument,
-# and append the python version directory to the end of it.  Depending on
-# the system other stuff may need to be put here as well.
-
-if [ -n "${PYTHON_INSTALL_DIR}" ]
-then
-framework_python_dir=`${PYTHON} -c "from distutils.sysconfig import 
get_python_lib; print get_python_lib(True, False, 
\"${PYTHON_INSTALL_DIR}\");"`/lldb
-else
-framework_python_dir=`${PYTHON} -c "from distutils.sysconfig import 
get_python_lib; print get_python_lib(True, False);"`/lldb
-fi
-fi
-
-[ -n "${CONFIG_BUILD_DIR}" ] || CONFIG_BUILD_DIR=${framework_python_dir}
-
-#
-# Look for the directory in which to put the Python files;  if it does 

[Lldb-commits] [PATCH] D65128: [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

2019-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

I'm fine with this if Jim is.




Comment at: lldb/source/Expression/IRExecutionUnit.cpp:601
 
   if (log) {
+LLDB_LOGF(log,

looks like there are some `if(log)`s still remaining. Maybe the `{}` around the 
printf confused your vim macro?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65128/new/

https://reviews.llvm.org/D65128



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


[Lldb-commits] [PATCH] D65152: Fix issues with inferior stdout coming out of order

2019-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 211439.
labath added a comment.

Thanks for the feedback. Updating the patch to avoid calling the flush function 
twice.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65152/new/

https://reviews.llvm.org/D65152

Files:
  include/lldb/Core/Debugger.h
  include/lldb/Interpreter/CommandInterpreter.h
  source/Core/Debugger.cpp
  source/Interpreter/CommandInterpreter.cpp

Index: source/Interpreter/CommandInterpreter.cpp
===
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -2701,32 +2701,14 @@
   }
 }
 
-size_t CommandInterpreter::GetProcessOutput() {
-  //  The process has stuff waiting for stderr; get it and write it out to the
-  //  appropriate place.
-  char stdio_buffer[1024];
-  size_t len;
-  size_t total_bytes = 0;
-  Status error;
+void CommandInterpreter::GetProcessOutput() {
   TargetSP target_sp(m_debugger.GetTargetList().GetSelectedTarget());
-  if (target_sp) {
-ProcessSP process_sp(target_sp->GetProcessSP());
-if (process_sp) {
-  while ((len = process_sp->GetSTDOUT(stdio_buffer, sizeof(stdio_buffer),
-  error)) > 0) {
-size_t bytes_written = len;
-m_debugger.GetOutputFile()->Write(stdio_buffer, bytes_written);
-total_bytes += len;
-  }
-  while ((len = process_sp->GetSTDERR(stdio_buffer, sizeof(stdio_buffer),
-  error)) > 0) {
-size_t bytes_written = len;
-m_debugger.GetErrorFile()->Write(stdio_buffer, bytes_written);
-total_bytes += len;
-  }
-}
-  }
-  return total_bytes;
+  if (!target_sp)
+return;
+
+  if (ProcessSP process_sp = target_sp->GetProcessSP())
+m_debugger.FlushProcessOutput(*process_sp, /*flush_stdout*/ true,
+  /*flush_stderr*/ true);
 }
 
 void CommandInterpreter::StartHandlingCommand() {
Index: source/Core/Debugger.cpp
===
--- source/Core/Debugger.cpp
+++ source/Core/Debugger.cpp
@@ -1360,60 +1360,23 @@
   //}
 }
 
-size_t Debugger::GetProcessSTDOUT(Process *process, Stream *stream) {
-  size_t total_bytes = 0;
-  if (stream == nullptr)
-stream = GetOutputFile().get();
-
-  if (stream) {
-//  The process has stuff waiting for stdout; get it and write it out to the
-//  appropriate place.
-if (process == nullptr) {
-  TargetSP target_sp = GetTargetList().GetSelectedTarget();
-  if (target_sp)
-process = target_sp->GetProcessSP().get();
-}
-if (process) {
-  Status error;
-  size_t len;
-  char stdio_buffer[1024];
-  while ((len = process->GetSTDOUT(stdio_buffer, sizeof(stdio_buffer),
-   error)) > 0) {
-stream->Write(stdio_buffer, len);
-total_bytes += len;
-  }
-}
-stream->Flush();
-  }
-  return total_bytes;
-}
-
-size_t Debugger::GetProcessSTDERR(Process *process, Stream *stream) {
-  size_t total_bytes = 0;
-  if (stream == nullptr)
-stream = GetOutputFile().get();
-
-  if (stream) {
-//  The process has stuff waiting for stderr; get it and write it out to the
-//  appropriate place.
-if (process == nullptr) {
-  TargetSP target_sp = GetTargetList().GetSelectedTarget();
-  if (target_sp)
-process = target_sp->GetProcessSP().get();
-}
-if (process) {
-  Status error;
-  size_t len;
-  char stdio_buffer[1024];
-  while ((len = process->GetSTDERR(stdio_buffer, sizeof(stdio_buffer),
-   error)) > 0) {
-stream->Write(stdio_buffer, len);
-total_bytes += len;
-  }
-}
-stream->Flush();
-  }
-  return total_bytes;
+void Debugger::FlushProcessOutput(Process , bool flush_stdout,
+  bool flush_stderr) {
+  const auto  = [&](Stream ,
+  size_t (Process::*get)(char *, size_t, Status &)) {
+Status error;
+size_t len;
+char buffer[1024];
+while ((len = (process.*get)(buffer, sizeof(buffer), error)) > 0)
+  stream.Write(buffer, len);
+stream.Flush();
+  };
+
+  std::lock_guard guard(m_output_flush_mutex);
+  if (flush_stdout)
+flush(*GetAsyncOutputStream(), ::GetSTDOUT);
+  if (flush_stderr)
+flush(*GetAsyncErrorStream(), ::GetSTDERR);
 }
 
 // This function handles events that were broadcast by the process.
@@ -1453,15 +1416,9 @@
   pop_process_io_handler);
 }
 
-// Now display and STDOUT
-if (got_stdout || got_state_changed) {
-  GetProcessSTDOUT(process_sp.get(), output_stream_sp.get());
-}
-
-// Now display and STDERR
-if (got_stderr || got_state_changed) {
-  GetProcessSTDERR(process_sp.get(), error_stream_sp.get());
-}
+// Now display STDOUT and STDERR
+

[Lldb-commits] [PATCH] D65185: Let tablegen generate property definitions

2019-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: aprantl.
labath added a comment.

My dream is to one day be able to define a property by simply declaring a 
variable somewhere (say: `Property Foo(ParentProperty, "foo", "description 
of foo", DefaultValue);`), and that one could just get/set them via something 
like `context[Foo] = new_value`. In that world, to tablegenning would hopefully 
be necessary, but that world is still pretty far away, and your approach does 
help with eliminating the redundancy, so maybe it's worth doing anyway... I 
dunno...

Regarding the patch itself, I have two questions/comments:

- you put all property definitions into a single file, including those coming 
from "plugins". This is kind of bad as the knowledge of plugin internals leaks 
out. It may not be too bad, if the same effect could be achieved by just 
putting the definitions into a separate file and running tablegen twice, and 
this is just a way of avoiding that. It looks like that is the case here, but 
I'm not 100% sure. It's something to keep an eye on, at least, particularly, if 
we ever want to make "real" plugins.
- I'm wondering if the same effect could not be achieved in a more low-cost way 
via a `.def` header file. I believe @aprantl had a patch like that at one 
point. The .def file could just contain something like: `LLDB_PROPERTY(eFoo, 
"foo", "description", default)`. When you want to define the enum, you just 
have the macro expand to "eFoo", when you define the property itself, you have 
it expand to the whole `{eFoo, ...}` blurb... The advantage of tablegen is that 
it allows you to define the property list via some non-trivial algorithm, but 
it's not clear to me whether this is needed/useful here...


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65185/new/

https://reviews.llvm.org/D65185



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


[Lldb-commits] [PATCH] D65165: [Symbol] Fix some botched logic in Variable::GetLanguage

2019-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Thanks for responding quickly. LGTM, with one comment..




Comment at: source/Symbol/Variable.cpp:62
   if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
-if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+if ((lang = func->GetLanguage()))
+  return lang;

if you want to keep the assignment in the if condition, then I think the best 
way to express that would be to say `if((lang = func->GetLanguage()) != 
lldb::eLanguageTypeUnknown)`. That way one does not have to wonder "why is this 
code checking the zero value too and what does that mean?", and the check 
against `eLanguageTypeUnknown` is still explicit.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65165/new/

https://reviews.llvm.org/D65165



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


[Lldb-commits] [PATCH] D65122: [Symbol] Use llvm::Expected when getting TypeSystems

2019-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Core/ValueObjectRegister.cpp:261
+  if (auto *exe_module = target->GetExecutableModulePointer()) {
+if (auto type_system_or_err =
+exe_module->GetTypeSystemForLanguage(eLanguageTypeC)) {

xiaobai wrote:
> labath wrote:
> > JDevlieghere wrote:
> > > As a general note: I think it's good practice to use `llvm::consumeError` 
> > > when discarding the error to make it explicit that it's not handled. This 
> > > also makes it easier down the line to handle the error, e.g. by logging 
> > > it.
> > This is not just good practice, it is actually required. An simply checking 
> > the bool-ness of the Expected object will not set the "checked" flag of the 
> > error object, and it will assert when it is destroyed (if asserts are 
> > enabled).
> So what you're saying is do not define it in an if condition, but rather get 
> the Expected and if it isn't valid then we consume the error, else use the 
> type system. Is that right?
Yes, although technically, the value can still be defined in the if-condition, 
as its scope extends into the else clause. So the following code is perfectly 
valid (if slightly surprising):
```
if (auto expected_foo = maybe_get_foo())
  do_stuff(*expected_foo);
else
  log(expected_foo.takeError());
```



Comment at: source/Expression/Materializer.cpp:875
+if (!type_system_or_err) {
+  err.SetErrorStringWithFormat(
+  "Couldn't dematerialize a result variable: "

xiaobai wrote:
> JDevlieghere wrote:
> > Another possible alternative would be to join the errors (llvm::joinErrors) 
> > and use the resulting error to initialize the status. Not sure if that 
> > makes things better here though. 
> I'm not sure either, I'll try it and see what it looks like.
I'm not a fan of joined errors, and this does not sound like the right place to 
start using them, as these aren't two separate errors that we've encountered, 
but rather one error that ends up causing another error to happen. So the best 
way to model this IMO would be to use nested errors the same way that Java has 
nested exceptions  (but I don't think it's worth doing that here).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65122/new/

https://reviews.llvm.org/D65122



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


[Lldb-commits] [PATCH] D62503: Add ReadCStringFromMemory for faster string reads

2019-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

sgtm


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62503/new/

https://reviews.llvm.org/D62503



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