Author: dim
Date: Tue May  2 18:31:19 2017
New Revision: 317692
URL: https://svnweb.freebsd.org/changeset/base/317692

Log:
  Vendor import of lldb trunk r301939:
  https://llvm.org/svn/llvm-project/lldb/trunk@301939

Added:
  vendor/lldb/dist/cmake/XcodeHeaderGenerator/
  vendor/lldb/dist/cmake/XcodeHeaderGenerator/CMakeLists.txt   (contents, props 
changed)
  vendor/lldb/dist/cmake/modules/LLDBGenerateConfig.cmake
  vendor/lldb/dist/source/Host/common/MainLoop.cpp   (contents, props changed)
  vendor/lldb/dist/unittests/ObjectFile/ELF/Inputs/
  
vendor/lldb/dist/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml
  vendor/lldb/dist/unittests/ObjectFile/ELF/TestObjectFileELF.cpp   (contents, 
props changed)
Deleted:
  vendor/lldb/dist/include/lldb/Host/posix/MainLoopPosix.h
  vendor/lldb/dist/source/Host/posix/MainLoopPosix.cpp
Modified:
  vendor/lldb/dist/CMakeLists.txt
  vendor/lldb/dist/cmake/modules/LLDBConfig.cmake
  vendor/lldb/dist/include/lldb/Core/Module.h
  vendor/lldb/dist/include/lldb/Core/TraceOptions.h
  vendor/lldb/dist/include/lldb/Core/UniqueCStringMap.h
  vendor/lldb/dist/include/lldb/Host/Config.h
  vendor/lldb/dist/include/lldb/Host/Config.h.cmake
  vendor/lldb/dist/include/lldb/Host/MainLoop.h
  vendor/lldb/dist/include/lldb/Host/PosixApi.h
  vendor/lldb/dist/include/lldb/Host/Socket.h
  vendor/lldb/dist/include/lldb/Host/common/TCPSocket.h
  vendor/lldb/dist/include/lldb/Host/common/UDPSocket.h
  vendor/lldb/dist/include/lldb/Host/linux/AbstractSocket.h
  vendor/lldb/dist/include/lldb/Host/posix/DomainSocket.h
  vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h
  vendor/lldb/dist/include/lldb/Symbol/SymbolFile.h
  vendor/lldb/dist/include/lldb/Symbol/Symtab.h
  vendor/lldb/dist/include/lldb/Target/Target.h
  vendor/lldb/dist/lldb.xcodeproj/project.pbxproj
  
vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
  vendor/lldb/dist/packages/Python/lldbsuite/test/make/Android.rules
  
vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
  vendor/lldb/dist/source/Core/Module.cpp
  vendor/lldb/dist/source/Host/CMakeLists.txt
  vendor/lldb/dist/source/Host/common/Socket.cpp
  vendor/lldb/dist/source/Host/common/SocketAddress.cpp
  vendor/lldb/dist/source/Host/common/TCPSocket.cpp
  vendor/lldb/dist/source/Host/common/UDPSocket.cpp
  vendor/lldb/dist/source/Host/linux/AbstractSocket.cpp
  vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  vendor/lldb/dist/source/Host/posix/DomainSocket.cpp
  vendor/lldb/dist/source/Interpreter/CommandInterpreter.cpp
  vendor/lldb/dist/source/Interpreter/OptionValueEnumeration.cpp
  vendor/lldb/dist/source/Interpreter/OptionValueProperties.cpp
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
  vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
  
vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  
vendor/lldb/dist/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
  
vendor/lldb/dist/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/NameToDIE.h
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  vendor/lldb/dist/source/Symbol/ClangASTContext.cpp
  vendor/lldb/dist/source/Symbol/GoASTContext.cpp
  vendor/lldb/dist/source/Symbol/SymbolFile.cpp
  vendor/lldb/dist/source/Symbol/Symtab.cpp
  vendor/lldb/dist/source/Target/Target.cpp
  vendor/lldb/dist/source/Utility/ConstString.cpp
  vendor/lldb/dist/tools/debugserver/debugserver.xcodeproj/project.pbxproj
  vendor/lldb/dist/tools/debugserver/source/CMakeLists.txt
  vendor/lldb/dist/tools/debugserver/source/RNBSocket.cpp
  vendor/lldb/dist/tools/debugserver/source/debugserver.cpp
  vendor/lldb/dist/tools/lldb-server/Acceptor.cpp
  vendor/lldb/dist/unittests/Host/SocketTest.cpp
  vendor/lldb/dist/unittests/ObjectFile/ELF/CMakeLists.txt
  vendor/lldb/dist/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
  vendor/lldb/dist/unittests/debugserver/RNBSocketTest.cpp

Modified: vendor/lldb/dist/CMakeLists.txt
==============================================================================
--- vendor/lldb/dist/CMakeLists.txt     Tue May  2 18:31:13 2017        
(r317691)
+++ vendor/lldb/dist/CMakeLists.txt     Tue May  2 18:31:19 2017        
(r317692)
@@ -1,8 +1,15 @@
 cmake_minimum_required(VERSION 3.4.3)
 
-include(cmake/modules/LLDBStandalone.cmake)
-include(cmake/modules/LLDBConfig.cmake)
-include(cmake/modules/AddLLDB.cmake)
+# Add path for custom modules
+set(CMAKE_MODULE_PATH
+  ${CMAKE_MODULE_PATH}
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+  )
+
+include(LLDBStandalone)
+include(LLDBConfig)
+include(AddLLDB)
 
 if (CMAKE_SYSTEM_NAME MATCHES "Windows|Android")
   set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)

Added: vendor/lldb/dist/cmake/XcodeHeaderGenerator/CMakeLists.txt
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/lldb/dist/cmake/XcodeHeaderGenerator/CMakeLists.txt  Tue May  2 
18:31:19 2017        (r317692)
@@ -0,0 +1,14 @@
+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)

