svn commit: r320384 - in vendor/lldb/dist: include/lldb include/lldb/Host include/lldb/Host/common include/lldb/Host/posix lldb.xcodeproj packages/Python/lldbsuite/test packages/Python/lldbsuite/te...

Dimitry Andric dim at FreeBSD.org
Mon Jun 26 20:34:01 UTC 2017


Author: dim
Date: Mon Jun 26 20:33:56 2017
New Revision: 320384
URL: https://svnweb.freebsd.org/changeset/base/320384

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

Added:
  vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/
  vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/
  vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/Makefile   (contents, props changed)
  vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py   (contents, props changed)
  vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/main.c   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/ASan/
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/ASan/CMakeLists.txt   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/MainThreadChecker/
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/TSan/
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/TSan/CMakeLists.txt   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/UBSan/
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/UBSan/CMakeLists.txt   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h   (contents, props changed)
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/
  vendor/lldb/dist/unittests/Host/HostTest.cpp   (contents, props changed)
Deleted:
  vendor/lldb/dist/include/lldb/Host/posix/ProcessLauncherPosix.h
  vendor/lldb/dist/source/Host/posix/ProcessLauncherPosix.cpp
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/AddressSanitizer/CMakeLists.txt
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/ThreadSanitizer/CMakeLists.txt
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h
  vendor/lldb/dist/test/android/
  vendor/lldb/dist/test/api/
  vendor/lldb/dist/test/arm_emulation/
  vendor/lldb/dist/test/attic/
  vendor/lldb/dist/test/benchmarks/
  vendor/lldb/dist/test/c++/
  vendor/lldb/dist/test/driver/
  vendor/lldb/dist/test/example/
  vendor/lldb/dist/test/expression_command/
  vendor/lldb/dist/test/functionalities/
  vendor/lldb/dist/test/help/
  vendor/lldb/dist/test/lang/
  vendor/lldb/dist/test/linux/
  vendor/lldb/dist/test/logging/
  vendor/lldb/dist/test/macosx/
  vendor/lldb/dist/test/make/
  vendor/lldb/dist/test/pexpect-2.4/
  vendor/lldb/dist/test/plugins/
  vendor/lldb/dist/test/python_api/
  vendor/lldb/dist/test/settings/
  vendor/lldb/dist/test/source-manager/
  vendor/lldb/dist/test/terminal/
  vendor/lldb/dist/test/tools/
  vendor/lldb/dist/test/types/
  vendor/lldb/dist/test/unittest2/
  vendor/lldb/dist/test/warnings/
Modified:
  vendor/lldb/dist/include/lldb/Host/Host.h
  vendor/lldb/dist/include/lldb/Host/common/NativeProcessProtocol.h
  vendor/lldb/dist/include/lldb/lldb-enumerations.h
  vendor/lldb/dist/include/lldb/lldb-private-enumerations.h
  vendor/lldb/dist/lldb.xcodeproj/project.pbxproj
  vendor/lldb/dist/packages/Python/lldbsuite/test/decorators.py
  vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
  vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
  vendor/lldb/dist/scripts/Python/python-wrapper.swig
  vendor/lldb/dist/source/API/SBThread.cpp
  vendor/lldb/dist/source/API/SystemInitializerFull.cpp
  vendor/lldb/dist/source/Commands/CommandObjectFrame.cpp
  vendor/lldb/dist/source/Core/IOHandler.cpp
  vendor/lldb/dist/source/Core/Mangled.cpp
  vendor/lldb/dist/source/Core/Timer.cpp
  vendor/lldb/dist/source/Host/CMakeLists.txt
  vendor/lldb/dist/source/Host/common/Host.cpp
  vendor/lldb/dist/source/Host/common/NativeProcessProtocol.cpp
  vendor/lldb/dist/source/Host/macosx/Host.mm
  vendor/lldb/dist/source/Host/posix/ProcessLauncherPosixFork.cpp
  vendor/lldb/dist/source/Host/windows/Host.cpp
  vendor/lldb/dist/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
  vendor/lldb/dist/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  vendor/lldb/dist/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
  vendor/lldb/dist/source/Plugins/InstrumentationRuntime/CMakeLists.txt
  vendor/lldb/dist/source/Plugins/Language/ObjC/Cocoa.cpp
  vendor/lldb/dist/source/Plugins/Language/ObjC/NSArray.cpp
  vendor/lldb/dist/source/Plugins/Language/ObjC/NSDictionary.cpp
  vendor/lldb/dist/source/Plugins/Language/ObjC/ObjCLanguage.cpp
  vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
  vendor/lldb/dist/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
  vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.h
  vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  vendor/lldb/dist/unittests/Host/CMakeLists.txt
  vendor/lldb/dist/unittests/Process/gdb-remote/CMakeLists.txt
  vendor/lldb/dist/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
  vendor/lldb/dist/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  vendor/lldb/dist/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
  vendor/lldb/dist/unittests/Process/gdb-remote/GDBRemoteTestUtils.h
  vendor/lldb/dist/unittests/tools/lldb-server/tests/TestClient.cpp

Modified: vendor/lldb/dist/include/lldb/Host/Host.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/Host.h	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/include/lldb/Host/Host.h	Mon Jun 26 20:33:56 2017	(r320384)
@@ -29,6 +29,27 @@ class FileAction;
 class ProcessLaunchInfo;
 
 //----------------------------------------------------------------------
+// Exit Type for inferior processes
+//----------------------------------------------------------------------
+struct WaitStatus {
+  enum Type : uint8_t {
+    Exit,   // The status represents the return code from normal
+            // program exit (i.e. WIFEXITED() was true)
+    Signal, // The status represents the signal number that caused
+            // the program to exit (i.e. WIFSIGNALED() was true)
+    Stop,   // The status represents the signal number that caused the
+            // program to stop (i.e. WIFSTOPPED() was true)
+  };
+
+  Type type;
+  uint8_t status;
+
+  WaitStatus(Type type, uint8_t status) : type(type), status(status) {}
+
+  static WaitStatus Decode(int wstatus);
+};
+
+//----------------------------------------------------------------------
 /// @class Host Host.h "lldb/Host/Host.h"
 /// @brief A class that provides host computer information.
 ///
