[llvm-branch-commits] [lldb] r199912 - Merge with top of tree.

Greg Clayton gclayton at apple.com
Thu Jan 23 10:27:12 PST 2014


Author: gclayton
Date: Thu Jan 23 12:27:11 2014
New Revision: 199912

URL: http://llvm.org/viewvc/llvm-project?rev=199912&view=rev
Log:
Merge with top of tree.


Added:
    lldb/branches/iohandler/source/Plugins/SystemRuntime/MacOSX/Makefile
      - copied unchanged from r199911, lldb/trunk/source/Plugins/SystemRuntime/MacOSX/Makefile
    lldb/branches/iohandler/test/functionalities/data-formatter/user-format-vs-summary/
      - copied from r199911, lldb/trunk/test/functionalities/data-formatter/user-format-vs-summary/
    lldb/branches/iohandler/test/functionalities/thread/thread_specific_break/
      - copied from r199911, lldb/trunk/test/functionalities/thread/thread_specific_break/
    lldb/branches/iohandler/test/macosx/indirect_symbol/
      - copied from r199911, lldb/trunk/test/macosx/indirect_symbol/
    lldb/branches/iohandler/tools/debugserver/Makefile
      - copied unchanged from r199911, lldb/trunk/tools/debugserver/Makefile
    lldb/branches/iohandler/tools/debugserver/scripts/Makefile
      - copied unchanged from r199911, lldb/trunk/tools/debugserver/scripts/Makefile
    lldb/branches/iohandler/tools/debugserver/source/MacOSX/Makefile
      - copied unchanged from r199911, lldb/trunk/tools/debugserver/source/MacOSX/Makefile
    lldb/branches/iohandler/tools/debugserver/source/MacOSX/i386/Makefile
      - copied unchanged from r199911, lldb/trunk/tools/debugserver/source/MacOSX/i386/Makefile
    lldb/branches/iohandler/tools/debugserver/source/MacOSX/x86_64/Makefile
      - copied unchanged from r199911, lldb/trunk/tools/debugserver/source/MacOSX/x86_64/Makefile
    lldb/branches/iohandler/tools/debugserver/source/Makefile
      - copied unchanged from r199911, lldb/trunk/tools/debugserver/source/Makefile
Modified:
    lldb/branches/iohandler/   (props changed)
    lldb/branches/iohandler/docs/lldb-gdb-remote.txt
    lldb/branches/iohandler/include/lldb/Core/ArchSpec.h
    lldb/branches/iohandler/include/lldb/Core/MappedHash.h
    lldb/branches/iohandler/include/lldb/Host/Host.h
    lldb/branches/iohandler/include/lldb/Target/Platform.h
    lldb/branches/iohandler/include/lldb/Utility/Iterable.h
    lldb/branches/iohandler/lib/Makefile
    lldb/branches/iohandler/scripts/build-llvm.pl
    lldb/branches/iohandler/scripts/generate-vers.pl
    lldb/branches/iohandler/source/CMakeLists.txt
    lldb/branches/iohandler/source/Commands/CommandObjectExpression.cpp
    lldb/branches/iohandler/source/Core/ArchSpec.cpp
    lldb/branches/iohandler/source/Core/ConnectionFileDescriptor.cpp
    lldb/branches/iohandler/source/Core/DataExtractor.cpp
    lldb/branches/iohandler/source/Core/ValueObject.cpp
    lldb/branches/iohandler/source/Core/ValueObjectVariable.cpp
    lldb/branches/iohandler/source/DataFormatters/ValueObjectPrinter.cpp
    lldb/branches/iohandler/source/Expression/ClangASTSource.cpp
    lldb/branches/iohandler/source/Expression/DWARFExpression.cpp
    lldb/branches/iohandler/source/Expression/IRExecutionUnit.cpp
    lldb/branches/iohandler/source/Expression/Materializer.cpp
    lldb/branches/iohandler/source/Host/common/Host.cpp
    lldb/branches/iohandler/source/Host/linux/Host.cpp
    lldb/branches/iohandler/source/Host/macosx/Host.mm
    lldb/branches/iohandler/source/Makefile
    lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/branches/iohandler/source/Plugins/Makefile
    lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
    lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
    lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.cpp
    lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.h
    lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
    lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
    lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.cpp
    lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.h
    lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
    lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
    lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
    lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/branches/iohandler/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
    lldb/branches/iohandler/source/Symbol/ClangASTType.cpp
    lldb/branches/iohandler/source/Target/Platform.cpp
    lldb/branches/iohandler/source/Target/StopInfo.cpp
    lldb/branches/iohandler/source/Target/Target.cpp
    lldb/branches/iohandler/source/Target/ThreadList.cpp
    lldb/branches/iohandler/test/api/multithreaded/TestMultithreaded.py
    lldb/branches/iohandler/test/dotest.py
    lldb/branches/iohandler/test/functionalities/alias/TestAliases.py
    lldb/branches/iohandler/test/functionalities/inferior-assert/TestInferiorAssert.py
    lldb/branches/iohandler/tools/Makefile
    lldb/branches/iohandler/tools/debugserver/scripts/dbgnub-config.pl
    lldb/branches/iohandler/tools/debugserver/source/DNB.cpp
    lldb/branches/iohandler/tools/lldb-gdbserver/lldb-gdbserver.cpp
    lldb/branches/iohandler/www/lldb-gdb.html

Propchange: lldb/branches/iohandler/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 23 12:27:11 2014
@@ -1,2 +1,2 @@
 /lldb/branches/apple/python-GIL:156467-162159
-/lldb/trunk:198360-198987
+/lldb/trunk:198360-199911

Modified: lldb/branches/iohandler/docs/lldb-gdb-remote.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/docs/lldb-gdb-remote.txt?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/docs/lldb-gdb-remote.txt (original)
+++ lldb/branches/iohandler/docs/lldb-gdb-remote.txt Thu Jan 23 12:27:11 2014
@@ -536,6 +536,7 @@ os_kernel: a string describing the kerne
 os_version: a version string that represents the current OS version (10.8.2)
 watchpoint_exceptions_received: one of "before" or "after" to specify if a watchpoint is triggered before or after the pc when it stops
 default_packet_timeout: an unsigned number that specifies the default timeout in seconds
+distribution_id: optional. For linux, specifies distribution id (e.g. ubuntu, fedora, etc.)
 
 //----------------------------------------------------------------------
 // "qGDBServerVersion"

Modified: lldb/branches/iohandler/include/lldb/Core/ArchSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Core/ArchSpec.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Core/ArchSpec.h (original)
+++ lldb/branches/iohandler/include/lldb/Core/ArchSpec.h Thu Jan 23 12:27:11 2014
@@ -13,6 +13,7 @@
 #if defined(__cplusplus)
 
 #include "lldb/lldb-private.h"
+#include "lldb/Core/ConstString.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
 
@@ -90,6 +91,7 @@ public:
         eCore_x86_32_i486sx,
         
         eCore_x86_64_x86_64,
+        eCore_x86_64_x86_64h, // Haswell enabled x86_64
         eCore_uknownMach32,
         eCore_uknownMach64,
         kNumCores,
@@ -203,6 +205,27 @@ public:
     GetMachine () const;
 
     //------------------------------------------------------------------
+    /// Returns the distribution id of the architecture.
+    ///
+    /// This will be something like "ubuntu", "fedora", etc. on Linux.
+    ///
+    /// @return A ConstString ref containing the distribution id,
+    ///         potentially empty.
+    //------------------------------------------------------------------
+    const ConstString&
+    GetDistributionId () const;
+
+    //------------------------------------------------------------------
+    /// Set the distribution id of the architecture.
+    ///
+    /// This will be something like "ubuntu", "fedora", etc. on Linux.
+    /// This should be the same value returned by
+    /// Host::GetDistributionId ().
+    ///------------------------------------------------------------------
+    void
+    SetDistributionId (const char* distribution_id);
+
+    //------------------------------------------------------------------
     /// Tests if this ArchSpec is valid.
     ///
     /// @return True if the current architecture is valid, false
@@ -400,6 +423,8 @@ protected:
     Core m_core;
     lldb::ByteOrder m_byte_order;
 
+    ConstString m_distribution_id;
+
     // Called when m_def or m_entry are changed.  Fills in all remaining
     // members with default values.
     void

Modified: lldb/branches/iohandler/include/lldb/Core/MappedHash.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Core/MappedHash.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Core/MappedHash.h (original)
+++ lldb/branches/iohandler/include/lldb/Core/MappedHash.h Thu Jan 23 12:27:11 2014
@@ -382,9 +382,9 @@ public:
             lldb::offset_t offset = m_header.Read (data, 0);
             if (offset != LLDB_INVALID_OFFSET && IsValid ())
             {
-                m_hash_indexes = (uint32_t *)data.GetData (&offset, m_header.bucket_count * sizeof(uint32_t));
-                m_hash_values  = (uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
-                m_hash_offsets = (uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
+                m_hash_indexes = (const uint32_t *)data.GetData (&offset, m_header.bucket_count * sizeof(uint32_t));
+                m_hash_values  = (const uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
+                m_hash_offsets = (const uint32_t *)data.GetData (&offset, m_header.hashes_count * sizeof(uint32_t));
             }
         }
         
@@ -542,9 +542,9 @@ public:
     protected:
         // Implementation agnostic information
         HeaderType m_header;
-        uint32_t *m_hash_indexes;
-        uint32_t *m_hash_values;
-        uint32_t *m_hash_offsets;
+        const uint32_t *m_hash_indexes;
+        const uint32_t *m_hash_values;
+        const uint32_t *m_hash_offsets;
     };
     
 };

Modified: lldb/branches/iohandler/include/lldb/Host/Host.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Host/Host.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Host/Host.h (original)
+++ lldb/branches/iohandler/include/lldb/Host/Host.h Thu Jan 23 12:27:11 2014
@@ -202,6 +202,23 @@ public:
     GetTargetTriple ();
 
     //------------------------------------------------------------------
+    /// Gets the name of the distribution (i.e. distributor id).
+    ///
+    /// On Linux, this will return the equivalent of lsb_release -i.
+    /// Android will return 'android'.  Other systems may return
+    /// nothing.
+    ///
+    /// @return
+    ///     A ConstString reference containing the OS distribution id.
+    ///     The return string will be all lower case, with whitespace
+    ///     replaced with underscores.  The return string will be
+    ///     empty (result.AsCString() will return NULL) if the distribution
+    ///     cannot be obtained.
+    //------------------------------------------------------------------
+    static const ConstString &
+    GetDistributionId ();
+
+    //------------------------------------------------------------------
     /// Get the process ID for the calling process.
     ///
     /// @return
@@ -459,7 +476,15 @@ public:
 
     static bool
     GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info);
-    
+
+#if defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__)
+    static short
+    GetPosixspawnFlags (ProcessLaunchInfo &launch_info);
+
+    static Error
+    LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t &pid);
+#endif
+
     static lldb::pid_t
     LaunchApplication (const FileSpec &app_file_spec);
 

Modified: lldb/branches/iohandler/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Target/Platform.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Target/Platform.h (original)
+++ lldb/branches/iohandler/include/lldb/Target/Platform.h Thu Jan 23 12:27:11 2014
@@ -314,9 +314,9 @@ namespace lldb_private {
         ///     An error object.
         //------------------------------------------------------------------
         virtual Error
-        GetFile (const FileSpec &platform_file, 
-                 const UUID *uuid_ptr,
-                 FileSpec &local_file);
+        GetFileWithUUID (const FileSpec &platform_file, 
+                         const UUID *uuid_ptr,
+                         FileSpec &local_file);
 
         //----------------------------------------------------------------------
         // Locate the scripting resource given a module specification.

Modified: lldb/branches/iohandler/include/lldb/Utility/Iterable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/include/lldb/Utility/Iterable.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/include/lldb/Utility/Iterable.h (original)
+++ lldb/branches/iohandler/include/lldb/Utility/Iterable.h Thu Jan 23 12:27:11 2014
@@ -147,9 +147,14 @@ public:
         return m_iter >= rhs.m_iter;
     }
     
-    friend AdaptedConstIterator operator+(typename BackingIterator::difference_type, AdaptedConstIterator &);
-    friend typename BackingIterator::difference_type operator-(AdaptedConstIterator &, AdaptedConstIterator &);
-    friend void swap(AdaptedConstIterator &, AdaptedConstIterator &);
+    template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
+    friend AdaptedConstIterator<C1, E1, A1> operator+(typename C1::const_iterator::difference_type, AdaptedConstIterator<C1, E1, A1> &);
+
+    template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
+    friend typename C1::const_iterator::difference_type operator-(AdaptedConstIterator<C1, E1, A1> &, AdaptedConstIterator<C1, E1, A1> &);
+
+    template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
+    friend void swap(AdaptedConstIterator<C1, E1, A1> &, AdaptedConstIterator<C1, E1, A1> &);
 };
     
 template <typename C, typename E, E (*A)(typename C::const_iterator &)>

Modified: lldb/branches/iohandler/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/lib/Makefile?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/lib/Makefile (original)
+++ lldb/branches/iohandler/lib/Makefile Thu Jan 23 12:27:11 2014
@@ -96,7 +96,8 @@ ifeq ($(HOST_OS),Darwin)
               lldbPluginObjectFileMachO.a \
               lldbPluginSymbolVendorMacOSX.a \
               lldbPluginProcessDarwin.a \
-              lldbPluginProcessMachCore.a
+              lldbPluginProcessMachCore.a \
+              lldbPluginSystemRuntimeMacOSX.a
 endif
 
 ifeq ($(HOST_OS),Linux)