Modified: vendor/lldb/dist/cmake/modules/LLDBConfig.cmake
==============================================================================
--- vendor/lldb/dist/cmake/modules/LLDBConfig.cmake     Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/cmake/modules/LLDBConfig.cmake     Tue May  2 18:31:19 
2017        (r317692)
@@ -426,20 +426,4 @@ if ((CMAKE_SYSTEM_NAME MATCHES "Android"
 endif()
 
 find_package(Backtrace)
-
-include(CheckIncludeFile)
-check_include_file(termios.h HAVE_TERMIOS_H)
-check_include_file(sys/event.h HAVE_SYS_EVENT_H)
-
-# These checks exist in LLVM's configuration, so I want to match the LLVM names
-# so that the check isn't duplicated, but we translate them into the LLDB names
-# so that I don't have to change all the uses at the moment.
-set(LLDB_CONFIG_TERMIOS_SUPPORTED ${HAVE_TERMIOS_H})
-if(NOT UNIX)
-  set(LLDB_DISABLE_POSIX 1)
-endif()
-
-# This should be done at the end
-configure_file(
-  ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake
-  ${CMAKE_CURRENT_BINARY_DIR}/include/lldb/Host/Config.h)
+include(LLDBGenerateConfig)

Added: vendor/lldb/dist/cmake/modules/LLDBGenerateConfig.cmake
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/lldb/dist/cmake/modules/LLDBGenerateConfig.cmake     Tue May  2 
18:31:19 2017        (r317692)
@@ -0,0 +1,35 @@
+# This file contains all the logic for running configure-time checks
+
+include(CheckSymbolExists)
+include(CheckIncludeFile)
+include(CheckIncludeFiles)
+
+set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+check_symbol_exists(ppoll poll.h HAVE_PPOLL)
+set(CMAKE_REQUIRED_DEFINITIONS)
+check_symbol_exists(sigaction signal.h HAVE_SIGACTION)
+
+check_include_file(termios.h HAVE_TERMIOS_H)
+check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
+
+# These checks exist in LLVM's configuration, so I want to match the LLVM names
+# so that the check isn't duplicated, but we translate them into the LLDB names
+# so that I don't have to change all the uses at the moment.
+set(LLDB_CONFIG_TERMIOS_SUPPORTED ${HAVE_TERMIOS_H})
+if(NOT UNIX)
+  set(LLDB_DISABLE_POSIX 1)
+endif()
+
+if(NOT LLDB_CONFIG_HEADER_INPUT)
+ set(LLDB_CONFIG_HEADER_INPUT ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake)
+endif()
+
+if(NOT LLDB_CONFIG_HEADER_OUTPUT)
+ set(LLDB_CONFIG_HEADER_OUTPUT 
${CMAKE_CURRENT_BINARY_DIR}/include/lldb/Host/Config.h)
+endif()
+
+# This should be done at the end
+configure_file(
+  ${LLDB_CONFIG_HEADER_INPUT}
+  ${LLDB_CONFIG_HEADER_OUTPUT}
+  )

Modified: vendor/lldb/dist/include/lldb/Core/Module.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Core/Module.h Tue May  2 18:31:13 2017        
(r317691)
+++ vendor/lldb/dist/include/lldb/Core/Module.h Tue May  2 18:31:19 2017        
(r317692)
@@ -614,6 +614,8 @@ public:
 
   const FileSpec &GetSymbolFileFileSpec() const { return m_symfile_spec; }
 
+  void PreloadSymbols();
+
   void SetSymbolFileFileSpec(const FileSpec &file);
 
   const llvm::sys::TimePoint<> &GetModificationTime() const {

Modified: vendor/lldb/dist/include/lldb/Core/TraceOptions.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Core/TraceOptions.h   Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Core/TraceOptions.h   Tue May  2 18:31:19 
2017        (r317692)
@@ -59,4 +59,4 @@ private:
 };
 }
 
-#endif // liblldb_TraceOptions_h_
\ No newline at end of file
+#endif // liblldb_TraceOptions_h_

Modified: vendor/lldb/dist/include/lldb/Core/UniqueCStringMap.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Core/UniqueCStringMap.h       Tue May  2 
18:31:13 2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Core/UniqueCStringMap.h       Tue May  2 
18:31:19 2017        (r317692)
@@ -17,10 +17,9 @@
 
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/RegularExpression.h"
 
-#include "llvm/ADT/StringRef.h"
-
 namespace lldb_private {
 
 //----------------------------------------------------------------------
@@ -37,13 +36,17 @@ public:
   struct Entry {
     Entry() {}
 
-    Entry(llvm::StringRef cstr) : cstring(cstr), value() {}
+    Entry(ConstString cstr) : cstring(cstr), value() {}
 
-    Entry(llvm::StringRef cstr, const T &v) : cstring(cstr), value(v) {}
+    Entry(ConstString cstr, const T &v) : cstring(cstr), value(v) {}
 
-    bool operator<(const Entry &rhs) const { return cstring < rhs.cstring; }
+    // This is only for uniqueness, not lexicographical ordering, so we can
+    // just compare pointers.
+    bool operator<(const Entry &rhs) const {
+      return cstring.GetCString() < rhs.cstring.GetCString();
+    }
 
-    llvm::StringRef cstring;
+    ConstString cstring;
     T value;
   };
 
@@ -52,7 +55,7 @@ public:
   // this map, then later call UniqueCStringMap<T>::Sort() before doing
   // any searches by name.
   //------------------------------------------------------------------
-  void Append(llvm::StringRef unique_cstr, const T &value) {
+  void Append(ConstString unique_cstr, const T &value) {
     m_map.push_back(typename UniqueCStringMap<T>::Entry(unique_cstr, value));
   }
 
@@ -64,7 +67,7 @@ public:
   // Call this function to always keep the map sorted when putting
   // entries into the map.
   //------------------------------------------------------------------
-  void Insert(llvm::StringRef unique_cstr, const T &value) {
+  void Insert(ConstString unique_cstr, const T &value) {
     typename UniqueCStringMap<T>::Entry e(unique_cstr, value);
     m_map.insert(std::upper_bound(m_map.begin(), m_map.end(), e), e);
   }
@@ -87,7 +90,7 @@ public:
     return false;
   }
 
-  llvm::StringRef GetCStringAtIndexUnchecked(uint32_t idx) const {
+  ConstString GetCStringAtIndexUnchecked(uint32_t idx) const {
     return m_map[idx].cstring;
   }
 
@@ -101,8 +104,8 @@ public:
     return m_map[idx].value;
   }
 
-  llvm::StringRef GetCStringAtIndex(uint32_t idx) const {
-    return ((idx < m_map.size()) ? m_map[idx].cstring : llvm::StringRef());
+  ConstString GetCStringAtIndex(uint32_t idx) const {
+    return ((idx < m_map.size()) ? m_map[idx].cstring : ConstString());
   }
 
   //------------------------------------------------------------------
@@ -113,7 +116,7 @@ public:
   // T values and only if there is a sensible failure value that can
   // be returned and that won't match any existing values.
   //------------------------------------------------------------------
-  T Find(llvm::StringRef unique_cstr, T fail_value) const {
+  T Find(ConstString unique_cstr, T fail_value) const {
     Entry search_entry(unique_cstr);
     const_iterator end = m_map.end();
     const_iterator pos = std::lower_bound(m_map.begin(), end, search_entry);
@@ -131,15 +134,12 @@ public:
   // The caller is responsible for ensuring that the collection does
   // not change during while using the returned pointer.
   //------------------------------------------------------------------
-  const Entry *FindFirstValueForName(llvm::StringRef unique_cstr) const {
+  const Entry *FindFirstValueForName(ConstString unique_cstr) const {
     Entry search_entry(unique_cstr);
     const_iterator end = m_map.end();
     const_iterator pos = std::lower_bound(m_map.begin(), end, search_entry);
-    if (pos != end) {
-      llvm::StringRef pos_cstr = pos->cstring;
-      if (pos_cstr == unique_cstr)
-        return &(*pos);
-    }
+    if (pos != end && pos->cstring == unique_cstr)
+      return &(*pos);
     return nullptr;
   }
 
@@ -164,7 +164,7 @@ public:
     return nullptr;
   }
 
-  size_t GetValues(llvm::StringRef unique_cstr, std::vector<T> &values) const {
+  size_t GetValues(ConstString unique_cstr, std::vector<T> &values) const {
     const size_t start_size = values.size();
 
     Entry search_entry(unique_cstr);
@@ -186,7 +186,7 @@ public:
 
     const_iterator pos, end = m_map.end();
     for (pos = m_map.begin(); pos != end; ++pos) {
-      if (regex.Execute(pos->cstring))
+      if (regex.Execute(pos->cstring.GetCString()))
         values.push_back(pos->value);
     }
 
@@ -240,7 +240,7 @@ public:
     }
   }
 
-  size_t Erase(llvm::StringRef unique_cstr) {
+  size_t Erase(ConstString unique_cstr) {
     size_t num_removed = 0;
     Entry search_entry(unique_cstr);
     iterator end = m_map.end();

Modified: vendor/lldb/dist/include/lldb/Host/Config.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/Config.h Tue May  2 18:31:13 2017        
(r317691)
+++ vendor/lldb/dist/include/lldb/Host/Config.h Tue May  2 18:31:19 2017        
(r317692)
@@ -18,6 +18,10 @@
 
 #define HAVE_SYS_EVENT_H 1
 
+#define HAVE_PPOLL 0
+
+#define HAVE_SIGACTION 1
+
 #else
 
 #error This file is only used by the Xcode build.

Modified: vendor/lldb/dist/include/lldb/Host/Config.h.cmake
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/Config.h.cmake   Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Host/Config.h.cmake   Tue May  2 18:31:19 
2017        (r317692)
@@ -16,4 +16,8 @@
 
 #cmakedefine01 HAVE_SYS_EVENT_H
 
+#cmakedefine01 HAVE_PPOLL
+
+#cmakedefine01 HAVE_SIGACTION
+
 #endif // #ifndef LLDB_HOST_CONFIG_H

Modified: vendor/lldb/dist/include/lldb/Host/MainLoop.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/MainLoop.h       Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Host/MainLoop.h       Tue May  2 18:31:19 
2017        (r317692)
@@ -10,16 +10,96 @@
 #ifndef lldb_Host_MainLoop_h_
 #define lldb_Host_MainLoop_h_
 
-#ifdef _WIN32
+#include "lldb/Host/Config.h"
 #include "lldb/Host/MainLoopBase.h"
+
+#include "llvm/ADT/DenseMap.h"
+
+#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H
+#define SIGNAL_POLLING_UNSUPPORTED 1
+#endif
+
 namespace lldb_private {
-typedef MainLoopBase MainLoop;
-}
-#else
-#include "lldb/Host/posix/MainLoopPosix.h"
-namespace lldb_private {
-typedef MainLoopPosix MainLoop;
-}
+
+// Implementation of the MainLoopBase class. It can monitor file descriptors 
for
+// readability using ppoll, kqueue, poll or WSAPoll. On Windows it only 
supports
+// polling sockets, and will not work on generic file handles or pipes. On
+// systems without kqueue or ppoll handling singnals is not supported. In
+// addition to the common base, this class provides the ability to invoke a
+// given handler when a signal is received.
+//
+// Since this class is primarily intended to be used for single-threaded
+// processing, it does not attempt to perform any internal synchronisation and
+// any concurrent accesses must be protected  externally. However, it is
+// perfectly legitimate to have more than one instance of this class running on
+// separate threads, or even a single thread (with some limitations on signal
+// monitoring).
+// TODO: Add locking if this class is to be used in a multi-threaded context.
+class MainLoop : public MainLoopBase {
+private:
+  class SignalHandle;
+
+public:
+  typedef std::unique_ptr<SignalHandle> SignalHandleUP;
+
+  ~MainLoop() override;
+
+  ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp,
+                                  const Callback &callback,
+                                  Error &error) override;
+
+  // Listening for signals from multiple MainLoop instances is perfectly safe 
as
+  // long as they don't try to listen for the same signal. The callback 
function
+  // is invoked when the control returns to the Run() function, not when the
+  // hander is executed. This mean that you can treat the callback as a normal
+  // function and perform things which would not be safe in a signal handler.
+  // However, since the callback is not invoked synchronously, you cannot use
+  // this mechanism to handle SIGSEGV and the like.
+  SignalHandleUP RegisterSignal(int signo, const Callback &callback,
+                                Error &error);
+
+  Error Run() override;
+
+  // This should only be performed from a callback. Do not attempt to terminate
+  // the processing from another thread.
+  // TODO: Add synchronization if we want to be terminated from another thread.
+  void RequestTermination() override { m_terminate_request = true; }
+
+protected:
+  void UnregisterReadObject(IOObject::WaitableHandle handle) override;
+
+  void UnregisterSignal(int signo);
+
+private:
+  class SignalHandle {
+  public:
+    ~SignalHandle() { m_mainloop.UnregisterSignal(m_signo); }
+
+  private:
+    SignalHandle(MainLoop &mainloop, int signo)
+        : m_mainloop(mainloop), m_signo(signo) {}
+
+    MainLoop &m_mainloop;
+    int m_signo;
+
+    friend class MainLoop;
+    DISALLOW_COPY_AND_ASSIGN(SignalHandle);
+  };
+
+  struct SignalInfo {
+    Callback callback;
+#if HAVE_SIGACTION
+    struct sigaction old_action;
 #endif
+    bool was_blocked : 1;
+  };
+  class RunImpl;
+
+  llvm::DenseMap<IOObject::WaitableHandle, Callback> m_read_fds;
+  llvm::DenseMap<int, SignalInfo> m_signals;
+  bool m_terminate_request : 1;
+};
+
+} // namespace lldb_private
 
 #endif // lldb_Host_MainLoop_h_

Modified: vendor/lldb/dist/include/lldb/Host/PosixApi.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/PosixApi.h       Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Host/PosixApi.h       Tue May  2 18:31:19 
2017        (r317692)
@@ -14,9 +14,7 @@
 // to provide a minimum level of compatibility across all platforms to rely
 // on various posix api functionality.
 
-#include "llvm/Support/Compiler.h"
-
-#if defined(LLVM_ON_WIN32)
+#if defined(_WIN32)
 #include "lldb/Host/windows/PosixApi.h"
 #endif
 

Modified: vendor/lldb/dist/include/lldb/Host/Socket.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/Socket.h Tue May  2 18:31:13 2017        
(r317691)
+++ vendor/lldb/dist/include/lldb/Host/Socket.h Tue May  2 18:31:19 2017        
(r317692)
@@ -57,8 +57,7 @@ public:
 
   virtual Error Connect(llvm::StringRef name) = 0;
   virtual Error Listen(llvm::StringRef name, int backlog) = 0;
-  virtual Error Accept(llvm::StringRef name, bool child_processes_inherit,
-                       Socket *&socket) = 0;
+  virtual Error Accept(Socket *&socket) = 0;
 
   // Initialize a Tcp Socket object in listening mode.  listen and accept are
   // implemented
@@ -103,7 +102,8 @@ public:
                                 int32_t &port, Error *error_ptr);
 
 protected:
-  Socket(NativeSocket socket, SocketProtocol protocol, bool should_close);
+  Socket(SocketProtocol protocol, bool should_close,
+         bool m_child_process_inherit);
 
   virtual size_t Send(const void *buf, const size_t num_bytes);
 
@@ -117,6 +117,7 @@ protected:
 
   SocketProtocol m_protocol;
   NativeSocket m_socket;
+  bool m_child_processes_inherit;
 };
 
 } // namespace lldb_private

Modified: vendor/lldb/dist/include/lldb/Host/common/TCPSocket.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/common/TCPSocket.h       Tue May  2 
18:31:13 2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Host/common/TCPSocket.h       Tue May  2 
18:31:19 2017        (r317692)
@@ -11,12 +11,16 @@
 #define liblldb_TCPSocket_h_
 
 #include "lldb/Host/Socket.h"
+#include "lldb/Host/SocketAddress.h"
+#include <map>
 
 namespace lldb_private {
 class TCPSocket : public Socket {
 public:
-  TCPSocket(NativeSocket socket, bool should_close);
-  TCPSocket(bool child_processes_inherit, Error &error);
+  TCPSocket(bool should_close, bool child_processes_inherit);
+  TCPSocket(NativeSocket socket, bool should_close,
+            bool child_processes_inherit);
+  ~TCPSocket() override;
 
   // returns port number or 0 if error
   uint16_t GetLocalPortNumber() const;
@@ -37,8 +41,18 @@ public:
 
   Error Connect(llvm::StringRef name) override;
   Error Listen(llvm::StringRef name, int backlog) override;
-  Error Accept(llvm::StringRef name, bool child_processes_inherit,
-               Socket *&conn_socket) override;
+  Error Accept(Socket *&conn_socket) override;
+
+  Error CreateSocket(int domain);
+
+  bool IsValid() const override;
+
+private:
+  TCPSocket(NativeSocket socket, const TCPSocket &listen_socket);
+
+  void CloseListenSockets();
+
+  std::map<int, SocketAddress> m_listen_sockets;
 };
 }
 

Modified: vendor/lldb/dist/include/lldb/Host/common/UDPSocket.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/common/UDPSocket.h       Tue May  2 
18:31:13 2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Host/common/UDPSocket.h       Tue May  2 
18:31:19 2017        (r317692)
@@ -15,19 +15,20 @@
 namespace lldb_private {
 class UDPSocket : public Socket {
 public:
-  UDPSocket(bool child_processes_inherit, Error &error);
+  UDPSocket(bool should_close, bool child_processes_inherit);
 
   static Error Connect(llvm::StringRef name, bool child_processes_inherit,
                        Socket *&socket);
 
 private:
-  UDPSocket(NativeSocket socket);
+  UDPSocket(NativeSocket socket, const UDPSocket &listen_socket);
 
   size_t Send(const void *buf, const size_t num_bytes) override;
   Error Connect(llvm::StringRef name) override;
   Error Listen(llvm::StringRef name, int backlog) override;
-  Error Accept(llvm::StringRef name, bool child_processes_inherit,
-               Socket *&socket) override;
+  Error Accept(Socket *&socket) override;
+
+  Error CreateSocket();
 
   SocketAddress m_sockaddr;
 };

Modified: vendor/lldb/dist/include/lldb/Host/linux/AbstractSocket.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/linux/AbstractSocket.h   Tue May  2 
18:31:13 2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Host/linux/AbstractSocket.h   Tue May  2 
18:31:19 2017        (r317692)
@@ -15,7 +15,7 @@
 namespace lldb_private {
 class AbstractSocket : public DomainSocket {
 public:
-  AbstractSocket(bool child_processes_inherit, Error &error);
+  AbstractSocket(bool child_processes_inherit);
 
 protected:
   size_t GetNameOffset() const override;

Modified: vendor/lldb/dist/include/lldb/Host/posix/DomainSocket.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/posix/DomainSocket.h     Tue May  2 
18:31:13 2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Host/posix/DomainSocket.h     Tue May  2 
18:31:19 2017        (r317692)
@@ -15,22 +15,20 @@
 namespace lldb_private {
 class DomainSocket : public Socket {
 public:
-  DomainSocket(bool child_processes_inherit, Error &error);
+  DomainSocket(bool should_close, bool child_processes_inherit);
 
   Error Connect(llvm::StringRef name) override;
   Error Listen(llvm::StringRef name, int backlog) override;
-  Error Accept(llvm::StringRef name, bool child_processes_inherit,
-               Socket *&socket) override;
+  Error Accept(Socket *&socket) override;
 
 protected:
-  DomainSocket(SocketProtocol protocol, bool child_processes_inherit,
-               Error &error);
+  DomainSocket(SocketProtocol protocol, bool child_processes_inherit);
 
   virtual size_t GetNameOffset() const;
   virtual void DeleteSocketFile(llvm::StringRef name);
 
 private:
-  DomainSocket(NativeSocket socket);
+  DomainSocket(NativeSocket socket, const DomainSocket &listen_socket);
 };
 }
 

Modified: vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h   Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h   Tue May  2 18:31:19 
2017        (r317692)
@@ -805,9 +805,9 @@ public:
   bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; }
 
   // Strip linker annotations (such as @@VERSION) from symbol names.
-  virtual std::string
+  virtual llvm::StringRef
   StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const {
-    return symbol_name.str();
+    return symbol_name;
   }
 
   static lldb::SymbolType GetSymbolTypeFromName(

Modified: vendor/lldb/dist/include/lldb/Symbol/SymbolFile.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Symbol/SymbolFile.h   Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Symbol/SymbolFile.h   Tue May  2 18:31:19 
2017        (r317692)
@@ -180,6 +180,8 @@ public:
                           uint32_t type_mask,
                           lldb_private::TypeList &type_list) = 0;
 
+  virtual void PreloadSymbols();
+
   virtual lldb_private::TypeSystem *
   GetTypeSystemForLanguage(lldb::LanguageType language);
 

Modified: vendor/lldb/dist/include/lldb/Symbol/Symtab.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Symbol/Symtab.h       Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Symbol/Symtab.h       Tue May  2 18:31:19 
2017        (r317692)
@@ -40,6 +40,7 @@ public:
   Symtab(ObjectFile *objfile);
   ~Symtab();
 
+  void PreloadSymbols();
   void Reserve(size_t count);
   Symbol *Resize(size_t count);
   uint32_t AddSymbol(const Symbol &symbol);

Modified: vendor/lldb/dist/include/lldb/Target/Target.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Target/Target.h       Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/include/lldb/Target/Target.h       Tue May  2 18:31:19 
2017        (r317692)
@@ -82,6 +82,10 @@ public:
 
   bool SetPreferDynamicValue(lldb::DynamicValueType d);
 
+  bool GetPreloadSymbols() const;
+
+  void SetPreloadSymbols(bool b);
+
   bool GetDisableASLR() const;
 
   void SetDisableASLR(bool b);

Modified: vendor/lldb/dist/lldb.xcodeproj/project.pbxproj
==============================================================================
--- vendor/lldb/dist/lldb.xcodeproj/project.pbxproj     Tue May  2 18:31:13 
2017        (r317691)
+++ vendor/lldb/dist/lldb.xcodeproj/project.pbxproj     Tue May  2 18:31:19 
2017        (r317692)
@@ -665,7 +665,6 @@
                26FFC19D14FC072100087D58 /* DynamicLoaderPOSIXDYLD.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 26FFC19714FC072100087D58 /* 
DynamicLoaderPOSIXDYLD.cpp */; };
                304B2E461CAAA57B007829FE /* ClangUtil.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 3032B1B61CAAA3D1004BE1AB /* ClangUtil.cpp */; };
                30B38A001CAAA6D7009524E3 /* ClangUtil.h in Headers */ = {isa = 
PBXBuildFile; fileRef = 3032B1B91CAAA400004BE1AB /* ClangUtil.h */; };
-               30DED5DE1B4ECB49004CC508 /* MainLoopPosix.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 30DED5DC1B4ECB17004CC508 /* MainLoopPosix.cpp 
*/; };
                332CCB181AFF41620034D4C4 /* SBLanguageRuntime.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 3392EBB71AFF402200858B9F /* SBLanguageRuntime.h 
*/; settings = {ATTRIBUTES = (Public, ); }; };
                33E5E8471A674FB60024ED68 /* StringConvert.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 33E5E8411A672A240024ED68 /* StringConvert.cpp 
*/; };
                3F8160A61AB9F7DD001DA9DF /* Logging.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 3F8160A51AB9F7DD001DA9DF /* Logging.cpp */; };