@@ -111,15 +132,6 @@ class Host { (public)
 
   static const char *GetSignalAsCString(int signo);
 
-  typedef void (*ThreadLocalStorageCleanupCallback)(void *p);
-
-  static lldb::thread_key_t
-  ThreadLocalStorageCreate(ThreadLocalStorageCleanupCallback callback);
-
-  static void *ThreadLocalStorageGet(lldb::thread_key_t key);
-
-  static void ThreadLocalStorageSet(lldb::thread_key_t key, void *value);
-
   //------------------------------------------------------------------
   /// Given an address in the current process (the process that
   /// is running the LLDB code), return the name of the module that
@@ -184,22 +196,6 @@ class Host { (public)
 
   static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info);
 
-#if (defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) ||       \
-     defined(__GLIBC__) || defined(__NetBSD__) || defined(__OpenBSD__)) &&                             \
-    !defined(__ANDROID__)
-
-  static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info);
-
-  static Status LaunchProcessPosixSpawn(const char *exe_path,
-                                        const ProcessLaunchInfo &launch_info,
-                                        lldb::pid_t &pid);
-
-  static bool AddPosixSpawnFileAction(void *file_actions,
-                                      const FileAction *info, Log *log,
-                                      Status &error);
-
-#endif
-
   static const lldb::UnixSignalsSP &GetUnixSignals();
 
   static Status LaunchProcess(ProcessLaunchInfo &launch_info);
@@ -245,6 +241,15 @@ class Host { (public)
 };
 
 } // namespace lldb_private
+
+namespace llvm {
+template <> struct format_provider<lldb_private::WaitStatus> {
+  /// Options = "" gives a human readable description of the status
+  /// Options = "g" gives a gdb-remote protocol status (e.g., X09)
+  static void format(const lldb_private::WaitStatus &WS, raw_ostream &OS,
+                     llvm::StringRef Options);
+};
+} // namespace llvm
 
 #endif // #if defined(__cplusplus)
 #endif // liblldb_Host_h_

Modified: vendor/lldb/dist/include/lldb/Host/common/NativeProcessProtocol.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Host/common/NativeProcessProtocol.h	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/include/lldb/Host/common/NativeProcessProtocol.h	Mon Jun 26 20:33:56 2017	(r320384)
@@ -11,6 +11,7 @@
 #define liblldb_NativeProcessProtocol_h_
 
 #include "lldb/Core/TraceOptions.h"
+#include "lldb/Host/Host.h"
 #include "lldb/Host/MainLoop.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-private-forward.h"
@@ -158,12 +159,9 @@ class NativeProcessProtocol (public)
   //----------------------------------------------------------------------
   // Exit Status
   //----------------------------------------------------------------------
-  virtual bool GetExitStatus(lldb_private::ExitType *exit_type, int *status,
-                             std::string &exit_description);
+  virtual llvm::Optional<WaitStatus> GetExitStatus();
 
-  virtual bool SetExitStatus(lldb_private::ExitType exit_type, int status,
-                             const char *exit_description,
-                             bool bNotifyStateChange);
+  virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange);
 
   //----------------------------------------------------------------------
   // Access to threads
@@ -421,9 +419,8 @@ class NativeProcessProtocol (public)
   lldb::StateType m_state;
   mutable std::recursive_mutex m_state_mutex;
 
-  lldb_private::ExitType m_exit_type;
-  int m_exit_status;
-  std::string m_exit_description;
+  llvm::Optional<WaitStatus> m_exit_status;
+
   std::recursive_mutex m_delegates_mutex;
   std::vector<NativeDelegate *> m_delegates;
   NativeBreakpointList m_breakpoint_list;

Modified: vendor/lldb/dist/include/lldb/lldb-enumerations.h
==============================================================================
--- vendor/lldb/dist/include/lldb/lldb-enumerations.h	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/include/lldb/lldb-enumerations.h	Mon Jun 26 20:33:56 2017	(r320384)
@@ -454,6 +454,8 @@ enum LanguageType {
 enum InstrumentationRuntimeType {
   eInstrumentationRuntimeTypeAddressSanitizer = 0x0000,
   eInstrumentationRuntimeTypeThreadSanitizer = 0x0001,
+  eInstrumentationRuntimeTypeUndefinedBehaviorSanitizer = 0x0002,
+  eInstrumentationRuntimeTypeMainThreadChecker = 0x0003,
   eNumInstrumentationRuntimeTypes
 };
 

Modified: vendor/lldb/dist/include/lldb/lldb-private-enumerations.h
==============================================================================
--- vendor/lldb/dist/include/lldb/lldb-private-enumerations.h	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/include/lldb/lldb-private-enumerations.h	Mon Jun 26 20:33:56 2017	(r320384)
@@ -212,19 +212,6 @@ enum class LineStatus {
 };
 
 //----------------------------------------------------------------------
-// Exit Type for inferior processes
-//----------------------------------------------------------------------
-typedef enum ExitType {
-  eExitTypeInvalid,
-  eExitTypeExit,   // The exit status represents the return code from normal
-                   // program exit (i.e. WIFEXITED() was true)
-  eExitTypeSignal, // The exit status represents the signal number that caused
-                   // the program to exit (i.e. WIFSIGNALED() was true)
-  eExitTypeStop,   // The exit status represents the stop signal that caused the
-                   // program to exit (i.e. WIFSTOPPED() was true)
-} ExitType;
-
-//----------------------------------------------------------------------
 // Boolean result of running a Type Validator
 //----------------------------------------------------------------------
 enum class TypeValidatorResult : bool { Success = true, Failure = false };

Modified: vendor/lldb/dist/lldb.xcodeproj/project.pbxproj
==============================================================================
--- vendor/lldb/dist/lldb.xcodeproj/project.pbxproj	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/lldb.xcodeproj/project.pbxproj	Mon Jun 26 20:33:56 2017	(r320384)
@@ -744,6 +744,7 @@
 		4CF3D80C15AF4DC800845BF3 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework */; };
 		4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CF52AF41428291E0051E832 /* SBFileSpecList.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF52AF7142829390051E832 /* SBFileSpecList.cpp */; };
+		54067BF11DF2041B00749AA5 /* UndefinedBehaviorSanitizerRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54067BEC1DF2034B00749AA5 /* UndefinedBehaviorSanitizerRuntime.cpp */; };
 		6D0F61431C80AAAE00A4ECEE /* JavaASTContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F61411C80AAAA00A4ECEE /* JavaASTContext.cpp */; };
 		6D0F61481C80AAD600A4ECEE /* DWARFASTParserJava.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F61441C80AACF00A4ECEE /* DWARFASTParserJava.cpp */; };
 		6D0F614E1C80AB0700A4ECEE /* JavaLanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F614A1C80AB0400A4ECEE /* JavaLanguageRuntime.cpp */; };