Modified: lldb/branches/iohandler/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/scripts/build-llvm.pl?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/scripts/build-llvm.pl (original)
+++ lldb/branches/iohandler/scripts/build-llvm.pl Thu Jan 23 12:27:11 2014
@@ -242,6 +242,12 @@ sub build_llvm
             print "Configuring clang ($arch) in '$llvm_dstroot_arch'...\n";
             my $lldb_configuration_options = "--enable-targets=x86_64,arm $common_configure_options $llvm_config_href->{configure_options}";
 
+            # We're configuring llvm/clang with --enable-cxx11 and --enable-libcpp but llvm/configure doesn't
+            # pick up the right C++ standard library.  If we have a MACOSX_DEPLOYMENT_TARGET of 10.7 or 10.8
+            # (or are using actually building on those releases), we need to specify "-stdlib=libc++" at link
+            # time or llvm/configure will not see <atomic> as available and error out (v. llvm r199313).
+            $ENV{LDFLAGS} = $ENV{LDFLAGS} . " -stdlib=libc++";
+
             if ($is_arm)
             {
                 $lldb_configuration_options .= " --host=arm-apple-darwin${os_release} --target=arm-apple-darwin${os_release} --build=i686-apple-darwin${os_release} --program-prefix=\"\"";

Modified: lldb/branches/iohandler/scripts/generate-vers.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/scripts/generate-vers.pl?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/scripts/generate-vers.pl (original)
+++ lldb/branches/iohandler/scripts/generate-vers.pl Thu Jan 23 12:27:11 2014
@@ -2,11 +2,11 @@
 
 sub usage()
 {
-  print "Usage: generate-vers.pl /path/toproject.pbxproj";
+  print "Usage: generate-vers.pl /path/toproject.pbxproj program_name";
   exit(0);
 }
 
-(scalar @ARGV == 1) or usage();
+(scalar @ARGV == 2) or usage();
 
 open $pbxproj, $ARGV[0] or die "Couldn't open ".$ARGV[0];
 
@@ -51,6 +51,6 @@ $lowercase_name = lc $product_name;
 
 close $pbxproj;
 
-$file_string = " const unsigned char liblldb_coreVersionString[] __attribute__ ((used)) = \"@(#)PROGRAM:".$uppercase_name."  PROJECT:".$lowercase_name."-".$lldb_version_string."\" \"\\n\"; const double liblldb_coreVersionNumber __attribute__ ((used)) = (double)".$lldb_version.".".$lldb_train.";\n";
+$file_string = " const unsigned char ".$ARGV[1]."VersionString[] __attribute__ ((used)) = \"@(#)PROGRAM:".$uppercase_name."  PROJECT:".$lowercase_name."-".$lldb_version_string."\" \"\\n\"; const double ".$ARGV[1]."VersionNumber __attribute__ ((used)) = (double)".$lldb_version.".".$lldb_train.";\n";
 
 print $file_string;

Modified: lldb/branches/iohandler/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/CMakeLists.txt?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/CMakeLists.txt (original)
+++ lldb/branches/iohandler/source/CMakeLists.txt Thu Jan 23 12:27:11 2014
@@ -110,7 +110,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Darwin"
   set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
   add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
     COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
-            ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
+            ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core
             > ${LLDB_VERS_GENERATED_FILE})
 
   set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)

Modified: lldb/branches/iohandler/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Commands/CommandObjectExpression.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/branches/iohandler/source/Commands/CommandObjectExpression.cpp Thu Jan 23 12:27:11 2014
@@ -292,6 +292,8 @@ CommandObjectExpression::EvaluateExpress
         
         if (m_command_options.timeout > 0)
             options.SetTimeoutUsec(m_command_options.timeout);
+        else
+            options.SetTimeoutUsec(0);
         
         exe_results = target->EvaluateExpression (expr, 
                                                   exe_ctx.GetFramePtr(),

Modified: lldb/branches/iohandler/source/Core/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/ArchSpec.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/ArchSpec.cpp (original)
+++ lldb/branches/iohandler/source/Core/ArchSpec.cpp Thu Jan 23 12:27:11 2014
@@ -104,6 +104,7 @@ static const CoreDefinition g_core_defin
     { eByteOrderLittle, 4, 1, 15, llvm::Triple::x86    , ArchSpec::eCore_x86_32_i486sx  , "i486sx"    },
 
     { eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64 , ArchSpec::eCore_x86_64_x86_64  , "x86_64"    },
+    { eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64 , ArchSpec::eCore_x86_64_x86_64h , "x86_64h"   },
     { eByteOrderLittle, 4, 4, 4 , llvm::Triple::UnknownArch , ArchSpec::eCore_uknownMach32  , "unknown-mach-32" },
     { eByteOrderLittle, 8, 4, 4 , llvm::Triple::UnknownArch , ArchSpec::eCore_uknownMach64  , "unknown-mach-64" }
 };
@@ -205,10 +206,11 @@ static const ArchDefinitionEntry g_macho
     { ArchSpec::eCore_x86_32_i386     , llvm::MachO::CPU_TYPE_I386      , 3      , UINT32_MAX , SUBTYPE_MASK },
     { ArchSpec::eCore_x86_32_i486     , llvm::MachO::CPU_TYPE_I386      , 4      , UINT32_MAX , SUBTYPE_MASK },
     { ArchSpec::eCore_x86_32_i486sx   , llvm::MachO::CPU_TYPE_I386      , 0x84   , UINT32_MAX , SUBTYPE_MASK },
-    { ArchSpec::eCore_x86_32_i386     , llvm::MachO::CPU_TYPE_I386      , CPU_ANY, UINT32_MAX , UINT32_MAX  },
+    { ArchSpec::eCore_x86_32_i386     , llvm::MachO::CPU_TYPE_I386      , CPU_ANY, UINT32_MAX , UINT32_MAX   },
     { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPU_TYPE_X86_64    , 3      , UINT32_MAX , SUBTYPE_MASK },
     { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPU_TYPE_X86_64    , 4      , UINT32_MAX , SUBTYPE_MASK },
-    { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPU_TYPE_X86_64    , CPU_ANY, UINT32_MAX , UINT32_MAX  },
+    { ArchSpec::eCore_x86_64_x86_64h  , llvm::MachO::CPU_TYPE_X86_64    , 8      , UINT32_MAX , SUBTYPE_MASK },
+    { ArchSpec::eCore_x86_64_x86_64   , llvm::MachO::CPU_TYPE_X86_64    , CPU_ANY, UINT32_MAX , UINT32_MAX   },
     // Catch any unknown mach architectures so we can always use the object and symbol mach-o files
     { ArchSpec::eCore_uknownMach32    , 0                               , 0      , 0xFF000000u, 0x00000000u },
     { ArchSpec::eCore_uknownMach64    , llvm::MachO::CPU_ARCH_ABI64     , 0      , 0xFF000000u, 0x00000000u }