@@ -868,6 +867,8 @@
                9A0FDEA71E8EF5110086B2F5 /* RegisterContextLinux_mips.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A0FDE971E8EF5010086B2F5 /* 
RegisterContextLinux_mips.cpp */; };
                9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = 
PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = 
{ATTRIBUTES = (Public, ); }; };
                9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; };
+               9A1E595C1EB2B141002206A5 /* SBTrace.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */; };
+               9A1E595D1EB2B141002206A5 /* SBTraceOptions.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp 
*/; };
                9A22A161135E30370024DDC3 /* EmulateInstructionARM.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A22A15D135E30370024DDC3 /* 
EmulateInstructionARM.cpp */; };
                9A22A163135E30370024DDC3 /* EmulationStateARM.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 9A22A15F135E30370024DDC3 /* 
EmulationStateARM.cpp */; };
                9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */ = {isa 
= PBXBuildFile; fileRef = 9A357582116CFDEE00E8ED2F /* SBValueList.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
@@ -876,6 +877,8 @@
                9A357673116E7B6400E8ED2F /* SBStringList.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9A357672116E7B6400E8ED2F /* SBStringList.cpp */; 
};
                9A3576A8116E9AB700E8ED2F /* SBHostOS.h in Headers */ = {isa = 
PBXBuildFile; fileRef = 9A3576A7116E9AB700E8ED2F /* SBHostOS.h */; settings = 
{ATTRIBUTES = (Public, ); }; };
                9A3576AA116E9AC700E8ED2F /* SBHostOS.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A3576A9116E9AC700E8ED2F /* SBHostOS.cpp */; };