@@ -766,6 +767,7 @@
 		8C26C4261C3EA5F90031DF7C /* ThreadSanitizerRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C26C4241C3EA4340031DF7C /* ThreadSanitizerRuntime.cpp */; };
 		8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */; };
 		8C2D6A5E197A250F006989C9 /* MemoryHistoryASan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */; };
+		8C3BD9961EF45DA50016C343 /* MainThreadCheckerRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */; };
 		8CCB017E19BA28A80009FD44 /* ThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */; };
 		8CCB018219BA4E270009FD44 /* SBThreadCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CCB018119BA4E210009FD44 /* SBThreadCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		8CCB018319BA51BF0009FD44 /* SBThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017F19BA4DD00009FD44 /* SBThreadCollection.cpp */; };
@@ -2576,6 +2578,8 @@
 		4CEDAED311754F5E00E875A6 /* ThreadPlanStepUntil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanStepUntil.h; path = include/lldb/Target/ThreadPlanStepUntil.h; sourceTree = "<group>"; };
 		4CF52AF41428291E0051E832 /* SBFileSpecList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBFileSpecList.h; path = include/lldb/API/SBFileSpecList.h; sourceTree = "<group>"; };
 		4CF52AF7142829390051E832 /* SBFileSpecList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBFileSpecList.cpp; path = source/API/SBFileSpecList.cpp; sourceTree = "<group>"; };
+		54067BEC1DF2034B00749AA5 /* UndefinedBehaviorSanitizerRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = UndefinedBehaviorSanitizerRuntime.cpp; path = UndefinedBehaviorSanitizer/UndefinedBehaviorSanitizerRuntime.cpp; sourceTree = "<group>"; };
+		54067BED1DF2034B00749AA5 /* UndefinedBehaviorSanitizerRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UndefinedBehaviorSanitizerRuntime.h; path = UndefinedBehaviorSanitizer/UndefinedBehaviorSanitizerRuntime.h; sourceTree = "<group>"; };
 		69A01E1C1236C5D400C660B5 /* Host.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Host.cpp; sourceTree = "<group>"; };
 		69A01E1F1236C5D400C660B5 /* Symbols.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Symbols.cpp; sourceTree = "<group>"; };
 		6D0F613C1C80AA8900A4ECEE /* DebugMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DebugMacros.h; path = include/lldb/Symbol/DebugMacros.h; sourceTree = "<group>"; };
@@ -2624,6 +2628,8 @@
 		8C2D6A54197A1EBE006989C9 /* MemoryHistory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MemoryHistory.h; path = include/lldb/Target/MemoryHistory.h; sourceTree = "<group>"; };
 		8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryHistoryASan.cpp; sourceTree = "<group>"; };
 		8C2D6A5B197A1FDC006989C9 /* MemoryHistoryASan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryHistoryASan.h; sourceTree = "<group>"; };
+		8C3BD9931EF45D9B0016C343 /* MainThreadCheckerRuntime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MainThreadCheckerRuntime.h; sourceTree = "<group>"; };
+		8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MainThreadCheckerRuntime.cpp; sourceTree = "<group>"; };
 		8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadCollection.cpp; path = source/Target/ThreadCollection.cpp; sourceTree = "<group>"; };
 		8CCB017C19BA289B0009FD44 /* ThreadCollection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ThreadCollection.h; path = include/lldb/Target/ThreadCollection.h; sourceTree = "<group>"; };
 		8CCB017F19BA4DD00009FD44 /* SBThreadCollection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SBThreadCollection.cpp; path = source/API/SBThreadCollection.cpp; sourceTree = "<group>"; };
@@ -5912,6 +5918,15 @@
 			path = "gdb-remote";
 			sourceTree = "<group>";
 		};
+		54067BEA1DF2033700749AA5 /* UndefinedBehaviorSanitizer */ = {
+			isa = PBXGroup;
+			children = (
+				54067BEC1DF2034B00749AA5 /* UndefinedBehaviorSanitizerRuntime.cpp */,
+				54067BED1DF2034B00749AA5 /* UndefinedBehaviorSanitizerRuntime.h */,
+			);
+			name = UndefinedBehaviorSanitizer;
+			sourceTree = "<group>";
+		};
 		69A01E1A1236C5D400C660B5 /* common */ = {
 			isa = PBXGroup;
 			children = (
@@ -6011,11 +6026,22 @@
 			path = asan;
 			sourceTree = "<group>";
 		};
+		8C3BD9911EF45D9B0016C343 /* MainThreadChecker */ = {
+			isa = PBXGroup;
+			children = (
+				8C3BD9931EF45D9B0016C343 /* MainThreadCheckerRuntime.h */,
+				8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */,
+			);
+			path = MainThreadChecker;
+			sourceTree = "<group>";
+		};
 		8CF02ADD19DCBEC200B14BE0 /* InstrumentationRuntime */ = {
 			isa = PBXGroup;
 			children = (
+				54067BEA1DF2033700749AA5 /* UndefinedBehaviorSanitizer */,
 				8C26C4221C3EA4050031DF7C /* ThreadSanitizer */,
 				8CF02ADE19DCBEE600B14BE0 /* AddressSanitizer */,
+				8C3BD9911EF45D9B0016C343 /* MainThreadChecker */,
 			);
 			path = InstrumentationRuntime;
 			sourceTree = "<group>";
@@ -7133,6 +7159,7 @@
 				2689001213353DDE00698AC0 /* CommandObjectApropos.cpp in Sources */,
 				4C88BC2A1BA3722B00AA0964 /* Expression.cpp in Sources */,
 				AE44FB4C1BB4BB540033EB62 /* GoFormatterFunctions.cpp in Sources */,
+				8C3BD9961EF45DA50016C343 /* MainThreadCheckerRuntime.cpp in Sources */,
 				23042D121976CA1D00621B2C /* PlatformKalimba.cpp in Sources */,
 				2689001313353DDE00698AC0 /* CommandObjectArgs.cpp in Sources */,
 				2689001413353DDE00698AC0 /* CommandObjectBreakpoint.cpp in Sources */,
@@ -7623,6 +7650,7 @@
 				26954EBE1401EE8B00294D09 /* DynamicRegisterInfo.cpp in Sources */,
 				6D9AB3DD1BB2B74E003F2289 /* TypeMap.cpp in Sources */,
 				255EFF761AFABA950069F277 /* LockFilePosix.cpp in Sources */,
+				54067BF11DF2041B00749AA5 /* UndefinedBehaviorSanitizerRuntime.cpp in Sources */,
 				3FBA69EC1B6067430008F44A /* PythonDataObjects.cpp in Sources */,
 				26274FA714030F79006BA130 /* DynamicLoaderDarwinKernel.cpp in Sources */,
 				94FA3DE01405D50400833217 /* ValueObjectConstResultChild.cpp in Sources */,

Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/decorators.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/decorators.py	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/decorators.py	Mon Jun 26 20:33:56 2017	(r320384)
@@ -681,6 +681,53 @@ def skipUnlessThreadSanitizer(func):
         return None
     return skipTestIfFn(is_compiler_clang_with_thread_sanitizer)(func)
 
+def skipUnlessUndefinedBehaviorSanitizer(func):
+    """Decorate the item to skip test unless -fsanitize=undefined is supported."""
+
+    def is_compiler_clang_with_ubsan(self):
+        # Write out a temp file which exhibits UB.
+        inputf = tempfile.NamedTemporaryFile(suffix='.c')
+        inputf.write('int main() { int x = 0; return x / x; }\n')
+        inputf.flush()
+
+        # We need to write out the object into a named temp file for inspection.
+        outputf = tempfile.NamedTemporaryFile()
+
+        # Try to compile with ubsan turned on.
+        cmd = '%s -fsanitize=undefined %s -o %s' % (self.getCompiler(), inputf.name, outputf.name)
+        if os.popen(cmd).close() is not None:
+            return "Compiler cannot compile with -fsanitize=undefined"
+
+        # Check that we actually see ubsan instrumentation in the binary.
+        cmd = 'nm %s' % outputf.name
+        with os.popen(cmd) as nm_output:
+            if '___ubsan_handle_divrem_overflow' not in nm_output.read():
+                return "Division by zero instrumentation is missing"
+
+        # Find the ubsan dylib.
+        # FIXME: This check should go away once compiler-rt gains support for __ubsan_on_report.
+        cmd = '%s -fsanitize=undefined -x c - -o - -### 2>&1' % self.getCompiler()
+        with os.popen(cmd) as cc_output:
+            driver_jobs = cc_output.read()
+            m = re.search(r'"([^"]+libclang_rt.ubsan_osx_dynamic.dylib)"', driver_jobs)
+            if not m:
+                return "Could not find the ubsan dylib used by the driver"
+            ubsan_dylib = m.group(1)
+
+        # Check that the ubsan dylib has special monitor hooks.
+        cmd = 'nm -gU %s' % ubsan_dylib
+        with os.popen(cmd) as nm_output:
+            syms = nm_output.read()
+            if '___ubsan_on_report' not in syms:
+                return "Missing ___ubsan_on_report"
+            if '___ubsan_get_current_report_data' not in syms:
+                return "Missing ___ubsan_get_current_report_data"
+
+        # OK, this dylib + compiler works for us.
+        return None
+
+    return skipTestIfFn(is_compiler_clang_with_ubsan)(func)
+
 def skipUnlessAddressSanitizer(func):
     """Decorate the item to skip test unless Clang -fsanitize=thread is supported."""
 

Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py	Mon Jun 26 20:33:56 2017	(r320384)
@@ -186,15 +186,26 @@ class ObjCDataFormatterTestCase(TestBase):
 
     def nsnumber_data_formatter_commands(self):
         # Now enable AppKit and check we are displaying Cocoa classes correctly
-        self.expect('frame variable num1 num2 num3 num4 num5 num6 num7 num9',
+        self.expect('frame variable num1 num2 num3 num5 num6 num7 num9',
                     substrs=['(NSNumber *) num1 = ', ' (int)5',
                              '(NSNumber *) num2 = ', ' (float)3.1',
                              '(NSNumber *) num3 = ', ' (double)3.14',
-                             '(NSNumber *) num4 = ', ' (long)-2',
                              '(NSNumber *) num5 = ', ' (char)65',
                              '(NSNumber *) num6 = ', ' (long)255',
                              '(NSNumber *) num7 = ', '2000000',
                              '(NSNumber *) num9 = ', ' (short)-31616'])
+
+        
+        self.runCmd('frame variable num4', check=True)
+        output = self.res.GetOutput()
+        i128_handled_correctly = False
+
+        if output.find('long') >= 0:
+            i128_handled_correctly = (output.find('(long)-2') >= 0)
+        if output.find('int128_t') >= 0:
+            i128_handled_correctly = (output.find('(int128_t)18446744073709551614') >= 0) # deliberately broken, should be ..14
+
+        self.assertTrue(i128_handled_correctly, "Expected valid output for int128_t; got " + output)
 
         self.expect('frame variable num_at1 num_at2 num_at3 num_at4',
                     substrs=['(NSNumber *) num_at1 = ', ' (int)12',

Added: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/Makefile	Mon Jun 26 20:33:56 2017	(r320384)
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+CFLAGS_EXTRAS := -fsanitize=undefined -g
+
+include $(LEVEL)/Makefile.rules

Added: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py	Mon Jun 26 20:33:56 2017	(r320384)
@@ -0,0 +1,90 @@
+"""
+Tests basic UndefinedBehaviorSanitizer support (detecting an alignment error).
+"""
+
+import os
+import time
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+import lldbsuite.test.lldbutil as lldbutil
+import json
+
+
+class UbsanBasicTestCase(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
+    @skipUnlessUndefinedBehaviorSanitizer
+    def test(self):
+        self.build()
+        self.ubsan_tests()
+
+    def setUp(self):
+        # Call super's setUp().
+        TestBase.setUp(self)
+        self.line_align = line_number('main.c', '// align line')
+
+    def ubsan_tests(self):
+        # Load the test
+        exe = os.path.join(os.getcwd(), "a.out")
+        self.expect(
+            "file " + exe,
+            patterns=["Current executable set to .*a.out"])
+
+        self.runCmd("run")
+
+        process = self.dbg.GetSelectedTarget().process
+        thread = process.GetSelectedThread()
+        frame = thread.GetSelectedFrame()
+
+        # the stop reason of the thread should be breakpoint.
+        self.expect("thread list", "A ubsan issue should be detected",
+                    substrs=['stopped', 'stop reason ='])
+
+        stop_reason = thread.GetStopReason()
+        self.assertEqual(stop_reason, lldb.eStopReasonInstrumentation)
+
+        # test that the UBSan dylib is present
+        self.expect(
+            "image lookup -n __ubsan_on_report",
+            "__ubsan_on_report should be present",
+            substrs=['1 match found'])
+
+        # We should be stopped in __ubsan_on_report
+        self.assertTrue("__ubsan_on_report" in frame.GetFunctionName())
+
+        # The stopped thread backtrace should contain either 'align line'
+        found = False
+        for i in range(thread.GetNumFrames()):
+            frame = thread.GetFrameAtIndex(i)
+            if frame.GetLineEntry().GetFileSpec().GetFilename() == "main.c":
+                if frame.GetLineEntry().GetLine() == self.line_align:
+                    found = True
+        self.assertTrue(found)
+
+        backtraces = thread.GetStopReasonExtendedBacktraces(
+            lldb.eInstrumentationRuntimeTypeUndefinedBehaviorSanitizer)
+        self.assertTrue(backtraces.GetSize() == 1)
+
+        self.expect(
+            "thread info -s",
+            "The extended stop info should contain the UBSan provided fields",
+            substrs=[
+                "instrumentation_class",
+                "memory_address",
+                "description",
+                "filename",
+                "line",
+                "col"])
+
+        output_lines = self.res.GetOutput().split('\n')
+        json_line = '\n'.join(output_lines[2:])
+        data = json.loads(json_line)
+
+        self.assertEqual(data["instrumentation_class"], "UndefinedBehaviorSanitizer")
+        self.assertEqual(data["description"], "misaligned-pointer-use")
+        self.assertEqual(data["filename"], "main.c")
+        self.assertEqual(data["line"], self.line_align)
+
+        self.runCmd("continue")

Added: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/main.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/ubsan/basic/main.c	Mon Jun 26 20:33:56 2017	(r320384)
@@ -0,0 +1,4 @@
+int main() {
+  int data[4];
+  return *(int *)(((char *)&data[0]) + 2); // align line
+}

Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py	Mon Jun 26 20:33:56 2017	(r320384)
@@ -121,8 +121,6 @@ class ObjCNewSyntaxTestCase(TestBase):
             '7.0.0'])
     @skipIf(macos_version=["<", "10.12"])
     @expectedFailureAll(archs=["i[3-6]86"])
-    @expectedFailureAll(
-        bugnumber="rdar://32777981")
     def test_update_dictionary(self):
         self.runToBreakpoint()
 
@@ -165,8 +163,6 @@ class ObjCNewSyntaxTestCase(TestBase):
             '7.0.0'])
     @skipIf(macos_version=["<", "10.12"])
     @expectedFailureAll(archs=["i[3-6]86"])
-    @expectedFailureAll(
-        bugnumber="rdar://32777981")
     def test_dictionary_literal(self):
         self.runToBreakpoint()
 

Modified: vendor/lldb/dist/scripts/Python/python-wrapper.swig
==============================================================================
--- vendor/lldb/dist/scripts/Python/python-wrapper.swig	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/scripts/Python/python-wrapper.swig	Mon Jun 26 20:33:56 2017	(r320384)
@@ -929,7 +929,8 @@ void LLDBSwigPythonCallPythonLogOutputCallback(const c
 void LLDBSwigPythonCallPythonLogOutputCallback(const char *str, void *baton) {
     if (baton != Py_None) {
       SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-      PyObject_CallFunction(reinterpret_cast<PyObject*>(baton), const_cast<char*>("s"), str);
+      PyObject *result = PyObject_CallFunction(reinterpret_cast<PyObject*>(baton), const_cast<char*>("s"), str);
+	  Py_XDECREF(result);
       SWIG_PYTHON_THREAD_END_BLOCK;
     }
 }

Modified: vendor/lldb/dist/source/API/SBThread.cpp
==============================================================================
--- vendor/lldb/dist/source/API/SBThread.cpp	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/source/API/SBThread.cpp	Mon Jun 26 20:33:56 2017	(r320384)
@@ -293,10 +293,6 @@ SBThread::GetStopReasonExtendedBacktraces(Instrumentat
   ThreadCollectionSP threads;
   threads.reset(new ThreadCollection());
 
-  // We currently only support ThreadSanitizer.
-  if (type != eInstrumentationRuntimeTypeThreadSanitizer)
-    return threads;
-
   std::unique_lock<std::recursive_mutex> lock;
   ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 

Modified: vendor/lldb/dist/source/API/SystemInitializerFull.cpp
==============================================================================
--- vendor/lldb/dist/source/API/SystemInitializerFull.cpp	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/source/API/SystemInitializerFull.cpp	Mon Jun 26 20:33:56 2017	(r320384)
@@ -49,8 +49,10 @@
 #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
 #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
 #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
-#include "Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h"
-#include "Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h"
+#include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h"
+#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h"
+#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h"
+#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
 #include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
 #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
 #include "Plugins/Language/Go/GoLanguage.h"
@@ -310,6 +312,8 @@ void SystemInitializerFull::Initialize() {
   MemoryHistoryASan::Initialize();
   AddressSanitizerRuntime::Initialize();
   ThreadSanitizerRuntime::Initialize();
+  UndefinedBehaviorSanitizerRuntime::Initialize();
+  MainThreadCheckerRuntime::Initialize();
 
   SymbolVendorELF::Initialize();
   SymbolFileDWARF::Initialize();
@@ -434,6 +438,8 @@ void SystemInitializerFull::Terminate() {
   MemoryHistoryASan::Terminate();
   AddressSanitizerRuntime::Terminate();
   ThreadSanitizerRuntime::Terminate();
+  UndefinedBehaviorSanitizerRuntime::Terminate();
+  MainThreadCheckerRuntime::Terminate();
   SymbolVendorELF::Terminate();
   SymbolFileDWARF::Terminate();
   SymbolFilePDB::Terminate();

Modified: vendor/lldb/dist/source/Commands/CommandObjectFrame.cpp
==============================================================================
--- vendor/lldb/dist/source/Commands/CommandObjectFrame.cpp	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/source/Commands/CommandObjectFrame.cpp	Mon Jun 26 20:33:56 2017	(r320384)
@@ -655,32 +655,30 @@ class CommandObjectFrameVariable : public CommandObjec
         if (num_variables > 0) {
           for (size_t i = 0; i < num_variables; i++) {
             var_sp = variable_list->GetVariableAtIndex(i);
-            switch (var_sp->GetScope())
-            {
-              case eValueTypeVariableGlobal:
-                if  (!m_option_variable.show_globals)
-                  continue;
-                break;
-              case eValueTypeVariableStatic:
-                if (!m_option_variable.show_globals)
-                  continue;
-                break;
-              case eValueTypeVariableArgument:
-                if (!m_option_variable.show_args)
-                  continue;
-                break;
-              case eValueTypeVariableLocal:
-                if (!m_option_variable.show_locals)
-                  continue;
-                break;
-              default:
+            switch (var_sp->GetScope()) {
+            case eValueTypeVariableGlobal:
+              if (!m_option_variable.show_globals)
                 continue;
-                break;
-                
+              break;
+            case eValueTypeVariableStatic:
+              if (!m_option_variable.show_globals)
+                continue;
+              break;
+            case eValueTypeVariableArgument:
+              if (!m_option_variable.show_args)
+                continue;
+              break;
+            case eValueTypeVariableLocal:
+              if (!m_option_variable.show_locals)
+                continue;
+              break;
+            default:
+              continue;
+              break;
             }
-          std::string scope_string;
-          if (m_option_variable.show_scope)
-            scope_string = GetScopeString(var_sp).str();
+            std::string scope_string;
+            if (m_option_variable.show_scope)
+              scope_string = GetScopeString(var_sp).str();
 
             // Use the variable object code to make sure we are
             // using the same APIs as the public API will be

Modified: vendor/lldb/dist/source/Core/IOHandler.cpp
==============================================================================
--- vendor/lldb/dist/source/Core/IOHandler.cpp	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/source/Core/IOHandler.cpp	Mon Jun 26 20:33:56 2017	(r320384)
@@ -58,7 +58,7 @@
 #include "llvm/ADT/StringRef.h" // for StringRef
 
 #ifdef _MSC_VER
-#include <windows.h>
+#include "lldb/Host/windows/windows.h"
 #endif
 
 #include <memory> // for shared_ptr

Modified: vendor/lldb/dist/source/Core/Mangled.cpp
==============================================================================
--- vendor/lldb/dist/source/Core/Mangled.cpp	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/source/Core/Mangled.cpp	Mon Jun 26 20:33:56 2017	(r320384)
@@ -10,7 +10,7 @@
 #include "lldb/Core/Mangled.h"
 
 #if defined(_WIN32)
-#include <windows.h>
+#include "lldb/Host/windows/windows.h"
 
 #include <dbghelp.h>
 #pragma comment(lib, "dbghelp.lib")

Modified: vendor/lldb/dist/source/Core/Timer.cpp
==============================================================================
--- vendor/lldb/dist/source/Core/Timer.cpp	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/source/Core/Timer.cpp	Mon Jun 26 20:33:56 2017	(r320384)
@@ -38,22 +38,11 @@ static std::mutex &GetFileMutex() {
   return *g_file_mutex_ptr;
 }
 
-static void ThreadSpecificCleanup(void *p) {
-  delete static_cast<TimerStack *>(p);
+static TimerStack &GetTimerStackForCurrentThread() {
+  static thread_local TimerStack g_stack;
+  return g_stack;
 }
 
-static TimerStack *GetTimerStackForCurrentThread() {
-  static lldb::thread_key_t g_key =
-      Host::ThreadLocalStorageCreate(ThreadSpecificCleanup);
-
-  void *timer_stack = Host::ThreadLocalStorageGet(g_key);
-  if (timer_stack == NULL) {
-    Host::ThreadLocalStorageSet(g_key, new TimerStack);
-    timer_stack = Host::ThreadLocalStorageGet(g_key);
-  }
-  return (TimerStack *)timer_stack;
-}
-
 Timer::Category::Category(const char *cat) : m_name(cat) {
   m_nanos.store(0, std::memory_order_release);
   Category *expected = g_categories;
@@ -66,16 +55,14 @@ void Timer::SetQuiet(bool value) { g_quiet = value; }
 
 Timer::Timer(Timer::Category &category, const char *format, ...)
     : m_category(category), m_total_start(std::chrono::steady_clock::now()) {
-  TimerStack *stack = GetTimerStackForCurrentThread();
-  if (!stack)
-    return;
+  TimerStack &stack = GetTimerStackForCurrentThread();
 
-  stack->push_back(this);
-  if (g_quiet && stack->size() <= g_display_depth) {
+  stack.push_back(this);
+  if (g_quiet && stack.size() <= g_display_depth) {
     std::lock_guard<std::mutex> lock(GetFileMutex());
 
     // Indent
-    ::fprintf(stdout, "%*s", int(stack->size() - 1) * TIMER_INDENT_AMOUNT, "");
+    ::fprintf(stdout, "%*s", int(stack.size() - 1) * TIMER_INDENT_AMOUNT, "");
     // Print formatted string
     va_list args;
     va_start(args, format);
@@ -90,26 +77,23 @@ Timer::Timer(Timer::Category &category, const char *fo
 Timer::~Timer() {
   using namespace std::chrono;
 
-  TimerStack *stack = GetTimerStackForCurrentThread();
-  if (!stack)
-    return;
-
   auto stop_time = steady_clock::now();
   auto total_dur = stop_time - m_total_start;
   auto timer_dur = total_dur - m_child_duration;
 
-  if (g_quiet && stack->size() <= g_display_depth) {
+  TimerStack &stack = GetTimerStackForCurrentThread();
+  if (g_quiet && stack.size() <= g_display_depth) {
     std::lock_guard<std::mutex> lock(GetFileMutex());
     ::fprintf(stdout, "%*s%.9f sec (%.9f sec)\n",
-              int(stack->size() - 1) * TIMER_INDENT_AMOUNT, "",
+              int(stack.size() - 1) * TIMER_INDENT_AMOUNT, "",
               duration<double>(total_dur).count(),
               duration<double>(timer_dur).count());
   }
 
-  assert(stack->back() == this);
-  stack->pop_back();
-  if (!stack->empty())
-    stack->back()->ChildDuration(total_dur);
+  assert(stack.back() == this);
+  stack.pop_back();
+  if (!stack.empty())
+    stack.back()->ChildDuration(total_dur);
 
   // Keep total results for each category so we can dump results.
   m_category.m_nanos += std::chrono::nanoseconds(timer_dur).count();

Modified: vendor/lldb/dist/source/Host/CMakeLists.txt
==============================================================================
--- vendor/lldb/dist/source/Host/CMakeLists.txt	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/source/Host/CMakeLists.txt	Mon Jun 26 20:33:56 2017	(r320384)
@@ -90,12 +90,6 @@ else()
     posix/ProcessLauncherPosixFork.cpp
     )
 
-  if (NOT (CMAKE_SYSTEM_NAME MATCHES "Android"))
-    add_host_subdirectory(posix
-      posix/ProcessLauncherPosix.cpp
-      )
-  endif()
-
   if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
     include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
     add_host_subdirectory(macosx

Modified: vendor/lldb/dist/source/Host/common/Host.cpp
==============================================================================
--- vendor/lldb/dist/source/Host/common/Host.cpp	Mon Jun 26 20:33:51 2017	(r320383)
+++ vendor/lldb/dist/source/Host/common/Host.cpp	Mon Jun 26 20:33:56 2017	(r320384)
@@ -68,15 +68,14 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-private-forward.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
 
 #if defined(_WIN32)
 #include "lldb/Host/windows/ProcessLauncherWindows.h"
-#elif defined(__linux__) || defined(__NetBSD__)
-#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
 #else
-#include "lldb/Host/posix/ProcessLauncherPosix.h"
+#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
 #endif
 
 #if defined(__APPLE__)
@@ -407,25 +406,6 @@ const char *Host::GetSignalAsCString(int signo) {
 
 #endif
 
-#ifndef _WIN32
-
-lldb::thread_key_t
-Host::ThreadLocalStorageCreate(ThreadLocalStorageCleanupCallback callback) {
-  pthread_key_t key;
-  ::pthread_key_create(&key, callback);
-  return key;
-}
-
-void *Host::ThreadLocalStorageGet(lldb::thread_key_t key) {
-  return ::pthread_getspecific(key);
-}
-
-void Host::ThreadLocalStorageSet(lldb::thread_key_t key, void *value) {
-  ::pthread_setspecific(key, value);
-}
-
-#endif
-
 #if !defined(__APPLE__) // see Host.mm
 
 bool Host::GetBundleDirectory(const FileSpec &file, FileSpec &bundle) {
@@ -602,359 +582,14 @@ Status Host::RunShellCommand(const Args &args, const F
   return error;
 }
 
-// LaunchProcessPosixSpawn for Apple, Linux, FreeBSD, NetBSD and other GLIBC
-// systems
-
-#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) ||        \
-    defined(__GLIBC__) || defined(__NetBSD__)
-#if !defined(__ANDROID__)
-// this method needs to be visible to macosx/Host.cpp and
-// common/Host.cpp.
-
-short Host::GetPosixspawnFlags(const ProcessLaunchInfo &launch_info) {
-  short flags = POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK;
-
-#if defined(__APPLE__)
-  if (launch_info.GetFlags().Test(eLaunchFlagExec))
-    flags |= POSIX_SPAWN_SETEXEC; // Darwin specific posix_spawn flag
-
-  if (launch_info.GetFlags().Test(eLaunchFlagDebug))
-    flags |= POSIX_SPAWN_START_SUSPENDED; // Darwin specific posix_spawn flag
-
-  if (launch_info.GetFlags().Test(eLaunchFlagDisableASLR))
-    flags |= _POSIX_SPAWN_DISABLE_ASLR; // Darwin specific posix_spawn flag
-
-  if (launch_info.GetLaunchInSeparateProcessGroup())
-    flags |= POSIX_SPAWN_SETPGROUP;
-
-#ifdef POSIX_SPAWN_CLOEXEC_DEFAULT
-#if defined(__APPLE__) && (defined(__x86_64__) || defined(__i386__))
-  static LazyBool g_use_close_on_exec_flag = eLazyBoolCalculate;
-  if (g_use_close_on_exec_flag == eLazyBoolCalculate) {
-    g_use_close_on_exec_flag = eLazyBoolNo;
-
-    uint32_t major, minor, update;
-    if (HostInfo::GetOSVersion(major, minor, update)) {
-      // Kernel panic if we use the POSIX_SPAWN_CLOEXEC_DEFAULT on 10.7 or
-      // earlier
-      if (major > 10 || (major == 10 && minor > 7)) {
-        // Only enable for 10.8 and later OS versions
-        g_use_close_on_exec_flag = eLazyBoolYes;
-      }
-    }
-  }
-#else
-  static LazyBool g_use_close_on_exec_flag = eLazyBoolYes;
-#endif
-  // Close all files exception those with file actions if this is supported.
-  if (g_use_close_on_exec_flag == eLazyBoolYes)
-    flags |= POSIX_SPAWN_CLOEXEC_DEFAULT;
-#endif
-#endif // #if defined (__APPLE__)
-  return flags;
-}
-
-Status Host::LaunchProcessPosixSpawn(const char *exe_path,
-                                     const ProcessLaunchInfo &launch_info,
-                                     lldb::pid_t &pid) {
-  Status error;
-  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST |
-                                                  LIBLLDB_LOG_PROCESS));
-
-  posix_spawnattr_t attr;
-  error.SetError(::posix_spawnattr_init(&attr), eErrorTypePOSIX);
-
-  if (error.Fail()) {
-    LLDB_LOG(log, "error: {0}, ::posix_spawnattr_init ( &attr )", error);
-    return error;
-  }
-
-  // Make a quick class that will cleanup the posix spawn attributes in case
-  // we return in the middle of this function.
-  lldb_utility::CleanUp<posix_spawnattr_t *, int> posix_spawnattr_cleanup(
-      &attr, posix_spawnattr_destroy);
-
-  sigset_t no_signals;
-  sigset_t all_signals;
-  sigemptyset(&no_signals);
-  sigfillset(&all_signals);
-  ::posix_spawnattr_setsigmask(&attr, &no_signals);
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
-  ::posix_spawnattr_setsigdefault(&attr, &no_signals);
-#else
-  ::posix_spawnattr_setsigdefault(&attr, &all_signals);
-#endif
-
-  short flags = GetPosixspawnFlags(launch_info);
-
-  error.SetError(::posix_spawnattr_setflags(&attr, flags), eErrorTypePOSIX);
-  if (error.Fail()) {
-    LLDB_LOG(log,
-             "error: {0}, ::posix_spawnattr_setflags ( &attr, flags={1:x} )",
-             error, flags);
-    return error;
-  }
-
-// posix_spawnattr_setbinpref_np appears to be an Apple extension per:
-// http://www.unix.com/man-page/OSX/3/posix_spawnattr_setbinpref_np/
-#if defined(__APPLE__) && !defined(__arm__)
-
-  // Don't set the binpref if a shell was provided.  After all, that's only
-  // going to affect what version of the shell
-  // is launched, not what fork of the binary is launched.  We insert "arch
-  // --arch <ARCH> as part of the shell invocation
-  // to do that job on OSX.
-
-  if (launch_info.GetShell() == nullptr) {
-    // We don't need to do this for ARM, and we really shouldn't now that we
-    // have multiple CPU subtypes and no posix_spawnattr call that allows us
-    // to set which CPU subtype to launch...
-    const ArchSpec &arch_spec = launch_info.GetArchitecture();
-    cpu_type_t cpu = arch_spec.GetMachOCPUType();
-    cpu_type_t sub = arch_spec.GetMachOCPUSubType();
-    if (cpu != 0 && cpu != static_cast<cpu_type_t>(UINT32_MAX) &&
-        cpu != static_cast<cpu_type_t>(LLDB_INVALID_CPUTYPE) &&
-        !(cpu == 0x01000007 && sub == 8)) // If haswell is specified, don't try
-                                          // to set the CPU type or we will fail
-    {
-      size_t ocount = 0;
-      error.SetError(::posix_spawnattr_setbinpref_np(&attr, 1, &cpu, &ocount),
-                     eErrorTypePOSIX);
-      if (error.Fail())
-        LLDB_LOG(log, "error: {0}, ::posix_spawnattr_setbinpref_np ( &attr, 1, "
-                      "cpu_type = {1:x}, count => {2} )",
-                 error, cpu, ocount);
-
-      if (error.Fail() || ocount != 1)
-        return error;
-    }
-  }
-
-#endif
-
-  const char *tmp_argv[2];
-  char *const *argv = const_cast<char *const *>(
-      launch_info.GetArguments().GetConstArgumentVector());
-  char *const *envp = const_cast<char *const *>(
-      launch_info.GetEnvironmentEntries().GetConstArgumentVector());
-  if (argv == NULL) {
-    // posix_spawn gets very unhappy if it doesn't have at least the program
-    // name in argv[0]. One of the side affects I have noticed is the
-    // environment
-    // variables don't make it into the child process if "argv == NULL"!!!
-    tmp_argv[0] = exe_path;
-    tmp_argv[1] = NULL;
-    argv = const_cast<char *const *>(tmp_argv);
-  }
-
+// The functions below implement process launching for non-Apple-based platforms
 #if !defined(__APPLE__)
-  // manage the working directory
-  char current_dir[PATH_MAX];
-  current_dir[0] = '\0';
-#endif
-
-  FileSpec working_dir{launch_info.GetWorkingDirectory()};
-  if (working_dir) {
-#if defined(__APPLE__)
-    // Set the working directory on this thread only
-    if (__pthread_chdir(working_dir.GetCString()) < 0) {
-      if (errno == ENOENT) {
-        error.SetErrorStringWithFormat("No such file or directory: %s",
-                                       working_dir.GetCString());
-      } else if (errno == ENOTDIR) {
-        error.SetErrorStringWithFormat("Path doesn't name a directory: %s",
-                                       working_dir.GetCString());
-      } else {
-        error.SetErrorStringWithFormat("An unknown error occurred when "
-                                       "changing directory for process "
-                                       "execution.");
-      }
-      return error;
-    }
-#else
-    if (::getcwd(current_dir, sizeof(current_dir)) == NULL) {
-      error.SetError(errno, eErrorTypePOSIX);
-      LLDB_LOG(log, "error: {0}, unable to save the current directory", error);
-      return error;
-    }
-
-    if (::chdir(working_dir.GetCString()) == -1) {
-      error.SetError(errno, eErrorTypePOSIX);
-      LLDB_LOG(log, "error: {0}, unable to change working directory to {1}",
-               error, working_dir);
-      return error;
-    }
-#endif
-  }
-
-  ::pid_t result_pid = LLDB_INVALID_PROCESS_ID;
-  const size_t num_file_actions = launch_info.GetNumFileActions();
-  if (num_file_actions > 0) {
-    posix_spawn_file_actions_t file_actions;
-    error.SetError(::posix_spawn_file_actions_init(&file_actions),
-                   eErrorTypePOSIX);
-    if (error.Fail()) {
-      LLDB_LOG(log,
-               "error: {0}, ::posix_spawn_file_actions_init ( &file_actions )",
-               error);
-      return error;
-    }
-
-    // Make a quick class that will cleanup the posix spawn attributes in case
-    // we return in the middle of this function.
-    lldb_utility::CleanUp<posix_spawn_file_actions_t *, int>
-        posix_spawn_file_actions_cleanup(&file_actions,
-                                         posix_spawn_file_actions_destroy);
-
-    for (size_t i = 0; i < num_file_actions; ++i) {
-      const FileAction *launch_file_action =
-          launch_info.GetFileActionAtIndex(i);
-      if (launch_file_action) {
-        if (!AddPosixSpawnFileAction(&file_actions, launch_file_action, log,
-                                     error))
-          return error;
-      }
-    }
-
-    error.SetError(
-        ::posix_spawnp(&result_pid, exe_path, &file_actions, &attr, argv, envp),
-        eErrorTypePOSIX);
-
-    if (error.Fail()) {
-      LLDB_LOG(log, "error: {0}, ::posix_spawnp(pid => {1}, path = '{2}', "
-                    "file_actions = {3}, "
-                    "attr = {4}, argv = {5}, envp = {6} )",
-               error, result_pid, exe_path, &file_actions, &attr, argv, envp);
-      if (log) {
-        for (int ii = 0; argv[ii]; ++ii)
-          LLDB_LOG(log, "argv[{0}] = '{1}'", ii, argv[ii]);
-      }
-    }
-
-  } else {
-    error.SetError(
-        ::posix_spawnp(&result_pid, exe_path, NULL, &attr, argv, envp),
-        eErrorTypePOSIX);
-
-    if (error.Fail()) {
-      LLDB_LOG(log, "error: {0}, ::posix_spawnp ( pid => {1}, path = '{2}', "
-                    "file_actions = NULL, attr = {3}, argv = {4}, envp = {5} )",
-               error, result_pid, exe_path, &attr, argv, envp);
-      if (log) {
-        for (int ii = 0; argv[ii]; ++ii)
-          LLDB_LOG(log, "argv[{0}] = '{1}'", ii, argv[ii]);
-      }
-    }
-  }
-  pid = result_pid;
-
-  if (working_dir) {
-#if defined(__APPLE__)
-    // No more thread specific current working directory
-    __pthread_fchdir(-1);
-#else
-    if (::chdir(current_dir) == -1 && error.Success()) {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list