@@ -349,14 +351,16 @@ FindArchDefinitionEntry (const ArchDefin
 ArchSpec::ArchSpec() :
     m_triple (),
     m_core (kCore_invalid),
-    m_byte_order (eByteOrderInvalid)
+    m_byte_order (eByteOrderInvalid),
+    m_distribution_id ()
 {
 }
 
 ArchSpec::ArchSpec (const char *triple_cstr, Platform *platform) :
     m_triple (),
     m_core (kCore_invalid),
-    m_byte_order (eByteOrderInvalid)
+    m_byte_order (eByteOrderInvalid),
+    m_distribution_id ()
 {
     if (triple_cstr)
         SetTriple(triple_cstr, platform);
@@ -366,7 +370,8 @@ ArchSpec::ArchSpec (const char *triple_c
 ArchSpec::ArchSpec (const char *triple_cstr) :
     m_triple (),
     m_core (kCore_invalid),
-    m_byte_order (eByteOrderInvalid)
+    m_byte_order (eByteOrderInvalid),
+    m_distribution_id ()
 {
     if (triple_cstr)
         SetTriple(triple_cstr);
@@ -375,7 +380,8 @@ ArchSpec::ArchSpec (const char *triple_c
 ArchSpec::ArchSpec(const llvm::Triple &triple) :
     m_triple (),
     m_core (kCore_invalid),
-    m_byte_order (eByteOrderInvalid)
+    m_byte_order (eByteOrderInvalid),
+    m_distribution_id ()
 {
     SetTriple(triple);
 }
@@ -383,7 +389,8 @@ ArchSpec::ArchSpec(const llvm::Triple &t
 ArchSpec::ArchSpec (ArchitectureType arch_type, uint32_t cpu, uint32_t subtype) :
     m_triple (),
     m_core (kCore_invalid),
-    m_byte_order (eByteOrderInvalid)
+    m_byte_order (eByteOrderInvalid),
+    m_distribution_id ()
 {
     SetArchitecture (arch_type, cpu, subtype);
 }
@@ -403,6 +410,7 @@ ArchSpec::operator= (const ArchSpec& rhs
         m_triple = rhs.m_triple;
         m_core = rhs.m_core;
         m_byte_order = rhs.m_byte_order;
+        m_distribution_id = rhs.m_distribution_id;
     }
     return *this;
 }
@@ -413,6 +421,7 @@ ArchSpec::Clear()
     m_triple = llvm::Triple();
     m_core = kCore_invalid;
     m_byte_order = eByteOrderInvalid;
+    m_distribution_id.Clear ();
 }
 
 //===----------------------------------------------------------------------===//
@@ -468,6 +477,18 @@ ArchSpec::GetMachine () const
     return llvm::Triple::UnknownArch;
 }
 
+const ConstString&
+ArchSpec::GetDistributionId () const
+{
+    return m_distribution_id;
+}
+
+void
+ArchSpec::SetDistributionId (const char* distribution_id)
+{
+    m_distribution_id.SetCString (distribution_id);
+}
+
 uint32_t
 ArchSpec::GetAddressByteSize() const
 {
@@ -763,6 +784,8 @@ ArchSpec::IsCompatibleMatch (const ArchS
 bool
 ArchSpec::IsEqualTo (const ArchSpec& rhs, bool exact_match) const
 {
+    // explicitly ignoring m_distribution_id in this method.
+
     if (GetByteOrder() != rhs.GetByteOrder())
         return false;
         
@@ -873,7 +896,7 @@ cores_match (const ArchSpec::Core core1,
         if (core2 == ArchSpec::kCore_arm_any)
             return true;
         break;
-        
+    
     case ArchSpec::kCore_x86_32_any:
         if ((core2 >= ArchSpec::kCore_x86_32_first && core2 <= ArchSpec::kCore_x86_32_last) || (core2 == ArchSpec::kCore_x86_32_any))
             return true;

Modified: lldb/branches/iohandler/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/ConnectionFileDescriptor.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/branches/iohandler/source/Core/ConnectionFileDescriptor.cpp Thu Jan 23 12:27:11 2014
@@ -1380,7 +1380,7 @@ ConnectionFileDescriptor::SocketListen (
         {
             struct sockaddr_in accept_addr;
             ::memset (&accept_addr, 0, sizeof accept_addr);
-#ifndef __linux__
+#if !(defined (__linux__) || defined(_MSC_VER))
             accept_addr.sin_len = sizeof accept_addr;
 #endif
             socklen_t accept_addr_len = sizeof accept_addr;
@@ -1402,7 +1402,7 @@ ConnectionFileDescriptor::SocketListen (
             else
             {
                 if (
-#ifndef __linux__
+#if !(defined(__linux__) || (defined(_MSC_VER)))
                     accept_addr_len == listen_addr.sockaddr_in().sin_len &&
 #endif
                     accept_addr.sin_addr.s_addr == listen_addr.sockaddr_in().sin_addr.s_addr)

Modified: lldb/branches/iohandler/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/DataExtractor.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/DataExtractor.cpp (original)
+++ lldb/branches/iohandler/source/Core/DataExtractor.cpp Thu Jan 23 12:27:11 2014
@@ -1809,6 +1809,7 @@ DataExtractor::Dump (Stream *s,
                                     case ArchSpec::eCore_x86_32_i486:
                                     case ArchSpec::eCore_x86_32_i486sx:
                                     case ArchSpec::eCore_x86_64_x86_64:
+                                    case ArchSpec::eCore_x86_64_x86_64h:
                                         // clang will assert when contructing the apfloat if we use a 16 byte integer value
                                         if (GetAPInt (*this, &offset, 10, apint))
                                         {

Modified: lldb/branches/iohandler/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/ValueObject.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/ValueObject.cpp (original)
+++ lldb/branches/iohandler/source/Core/ValueObject.cpp Thu Jan 23 12:27:11 2014
@@ -1685,8 +1685,12 @@ ValueObject::DumpPrintableRepresentation
         // area for cases where our desired output is not backed by some other longer-term storage
         StreamString strm;
 
-        if (custom_format != eFormatInvalid)
+        bool reset_format = false;
+        if (custom_format != eFormatInvalid && GetFormat() == lldb::eFormatDefault)
+        {
+            reset_format = true;
             SetFormat(custom_format);
+        }
         
         switch(val_obj_display)
         {
@@ -1741,10 +1745,17 @@ ValueObject::DumpPrintableRepresentation
             }
         }
         
+        
         if (cstr)
+        {
             s.PutCString(cstr);
+            if (reset_format)
+                SetFormat(lldb::eFormatDefault);
+        }
         else
         {
+            if (reset_format)
+                SetFormat(lldb::eFormatDefault);
             if (m_error.Fail())
             {
                 if (do_dump_error)
@@ -1766,9 +1777,6 @@ ValueObject::DumpPrintableRepresentation
         // even if we have an error message as output, that's a success
         // from our callers' perspective, so return true
         var_success = true;
-        
-        if (custom_format != eFormatInvalid)
-            SetFormat(eFormatDefault);
     }
     
     return var_success;

Modified: lldb/branches/iohandler/source/Core/ValueObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/ValueObjectVariable.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/branches/iohandler/source/Core/ValueObjectVariable.cpp Thu Jan 23 12:27:11 2014
@@ -328,6 +328,12 @@ ValueObjectVariable::GetLocationAsCStrin
 bool
 ValueObjectVariable::SetValueFromCString (const char *value_str, Error& error)
 {
+    if (!UpdateValueIfNeeded())
+    {
+        error.SetErrorString("unable to update value before writing");
+        return false;
+    }
+    
     if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo)
     {
         RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo();
@@ -360,6 +366,12 @@ ValueObjectVariable::SetValueFromCString
 bool
 ValueObjectVariable::SetData (DataExtractor &data, Error &error)
 {
+    if (!UpdateValueIfNeeded())
+    {
+        error.SetErrorString("unable to update value before writing");
+        return false;
+    }
+    
     if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo)
     {
         RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo();

Modified: lldb/branches/iohandler/source/DataFormatters/ValueObjectPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/DataFormatters/ValueObjectPrinter.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/branches/iohandler/source/DataFormatters/ValueObjectPrinter.cpp Thu Jan 23 12:27:11 2014
@@ -282,17 +282,15 @@ ValueObjectPrinter::GetValueSummaryError
                                           std::string& summary,
                                           std::string& error)
 {
-    if (options.m_format != eFormatDefault && options.m_format != m_valobj->GetFormat())
+    lldb::Format original_format;
+    bool custom_format = options.m_format != eFormatDefault && options.m_format != m_valobj->GetFormat();
+    if (custom_format)
     {
-        m_valobj->GetValueAsCString(options.m_format,
-                                    value);
-    }
-    else
-    {
-        const char* val_cstr = m_valobj->GetValueAsCString();
-        if (val_cstr)
-            value.assign(val_cstr);
+        original_format = m_valobj->GetFormat();
+        m_valobj->SetFormat(options.m_format);
     }
+    const char* val_cstr = m_valobj->GetValueAsCString();
+    value.assign(val_cstr ? val_cstr : "");
     const char* err_cstr = m_valobj->GetError().AsCString();
     if (err_cstr)
         error.assign(err_cstr);
@@ -314,6 +312,8 @@ ValueObjectPrinter::GetValueSummaryError
             }
         }
     }
+    if (custom_format)
+        m_valobj->SetFormat(original_format);
 }
 
 bool

Modified: lldb/branches/iohandler/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Expression/ClangASTSource.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Expression/ClangASTSource.cpp (original)
+++ lldb/branches/iohandler/source/Expression/ClangASTSource.cpp Thu Jan 23 12:27:11 2014
@@ -1775,14 +1775,14 @@ NameSearchContext::AddFunDecl (const Cla
     
     if (func_proto_type)
     {        
-        unsigned NumArgs = func_proto_type->getNumArgs();
+        unsigned NumArgs = func_proto_type->getNumParams();
         unsigned ArgIndex;
         
         SmallVector<ParmVarDecl *, 5> parm_var_decls;
                 
         for (ArgIndex = 0; ArgIndex < NumArgs; ++ArgIndex)
         {
-            QualType arg_qual_type (func_proto_type->getArgType(ArgIndex));
+            QualType arg_qual_type (func_proto_type->getParamType(ArgIndex));
             
             parm_var_decls.push_back(ParmVarDecl::Create (*ast,
                                                           const_cast<DeclContext*>(m_decl_context),

Modified: lldb/branches/iohandler/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Expression/DWARFExpression.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Expression/DWARFExpression.cpp (original)
+++ lldb/branches/iohandler/source/Expression/DWARFExpression.cpp Thu Jan 23 12:27:11 2014
@@ -1429,6 +1429,12 @@ DWARFExpression::Evaluate
         //----------------------------------------------------------------------
         case DW_OP_deref:
             {
+                if (stack.empty())
+                {
+                    if (error_ptr)
+                        error_ptr->SetErrorString("Expression stack empty for DW_OP_deref.");
+                    return false;
+                }
                 Value::ValueType value_type = stack.back().GetValueType();
                 switch (value_type)
                 {
@@ -1504,6 +1510,12 @@ DWARFExpression::Evaluate
         //----------------------------------------------------------------------
         case DW_OP_deref_size:
             {
+                if (stack.empty())
+                {
+                    if (error_ptr)
+                        error_ptr->SetErrorString("Expression stack empty for DW_OP_deref_size.");
+                    return false;
+                }
                 uint8_t size = opcodes.GetU8(&offset);
                 Value::ValueType value_type = stack.back().GetValueType();
                 switch (value_type)

Modified: lldb/branches/iohandler/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Expression/IRExecutionUnit.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/branches/iohandler/source/Expression/IRExecutionUnit.cpp Thu Jan 23 12:27:11 2014
@@ -75,12 +75,7 @@ IRExecutionUnit::WriteNow (const uint8_t
         if (err.Success())
         {
             DataExtractor my_extractor(my_buffer.GetBytes(), my_buffer.GetByteSize(), lldb::eByteOrderBig, 8);
-
-            StreamString ss;
-            
-            my_extractor.Dump(&ss, 0, lldb::eFormatBytesWithASCII, 1, my_buffer.GetByteSize(), 32, allocation_process_addr, 0, 0);
-            
-            log->PutCString(ss.GetData());
+            my_extractor.PutToLog(log, 0, my_buffer.GetByteSize(), allocation_process_addr, 16, DataExtractor::TypeUInt8);
         }
     }
     
@@ -394,6 +389,25 @@ IRExecutionUnit::GetRunnableInfo(Error &
         {
             log->Printf("Function disassembly:\n%s", disassembly_stream.GetData());
         }
+        
+        log->Printf("Sections: ");
+        for (AllocationRecord &record : m_records)
+        {
+            if (record.m_process_address != LLDB_INVALID_ADDRESS)
+            {
+                record.dump(log);
+                
+                DataBufferHeap my_buffer(record.m_size, 0);
+                Error err;
+                ReadMemory(my_buffer.GetBytes(), record.m_process_address, record.m_size, err);
+                
+                if (err.Success())
+                {
+                    DataExtractor my_extractor(my_buffer.GetBytes(), my_buffer.GetByteSize(), lldb::eByteOrderBig, 8);
+                    my_extractor.PutToLog(log, 0, my_buffer.GetByteSize(), record.m_process_address, 16, DataExtractor::TypeUInt8);
+                }
+            }
+        }
     }
     
     func_addr = m_function_load_addr;

Modified: lldb/branches/iohandler/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Expression/Materializer.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Expression/Materializer.cpp (original)
+++ lldb/branches/iohandler/source/Expression/Materializer.cpp Thu Jan 23 12:27:11 2014
@@ -505,6 +505,9 @@ public:
                 size_t bit_align = m_variable_sp->GetType()->GetClangLayoutType().GetTypeBitAlign();
                 size_t byte_align = (bit_align + 7) / 8;
                 
+                if (!byte_align)
+                    byte_align = 1;
+                
                 Error alloc_error;
                 
                 m_temporary_allocation = map.Malloc(data.GetByteSize(), byte_align, lldb::ePermissionsReadable | lldb::ePermissionsWritable, IRMemoryMap::eAllocationPolicyMirror, alloc_error);
@@ -741,6 +744,9 @@ public:
             size_t bit_align = m_type.GetTypeBitAlign();
             size_t byte_align = (bit_align + 7) / 8;
             
+            if (!byte_align)
+                byte_align = 1;
+            
             Error alloc_error;
             
             m_temporary_allocation = map.Malloc(byte_size, byte_align, lldb::ePermissionsReadable | lldb::ePermissionsWritable, IRMemoryMap::eAllocationPolicyMirror, alloc_error);

Modified: lldb/branches/iohandler/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Host/common/Host.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Host/common/Host.cpp (original)
+++ lldb/branches/iohandler/source/Host/common/Host.cpp Thu Jan 23 12:27:11 2014
@@ -13,12 +13,12 @@
 #include <errno.h>
 #include <limits.h>
 #include <sys/types.h>
-#include <unistd.h>
 #ifdef _WIN32
 #include "lldb/Host/windows/windows.h"
 #include <winsock2.h>
 #include <WS2tcpip.h>
 #else
+#include <unistd.h>
 #include <dlfcn.h>
 #include <grp.h>
 #include <netdb.h>
@@ -38,7 +38,7 @@
 #include <AvailabilityMacros.h>
 #endif
 
-#if defined (__linux__) || defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
+#if defined (__linux__) || defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
 #include <spawn.h>
 #include <sys/wait.h>
 #include <sys/syscall.h>
@@ -69,6 +69,18 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/raw_ostream.h"
 
+#if defined (__APPLE__)
+#ifndef _POSIX_SPAWN_DISABLE_ASLR
+#define _POSIX_SPAWN_DISABLE_ASLR       0x0100
+#endif
+
+extern "C"
+{
+    int __pthread_chdir(const char *path);
+    int __pthread_fchdir (int fildes);
+}
+
+#endif
 
 using namespace lldb;
 using namespace lldb_private;
@@ -368,25 +380,31 @@ Host::GetArchitecture (SystemDefaultArch
         // If the OS is Linux, "unknown" in the vendor slot isn't what we want
         // for the default triple.  It's probably an artifact of config.guess.
         if (triple.getOS() == llvm::Triple::Linux && triple.getVendor() == llvm::Triple::UnknownVendor)
-            triple.setVendorName("");
+            triple.setVendorName ("");
+
+        const char* distribution_id = GetDistributionId ().AsCString();
 
         switch (triple.getArch())
         {
         default:
             g_host_arch_32.SetTriple(triple);
+            g_host_arch_32.SetDistributionId (distribution_id);
             g_supports_32 = true;
             break;
 
         case llvm::Triple::x86_64:
             g_host_arch_64.SetTriple(triple);
+            g_host_arch_64.SetDistributionId (distribution_id);
             g_supports_64 = true;
             g_host_arch_32.SetTriple(triple.get32BitArchVariant());
+            g_host_arch_32.SetDistributionId (distribution_id);
             g_supports_32 = true;
             break;
 
         case llvm::Triple::sparcv9:
         case llvm::Triple::ppc64:
             g_host_arch_64.SetTriple(triple);
+            g_host_arch_64.SetDistributionId (distribution_id);
             g_supports_64 = true;
             break;
         }
@@ -446,6 +464,19 @@ Host::GetTargetTriple()
     return g_host_triple;
 }
 
+// See linux/Host.cpp for Linux-based implementations of this.
+// Add your platform-specific implementation to the appropriate host file.
+#if !defined(__linux__)
+
+const ConstString &
+    Host::GetDistributionId ()
+{
+    static ConstString s_distribution_id;
+    return s_distribution_id;
+}
+
+#endif // #if !defined(__linux__)
+
 lldb::pid_t
 Host::GetCurrentProcessID()
 {
@@ -1099,19 +1130,23 @@ Host::GetLLDBPath (PathType path_type, F
                     {
                         framework_pos += strlen("LLDB.framework");
                         ::strncpy (framework_pos, "/Resources/Python", PATH_MAX - (framework_pos - raw_path));
-                    }
-#else
-                    llvm::SmallString<256> python_version_dir;
-                    llvm::raw_svector_ostream os(python_version_dir);
-                    os << "/python" << PY_MAJOR_VERSION << '.' << PY_MINOR_VERSION << "/site-packages";
-                    os.flush();
+                    } 
+                    else 
+                    {
+#endif
+                        llvm::SmallString<256> python_version_dir;
+                        llvm::raw_svector_ostream os(python_version_dir);
+                        os << "/python" << PY_MAJOR_VERSION << '.' << PY_MINOR_VERSION << "/site-packages";
+                        os.flush();
 
-                    // We may get our string truncated. Should we protect
-                    // this with an assert?
+                        // We may get our string truncated. Should we protect
+                        // this with an assert?
 
-                    ::strncat(raw_path, python_version_dir.c_str(),
-                              sizeof(raw_path) - strlen(raw_path) - 1);
+                        ::strncat(raw_path, python_version_dir.c_str(),
+                                  sizeof(raw_path) - strlen(raw_path) - 1);
 
+#if defined (__APPLE__)
+                    }
 #endif
                     FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path));
                     g_lldb_python_dir.SetCString(resolved_path);
@@ -1614,24 +1649,73 @@ Host::RunShellCommand (const char *comma
     return error;
 }
 
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__GLIBC__)
-// The functions below implement process launching via posix_spawn() for Linux
-// and FreeBSD.
 
-// The posix_spawn() and posix_spawnp() functions first appeared in FreeBSD 8.0,
-static Error
-LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t &pid)
+// LaunchProcessPosixSpawn for Apple, Linux, FreeBSD and other GLIBC
+// systems
+
+#if defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__)
+
+// this method needs to be visible to macosx/Host.cpp and
+// common/Host.cpp.
+
+short
+Host::GetPosixspawnFlags (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 (Host::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;
+}
+
+Error
+Host::LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t &pid)
 {
     Error error;
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS));
 
-    assert(exe_path);
-    assert(!launch_info.GetFlags().Test (eLaunchFlagDebug));
-
     posix_spawnattr_t attr;
-
     error.SetError( ::posix_spawnattr_init (&attr), eErrorTypePOSIX);
-    error.LogIfError(log, "::posix_spawnattr_init ( &attr )");
+
+    if (error.Fail() || log)
+        error.PutToLog(log, "::posix_spawnattr_init ( &attr )");
     if (error.Fail())
         return error;
 
@@ -1643,52 +1727,82 @@ LaunchProcessPosixSpawn (const char *exe
     sigset_t all_signals;
     sigemptyset (&no_signals);
     sigfillset (&all_signals);
-    ::posix_spawnattr_setsigmask(&attr, &all_signals);
+    ::posix_spawnattr_setsigmask(&attr, &no_signals);
+#if defined (__linux__)  || defined (__FreeBSD__)
     ::posix_spawnattr_setsigdefault(&attr, &no_signals);
+#else
+    ::posix_spawnattr_setsigdefault(&attr, &all_signals);
+#endif
 
-    short flags = POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK;
+    short flags = GetPosixspawnFlags(launch_info);
 
     error.SetError( ::posix_spawnattr_setflags (&attr, flags), eErrorTypePOSIX);
-    error.LogIfError(log, "::posix_spawnattr_setflags ( &attr, flags=0x%8.8x )", flags);
+    if (error.Fail() || log)
+        error.PutToLog(log, "::posix_spawnattr_setflags ( &attr, flags=0x%8.8x )", flags);
     if (error.Fail())
         return error;
 
-    const size_t num_file_actions = launch_info.GetNumFileActions ();
-    posix_spawn_file_actions_t file_actions, *file_action_ptr = NULL;
-    // 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_action_ptr, NULL, posix_spawn_file_actions_destroy);
+    // 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__)
+
+    // 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 != UINT32_MAX &&
+        cpu != 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() || log)
+            error.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %llu )", cpu, (uint64_t)ocount);
 
-    if (num_file_actions > 0)
-    {
-        error.SetError( ::posix_spawn_file_actions_init (&file_actions), eErrorTypePOSIX);
-        error.LogIfError(log, "::posix_spawn_file_actions_init ( &file_actions )");
-        if (error.Fail())
+        if (error.Fail() || ocount != 1)
             return error;
+    }
 
-        file_action_ptr = &file_actions;
-        posix_spawn_file_actions_cleanup.set(file_action_ptr);
+#endif
 
-        for (size_t i = 0; i < num_file_actions; ++i)
-        {
-            const ProcessLaunchInfo::FileAction *launch_file_action = launch_info.GetFileActionAtIndex(i);
-            if (launch_file_action &&
-                !ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (&file_actions,
-                                                                         launch_file_action,
-                                                                         log,
-                                                                         error))
-                return error;
-        }
+    const char *tmp_argv[2];
+    char * const *argv = (char * const*)launch_info.GetArguments().GetConstArgumentVector();
+    char * const *envp = (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 = (char * const*)tmp_argv;
     }
 
-    // Change working directory if neccessary.
+#if !defined (__APPLE__)
+    // manage the working directory
     char current_dir[PATH_MAX];
     current_dir[0] = '\0';
+#endif
 
     const char *working_dir = launch_info.GetWorkingDirectory();
-    if (working_dir != NULL)
+    if (working_dir)
     {
+#if defined (__APPLE__)
+        // Set the working directory on this thread only
+        if (__pthread_chdir (working_dir) < 0) {
+            if (errno == ENOENT) {
+                error.SetErrorStringWithFormat("No such file or directory: %s", working_dir);
+            } else if (errno == ENOTDIR) {
+                error.SetErrorStringWithFormat("Path doesn't name a directory: %s", working_dir);
+            } 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);
@@ -1702,45 +1816,111 @@ LaunchProcessPosixSpawn (const char *exe
             error.LogIfError(log, "unable to change working directory to %s", working_dir);
             return error;
         }
+#endif
     }
 
-    const char *tmp_argv[2];
-    char * const *argv = (char * const*)launch_info.GetArguments().GetConstArgumentVector();
-    char * const *envp = (char * const*)launch_info.GetEnvironmentEntries().GetConstArgumentVector();
+    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() || log)
+            error.PutToLog(log, "::posix_spawn_file_actions_init ( &file_actions )");
+        if (error.Fail())
+            return error;
 
-    // Prepare minimal argument list if we didn't get it from the launch_info structure.
-    // We must pass argv into posix_spawnp and it must contain at least two items -
-    // pointer to an executable and NULL.
-    if (argv == NULL)
+        // 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 ProcessLaunchInfo::FileAction *launch_file_action = launch_info.GetFileActionAtIndex(i);
+            if (launch_file_action)
+            {
+                if (!ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (&file_actions,
+                                                                             launch_file_action,
+                                                                             log,
+                                                                             error))
+                    return error;
+            }
+        }
+
+        error.SetError (::posix_spawnp (&pid,
+                                        exe_path,
+                                        &file_actions,
+                                        &attr,
+                                        argv,
+                                        envp),
+                        eErrorTypePOSIX);
+
+        if (error.Fail() || log)
+        {
+            error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )",
+                           pid,
+                           exe_path,
+                           &file_actions,
+                           &attr,
+                           argv,
+                           envp);
+            if (log)
+            {
+                for (int ii=0; argv[ii]; ++ii)
+                    log->Printf("argv[%i] = '%s'", ii, argv[ii]);
+            }
+        }
+
+    }
+    else
     {
-        tmp_argv[0] = exe_path;
-        tmp_argv[1] = NULL;
-        argv = (char * const*)tmp_argv;
+        error.SetError (::posix_spawnp (&pid,
+                                        exe_path,
+                                        NULL,
+                                        &attr,
+                                        argv,
+                                        envp),
+                        eErrorTypePOSIX);
+
+        if (error.Fail() || log)
+        {
+            error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = NULL, attr = %p, argv = %p, envp = %p )",
+                           pid,
+                           exe_path,
+                           &attr,
+                           argv,
+                           envp);
+            if (log)
+            {
+                for (int ii=0; argv[ii]; ++ii)
+                    log->Printf("argv[%i] = '%s'", ii, argv[ii]);
+            }
+        }
     }
 
-    error.SetError (::posix_spawnp (&pid,
-                                    exe_path,
-                                    (num_file_actions > 0) ? &file_actions : NULL,
-                                    &attr,
-                                    argv,
-                                    envp),
-                    eErrorTypePOSIX);
-
-    error.LogIfError(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )",
-                     pid, exe_path, file_action_ptr, &attr, argv, envp);
-
-    // Change back the current directory.
-    // NOTE: do not override previously established error from posix_spawnp.
-    if (working_dir != NULL && ::chdir(current_dir) == -1 && error.Success())
-    {
-        error.SetError(errno, eErrorTypePOSIX);
-        error.LogIfError(log, "unable to change current directory back to %s",
-                         current_dir);
+    if (working_dir)
+    {
+#if defined (__APPLE__)
+        // No more thread specific current working directory
+        __pthread_fchdir (-1);
+#else
+        if (::chdir(current_dir) == -1 && error.Success())
+        {
+            error.SetError(errno, eErrorTypePOSIX);
+            error.LogIfError(log, "unable to change current directory back to %s",
+                    current_dir);
+        }
+#endif
     }
 
     return error;
 }
 
+#endif // LaunchProcedssPosixSpawn: Apple, Linux, FreeBSD and other GLIBC systems
+
+
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__GLIBC__)
+// The functions below implement process launching via posix_spawn() for Linux
+// and FreeBSD.
 
 Error
 Host::LaunchProcess (ProcessLaunchInfo &launch_info)
@@ -1792,6 +1972,8 @@ Host::LaunchProcess (ProcessLaunchInfo &
         // If all went well, then set the process ID into the launch info
         launch_info.SetProcessID(pid);
 
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+
         // Make sure we reap any processes we spawn or we will have zombies.
         if (!launch_info.MonitorProcess())
         {
@@ -1800,6 +1982,13 @@ Host::LaunchProcess (ProcessLaunchInfo &
                                          NULL,
                                          pid,
                                          monitor_signals);
+            if (log)
+                log->PutCString ("monitored child process with default Process::SetProcessExitStatus.");
+        }
+        else
+        {
+            if (log)
+                log->PutCString ("monitored child process with user-specified process monitor.");
         }
     }
     else

Modified: lldb/branches/iohandler/source/Host/linux/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Host/linux/Host.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Host/linux/Host.cpp (original)
+++ lldb/branches/iohandler/source/Host/linux/Host.cpp Thu Jan 23 12:27:11 2014
@@ -20,6 +20,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Error.h"
+#include "lldb/Core/Log.h"
 #include "lldb/Target/Process.h"
 
 #include "lldb/Host/Host.h"
@@ -494,3 +495,114 @@ Host::GetEnvironment (StringList &env)
         env.AppendString(env_entry);
     return i;
 }
+
+const ConstString &
+Host::GetDistributionId ()
+{
+    // Try to run 'lbs_release -i', and use that response
+    // for the distribution id.
+
+    static bool s_evaluated;
+    static ConstString s_distribution_id;
+
+    if (!s_evaluated)
+    {
+        s_evaluated = true;
+
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_HOST));
+        if (log)
+            log->Printf ("attempting to determine Linux distribution...");
+
+        // check if the lsb_release command exists at one of the
+        // following paths
+        const char *const exe_paths[] = {
+            "/bin/lsb_release",
+            "/usr/bin/lsb_release"
+        };
+
+        for (int exe_index = 0;
+             exe_index < sizeof (exe_paths) / sizeof (exe_paths[0]);
+             ++exe_index)
+        {
+            const char *const get_distribution_info_exe = exe_paths[exe_index];
+            if (access (get_distribution_info_exe, F_OK))
+            {
+                // this exe doesn't exist, move on to next exe
+                if (log)
+                    log->Printf ("executable doesn't exist: %s",
+                            get_distribution_info_exe);
+                continue;
+            }
+
+            // execute the distribution-retrieval command, read output
+            std::string get_distribution_id_command (get_distribution_info_exe);
+            get_distribution_id_command += " -i";
+
+            FILE *file = popen (get_distribution_id_command.c_str (), "r");
+            if (!file)
+            {
+                if (log)
+                    log->Printf (
+                        "failed to run command: \"%s\", cannot retrieve "
+                        "platform information",
+                        get_distribution_id_command.c_str ());
+                return s_distribution_id;
+            }
+
+            // retrieve the distribution id string.
+            char distribution_id[256] = { '\0' };
+            if (fgets (distribution_id, sizeof (distribution_id) - 1, file)
+                    != NULL)
+            {
+                if (log)
+                    log->Printf ("distribution id command returned \"%s\"",
+                            distribution_id);
+
+                const char *const distributor_id_key = "Distributor ID:\t";
+                if (strstr (distribution_id, distributor_id_key))
+                {
+                    // strip newlines
+                    std::string id_string (distribution_id +
+                            strlen (distributor_id_key));
+                    id_string.erase(
+                        std::remove (
+                            id_string.begin (),
+                            id_string.end (),
+                            '\n'),
+                        id_string.end ());
+
+                    // lower case it and convert whitespace to underscores
+                    std::transform (
+                        id_string.begin(),
+                        id_string.end (),
+                        id_string.begin (),
+                        [] (char ch)
+                        { return tolower ( isspace (ch) ? '_' : ch ); });
+
+                    s_distribution_id.SetCString (id_string.c_str ());
+                    if (log)
+                        log->Printf ("distribion id set to \"%s\"",
+                                s_distribution_id.GetCString ());
+                }
+                else
+                {
+                    if (log)
+                        log->Printf ("failed to find \"%s\" field in \"%s\"",
+                                distributor_id_key, distribution_id);
+                }
+            }
+            else
+            {
+                if (log)
+                    log->Printf (
+                        "failed to retrieve distribution id, \"%s\" returned no"
+                        " lines", get_distribution_id_command.c_str ());
+            }
+
+            // clean up the file
+            pclose(file);
+        }
+    }
+
+    return s_distribution_id;
+}

Modified: lldb/branches/iohandler/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Host/macosx/Host.mm?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Host/macosx/Host.mm (original)
+++ lldb/branches/iohandler/source/Host/macosx/Host.mm Thu Jan 23 12:27:11 2014
@@ -1318,51 +1318,6 @@ Host::GetProcessInfo (lldb::pid_t pid, P
     return false;
 }
 
-static short
-GetPosixspawnFlags (ProcessLaunchInfo &launch_info)
-{
-    short flags = POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK;
-    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 (Host::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
-    
-    return flags;
-}
-
 #if !NO_XPC_SERVICES
 static void
 PackageXPCArguments (xpc_object_t message, const char *prefix, const Args& args)
@@ -1543,7 +1498,7 @@ LaunchProcessXPC (const char *exe_path,
     
     // Posix spawn stuff.
     xpc_dictionary_set_int64(message, LauncherXPCServiceCPUTypeKey, launch_info.GetArchitecture().GetMachOCPUType());
-    xpc_dictionary_set_int64(message, LauncherXPCServicePosixspawnFlagsKey, GetPosixspawnFlags(launch_info));
+    xpc_dictionary_set_int64(message, LauncherXPCServicePosixspawnFlagsKey, Host::GetPosixspawnFlags(launch_info));
     
     xpc_object_t reply = xpc_connection_send_message_with_reply_sync(conn, message);
     xpc_type_t returnType = xpc_get_type(reply);
@@ -1586,176 +1541,6 @@ LaunchProcessXPC (const char *exe_path,
 #endif
 }
 
-static Error
-LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t &pid)
-{
-    Error 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() || log)
-        error.PutToLog(log, "::posix_spawnattr_init ( &attr )");
-    if (error.Fail())
-        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);
-    ::posix_spawnattr_setsigdefault(&attr, &all_signals);
-
-    short flags = GetPosixspawnFlags(launch_info);
-    error.SetError( ::posix_spawnattr_setflags (&attr, flags), eErrorTypePOSIX);
-    if (error.Fail() || log)
-        error.PutToLog(log, "::posix_spawnattr_setflags ( &attr, flags=0x%8.8x )", flags);
-    if (error.Fail())
-        return error;
-    
-#if !defined(__arm__)
-    
-    // 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();
-    if (cpu != 0 && 
-        cpu != UINT32_MAX && 
-        cpu != LLDB_INVALID_CPUTYPE)
-    {
-        size_t ocount = 0;
-        error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
-        if (error.Fail() || log)
-            error.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %llu )", cpu, (uint64_t)ocount);
-        
-        if (error.Fail() || ocount != 1)
-            return error;
-    }
-    
-#endif
-    
-    const char *tmp_argv[2];
-    char * const *argv = (char * const*)launch_info.GetArguments().GetConstArgumentVector();
-    char * const *envp = (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 = (char * const*)tmp_argv;
-    }
-
-    const char *working_dir = launch_info.GetWorkingDirectory();
-    if (working_dir)
-    {
-        // No more thread specific current working directory
-        if (__pthread_chdir (working_dir) < 0) {
-            if (errno == ENOENT) {
-                error.SetErrorStringWithFormat("No such file or directory: %s", working_dir);
-            } else if (errno == ENOTDIR) {
-                error.SetErrorStringWithFormat("Path doesn't name a directory: %s", working_dir);
-            } else {
-                error.SetErrorStringWithFormat("An unknown error occurred when changing directory for process execution.");
-            }
-            return error;
-        }
-    }
-    
-    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() || log)
-            error.PutToLog(log, "::posix_spawn_file_actions_init ( &file_actions )");
-        if (error.Fail())
-            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 ProcessLaunchInfo::FileAction *launch_file_action = launch_info.GetFileActionAtIndex(i);
-            if (launch_file_action)
-            {
-                if (!ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (&file_actions,
-                                                                             launch_file_action,
-                                                                             log,
-                                                                             error))
-                    return error;
-            }
-        }
-        
-        error.SetError (::posix_spawnp (&pid, 
-                                        exe_path, 
-                                        &file_actions, 
-                                        &attr, 
-                                        argv,
-                                        envp),
-                        eErrorTypePOSIX);
-
-        if (error.Fail() || log)
-        {
-            error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )",
-                           pid, 
-                           exe_path, 
-                           &file_actions, 
-                           &attr, 
-                           argv, 
-                           envp);
-            if (log)
-            {
-                for (int ii=0; argv[ii]; ++ii)
-                    log->Printf("argv[%i] = '%s'", ii, argv[ii]);
-            }
-        }
-
-    }
-    else
-    {
-        error.SetError (::posix_spawnp (&pid, 
-                                        exe_path, 
-                                        NULL, 
-                                        &attr, 
-                                        argv,
-                                        envp),
-                        eErrorTypePOSIX);
-
-        if (error.Fail() || log)
-        {
-            error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = NULL, attr = %p, argv = %p, envp = %p )",
-                           pid, 
-                           exe_path, 
-                           &attr, 
-                           argv, 
-                           envp);
-            if (log)
-            {
-                for (int ii=0; argv[ii]; ++ii)
-                    log->Printf("argv[%i] = '%s'", ii, argv[ii]);
-            }
-        }
-    }
-    
-    if (working_dir)
-    {
-        // No more thread specific current working directory
-        __pthread_fchdir (-1);
-    }
-    
-    return error;
-}
-
 static bool
 ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info)
 {

Modified: lldb/branches/iohandler/source/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Makefile?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Makefile (original)
+++ lldb/branches/iohandler/source/Makefile Thu Jan 23 12:27:11 2014
@@ -25,7 +25,7 @@ include $(LLDB_LEVEL)/Makefile
 
 ifeq ($(HOST_OS),Darwin)
 LLDB_vers.c: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj
-	"$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj" > LLDB_vers.c
+	"$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/generate-vers.pl" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj" liblldb_core > LLDB_vers.c
 else
 LLDB_REVISION := $(strip \
         $(shell $(LLVM_SRC_ROOT)/utils/GetSourceVersion $(LLVM_SRC_ROOT)/tools/lldb))

Modified: lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Thu Jan 23 12:27:11 2014
@@ -1672,6 +1672,29 @@ DynamicLoaderMacOSXDYLD::GetStepThroughT
                         }
                     }
                 }