+               9A36D24D1EB3BE7F00AAD9EA /* SBTrace.h in Headers */ = {isa = 
PBXBuildFile; fileRef = 9A1E59581EB2B10D002206A5 /* SBTrace.h */; settings = 
{ATTRIBUTES = (Public, ); }; };
+               9A36D24E1EB3BE7F00AAD9EA /* SBTraceOptions.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 9A1E59591EB2B10D002206A5 /* SBTraceOptions.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
                9A4F35101368A51A00823F52 /* StreamAsynchronousIO.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9A4F350F1368A51A00823F52 /* 
StreamAsynchronousIO.cpp */; };
                9A77AD541E64E2760025CE04 /* RegisterInfoPOSIX_arm.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9A77AD501E64E24E0025CE04 /* 
RegisterInfoPOSIX_arm.cpp */; };
                9AC7038E117674FB0086C050 /* SBInstruction.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 9AC7038D117674EB0086C050 /* SBInstruction.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
@@ -978,6 +981,7 @@
                B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpoint.cpp */; 
};
                B2B7CCEB15D1BD6700EEFB57 /* CommandObjectWatchpointCommand.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = B2B7CCEA15D1BD6600EEFB57 /* 
CommandObjectWatchpointCommand.cpp */; };
                B2B7CCF015D1C20F00EEFB57 /* WatchpointOptions.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = B2B7CCEF15D1C20F00EEFB57 /* 
WatchpointOptions.cpp */; };
+               D67521381EA17C4200439694 /* MainLoop.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = D67521351EA17C3900439694 /* MainLoop.cpp */; };
                E769331C1A94D15400C73337 /* lldb-gdbserver.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26D6F3F4183E7F9300194858 /* lldb-gdbserver.cpp 
*/; };
                E769331E1A94D18100C73337 /* lldb-server.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = E769331D1A94D18100C73337 /* lldb-server.cpp */; 
};
                E7723D441AC4A7FB002BA082 /* RegisterContextPOSIXCore_arm64.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = E7723D421AC4A7FB002BA082 /* 
RegisterContextPOSIXCore_arm64.cpp */; };
@@ -2319,7 +2323,6 @@
                26FFC19814FC072100087D58 /* DynamicLoaderPOSIXDYLD.h */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path 