+                
+                SymbolContextList indirect_symbols;
+                images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeResolver, indirect_symbols);
+                size_t num_indirect_symbols = indirect_symbols.GetSize();
+                if (num_indirect_symbols > 0)
+                {
+                    for (uint32_t i = 0; i < num_indirect_symbols; i++)
+                    {
+                        SymbolContext context;
+                        AddressRange addr_range;
+                        if (indirect_symbols.GetContextAtIndex(i, context))
+                        {
+                            context.GetAddressRange (eSymbolContextEverything, 0, false, addr_range);
+                            addresses.push_back(addr_range.GetBaseAddress());
+                            if (log)
+                            {
+                                addr_t load_addr = addr_range.GetBaseAddress().GetLoadAddress(target_sp.get());
+
+                                log->Printf ("Found an indirect target symbol at 0x%" PRIx64 ".", load_addr);
+                            }
+                        }
+                    }
+                }
             }
         }
         else if (current_symbol->GetType() == eSymbolTypeReExported)

Modified: lldb/branches/iohandler/source/Plugins/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Makefile?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Makefile (original)
+++ lldb/branches/iohandler/source/Plugins/Makefile Thu Jan 23 12:27:11 2014
@@ -30,6 +30,7 @@ DIRS +=	ObjectContainer/Universal-Mach-O
 DIRS += SymbolVendor/MacOSX
 #DIRS += Process/MacOSX-User
 DIRS += Process/mach-core
+DIRS += SystemRuntime/MacOSX
 endif
 
 ifeq ($(HOST_OS),Linux)

Modified: lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Jan 23 12:27:11 2014
@@ -1987,7 +1987,7 @@ ObjectFileMachO::ParseSymtab ()
         std::vector<uint32_t> N_INCL_indexes;
         std::vector<uint32_t> N_BRAC_indexes;
         std::vector<uint32_t> N_COMM_indexes;
-        typedef std::map <uint64_t, uint32_t> ValueToSymbolIndexMap;
+        typedef std::multimap <uint64_t, uint32_t> ValueToSymbolIndexMap;
         typedef std::map <uint32_t, uint32_t> NListIndexToSymbolIndexMap;
         typedef std::map <const char *, uint32_t> ConstNameToSymbolIndexMap;
         ValueToSymbolIndexMap N_FUN_addr_to_sym_idx;
@@ -2322,7 +2322,7 @@ ObjectFileMachO::ParseSymtab ()
                                                             type = eSymbolTypeCode;
                                                             symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
 
-                                                            N_FUN_addr_to_sym_idx[nlist.n_value] = sym_idx;
+                                                            N_FUN_addr_to_sym_idx.insert(std::make_pair(nlist.n_value, sym_idx));
                                                             // We use the current number of symbols in the symbol table in lieu of
                                                             // using nlist_idx in case we ever start trimming entries out
                                                             N_FUN_indexes.push_back(sym_idx);
@@ -2347,7 +2347,7 @@ ObjectFileMachO::ParseSymtab ()
 
                                                     case N_STSYM:
                                                         // static symbol: name,,n_sect,type,address
-                                                        N_STSYM_addr_to_sym_idx[nlist.n_value] = sym_idx;
+                                                        N_STSYM_addr_to_sym_idx.insert(std::make_pair(nlist.n_value, sym_idx));
                                                         symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
                                                         type = eSymbolTypeData;
                                                         break;
@@ -2855,26 +2855,34 @@ ObjectFileMachO::ParseSymtab ()
                                                         // If we do find a match, and the name matches, then we
                                                         // can merge the two into just the function symbol to avoid
                                                         // duplicate entries in the symbol table
-                                                        ValueToSymbolIndexMap::const_iterator pos = N_FUN_addr_to_sym_idx.find (nlist.n_value);
-                                                        if (pos != N_FUN_addr_to_sym_idx.end())
+                                                        std::pair<ValueToSymbolIndexMap::const_iterator, ValueToSymbolIndexMap::const_iterator> range;
+                                                        range = N_FUN_addr_to_sym_idx.equal_range(nlist.n_value);
+                                                        if (range.first != range.second)
                                                         {
-                                                            if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+                                                            bool found_it = false;
+                                                            for (ValueToSymbolIndexMap::const_iterator pos = range.first; pos != range.second; ++pos)
                                                             {
-                                                                m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
-                                                                // We just need the flags from the linker symbol, so put these flags
-                                                                // into the N_FUN flags to avoid duplicate symbols in the symbol table
-                                                                sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
-                                                                sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
-                                                                if (resolver_addresses.find(nlist.n_value) != resolver_adresses.end())
-                                                                    sym[pos->second].SetType (eSymbolTypeResolver);
-                                                                sym[sym_idx].Clear();
-                                                                continue;
+                                                                if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+                                                                {
+                                                                    m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
+                                                                    // We just need the flags from the linker symbol, so put these flags
+                                                                    // into the N_FUN flags to avoid duplicate symbols in the symbol table
+                                                                    sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
+                                                                    sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
+                                                                    if (resolver_addresses.find(nlist.n_value) != resolver_addresses.end())
+                                                                        sym[pos->second].SetType (eSymbolTypeResolver);
+                                                                    sym[sym_idx].Clear();
+                                                                    found_it = true;
+                                                                    break;
+                                                                }
                                                             }
+                                                            if (found_it)
+                                                                continue;
                                                         }
                                                         else
                                                         {
-                                                            if (resolver_addresses.find(nlist.n_value) != resolver_adresses.end())
-                                                                sym[sym_idx].SetType (eSymbolTypeResolver);
+                                                            if (resolver_addresses.find(nlist.n_value) != resolver_addresses.end())
+                                                                type = eSymbolTypeResolver;
                                                         }
                                                     }
                                                     else if (type == eSymbolTypeData)
@@ -2883,19 +2891,27 @@ ObjectFileMachO::ParseSymtab ()
                                                         // If we do find a match, and the name matches, then we
                                                         // can merge the two into just the Static symbol to avoid
                                                         // duplicate entries in the symbol table
-                                                        ValueToSymbolIndexMap::const_iterator pos = N_STSYM_addr_to_sym_idx.find (nlist.n_value);
-                                                        if (pos != N_STSYM_addr_to_sym_idx.end())
+                                                        std::pair<ValueToSymbolIndexMap::const_iterator, ValueToSymbolIndexMap::const_iterator> range;
+                                                        range = N_STSYM_addr_to_sym_idx.equal_range(nlist.n_value);
+                                                        if (range.first != range.second)
                                                         {
-                                                            if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+                                                            bool found_it = false;
+                                                            for (ValueToSymbolIndexMap::const_iterator pos = range.first; pos != range.second; ++pos)
                                                             {
-                                                                m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
-                                                                // We just need the flags from the linker symbol, so put these flags
-                                                                // into the N_STSYM flags to avoid duplicate symbols in the symbol table
-                                                                sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
-                                                                sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
-                                                                sym[sym_idx].Clear();
-                                                                continue;
+                                                                if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+                                                                {
+                                                                    m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
+                                                                    // We just need the flags from the linker symbol, so put these flags
+                                                                    // into the N_STSYM flags to avoid duplicate symbols in the symbol table
+                                                                    sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
+                                                                    sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
+                                                                    sym[sym_idx].Clear();
+                                                                    found_it = true;
+                                                                    break;
+                                                                }
                                                             }
+                                                            if (found_it)
+                                                                continue;
                                                         }
                                                         else
                                                         {
@@ -3071,7 +3087,7 @@ ObjectFileMachO::ParseSymtab ()
                             type = eSymbolTypeCode;
                             symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
 
-                            N_FUN_addr_to_sym_idx[nlist.n_value] = sym_idx;
+                            N_FUN_addr_to_sym_idx.insert(std::make_pair(nlist.n_value, sym_idx));
                             // We use the current number of symbols in the symbol table in lieu of
                             // using nlist_idx in case we ever start trimming entries out
                             N_FUN_indexes.push_back(sym_idx);
@@ -3096,7 +3112,7 @@ ObjectFileMachO::ParseSymtab ()
 
                     case N_STSYM:
                         // static symbol: name,,n_sect,type,address
-                        N_STSYM_addr_to_sym_idx[nlist.n_value] = sym_idx;
+                        N_STSYM_addr_to_sym_idx.insert(std::make_pair(nlist.n_value, sym_idx));
                         symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
                         type = eSymbolTypeData;
                         break;
@@ -3607,26 +3623,34 @@ ObjectFileMachO::ParseSymtab ()
                             // If we do find a match, and the name matches, then we
                             // can merge the two into just the function symbol to avoid
                             // duplicate entries in the symbol table
-                            ValueToSymbolIndexMap::const_iterator pos = N_FUN_addr_to_sym_idx.find (nlist.n_value);
-                            if (pos != N_FUN_addr_to_sym_idx.end())
+                            std::pair<ValueToSymbolIndexMap::const_iterator, ValueToSymbolIndexMap::const_iterator> range;
+                            range = N_FUN_addr_to_sym_idx.equal_range(nlist.n_value);
+                            if (range.first != range.second)
                             {
-                                if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+                                bool found_it = false;
+                                for (ValueToSymbolIndexMap::const_iterator pos = range.first; pos != range.second; ++pos)
                                 {
-                                    m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
-                                    // We just need the flags from the linker symbol, so put these flags
-                                    // into the N_FUN flags to avoid duplicate symbols in the symbol table
-                                    sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
-                                    sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
-                                    if (resolver_addresses.find(nlist.n_value) != resolver_addresses.end())
-                                        sym[pos->second].SetType (eSymbolTypeResolver);
-                                    sym[sym_idx].Clear();
-                                    continue;
+                                    if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+                                    {
+                                        m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
+                                        // We just need the flags from the linker symbol, so put these flags
+                                        // into the N_FUN flags to avoid duplicate symbols in the symbol table
+                                        sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
+                                        sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
+                                        if (resolver_addresses.find(nlist.n_value) != resolver_addresses.end())
+                                            sym[pos->second].SetType (eSymbolTypeResolver);
+                                        sym[sym_idx].Clear();
+                                        found_it = true;
+                                        break;
+                                    }
                                 }
+                                if (found_it)
+                                    continue;
                             }
                             else
                             {
                                 if (resolver_addresses.find(nlist.n_value) != resolver_addresses.end())
-                                    sym[sym_idx].SetType (eSymbolTypeResolver);
+                                    type = eSymbolTypeResolver;
                             }
                         }
                         else if (type == eSymbolTypeData)