= DynamicLoaderPOSIXDYLD.h; sourceTree = "<group>"; };
                3032B1B61CAAA3D1004BE1AB /* ClangUtil.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = ClangUtil.cpp; path = source/Symbol/ClangUtil.cpp; sourceTree = 
"<group>"; };
                3032B1B91CAAA400004BE1AB /* ClangUtil.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ClangUtil.h; path = include/lldb/Symbol/ClangUtil.h; sourceTree = "<group>"; };
-               30DED5DC1B4ECB17004CC508 /* MainLoopPosix.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = MainLoopPosix.cpp; sourceTree = "<group>"; };
                33064C991A5C7A330033D415 /* UriParser.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = UriParser.cpp; path = source/Utility/UriParser.cpp; sourceTree = 
"<group>"; };
                3392EBB71AFF402200858B9F /* SBLanguageRuntime.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBLanguageRuntime.h; path = include/lldb/API/SBLanguageRuntime.h; sourceTree = 
"<group>"; };
                33E5E8411A672A240024ED68 /* StringConvert.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = StringConvert.cpp; sourceTree = "<group>"; };
@@ -2810,6 +2813,10 @@
                9A0FDE9B1E8EF5010086B2F5 /* RegisterInfos_mips.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
RegisterInfos_mips.h; path = Utility/RegisterInfos_mips.h; sourceTree = 
"<group>"; };
                9A19A6A51163BB7E00E0D453 /* SBValue.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBValue.h; path = include/lldb/API/SBValue.h; sourceTree = "<group>"; };
                9A19A6AD1163BB9800E0D453 /* SBValue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBValue.cpp; path = source/API/SBValue.cpp; sourceTree = "<group>"; };
+               9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBTrace.cpp; path = source/API/SBTrace.cpp; sourceTree = "<group>"; };
+               9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBTraceOptions.cpp; path = source/API/SBTraceOptions.cpp; sourceTree = 
"<group>"; };
+               9A1E59581EB2B10D002206A5 /* SBTrace.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBTrace.h; path = include/lldb/API/SBTrace.h; sourceTree = "<group>"; };
+               9A1E59591EB2B10D002206A5 /* SBTraceOptions.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBTraceOptions.h; path = include/lldb/API/SBTraceOptions.h; sourceTree = 
"<group>"; };
                9A22A15D135E30370024DDC3 /* EmulateInstructionARM.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = EmulateInstructionARM.cpp; sourceTree = "<group>"; };
                9A22A15E135E30370024DDC3 /* EmulateInstructionARM.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
EmulateInstructionARM.h; sourceTree = "<group>"; };
                9A22A15F135E30370024DDC3 /* EmulationStateARM.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = EmulationStateARM.cpp; sourceTree = "<group>"; };
@@ -3051,6 +3058,7 @@
                B2B7CCED15D1BFB700EEFB57 /* WatchpointOptions.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
WatchpointOptions.h; path = include/lldb/Breakpoint/WatchpointOptions.h; 
sourceTree = "<group>"; };
                B2B7CCEF15D1C20F00EEFB57 /* WatchpointOptions.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = WatchpointOptions.cpp; path = source/Breakpoint/WatchpointOptions.cpp; 
sourceTree = "<group>"; };
                B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
InstructionUtils.h; path = Utility/InstructionUtils.h; sourceTree = "<group>"; 
};
+               D67521351EA17C3900439694 /* MainLoop.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = MainLoop.cpp; sourceTree = "<group>"; };
                E73A15A41B548EC500786197 /* GDBRemoteSignals.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = GDBRemoteSignals.cpp; path = Utility/GDBRemoteSignals.cpp; sourceTree = 
"<group>"; };
                E73A15A51B548EC500786197 /* GDBRemoteSignals.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
GDBRemoteSignals.h; path = Utility/GDBRemoteSignals.h; sourceTree = "<group>"; 
};
                E769331D1A94D18100C73337 /* lldb-server.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = "lldb-server.cpp"; path = "tools/lldb-server/lldb-server.cpp"; 
sourceTree = "<group>"; };
@@ -4004,6 +4012,10 @@
                                8CCB017F19BA4DD00009FD44 /* 
SBThreadCollection.cpp */,
                                4C56543419D2297A002E9C44 /* SBThreadPlan.h */,
                                4C56543619D22B32002E9C44 /* SBThreadPlan.cpp */,