@@ -3635,19 +3659,27 @@ ObjectFileMachO::ParseSymtab ()
                             // If we do find a match, and the name matches, then we
                             // can merge the two into just the Static symbol to avoid
                             // duplicate entries in the symbol table
-                            ValueToSymbolIndexMap::const_iterator pos = N_STSYM_addr_to_sym_idx.find (nlist.n_value);
-                            if (pos != N_STSYM_addr_to_sym_idx.end())
+                            std::pair<ValueToSymbolIndexMap::const_iterator, ValueToSymbolIndexMap::const_iterator> range;
+                            range = N_STSYM_addr_to_sym_idx.equal_range(nlist.n_value);
+                            if (range.first != range.second)
                             {
-                                if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+                                bool found_it = false;
+                                for (ValueToSymbolIndexMap::const_iterator pos = range.first; pos != range.second; ++pos)
                                 {
-                                    m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
-                                    // We just need the flags from the linker symbol, so put these flags
-                                    // into the N_STSYM flags to avoid duplicate symbols in the symbol table
-                                    sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
-                                    sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
-                                    sym[sym_idx].Clear();
-                                    continue;
+                                    if (sym[sym_idx].GetMangled().GetName(Mangled::ePreferMangled) == sym[pos->second].GetMangled().GetName(Mangled::ePreferMangled))
+                                    {
+                                        m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
+                                        // We just need the flags from the linker symbol, so put these flags
+                                        // into the N_STSYM flags to avoid duplicate symbols in the symbol table
+                                        sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
+                                        sym[pos->second].SetFlags (nlist.n_type << 16 | nlist.n_desc);
+                                        sym[sym_idx].Clear();
+                                        found_it = true;
+                                        break;
+                                    }
                                 }
+                                if (found_it)
+                                    continue;
                             }
                             else
                             {

Modified: lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Thu Jan 23 12:27:11 2014
@@ -312,6 +312,7 @@ PlatformFreeBSD::GetSoftwareBreakpointTr
 
     case ArchSpec::eCore_x86_32_i386:
     case ArchSpec::eCore_x86_64_x86_64:
+    case ArchSpec::eCore_x86_64_x86_64h:
         {
             static const uint8_t g_i386_opcode[] = { 0xCC };
             trap_opcode = g_i386_opcode;
@@ -571,14 +572,14 @@ PlatformFreeBSD::GetGroupName (uint32_t
 
 // From PlatformMacOSX only
 Error
-PlatformFreeBSD::GetFile (const FileSpec &platform_file,
-                          const UUID *uuid_ptr,
-                          FileSpec &local_file)
+PlatformFreeBSD::GetFileWithUUID (const FileSpec &platform_file,
+                                  const UUID *uuid_ptr,
+                                  FileSpec &local_file)
 {
     if (IsRemote())
     {
         if (m_remote_platform_sp)
-            return m_remote_platform_sp->GetFile (platform_file, uuid_ptr, local_file);
+            return m_remote_platform_sp->GetFileWithUUID (platform_file, uuid_ptr, local_file);
     }
 
     // Default to the local case

Modified: lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Thu Jan 23 12:27:11 2014
@@ -144,8 +144,8 @@ public:
 
     // Only on PlatformMacOSX:
     virtual lldb_private::Error
-    GetFile (const lldb_private::FileSpec &platform_file,
-             const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file);
+    GetFileWithUUID (const lldb_private::FileSpec &platform_file,
+                     const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file);
 
     lldb_private::Error
     GetSharedModule (const lldb_private::ModuleSpec &module_spec,

Modified: lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.cpp Thu Jan 23 12:27:11 2014
@@ -85,7 +85,7 @@ PlatformLinux::CreateInstance (bool forc
         }
     }
     if (create)
-        return new PlatformLinux(true);
+        return new PlatformLinux(false);
     return NULL;
 }
 
@@ -285,13 +285,13 @@ PlatformLinux::ResolveExecutable (const
 }
 
 Error
-PlatformLinux::GetFile (const FileSpec &platform_file, 
-                        const UUID *uuid_ptr, FileSpec &local_file)
+PlatformLinux::GetFileWithUUID (const FileSpec &platform_file, 
+                                const UUID *uuid_ptr, FileSpec &local_file)
 {
     if (IsRemote())
     {
         if (m_remote_platform_sp)
-            return m_remote_platform_sp->GetFile (platform_file, uuid_ptr, local_file);
+            return m_remote_platform_sp->GetFileWithUUID (platform_file, uuid_ptr, local_file);
     }
 
     // Default to the local case
@@ -390,6 +390,7 @@ PlatformLinux::GetSoftwareBreakpointTrap
 
     case ArchSpec::eCore_x86_32_i386:
     case ArchSpec::eCore_x86_64_x86_64:
+    case ArchSpec::eCore_x86_64_x86_64h:
         {
             static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC };
             trap_opcode = g_i386_breakpoint_opcode;

Modified: lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.h (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/Linux/PlatformLinux.h Thu Jan 23 12:27:11 2014
@@ -73,8 +73,8 @@ namespace lldb_private {
         GetStatus (Stream &strm);
 
         virtual Error
-        GetFile (const FileSpec &platform_file,
-                 const UUID* uuid, FileSpec &local_file);
+        GetFileWithUUID (const FileSpec &platform_file,
+                         const UUID* uuid, FileSpec &local_file);
 
         virtual bool
         GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info);

Modified: lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Thu Jan 23 12:27:11 2014
@@ -983,23 +983,46 @@ PlatformDarwin::GetQueueIDForThreadQAddr
 bool
 PlatformDarwin::x86GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
 {
-    if (idx == 0)
+    ArchSpec host_arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+    if (host_arch.GetCore() == ArchSpec::eCore_x86_64_x86_64h)
     {
-        arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
-        return arch.IsValid();
+        switch (idx)
+        {
+            case 0:
+                arch = host_arch;
+                return true;
+
+            case 1:
+                arch.SetTriple("x86_64-apple-macosx");
+                return true;
+
+            case 2:
+                arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+                return true;
+
+            default: return false;
+        }
     }
-    else if (idx == 1)
+    else
     {
-        ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture));
-        ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64));
-        if (platform_arch.IsExactMatch(platform_arch64))
+        if (idx == 0)
         {
-            // This macosx platform supports both 32 and 64 bit. Since we already
-            // returned the 64 bit arch for idx == 0, return the 32 bit arch 
-            // for idx == 1
-            arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+            arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
             return arch.IsValid();
         }
+        else if (idx == 1)
+        {
+            ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture));
+            ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64));
+            if (platform_arch.IsExactMatch(platform_arch64))
+            {
+                // This macosx platform supports both 32 and 64 bit. Since we already
+                // returned the 64 bit arch for idx == 0, return the 32 bit arch 
+                // for idx == 1
+                arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+                return arch.IsValid();
+            }
+        }
     }
     return false;
 }