+                               9A1E59581EB2B10D002206A5 /* SBTrace.h */,
+                               9A1E59521EB2B0B9002206A5 /* SBTrace.cpp */,
+                               9A1E59591EB2B10D002206A5 /* SBTraceOptions.h */,
+                               9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp 
*/,
                                2617447911685869005ADD65 /* SBType.h */,
                                261744771168585B005ADD65 /* SBType.cpp */,
                                9475C18514E5E9C5001BFC6D /* SBTypeCategory.h */,
@@ -5667,7 +5679,6 @@
                        children = (
                                2579065E1BD0488D00178368 /* DomainSocket.cpp */,
                                255EFF751AFABA950069F277 /* LockFilePosix.cpp 
*/,
-                               30DED5DC1B4ECB17004CC508 /* MainLoopPosix.cpp 
*/,
                                AFDFDFD019E34D3400EAE509 /* 
ConnectionFileDescriptorPosix.cpp */,
                                3FDFDDC5199D37ED009756A7 /* FileSystem.cpp */,
                                3FDFE53019A292F0009756A7 /* HostInfoPosix.cpp 
*/,
@@ -5902,6 +5913,7 @@
                69A01E1A1236C5D400C660B5 /* common */ = {
                        isa = PBXGroup;
                        children = (
+                               D67521351EA17C3900439694 /* MainLoop.cpp */,
                                2579065A1BD0488100178368 /* TCPSocket.cpp */,
                                2579065B1BD0488100178368 /* UDPSocket.cpp */,
                                255EFF731AFABA720069F277 /* LockFileBase.cpp */,
@@ -6419,6 +6431,7 @@
                                254FBBA31A9166F100BD6378 /* SBAttachInfo.h in 
Headers */,
                                26680221115FD13D008E1FE4 /* SBDefines.h in 
Headers */,
                                8CCB018219BA4E270009FD44 /* 
SBThreadCollection.h in Headers */,
+                               9A36D24D1EB3BE7F00AAD9EA /* SBTrace.h in 
Headers */,
                                AF0EBBEC185941360059E52F /* SBQueue.h in 
Headers */,
                                26680222115FD13D008E1FE4 /* SBError.h in 
Headers */,
                                26680223115FD13D008E1FE4 /* SBEvent.h in 
Headers */,
@@ -6457,6 +6470,7 @@
                                941BCC8014E48C4000BB969C /* SBTypeFormat.h in 
Headers */,
                                9475C18F14E5F858001BFC6D /* 
SBTypeNameSpecifier.h in Headers */,
                                941BCC8114E48C4000BB969C /* SBTypeSummary.h in 
Headers */,
+                               9A36D24E1EB3BE7F00AAD9EA /* SBTraceOptions.h in 
Headers */,
                                23059A121958B3B2007B8189 /* SBUnixSignals.h in 
Headers */,
                                941BCC8214E48C4000BB969C /* SBTypeSynthetic.h 
in Headers */,
                                9A19A6AF1163BBB200E0D453 /* SBValue.h in 
Headers */,
@@ -7022,6 +7036,7 @@
                                23DCEA461D1C4D0F00A602B4 /* 
SBMemoryRegionInfo.cpp in Sources */,
                                26680330116005E7008E1FE4 /* SBDebugger.cpp in 
Sources */,
                                26680331116005E9008E1FE4 /* SBCommunication.cpp 
in Sources */,
+                               9A1E595D1EB2B141002206A5 /* SBTraceOptions.cpp 
in Sources */,
                                26680332116005EA008E1FE4 /* 
SBCommandReturnObject.cpp in Sources */,
                                26680333116005EC008E1FE4 /* 
SBCommandInterpreter.cpp in Sources */,
                                26680335116005EE008E1FE4 /* SBBroadcaster.cpp 
in Sources */,
@@ -7042,6 +7057,7 @@
                                261744781168585B005ADD65 /* SBType.cpp in 
Sources */,
                                9A35758E116CFE0F00E8ED2F /* SBValueList.cpp in 
Sources */,
                                9A357673116E7B6400E8ED2F /* SBStringList.cpp in 
Sources */,
+                               9A1E595C1EB2B141002206A5 /* SBTrace.cpp in 
Sources */,
                                9A3576AA116E9AC700E8ED2F /* SBHostOS.cpp in 
Sources */,
                                9AC703AF117675410086C050 /* SBInstruction.cpp 
in Sources */,
                                9AC703B1117675490086C050 /* 
SBInstructionList.cpp in Sources */,
@@ -7292,6 +7308,7 @@
                                945261C41B9A11FC00BF138D /* 
LibCxxUnorderedMap.cpp in Sources */,
                                26CEB5F218762056008F575A /* 
CommandObjectGUI.cpp in Sources */,
                                AF3A4AD21EA05C4700B5DEB4 /* 
PlatformRemoteDarwinDevice.cpp in Sources */,
+                               D67521381EA17C4200439694 /* MainLoop.cpp in 
Sources */,
                                2689008013353E2200698AC0 /* 
CommandInterpreter.cpp in Sources */,
                                AF77E0A41A033D360096C0EA /* 
RegisterContextPOSIX_powerpc.cpp in Sources */,
                                4CDB8D6D1DBA91B6006C5B13 /* 
LibStdcppUniquePointer.cpp in Sources */,
@@ -7784,7 +7801,6 @@
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               30DED5DE1B4ECB49004CC508 /* MainLoopPosix.cpp 
in Sources */,
                                E769331C1A94D15400C73337 /* lldb-gdbserver.cpp 
in Sources */,
                                26DC6A1D1337FECA00FF7998 /* lldb-platform.cpp 
in Sources */,
                                E769331E1A94D18100C73337 /* lldb-server.cpp in 
Sources */,

Modified: 
vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
==============================================================================
--- 
vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
  Tue May  2 18:31:13 2017        (r317691)
+++ 
vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
  Tue May  2 18:31:19 2017        (r317692)
@@ -13,14 +13,13 @@ class SharedLibTestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
-    def test_expr(self):
-        """Test that types work when defined in a shared library and 
forward-declared in the main executable"""
+    def common_test_expr(self, preload_symbols):
         if "clang" in self.getCompiler() and "3.4" in 
self.getCompilerVersion():
             self.skipTest(
                 "llvm.org/pr16214 -- clang emits partial DWARF for structures 
referenced via typedef")
 
         self.build()
-        self.common_setup()
+        self.common_setup(preload_symbols)
 
         # This should display correctly.
         self.expect(
@@ -31,6 +30,18 @@ class SharedLibTestCase(TestBase):
                 "(sub_foo)",
                 "other_element = 3"])
 
+        self.expect(
+            "expression GetMeASubFoo(my_foo_ptr)",
+            startstr="(sub_foo *) $")
+
+    def test_expr(self):
+        """Test that types work when defined in a shared library and 
forward-declared in the main executable"""
+        self.common_test_expr(True)
+
+    def test_expr_no_preload(self):
+        """Test that types work when defined in a shared library and 
forward-declared in the main executable, but with preloading disabled"""
+        self.common_test_expr(False)
+
     @unittest2.expectedFailure("rdar://problem/10704639")
     def test_frame_variable(self):
         """Test that types work when defined in a shared library and 
forward-declared in the main executable"""
@@ -54,7 +65,7 @@ class SharedLibTestCase(TestBase):
         self.line = line_number(self.source, '// Set breakpoint 0 here.')
         self.shlib_names = ["foo"]
 
-    def common_setup(self):
+    def common_setup(self, preload_symbols = True):
         # Run in synchronous mode
         self.dbg.SetAsync(False)
 
@@ -62,6 +73,8 @@ class SharedLibTestCase(TestBase):
         target = self.dbg.CreateTarget("a.out")
         self.assertTrue(target, VALID_TARGET)
 
+        self.runCmd("settings set target.preload-symbols " + 
str(preload_symbols).lower())
+
         # Break inside the foo function which takes a bar_ptr argument.
         lldbutil.run_break_set_by_file_and_line(
             self, self.source, self.line, num_expected_locations=1, 
loc_exact=True)

Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/make/Android.rules
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/make/Android.rules  Tue May 
 2 18:31:13 2017        (r317691)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/make/Android.rules  Tue May 
 2 18:31:19 2017        (r317692)
@@ -63,6 +63,7 @@ endif
 GCC_TOOLCHAIN = $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
 
 OBJCOPY ?= $(GCC_TOOLCHAIN)/bin/$(TOOL_PREFIX)-objcopy
+ARCHIVER ?= $(GCC_TOOLCHAIN)/bin/$(TOOL_PREFIX)-ar
 
 ifeq "$(findstring clang,$(CC))" "clang"
        ARCH_CFLAGS += -target $(TRIPLE) -gcc-toolchain $(GCC_TOOLCHAIN)

Modified: 
vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
==============================================================================
--- 
vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
 Tue May  2 18:31:13 2017        (r317691)
+++ 
vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
 Tue May  2 18:31:19 2017        (r317692)
@@ -319,8 +319,16 @@ class MiExecTestCase(lldbmi_testcase.MiT
         # -exec-step can keep us in the g_MyFunction for gcc
         self.runCmd("-exec-finish --frame 0")
         self.expect("\^running")
-        self.expect(
-            
"\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
+        it = 
self.expect(["\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"",
+                         
"\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\""])
+
+        if it == 1:
+            # Call to s_MyFunction may not follow immediately after 
g_MyFunction.
+            # There might be some instructions in between to restore 
caller-saved registers.
+            # We need to get past these instructions with a next to reach call 
to s_MyFunction.
+            self.runCmd("-exec-next --thread 1")
+            self.expect("\^running")
+            
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
 
         # Test that -exec-step steps into s_MyFunction
         # (and that --frame is optional)

Modified: vendor/lldb/dist/source/Core/Module.cpp
==============================================================================
--- vendor/lldb/dist/source/Core/Module.cpp     Tue May  2 18:31:13 2017        
(r317691)
+++ vendor/lldb/dist/source/Core/Module.cpp     Tue May  2 18:31:19 2017        
(r317692)
@@ -1432,6 +1432,22 @@ size_t Module::FindSymbolsMatchingRegExA
   return sc_list.GetSize() - initial_size;
 }
 
+void Module::PreloadSymbols() {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  SymbolVendor * sym_vendor = GetSymbolVendor();
+  if (!sym_vendor) {
+    return;
+  }
+  // Prime the symbol file first, since it adds symbols to the symbol table.
+  if (SymbolFile *symbol_file = sym_vendor->GetSymbolFile()) {
+    symbol_file->PreloadSymbols();
+  }
+  // Now we can prime the symbol table.
+  if (Symtab * symtab = sym_vendor->GetSymtab()) {
+    symtab->PreloadSymbols();
+  }
+}
+
 void Module::SetSymbolFileFileSpec(const FileSpec &file) {
   if (!file.Exists())
     return;

Modified: vendor/lldb/dist/source/Host/CMakeLists.txt
==============================================================================
--- vendor/lldb/dist/source/Host/CMakeLists.txt Tue May  2 18:31:13 2017        
(r317691)
+++ vendor/lldb/dist/source/Host/CMakeLists.txt Tue May  2 18:31:19 2017        
(r317692)
@@ -15,6 +15,7 @@ add_host_subdirectory(common
   common/HostThread.cpp
   common/IOObject.cpp
   common/LockFileBase.cpp
+  common/MainLoop.cpp
   common/MonitoringProcessLauncher.cpp
   common/NativeBreakpoint.cpp
   common/NativeBreakpointList.cpp
@@ -85,7 +86,6 @@ else()
     posix/HostProcessPosix.cpp
     posix/HostThreadPosix.cpp
     posix/LockFilePosix.cpp
-    posix/MainLoopPosix.cpp
     posix/PipePosix.cpp
     posix/ProcessLauncherPosixFork.cpp
     )

Added: vendor/lldb/dist/source/Host/common/MainLoop.cpp
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/lldb/dist/source/Host/common/MainLoop.cpp    Tue May  2 18:31:19 
2017        (r317692)
@@ -0,0 +1,382 @@
+//===-- MainLoop.cpp --------------------------------------------*- C++ 
-*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Config/llvm-config.h"
+
+#include "lldb/Host/MainLoop.h"
+#include "lldb/Utility/Error.h"
+#include <algorithm>
+#include <cassert>
+#include <cerrno>
+#include <csignal>
+#include <vector>
+#include <time.h>
+
+#if HAVE_SYS_EVENT_H
+#include <sys/event.h>
+#elif defined(LLVM_ON_WIN32)
+#include <winsock2.h>
+#else
+#include <poll.h>
+#endif
+
+#ifdef LLVM_ON_WIN32
+#define POLL WSAPoll
+#else
+#define POLL poll
+#endif
+
+#ifdef __ANDROID__
+#define FORCE_PSELECT
+#endif
+
+#if SIGNAL_POLLING_UNSUPPORTED
+#ifdef LLVM_ON_WIN32
+typedef int sigset_t;
+typedef int siginfo_t;
+#endif
+
+int ppoll(struct pollfd *fds, size_t nfds, const struct timespec *timeout_ts,
+          const sigset_t *) {
+  int timeout =
+      (timeout_ts == nullptr)
+          ? -1
+          : (timeout_ts->tv_sec * 1000 + timeout_ts->tv_nsec / 1000000);
+  return POLL(fds, nfds, timeout);
+}
+
+#endif
+
+using namespace lldb;
+using namespace lldb_private;
+
+static sig_atomic_t g_signal_flags[NSIG];
+
+static void SignalHandler(int signo, siginfo_t *info, void *) {
+  assert(signo < NSIG);
+  g_signal_flags[signo] = 1;
+}
+
+class MainLoop::RunImpl {
+public:
+  // TODO: Use llvm::Expected<T>
+  static std::unique_ptr<RunImpl> Create(MainLoop &loop, Error &error);
+  ~RunImpl();
+
+  Error Poll();
+
+  template <typename F> void ForEachReadFD(F &&f);
+  template <typename F> void ForEachSignal(F &&f);
+
+private:
+  MainLoop &loop;
+
+#if HAVE_SYS_EVENT_H
+  int queue_id;
+  std::vector<struct kevent> in_events;
+  struct kevent out_events[4];
+  int num_events = -1;
+
+  RunImpl(MainLoop &loop, int queue_id) : loop(loop), queue_id(queue_id) {
+    in_events.reserve(loop.m_read_fds.size() + loop.m_signals.size());
+  }
+#else
+  std::vector<int> signals;
+#ifdef FORCE_PSELECT
+  fd_set read_fd_set;
+#else
+  std::vector<struct pollfd> read_fds;
+#endif
+
+  RunImpl(MainLoop &loop) : loop(loop) {
+    signals.reserve(loop.m_signals.size());
+  }
+
+  sigset_t get_sigmask();
+#endif
+};
+
+#if HAVE_SYS_EVENT_H
+MainLoop::RunImpl::~RunImpl() {
+  int r = close(queue_id);
+  assert(r == 0);
+  (void)r;
+}
+std::unique_ptr<MainLoop::RunImpl> MainLoop::RunImpl::Create(MainLoop &loop, 
Error &error)
+{
+  error.Clear();
+  int queue_id = kqueue();
+  if(queue_id < 0) {
+    error = Error(errno, eErrorTypePOSIX);
+    return nullptr;
+  }
+  return std::unique_ptr<RunImpl>(new RunImpl(loop, queue_id));
+}
+
+Error MainLoop::RunImpl::Poll() {
+  in_events.resize(loop.m_read_fds.size() + loop.m_signals.size());
+  unsigned i = 0;
+  for (auto &fd : loop.m_read_fds)
+    EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
+
+  for (const auto &sig : loop.m_signals)
+    EV_SET(&in_events[i++], sig.first, EVFILT_SIGNAL, EV_ADD, 0, 0, 0);
+
+  num_events = kevent(queue_id, in_events.data(), in_events.size(), out_events,
+                      llvm::array_lengthof(out_events), nullptr);
+
+  if (num_events < 0)
+    return Error("kevent() failed with error %d\n", num_events);
+  return Error();
+}
+
+template <typename F> void MainLoop::RunImpl::ForEachReadFD(F &&f) {
+  assert(num_events >= 0);
+  for (int i = 0; i < num_events; ++i) {
+    f(out_events[i].ident);
+    if (loop.m_terminate_request)
+      return;
+  }
+}
+template <typename F> void MainLoop::RunImpl::ForEachSignal(F && f) {}
+#else
+MainLoop::RunImpl::~RunImpl() {}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to