Modified: lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Thu Jan 23 12:27:11 2014
@@ -22,11 +22,12 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Core/Error.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Core/Error.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleList.h"
+#include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Host/FileSpec.h"
@@ -249,7 +250,7 @@ PlatformMacOSX::GetSymbolFile (const Fil
     if (IsRemote())
     {
         if (m_remote_platform_sp)
-            return m_remote_platform_sp->GetFile (platform_file, uuid_ptr, local_file);
+            return m_remote_platform_sp->GetFileWithUUID (platform_file, uuid_ptr, local_file);
     }
 
     // Default to the local case
@@ -258,9 +259,9 @@ PlatformMacOSX::GetSymbolFile (const Fil
 }
 
 lldb_private::Error
-PlatformMacOSX::GetFile (const lldb_private::FileSpec &platform_file,
-                         const lldb_private::UUID *uuid_ptr,
-                         lldb_private::FileSpec &local_file)
+PlatformMacOSX::GetFileWithUUID (const lldb_private::FileSpec &platform_file,
+                                 const lldb_private::UUID *uuid_ptr,
+                                 lldb_private::FileSpec &local_file)
 {
     if (IsRemote() && m_remote_platform_sp)
     {
@@ -325,5 +326,34 @@ PlatformMacOSX::GetSharedModule (const l
                                  lldb::ModuleSP *old_module_sp_ptr,
                                  bool *did_create_ptr)
 {
-    return GetSharedModuleWithLocalCache(module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr);
+    Error error = GetSharedModuleWithLocalCache(module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr);
+    
+    if (module_sp)
+    {
+        if (module_spec.GetArchitecture().GetCore() == ArchSpec::eCore_x86_64_x86_64h)
+        {
+            ObjectFile *objfile = module_sp->GetObjectFile();
+            if (objfile == NULL)
+            {
+                // We didn't find an x86_64h slice, fall back to a x86_64 slice
+                ModuleSpec module_spec_x86_64 (module_spec);
+                module_spec_x86_64.GetArchitecture() = ArchSpec("x86_64-apple-macosx");
+                lldb::ModuleSP x86_64_module_sp;
+                lldb::ModuleSP old_x86_64_module_sp;
+                bool did_create = false;
+                Error x86_64_error = GetSharedModuleWithLocalCache(module_spec_x86_64, x86_64_module_sp, module_search_paths_ptr, &old_x86_64_module_sp, &did_create);
+                if (x86_64_module_sp && x86_64_module_sp->GetObjectFile())
+                {
+                    module_sp = x86_64_module_sp;
+                    if (old_module_sp_ptr)
+                        *old_module_sp_ptr = old_x86_64_module_sp;
+                    if (did_create_ptr)
+                        *did_create_ptr = did_create;
+                    return x86_64_error;
+                }
+            }
+        }
+    }
+    return error;
 }
+

Modified: lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.h (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/MacOSX/PlatformMacOSX.h Thu Jan 23 12:27:11 2014
@@ -87,9 +87,9 @@ public:
     }
     
     virtual lldb_private::Error
-    GetFile (const lldb_private::FileSpec &platform_file, 
-             const lldb_private::UUID *uuid_ptr,
-             lldb_private::FileSpec &local_file);
+    GetFileWithUUID (const lldb_private::FileSpec &platform_file, 
+                     const lldb_private::UUID *uuid_ptr,
+                     lldb_private::FileSpec &local_file);
     
     virtual bool
     GetSupportedArchitectureAtIndex (uint32_t idx, 

Modified: lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.cpp Thu Jan 23 12:27:11 2014
@@ -283,6 +283,7 @@ PlatformWindows::GetSoftwareBreakpointTr
     {
     case ArchSpec::eCore_x86_32_i386:
     case ArchSpec::eCore_x86_64_x86_64:
+    case ArchSpec::eCore_x86_64_x86_64h:
         {
             static const uint8_t g_i386_opcode[] = { 0xCC };
             trap_opcode = g_i386_opcode;
@@ -542,14 +543,14 @@ PlatformWindows::GetGroupName (uint32_t
 }
 
 Error
-PlatformWindows::GetFile (const FileSpec &platform_file,
-                          const UUID *uuid_ptr,
-                          FileSpec &local_file)
+PlatformWindows::GetFileWithUUID (const FileSpec &platform_file,
+                                  const UUID *uuid_ptr,
+                                  FileSpec &local_file)
 {
     if (IsRemote())
     {
         if (m_remote_platform_sp)
-            return m_remote_platform_sp->GetFile (platform_file, uuid_ptr, local_file);
+            return m_remote_platform_sp->GetFileWithUUID (platform_file, uuid_ptr, local_file);
     }
 
     // Default to the local case

Modified: lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.h (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/Windows/PlatformWindows.h Thu Jan 23 12:27:11 2014
@@ -125,8 +125,8 @@ public:
            lldb_private::Error &error);
 
     virtual lldb_private::Error
-    GetFile(const lldb_private::FileSpec &platform_file,
-            const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file);
+    GetFileWithUUID(const lldb_private::FileSpec &platform_file,
+                    const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file);
 
     lldb_private::Error
     GetSharedModule(const lldb_private::ModuleSpec &module_spec,

Modified: lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Thu Jan 23 12:27:11 2014
@@ -119,9 +119,9 @@ PlatformRemoteGDBServer::ResolveExecutab
 }
 
 Error
-PlatformRemoteGDBServer::GetFile (const FileSpec &platform_file, 
-                                  const UUID *uuid_ptr,
-                                  FileSpec &local_file)
+PlatformRemoteGDBServer::GetFileWithUUID (const FileSpec &platform_file, 
+                                          const UUID *uuid_ptr,
+                                          FileSpec &local_file)
 {
     // Default to the local case
     local_file = platform_file;

Modified: lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h (original)
+++ lldb/branches/iohandler/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h Thu Jan 23 12:27:11 2014
@@ -73,9 +73,9 @@ public:
     GetDescription ();
 
     virtual lldb_private::Error
-    GetFile (const lldb_private::FileSpec &platform_file, 
-             const lldb_private::UUID *uuid_ptr,
-             lldb_private::FileSpec &local_file);
+    GetFileWithUUID (const lldb_private::FileSpec &platform_file, 
+                     const lldb_private::UUID *uuid_ptr,
+                     lldb_private::FileSpec &local_file);
 
     virtual bool
     GetProcessInfo (lldb::pid_t pid, 

Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Thu Jan 23 12:27:11 2014
@@ -694,7 +694,11 @@ GDBRemoteCommunication::StartDebugserver
 
                 if (::mktemp (named_pipe_path))
                 {
+#if defined(_MSC_VER)
+                    if ( false )
+#else
                     if (::mkfifo(named_pipe_path, 0600) == 0)
+#endif
                     {
                         debugserver_args.AppendArgument("--named-pipe");
                         debugserver_args.AppendArgument(named_pipe_path);

Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Thu Jan 23 12:27:11 2014
@@ -1254,6 +1254,7 @@ GDBRemoteCommunicationClient::GetHostInf
                 std::string os_name;
                 std::string vendor_name;
                 std::string triple;
+                std::string distribution_id;
                 uint32_t pointer_byte_size = 0;
                 StringExtractor extractor;
                 ByteOrder byte_order = eByteOrderInvalid;
@@ -1287,6 +1288,13 @@ GDBRemoteCommunicationClient::GetHostInf
                         extractor.GetHexByteString (triple);
                         ++num_keys_decoded;
                     }
+                    else if (name.compare ("distribution_id") == 0)
+                    {
+                        extractor.GetStringRef ().swap (value);
+                        extractor.SetFilePos (0);
+                        extractor.GetHexByteString (distribution_id);
+                        ++num_keys_decoded;
+                    }
                     else if (name.compare("os_build") == 0)
                     {
                         extractor.GetStringRef().swap(value);
@@ -1461,7 +1469,9 @@ GDBRemoteCommunicationClient::GetHostInf
                     {
                         assert (byte_order == m_host_arch.GetByteOrder());
                     }
-                }       
+                }
+                if (!distribution_id.empty ())
+                    m_host_arch.SetDistributionId (distribution_id.c_str ());
             }
         }
     }

Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Thu Jan 23 12:27:11 2014
@@ -313,6 +313,14 @@ GDBRemoteCommunicationServer::Handle_qHo
     response.PutCStringAsRawHex8(host_triple.getTriple().c_str());
     response.Printf (";ptrsize:%u;",host_arch.GetAddressByteSize());
 
+    const char* distribution_id = host_arch.GetDistributionId ().AsCString ();
+    if (distribution_id)
+    {
+        response.PutCString("distribution_id:");
+        response.PutCStringAsRawHex8(distribution_id);
+        response.PutCString(";");
+    }
+
     uint32_t cpu = host_arch.GetMachOCPUType();
     uint32_t sub = host_arch.GetMachOCPUSubType();
     if (cpu != LLDB_INVALID_CPUTYPE)
@@ -806,8 +814,7 @@ GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qLaunchGDBServer (StringExtractorGDBRemote &packet)
 {
 #ifdef _WIN32
-    // No unix sockets on windows
-    return false;
+    return SendErrorResponse(9);
 #else
     // Spawn a local debugserver as a platform so we can then attach or launch
     // a process...

Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Jan 23 12:27:11 2014
@@ -94,7 +94,7 @@ using namespace lldb_private;
 
 
 namespace {
-    
+
     static PropertyDefinition
     g_properties[] =
     {

Modified: lldb/branches/iohandler/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h (original)
+++ lldb/branches/iohandler/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h Thu Jan 23 12:27:11 2014
@@ -53,7 +53,7 @@ public:
     bool                ExtractValue(const lldb_private::DWARFDataExtractor& data,
                                      lldb::offset_t* offset_ptr,
                                      const DWARFCompileUnit* cu);
-    bool                IsInlinedCStr() const { return (m_value.data != NULL) && m_value.data == (uint8_t*)m_value.value.cstr; }
+    bool                IsInlinedCStr() const { return (m_value.data != NULL) && m_value.data == (const uint8_t*)m_value.value.cstr; }
     const uint8_t*      BlockData() const;
     uint64_t            Reference(const DWARFCompileUnit* cu) const;
     uint64_t            Reference (dw_offset_t offset) const;

Modified: lldb/branches/iohandler/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Symbol/ClangASTType.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Symbol/ClangASTType.cpp (original)
+++ lldb/branches/iohandler/source/Symbol/ClangASTType.cpp Thu Jan 23 12:27:11 2014
@@ -414,7 +414,7 @@ ClangASTType::GetNumberOfFunctionArgumen
         QualType qual_type (GetCanonicalQualType());
         const FunctionProtoType* func = dyn_cast<FunctionProtoType>(qual_type.getTypePtr());
         if (func)
-            return func->getNumArgs();
+            return func->getNumParams();
     }
     return 0;
 }
@@ -428,8 +428,8 @@ ClangASTType::GetFunctionArgumentAtIndex
         const FunctionProtoType* func = dyn_cast<FunctionProtoType>(qual_type.getTypePtr());
         if (func)
         {
-            if (index < func->getNumArgs())
-                return ClangASTType(m_ast, func->getArgType(index).getAsOpaquePtr());
+            if (index < func->getNumParams())
+                return ClangASTType(m_ast, func->getParamType(index).getAsOpaquePtr());
         }
     }
     return ClangASTType();
@@ -1596,7 +1596,7 @@ ClangASTType::GetFunctionArgumentCount (
     {
         const FunctionProtoType* func = dyn_cast<FunctionProtoType>(GetCanonicalQualType());
         if (func)
-            return func->getNumArgs();
+            return func->getNumParams();
     }
     return -1;
 }
@@ -1609,9 +1609,9 @@ ClangASTType::GetFunctionArgumentTypeAtI
         const FunctionProtoType* func = dyn_cast<FunctionProtoType>(GetCanonicalQualType());
         if (func)
         {
-            const uint32_t num_args = func->getNumArgs();
+            const uint32_t num_args = func->getNumParams();
             if (idx < num_args)
-                return ClangASTType(m_ast, func->getArgType(idx));
+                return ClangASTType(m_ast, func->getParamType(idx));
         }
     }
     return ClangASTType();
@@ -4648,7 +4648,7 @@ ClangASTType::AddMethodToCXXRecordType (
     if (!method_function_prototype)
         return NULL;
     
-    unsigned int num_params = method_function_prototype->getNumArgs();
+    unsigned int num_params = method_function_prototype->getNumParams();
     
     CXXDestructorDecl *cxx_dtor_decl(NULL);
     CXXConstructorDecl *cxx_ctor_decl(NULL);
@@ -4746,7 +4746,7 @@ ClangASTType::AddMethodToCXXRecordType (
     cxx_method_decl->setVirtualAsWritten (is_virtual);
     
     if (is_attr_used)
-        cxx_method_decl->addAttr(::new (*m_ast) UsedAttr(SourceRange(), *m_ast));
+        cxx_method_decl->addAttr(clang::UsedAttr::CreateImplicit(*m_ast));
     
     // Populate the method decl with parameter decls
     
@@ -4761,7 +4761,7 @@ ClangASTType::AddMethodToCXXRecordType (
                                                SourceLocation(),
                                                SourceLocation(),
                                                NULL, // anonymous
-                                               method_function_prototype->getArgType(param_index),
+                                               method_function_prototype->getParamType(param_index),
                                                NULL,
                                                SC_None,
                                                NULL));
@@ -5134,7 +5134,7 @@ ClangASTType::AddMethodToObjCObjectType
     bool is_defined = false;
     ObjCMethodDecl::ImplementationControl imp_control = ObjCMethodDecl::None;
     
-    const unsigned num_args = method_function_prototype->getNumArgs();
+    const unsigned num_args = method_function_prototype->getNumParams();
     
     if (num_args != num_selectors_with_args)
         return NULL; // some debug information is corrupt.  We are not going to deal with it.
@@ -5169,7 +5169,7 @@ ClangASTType::AddMethodToObjCObjectType
                                                    SourceLocation(),
                                                    SourceLocation(),
                                                    NULL, // anonymous
-                                                   method_function_prototype->getArgType(param_index),
+                                                   method_function_prototype->getParamType(param_index),
                                                    NULL,
                                                    SC_Auto,
                                                    NULL));

Modified: lldb/branches/iohandler/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Target/Platform.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Target/Platform.cpp (original)
+++ lldb/branches/iohandler/source/Target/Platform.cpp Thu Jan 23 12:27:11 2014
@@ -81,9 +81,9 @@ Platform::SetDefaultPlatform (const lldb
 }
 
 Error
-Platform::GetFile (const FileSpec &platform_file, 
-                   const UUID *uuid_ptr,
-                   FileSpec &local_file)
+Platform::GetFileWithUUID (const FileSpec &platform_file, 
+                           const UUID *uuid_ptr,
+                           FileSpec &local_file)
 {
     // Default to the local case
     local_file = platform_file;

Modified: lldb/branches/iohandler/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Target/StopInfo.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Target/StopInfo.cpp (original)
+++ lldb/branches/iohandler/source/Target/StopInfo.cpp Thu Jan 23 12:27:11 2014
@@ -419,8 +419,15 @@ protected:
                         // The breakpoint site may have many locations associated with it, not all of them valid for
                         // this thread.  Skip the ones that aren't:
                         if (!bp_loc_sp->ValidForThisThread(thread_sp.get()))
+                        {
+                            if (log)
+                            {
+                                StreamString s;
+                                bp_loc_sp->GetDescription(&s, eDescriptionLevelBrief);
+                                log->Printf ("Breakpoint %s hit on thread 0x%llx but it was not for this thread, continuing.", s.GetData(), thread_sp->GetID());
+                            }
                             continue;
-                                                          
+                        }
                         // First run the condition for the breakpoint.  If that says we should stop, then we'll run
                         // the callback for the breakpoint.  If the callback says we shouldn't stop that will win.                    
                         
@@ -450,6 +457,12 @@ protected:
                             }
                             else
                             {
+                                if (log)
+                                {
+                                    StreamString s;
+                                    bp_loc_sp->GetDescription(&s, eDescriptionLevelBrief);
+                                    log->Printf ("Condition evaluated for breakpoint %s on thread 0x%llx conditon_says_stop: %i.", s.GetData(), thread_sp->GetID(), condition_says_stop);
+                                }
                                 if (!condition_says_stop)
                                     continue;
                             }

Modified: lldb/branches/iohandler/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Target/Target.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Target/Target.cpp (original)
+++ lldb/branches/iohandler/source/Target/Target.cpp Thu Jan 23 12:27:11 2014
@@ -1068,7 +1068,7 @@ Target::SetExecutableModule (ModuleSP& e
                 FileSpec dependent_file_spec (dependent_files.GetFileSpecPointerAtIndex(i));
                 FileSpec platform_dependent_file_spec;
                 if (m_platform_sp)
-                    m_platform_sp->GetFile (dependent_file_spec, NULL, platform_dependent_file_spec);
+                    m_platform_sp->GetFileWithUUID (dependent_file_spec, NULL, platform_dependent_file_spec);
                 else
                     platform_dependent_file_spec = dependent_file_spec;
 

Modified: lldb/branches/iohandler/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Target/ThreadList.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Target/ThreadList.cpp (original)
+++ lldb/branches/iohandler/source/Target/ThreadList.cpp Thu Jan 23 12:27:11 2014
@@ -293,17 +293,31 @@ ThreadList::ShouldStop (Event *event_ptr
     {
         ThreadSP thread_sp(*pos);
         
-        did_anybody_stop_for_a_reason |= thread_sp->ThreadStoppedForAReason();
+        // We should never get a stop for which no thread had a stop reason, but sometimes we do see this -
+        // for instance when we first connect to a remote stub.  In that case we should stop, since we can't figure out
+        // the right thing to do and stopping gives the user control over what to do in this instance.
+        //
+        // Note, this causes a problem when you have a thread specific breakpoint, and a bunch of threads hit the breakpoint,
+        // but not the thread which we are waiting for.  All the threads that are not "supposed" to hit the breakpoint
+        // are marked as having no stop reason, which is right, they should not show a stop reason.  But that triggers this
+        // code and causes us to stop seemingly for no reason.
+        //
+        // Since the only way we ever saw this error was on first attach, I'm only going to trigger set did_anybody_stop_for_a_reason
+        // to true unless this is the first stop.
+        //
+        // If this becomes a problem, we'll have to have another StopReason like "StopInfoHidden" which will look invalid
+        // everywhere but at this check.
+    
+        if (thread_sp->GetProcess()->GetStopID() > 1)
+            did_anybody_stop_for_a_reason = true;
+        else
+            did_anybody_stop_for_a_reason |= thread_sp->ThreadStoppedForAReason();
         
         const bool thread_should_stop = thread_sp->ShouldStop(event_ptr);
         if (thread_should_stop)
             should_stop |= true;
     }
 
-    // We should never get a stop for which no thread had a stop reason, but sometimes we do see this -
-    // for instance when we first connect to a remote stub.  In that case we should stop, since we can't figure out
-    // the right thing to do and stopping gives the user control over what to do in this instance.
-    
     if (!should_stop && !did_anybody_stop_for_a_reason)
     {
         should_stop = true;

Modified: lldb/branches/iohandler/test/api/multithreaded/TestMultithreaded.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/test/api/multithreaded/TestMultithreaded.py?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/test/api/multithreaded/TestMultithreaded.py (original)
+++ lldb/branches/iohandler/test/api/multithreaded/TestMultithreaded.py Thu Jan 23 12:27:11 2014
@@ -19,7 +19,6 @@ class SBBreakpointCallbackCase(TestBase)
           self.addTearDownHook(lambda: os.remove(self.inferior))
 
     @unittest2.expectedFailure # llvm.org/pr16000: SBBreakpoint.SetCallback() does nothing
-    @expectedFailureFreeBSD("llvm.org/pr18191") # Cannot find -llldb on FreeBSD
     @skipIfi386
     @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11
     def test_breakpoint_callback(self):
@@ -27,7 +26,6 @@ class SBBreakpointCallbackCase(TestBase)
         self.build_and_test('driver.cpp test_breakpoint_callback.cpp',
                             'test_breakpoint_callback')
 
-    @expectedFailureFreeBSD("llvm.org/pr18191") # Cannot find -llldb on FreeBSD
     @skipIfi386
     @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11
     def test_sb_api_listener_event_description(self):
@@ -36,7 +34,6 @@ class SBBreakpointCallbackCase(TestBase)
                             'test_listener_event_description')
         pass
 
-    @expectedFailureFreeBSD("llvm.org/pr18191") # Cannot find -llldb on FreeBSD
     @skipIfi386
     @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11
     def test_sb_api_listener_event_process_state(self):
@@ -48,7 +45,6 @@ class SBBreakpointCallbackCase(TestBase)
         pass
 
 
-    @expectedFailureFreeBSD("llvm.org/pr18191") # Cannot find -llldb on FreeBSD
     @skipIfi386
     @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11
     @skipIfLinux # llvm.org/pr16016 assertion failure in ProcessPOSIX.cpp.

Modified: lldb/branches/iohandler/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/test/dotest.py?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/test/dotest.py (original)
+++ lldb/branches/iohandler/test/dotest.py Thu Jan 23 12:27:11 2014
@@ -1001,7 +1001,7 @@ def setupSysPath():
             lines = lldb_dash_p_result.splitlines()
             if len(lines) == 1 and os.path.isfile(os.path.join(lines[0], init_in_python_dir)):
                 lldbPath = lines[0]
-                if "linux" in sys.platform:
+                if "freebsd" in sys.platform or "linux" in sys.platform:
                     os.environ['LLDB_LIB_DIR'] = os.path.join(lldbPath, '..', '..')
         
         if not lldbPath: 

Modified: lldb/branches/iohandler/test/functionalities/alias/TestAliases.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/test/functionalities/alias/TestAliases.py?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/test/functionalities/alias/TestAliases.py (original)
+++ lldb/branches/iohandler/test/functionalities/alias/TestAliases.py Thu Jan 23 12:27:11 2014
@@ -156,8 +156,7 @@ class AliasTestCase(TestBase):
 
         self.expect ("exprf x 1234",
                      COMMAND_FAILED_AS_EXPECTED, error = True,
-                     substrs = [ "use of undeclared identifier 'f'",
-                                 "1 errors parsing expression" ])
+                     substrs = [ "1 errors parsing expression" ])
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/iohandler/test/functionalities/inferior-assert/TestInferiorAssert.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/test/functionalities/inferior-assert/TestInferiorAssert.py?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/test/functionalities/inferior-assert/TestInferiorAssert.py (original)
+++ lldb/branches/iohandler/test/functionalities/inferior-assert/TestInferiorAssert.py Thu Jan 23 12:27:11 2014
@@ -35,6 +35,7 @@ class AssertingInferiorTestCase(TestBase
         self.inferior_asserting_registers()
 
     @expectedFailurei386 # llvm.org/pr17384: lldb needs to be aware of linux-vdso.so to unwind stacks properly
+    @expectedFailureFreeBSD('llvm.org/pr18533') # PC in __assert frame is outside of function
     def test_inferior_asserting_disassemble(self):
         """Test that lldb reliably disassembles frames after asserting (command)."""
         self.buildDefault()

Modified: lldb/branches/iohandler/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/tools/Makefile?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/tools/Makefile (original)
+++ lldb/branches/iohandler/tools/Makefile Thu Jan 23 12:27:11 2014
@@ -1,18 +1,31 @@
 ##===- source/Makefile -------------------------------------*- Makefile -*-===##
-# 
+#
 #                     The LLVM Compiler Infrastructure
 #
 # This file is distributed under the University of Illinois Open Source
 # License. See LICENSE.TXT for details.
-# 
+#
 ##===----------------------------------------------------------------------===##
 
 LLDB_LEVEL := ..
 include $(LLDB_LEVEL)/../../Makefile.config
 
-# tfiala test commit: will include lldb-gdbserver for linux x86_64 soon.
+# enable lldb-gdbserver for supported platforms
+DIRS :=
+ifneq (,$(strip $(filter $(HOST_OS), Linux)))
+ifneq (,$(strip $(filter $(HOST_ARCH), x86_64)))
+DIRS += lldb-gdbserver
+else
+endif
+else
+endif
+
 ifneq ($(HOST_OS),MingW)
-DIRS := driver lldb-platform
+DIRS += driver lldb-platform
+endif
+
+ifeq ($(HOST_OS),Darwin)
+DIRS += debugserver
 endif
 
 include $(LLDB_LEVEL)/Makefile

Modified: lldb/branches/iohandler/tools/debugserver/scripts/dbgnub-config.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/tools/debugserver/scripts/dbgnub-config.pl?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/tools/debugserver/scripts/dbgnub-config.pl (original)
+++ lldb/branches/iohandler/tools/debugserver/scripts/dbgnub-config.pl Thu Jan 23 12:27:11 2014
@@ -33,7 +33,7 @@ my $key;
 my $val;
 while (($key, $val) = each %ENV) 
 {
-	$val =~ s/\n/\n\/\/	/;
+	$val =~ s/\n/\n\/\/	/g;
 	printf CONFIG "//	%s = %s\n", $key, $val;
 }
 print CONFIG "//" . "-" x 72 . "\n";

Modified: lldb/branches/iohandler/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/tools/debugserver/source/DNB.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/tools/debugserver/source/DNB.cpp (original)
+++ lldb/branches/iohandler/tools/debugserver/source/DNB.cpp Thu Jan 23 12:27:11 2014
@@ -2067,7 +2067,7 @@ DNBSetArchitecture (const char *arch)
     {
         if (strcasecmp (arch, "i386") == 0)
             return DNBArchProtocol::SetArchitecture (CPU_TYPE_I386);
-        else if (strcasecmp (arch, "x86_64") == 0)
+        else if ((strcasecmp (arch, "x86_64") == 0) || (strcasecmp (arch, "x86_64h") == 0))
             return DNBArchProtocol::SetArchitecture (CPU_TYPE_X86_64);
         else if (strstr (arch, "arm") == arch)
             return DNBArchProtocol::SetArchitecture (CPU_TYPE_ARM);

Modified: lldb/branches/iohandler/tools/lldb-gdbserver/lldb-gdbserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/tools/lldb-gdbserver/lldb-gdbserver.cpp?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/tools/lldb-gdbserver/lldb-gdbserver.cpp (original)
+++ lldb/branches/iohandler/tools/lldb-gdbserver/lldb-gdbserver.cpp Thu Jan 23 12:27:11 2014
@@ -28,6 +28,8 @@
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Host/OptionParser.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
 using namespace lldb;
@@ -44,6 +46,7 @@ static struct option g_long_options[] =
 {
     { "debug",              no_argument,        &g_debug,           1   },
     { "verbose",            no_argument,        &g_verbose,         1   },
+    { "lldb-command",       required_argument,  NULL,               'c' },
     { "log-file",           required_argument,  NULL,               'l' },
     { "log-flags",          required_argument,  NULL,               'f' },
     { NULL,                 0,                  NULL,               0   }
@@ -75,7 +78,8 @@ signal_handler(int signo)
 static void
 display_usage (const char *progname)
 {
-    fprintf(stderr, "Usage:\n  %s [--log-file log-file-path] [--log-flags flags] HOST:PORT [-- PROGRAM ARG1 ARG2 ...]\n", progname);
+    fprintf(stderr, "Usage:\n  %s [--log-file log-file-path] [--log-flags flags] [--lldb-command command]* HOST:PORT "
+            "[-- PROGRAM ARG1 ARG2 ...]\n", progname);
     exit(0);
 }
 
@@ -94,31 +98,31 @@ main (int argc, char *argv[])
     Error error;
     int ch;
     Debugger::Initialize(NULL);
+
+    lldb::DebuggerSP debugger_sp = Debugger::CreateInstance ();
+
+    debugger_sp->SetInputFileHandle(stdin, false);
+    debugger_sp->SetOutputFileHandle(stdout, false);
+    debugger_sp->SetErrorFileHandle(stderr, false);
+
     ProcessLaunchInfo launch_info;
     ProcessAttachInfo attach_info;
 
     bool show_usage = false;
     int option_error = 0;
-//    StreamSP stream_sp (new StreamFile(stdout, false));
-//    const char *log_channels[] = { "host", "process", NULL };
-//    EnableLog (stream_sp, 0, log_channels, NULL);
 #if __GLIBC__
     optind = 0;
 #else
     optreset = 1;
     optind = 1;
 #endif
-    
+
     std::string short_options(OptionParser::GetShortOptionString(g_long_options));
 
-    
+    std::vector<std::string> lldb_commands;
+
     while ((ch = getopt_long_only(argc, argv, short_options.c_str(), g_long_options, &long_option_index)) != -1)
     {
-//        DNBLogDebug("option: ch == %c (0x%2.2x) --%s%c%s\n",
-//                    ch, (uint8_t)ch,
-//                    g_long_options[long_option_index].name,
-//                    g_long_options[long_option_index].has_arg ? '=' : ' ',
-//                    optarg ? optarg : "");
         switch (ch)
         {
         case 0:   // Any optional that auto set themselves will return 0
@@ -150,7 +154,6 @@ main (int argc, char *argv[])
                     }
 
                 }
-                
             }
             break;
 
@@ -158,20 +161,25 @@ main (int argc, char *argv[])
             if (optarg && optarg[0])
                 log_args.AppendArgument(optarg);
             break;
-            
+
+        case 'c': // lldb commands
+            if (optarg && optarg[0])
+                lldb_commands.push_back(optarg);
+            break;
+
         case 'h':   /* fall-through is intentional */
         case '?':
             show_usage = true;
             break;
         }
     }
-    
+
     if (show_usage || option_error)
     {
         display_usage(progname);
         exit(option_error);
     }
-    
+
     if (log_stream_sp)
     {
         if (log_args.GetArgumentCount() == 0)
@@ -180,15 +188,28 @@ main (int argc, char *argv[])
     }
 
     // Skip any options we consumed with getopt_long_only
+    printf ("optind = %d\n", optind);
     argc -= optind;
     argv += optind;
-    
+
     if (argc == 0)
     {
         display_usage(progname);
         exit(255);
     }
-    
+
+    // Run any commands requested
+    for (const auto &lldb_command : lldb_commands)
+    {
+        printf("(lldb) %s\n", lldb_command.c_str ());
+
+        lldb_private::CommandReturnObject result;
+        debugger_sp->GetCommandInterpreter ().HandleCommand (lldb_command.c_str (), eLazyBoolNo, result);
+        const char *output = result.GetOutputData ();
+        if (output && output[0])
+            puts (output);
+    }
+
     const char *host_and_port = argv[0];
     argc -= 1;
     argv += 1;
@@ -199,9 +220,15 @@ main (int argc, char *argv[])
     {
         // Launch the program specified on the command line
         launch_info.SetArguments((const char **)argv, true);
-        launch_info.GetFlags().Set(eLaunchFlagDebug | eLaunchFlagStopAtEntry);
+
+        unsigned int launch_flags = eLaunchFlagStopAtEntry;
+#if !defined(__linux__)
+        // linux doesn't yet handle eLaunchFlagDebug
+        launch_flags |= eLaunchFlagDebug;
+#endif
+        launch_info.GetFlags ().Set (launch_flags);
         error = Host::LaunchProcess (launch_info);
-        
+
         if (error.Success())
         {
             printf ("Launched '%s' as process %" PRIu64 "...\n", argv[0], launch_info.GetProcessID());

Modified: lldb/branches/iohandler/www/lldb-gdb.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/www/lldb-gdb.html?rev=199912&r1=199911&r2=199912&view=diff
==============================================================================
--- lldb/branches/iohandler/www/lldb-gdb.html (original)
+++ lldb/branches/iohandler/www/lldb-gdb.html Thu Jan 23 12:27:11 2014
@@ -974,8 +974,8 @@
                             <b>(gdb)</b> dump memory /tmp/mem.bin 0x1000 0x2000
                         </td>
                         <td class="content">
-                            <b>(lldb)</b> memory read --outfile /tmp/mem.bin --binary  0x1000 0x1200<br>
-                            <b>(lldb)</b> me r -o /tmp/mem.bin -b 0x1000 0x1200<br>
+                            <b>(lldb)</b> memory read --outfile /tmp/mem.bin --binary  0x1000 0x2000<br>
+                            <b>(lldb)</b> me r -o /tmp/mem.bin -b 0x1000 0x2000<br>
                         </td>
                     </tr>
                     <tr><td class="header" colspan="2">Get information about a specific heap allocation (available on Mac OS X only).</td></tr>





More information about the llvm-branch-commits mailing list