[lldb-dev] Current status of my Linux porting

Eli Friedman eli.friedman at gmail.com
Wed Jun 9 22:34:13 PDT 2010


Attached is my current diff to the LLDB tree to allow a mostly
complete build on Linux (not including the Makefiles).  I'm going
through all the changes in my tree to let other people possibly
comment, and also to simply keep it organized for myself:

source/Expression/ClangExpression.cpp:
Hack around API change in trunk clang

source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:
Linux doesn't have a header for CPU_TYPE_*.  (Extend/switch to
llvm/Support/MachO.h or llvm/ADT/Triple.h?)

source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp:
Linux doesn't have a header for CPU_TYPE_*.  (Extend/switch to
llvm/Support/MachO.h or llvm/ADT/Triple.h?)

source/Interpreter/ScriptInterpreterPython.cpp:
My build doesn't define init_lldb anywhere; I have no idea where the
definition is supposed to be.

source/Symbol/Symtab.cpp:
qsort_r isn't quite portable (uses different argument order on Linux
and *BSD).  Needs ifdeffery or switch to std::sort.

source/Symbol/ClangASTContext.cpp:
Update for API change in trunk clang; add missing include; fix include path

source/Core/Error.cpp:
Linux doesn't have kern_return_t or mach_error_string.  Also, missing includes.

source/Core/DataExtractor.cpp:
Linux doesn't have _OSReadInt* or OSReadSwapInt*; replacements are stubs.

source/Core/ModuleList.cpp:
TODO port ./source/Host/macosx/Symbols.cpp to Linux

source/Core/Log.cpp:
Linux doesn't have mach_thread_self()

source/Core/ArchSpec.cpp:
Linux doesn't have a header for CPU_TYPE_*.  (Extend/switch to
llvm/Support/MachO.h or llvm/ADT/Triple.h?)

source/Core/FileSpec.cpp:
st_mtimespec is BSD-only, st_mtim is Linux only AFAIK; maybe switch to
llvm/System/Path.h?

source/Core/Args.cpp:
optreset is BSD-only; needs ifdeffery or switching away from getopt()

source/API/SBTarget.cpp:
Symptom of large change; I moved all the files from source/Commands to
source/Interpreter to fix a circular dependency.

source/Host/linux/TimeValue.cpp:
Mostly copied from source/Host/macosx; why not just use llvm/System/TimeValue.h?

source/Host/linux/Host.cpp:
Nasty hacked port to get rid of OSX-specific stuff.

(source/Host/linux/Mutex.cpp and source/Host/linux/Condition.cpp are
copied unmodified; it'd be nice to contribute the condition variable
to core LLVM and get rid of the LLDB versions)

source/lldb.cpp:
The include paths here are a complete mess; perhaps the init functions
should be declared in a common lldb/Plugins/PluginInit.h

tools/driver/Driver.cpp:
optreset is BSD-only; needs ifdeffery or switching away from getopt()

include/lldb/Core/Error.h:
kern_return_t is OSX-only.

include/lldb/lldb-types.h:
Remove non-portable includes (needs testing on a Mac).

-Eli
-------------- next part --------------
Index: source/Expression/ClangExpression.cpp
===================================================================
--- source/Expression/ClangExpression.cpp	(revision 105756)
+++ source/Expression/ClangExpression.cpp	(working copy)
@@ -593,7 +593,7 @@
             if (!Act)
                 break;
 
-            if (Act->BeginSourceFile(*m_clang_ap, InFile, IsAST)) {
+            if (Act->BeginSourceFile(*m_clang_ap, InFile, InputKind())) {
                 Act->Execute();
                 Act->EndSourceFile();
             }
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp	(revision 105756)
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp	(working copy)
@@ -31,11 +31,6 @@
 using namespace lldb_private;
 using namespace std;
 
-
-#include <mach-o/nlist.h>
-#include <mach-o/stab.h>
-
-
 void
 ObjectFileELF::Initialize()
 {
@@ -827,6 +822,8 @@
 static uint32_t
 ELFMachineToMachCPU(Elf32_Half machine)
 {
+    return 7;
+#if 0
     switch (machine)
     {
     case EM_SPARC:  return CPU_TYPE_SPARC;
@@ -840,6 +837,7 @@
     case EM_ARM:    return 12;  // commented out in mach/machine.h
     }
     return 0;
+#endif
 }
 
 bool
Index: source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
===================================================================
--- source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp	(revision 105756)
+++ source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp	(working copy)
@@ -312,8 +312,15 @@
         return 0;
 }
 
+#ifndef CPU_TYPE_X86
+#define CPU_TYPE_X86 (7u)
+#endif
+#ifndef CPU_TYPE_X86_64
+#define CPU_TYPE_X86_64 (7u|0x01000000)
+#endif
+
 static inline const char *
-TripleForCPU(cpu_type_t cpuType)
+TripleForCPU(unsigned cpuType)
 {
     switch (cpuType)
     {
@@ -327,7 +334,7 @@
 }
 
 static inline EDAssemblySyntax_t
-SyntaxForCPU(cpu_type_t cpuType)
+SyntaxForCPU(unsigned cpuType)
 {
     switch (cpuType)
     {
@@ -342,7 +349,7 @@
 Disassembler *
 DisassemblerLLVM::CreateInstance(const ArchSpec &arch)
 {
-    cpu_type_t cpuType = arch.GetCPUType();
+    unsigned cpuType = arch.GetCPUType();
 
     if (TripleForCPU(cpuType))
         return new DisassemblerLLVM(arch);
@@ -353,7 +360,7 @@
 DisassemblerLLVM::DisassemblerLLVM(const ArchSpec &arch) :
     Disassembler(arch)
 {
-    cpu_type_t cpuType = arch.GetCPUType();
+    unsigned cpuType = arch.GetCPUType();
 
     const char *triple = TripleForCPU(cpuType);
     assert(triple && "Unhandled CPU type!");
Index: source/Interpreter/ScriptInterpreterPython.cpp
===================================================================
--- source/Interpreter/ScriptInterpreterPython.cpp	(revision 105756)
+++ source/Interpreter/ScriptInterpreterPython.cpp	(working copy)
@@ -149,7 +149,7 @@
     // Find the module that owns this code and use that path we get to
     // set the PYTHONPATH appropriately.
 
-    FileSpec this_module (Host::GetModuleFileSpecForHostAddress ((void *)init_lldb));
+    FileSpec this_module;// (Host::GetModuleFileSpecForHostAddress ((void *)init_lldb));
     std::string python_path;
 
     if (this_module.GetDirectory())
@@ -181,7 +181,7 @@
 
     m_compiled_module = static_cast<void*>(compiled_module);
 
-    init_lldb ();
+    //init_lldb ();
 
     // Update the path python uses to search for modules to include the current directory.
 
Index: source/Symbol/Symtab.cpp
===================================================================
--- source/Symbol/Symtab.cpp	(revision 105756)
+++ source/Symbol/Symtab.cpp	(working copy)
@@ -259,7 +259,7 @@
         return;
 
     // Sort the indexes in place using qsort
-    ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), (void *)&m_symbols[0], Symtab::CompareSymbolValueByIndex);
+//    ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), (void *)&m_symbols[0], Symtab::CompareSymbolValueByIndex);
 
     // Remove any duplicates if requested
     if (remove_duplicates)
Index: source/Symbol/ClangASTContext.cpp
===================================================================
--- source/Symbol/ClangASTContext.cpp	(revision 105756)
+++ source/Symbol/ClangASTContext.cpp	(working copy)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "ClangASTContext.h"
+#include "lldb/Symbol/ClangASTContext.h"
 
 // C Includes
 // C++ Includes
@@ -30,6 +30,8 @@
 // Project includes
 #include "lldb/Core/dwarf.h"
 
+#include <stdio.h>
+
 using namespace lldb_private;
 using namespace llvm;
 using namespace clang;
@@ -39,7 +41,7 @@
 ParseLangArgs
 (
     LangOptions &Opts,
-    FrontendOptions::InputKind IK
+    InputKind IK
 )
 {
     // FIXME: Cleanup per-file based stuff.
@@ -47,12 +49,12 @@
     // Set some properties which depend soley on the input kind; it would be nice
     // to move these to the language standard, and have the driver resolve the
     // input kind + language standard.
-    if (IK == FrontendOptions::IK_Asm) {
+    if (IK == IK_Asm) {
         Opts.AsmPreprocessor = 1;
-    } else if (IK == FrontendOptions::IK_ObjC ||
-               IK == FrontendOptions::IK_ObjCXX ||
-               IK == FrontendOptions::IK_PreprocessedObjC ||
-               IK == FrontendOptions::IK_PreprocessedObjCXX) {
+    } else if (IK == IK_ObjC ||
+               IK == IK_ObjCXX ||
+               IK == IK_PreprocessedObjC ||
+               IK == IK_PreprocessedObjCXX) {
         Opts.ObjC1 = Opts.ObjC2 = 1;
     }
 
@@ -61,23 +63,23 @@
     if (LangStd == LangStandard::lang_unspecified) {
         // Based on the base language, pick one.
         switch (IK) {
-            case FrontendOptions::IK_None:
-            case FrontendOptions::IK_AST:
+            case IK_None:
+            case IK_AST:
                 assert(0 && "Invalid input kind!");
-            case FrontendOptions::IK_OpenCL:
+            case IK_OpenCL:
                 LangStd = LangStandard::lang_opencl;
                 break;
-            case FrontendOptions::IK_Asm:
-            case FrontendOptions::IK_C:
-            case FrontendOptions::IK_PreprocessedC:
-            case FrontendOptions::IK_ObjC:
-            case FrontendOptions::IK_PreprocessedObjC:
+            case IK_Asm:
+            case IK_C:
+            case IK_PreprocessedC:
+            case IK_ObjC:
+            case IK_PreprocessedObjC:
                 LangStd = LangStandard::lang_gnu99;
                 break;
-            case FrontendOptions::IK_CXX:
-            case FrontendOptions::IK_PreprocessedCXX:
-            case FrontendOptions::IK_ObjCXX:
-            case FrontendOptions::IK_PreprocessedObjCXX:
+            case IK_CXX:
+            case IK_PreprocessedCXX:
+            case IK_ObjCXX:
+            case IK_PreprocessedObjCXX:
                 LangStd = LangStandard::lang_gnucxx98;
                 break;
         }
@@ -331,8 +333,8 @@
     if (m_language_options_ap.get() == NULL)
     {
         m_language_options_ap.reset(new LangOptions());
-        ParseLangArgs(*m_language_options_ap, FrontendOptions::IK_ObjCXX);
-//        InitializeLangOptions(*m_language_options_ap, FrontendOptions::IK_ObjCXX);
+        ParseLangArgs(*m_language_options_ap, IK_ObjCXX);
+//        InitializeLangOptions(*m_language_options_ap, IK_ObjCXX);
     }
     return m_language_options_ap.get();
 }
Index: source/Core/Error.cpp
===================================================================
--- source/Core/Error.cpp	(revision 105756)
+++ source/Core/Error.cpp	(working copy)
@@ -15,6 +15,10 @@
 // Project includes
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
+#include <cstdarg>
+#include <cstdlib>
+#include <cstring>
+typedef int kern_return_t;
 
 #if defined (__arm__)
 #include <SpringBoardServices/SpringBoardServer.h>
@@ -81,7 +85,7 @@
         switch (m_type)
         {
         case eErrorTypeMachKernel:
-            s = ::mach_error_string (m_code);
+            //s = ::mach_error_string (m_code);
             break;
 
         case eErrorTypePOSIX:
Index: source/Core/DataExtractor.cpp
===================================================================
--- source/Core/DataExtractor.cpp	(revision 105756)
+++ source/Core/DataExtractor.cpp	(working copy)
@@ -8,7 +8,6 @@
 //===----------------------------------------------------------------------===//
 
 #include <assert.h>
-#include <libkern/OSByteOrder.h>
 #include <stddef.h>
 
 #include <bitset>
@@ -25,6 +24,13 @@
 using namespace lldb;
 using namespace lldb_private;
 
+static unsigned _OSReadInt16(const unsigned char*, unsigned) {return 0;}
+static unsigned _OSReadInt32(const unsigned char*, unsigned) {return 0;}
+static unsigned _OSReadInt64(const unsigned char*, unsigned) {return 0;}
+static unsigned OSReadSwapInt16(const unsigned char*, unsigned) {return 0;}
+static unsigned OSReadSwapInt32(const unsigned char*, unsigned) {return 0;}
+static unsigned OSReadSwapInt64(const unsigned char*, unsigned) {return 0;}
+
 #define NON_PRINTABLE_CHAR '.'
 //----------------------------------------------------------------------
 // Default constructor.
Index: source/Core/ModuleList.cpp
===================================================================
--- source/Core/ModuleList.cpp	(revision 105756)
+++ source/Core/ModuleList.cpp	(working copy)
@@ -524,7 +524,7 @@
 
     // Fixup the incoming path in case the path points to a valid file, yet
     // the arch or UUID (if one was passed in) don't match.
-    FileSpec file_spec = Symbols::LocateExecutableObjectFile (&in_file_spec, arch.IsValid() ? &arch : NULL, uuid_ptr);
+    FileSpec file_spec;// = Symbols::LocateExecutableObjectFile (&in_file_spec, arch.IsValid() ? &arch : NULL, uuid_ptr);
 
     // Don't look for the file if it appears to be the same one we already
     // checked for above...
Index: source/Core/Log.cpp
===================================================================
--- source/Core/Log.cpp	(revision 105756)
+++ source/Core/Log.cpp	(working copy)
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // C Includes
-#include <mach/mach.h>
+//#include <mach/mach.h>
 #include <pthread.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -205,15 +205,15 @@
         }
 
         // Add the process and thread if requested
-        if (log_options & LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD)
-            header.Printf ("[%4.4x/%4.4x]: ", getpid(), mach_thread_self());
+//        if (log_options & LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD)
+//            header.Printf ("[%4.4x/%4.4x]: ", getpid(), mach_thread_self());
 
         // Add the process and thread if requested
         if (log_options & LLDB_LOG_OPTION_PREPEND_THREAD_NAME)
         {
-            const char *thread_name_str = Host::GetThreadName (getpid(), mach_thread_self());
-            if (thread_name_str)
-                header.Printf ("%s ", thread_name_str);
+//            const char *thread_name_str = Host::GetThreadName (getpid(), mach_thread_self());
+//            if (thread_name_str)
+//                header.Printf ("%s ", thread_name_str);
         }
 
         header.PrintfVarArg (format, args);
Index: source/Core/ArchSpec.cpp
===================================================================
--- source/Core/ArchSpec.cpp	(revision 105756)
+++ source/Core/ArchSpec.cpp	(working copy)
@@ -9,14 +9,24 @@
 
 #include "lldb/Core/ArchSpec.h"
 
-#include <mach/mach.h>
-#include <mach-o/nlist.h>
-
 #include <string>
+#include <stdio.h>
 
 using namespace lldb;
 using namespace lldb_private;
 
+#define CPU_ARCH_ABI64 (0x01000000u)
+#define CPU_SUBTYPE_MASK 0xff000000
+#define CPU_TYPE_ANY (-1u)
+#define CPU_TYPE_I386 (7u)
+#define CPU_TYPE_X86_64 (7u|CPU_ARCH_ABI64)
+#define CPU_TYPE_POWERPC (18u)
+#define CPU_TYPE_POWERPC64 (18u|CPU_ARCH_ABI64)
+#define CPU_SUBTYPE_X86_64_ALL (3u)
+#define CPU_SUBTYPE_I386_ALL (3u)
+typedef unsigned cpu_type_t;
+
+
 #define ARCH_SPEC_SEPARATOR_CHAR    '-'
 
 #ifndef CPU_TYPE_ARM
@@ -67,6 +77,7 @@
 //----------------------------------------------------------------------
 static ArchDefinition g_arch_defs[] =
 {
+#if 0
     { CPU_TYPE_ANY,         CPU_TYPE_ANY                , "all"         },
     { CPU_TYPE_ARM,         CPU_TYPE_ANY                , "arm"         },
     { CPU_TYPE_ARM,         CPU_SUBTYPE_ARM_ALL         , "arm"         },
@@ -97,7 +108,7 @@
     { CPU_TYPE_I386,        CPU_TYPE_ANY                , "i386"        },
     { CPU_TYPE_X86_64,      CPU_SUBTYPE_X86_64_ALL      , "x86_64"      },
     { CPU_TYPE_X86_64,      CPU_TYPE_ANY                , "x86_64"      },
-
+#endif
     // TODO: when we get a platform that knows more about the host OS we should
     // let it call some accessor funcitons to set the default system arch for
     // the default, 32 and 64 bit cases instead of hard coding it in this
@@ -870,7 +881,7 @@
     eRegNumPPC_GCC_vscr     = 110,
     eRegNumPPC_GCC_spe_acc  = 111,
     eRegNumPPC_GCC_spefscr  = 112,
-    eRegNumPPC_GCC_sfp      = 113,
+    eRegNumPPC_GCC_sfp      = 113
 };
 
 static const char * g_arm_gcc_reg_names[] = {
@@ -1678,4 +1689,3 @@
 
     return lhs_cpu < rhs_cpu;
 }
-
Index: source/Core/FileSpec.cpp
===================================================================
--- source/Core/FileSpec.cpp	(revision 105756)
+++ source/Core/FileSpec.cpp	(working copy)
@@ -373,7 +373,7 @@
     TimeValue mod_time;
     struct stat file_stats;
     if (GetFileStats (this, &file_stats))
-        mod_time = file_stats.st_mtimespec;
+        mod_time = file_stats.st_mtim;
     return mod_time;
 }
 
Index: source/Core/Args.cpp
===================================================================
--- source/Core/Args.cpp	(revision 105756)
+++ source/Core/Args.cpp	(working copy)
@@ -477,7 +477,7 @@
             }
         }
     }
-    optreset = 1;
+    //optreset = 1;
     optind = 1;
     int val;
     while (1)
@@ -837,7 +837,7 @@
         }
     }
 
-    optreset = 1;
+    //optreset = 1;
     optind = 1;
     int val;
     while (1)
@@ -974,7 +974,7 @@
         }
     }
 
-    optreset = 1;
+//    optreset = 1;
     optind = 1;
     opterr = 0;
 
Index: source/API/SBTarget.cpp
===================================================================
--- source/API/SBTarget.cpp	(revision 105756)
+++ source/API/SBTarget.cpp	(working copy)
@@ -33,7 +33,7 @@
 #include "lldb/Target/TargetList.h"
 
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "../source/Commands/CommandObjectBreakpoint.h"
+#include "../source/Interpreter/CommandObjectBreakpoint.h"
 
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBProcess.h"
Index: source/Host/linux/TimeValue.cpp
===================================================================
--- source/Host/linux/TimeValue.cpp	(revision 0)
+++ source/Host/linux/TimeValue.cpp	(working copy)
@@ -7,7 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "TimeValue.h"
+#include "lldb/Host/TimeValue.h"
+#include <stddef.h>
 
 // C Includes
 // C++ Includes
Index: source/Host/linux/Host.cpp
===================================================================
--- source/Host/linux/Host.cpp	(revision 0)
+++ source/Host/linux/Host.cpp	(working copy)
@@ -9,24 +9,16 @@
 
 #include <dlfcn.h>
 #include <libgen.h>
-#include <mach/mach.h>
-#include <mach-o/dyld.h>
 #include <signal.h>
 #include <stddef.h>
 #include <sys/sysctl.h>
 #include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 
 #include <map>
 #include <string>
 
-#include <objc/objc-auto.h>
-
-#include <Foundation/Foundation.h>
-
-#include "CFCBundle.h"
-#include "CFCReleaser.h"
-#include "CFCString.h"
-
 #include "lldb/Host/Host.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/ConstString.h"
@@ -82,7 +74,7 @@
 lldb::pid_t
 Host::GetCurrentThreadID()
 {
-    return ::mach_thread_self();
+    return pthread_self();
 }
 
 
@@ -90,6 +82,7 @@
 Host::GetArchitecture ()
 {
     static ArchSpec g_host_arch;
+#if 0
     if (!g_host_arch.IsValid())
     {
         uint32_t cputype, cpusubtype;
@@ -114,6 +107,9 @@
             }
         }
     }
+#else
+    g_host_arch.SetArch(7u, 144u);
+#endif
     return g_host_arch;
 }
 
@@ -123,10 +119,14 @@
     static ConstString g_vendor;
     if (!g_vendor)
     {
+#if 0
         char ostype[64];
         size_t len = sizeof(ostype);
         if (::sysctlbyname("kern.ostype", &ostype, &len, NULL, 0) == 0)
             g_vendor.SetCString (ostype);
+#else
+        g_vendor.SetCString("gnu");
+#endif
     }
     return g_vendor;
 }
@@ -134,7 +134,7 @@
 const ConstString &
 Host::GetOSString()
 {
-    static ConstString g_os_string("apple");
+    static ConstString g_os_string("linux");
     return g_os_string;
 }
 
@@ -160,60 +160,16 @@
     return g_host_triple;
 }
 
-class MacOSXDarwinThread
-{
-public:
-    MacOSXDarwinThread(const char *thread_name) :
-        m_pool (nil)
-    {
-        // Register our thread with the collector if garbage collection is enabled.
-        if (objc_collectingEnabled())
-        {
-#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
-            // On Leopard and earlier there is no way objc_registerThreadWithCollector
-            // function, so we do it manually.
-            auto_zone_register_thread(auto_zone());
-#else
-            // On SnowLoepard and later we just call the thread registration function.
-            objc_registerThreadWithCollector();
-#endif
-        }
-        else
-        {
-            m_pool = [[NSAutoreleasePool alloc] init];
-        }
-
-
-        Host::SetThreadName (LLDB_INVALID_PROCESS_ID, LLDB_INVALID_THREAD_ID, thread_name);
-    }
-
-    ~MacOSXDarwinThread()
-    {
-        if (m_pool)
-            [m_pool release];
-    }
-
-    static void PThreadDestructor (void *v)
-    {
-        delete (MacOSXDarwinThread*)v;
-    }
-
-protected:
-    NSAutoreleasePool * m_pool;
-private:
-    DISALLOW_COPY_AND_ASSIGN (MacOSXDarwinThread);
-};
-
 static pthread_once_t g_thread_create_once = PTHREAD_ONCE_INIT;
 static pthread_key_t g_thread_create_key = 0;
 
 static void
 InitThreadCreated()
 {
-    ::pthread_key_create (&g_thread_create_key, MacOSXDarwinThread::PThreadDestructor);
+    ::pthread_key_create (&g_thread_create_key, 0);
 }
 
-typedef struct HostThreadCreateInfo
+struct HostThreadCreateInfo
 {
     std::string thread_name;
     thread_func_t thread_fptr;
@@ -305,7 +261,7 @@
     ::pthread_once (&g_thread_create_once, InitThreadCreated);
     if (g_thread_create_key)
     {
-        ::pthread_setspecific (g_thread_create_key, new MacOSXDarwinThread(thread_name));
+        //::pthread_setspecific (g_thread_create_key, new MacOSXDarwinThread(thread_name));
     }
 }
 
@@ -446,6 +402,7 @@
     static FileSpec g_program_filepsec;
     if (!g_program_filepsec)
     {
+#if 0
         std::string program_fullpath;
         program_fullpath.resize (PATH_MAX);
         // If DST is NULL, then return the number of bytes needed.
@@ -461,6 +418,7 @@
         }
         if (err == 0)
             g_program_filepsec.SetFile(program_fullpath.data());
+#endif
     }
     return g_program_filepsec;
 }
@@ -483,6 +441,7 @@
 bool
 Host::ResolveExecutableInBundle (FileSpec *file)
 {
+#if 0
     if (file->GetFileType () == FileSpec::eFileTypeDirectory)
     {
         char path[PATH_MAX];
@@ -500,10 +459,11 @@
             }
         }
     }
+#endif
     return false;
 }
 
-typedef struct MonitorInfo
+struct MonitorInfo
 {
     int handle;
     pthread_t thread;
@@ -554,7 +514,7 @@
         Mutex::Locker locker(&g_monitor_map_mutex);
         if (!g_monitor_thread)
         {
-            pid_t wait_pid = -1;
+            ::pid_t wait_pid = -1;
             g_monitor_thread = ThreadCreate ("<lldb.host.wait4>",
                                              MonitorChildProcessThreadFunction,
                                              &wait_pid,
@@ -640,7 +600,7 @@
     if (log)
         log->Printf ("%s (arg = %p) thread starting...", function, arg);
 
-    const pid_t wait_pid = -1;//*((pid_t*)arg);
+    const ::pid_t wait_pid = -1;//*((pid_t*)arg);
     int status = -1;
     const int options = 0;
     struct rusage *rusage = NULL;
@@ -722,7 +682,7 @@
             }
             else
             {
-                status_cstr = "(???)";
+                status_cstr = "(???"")";
             }
 
             if (log)
Index: source/lldb.cpp
===================================================================
--- source/lldb.cpp	(revision 105756)
+++ source/lldb.cpp	(working copy)
@@ -9,9 +9,12 @@
 
 #include "lldb/lldb-private.h"
 #include "lldb/lldb-private-log.h"
+#include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Host/Host.h"
+#include "lldb/Host/Mutex.h"
+#if 0
 #include "ABIMacOSX_i386.h"
 #include "ABISysV_x86_64.h"
 #include "DisassemblerLLVM.h"
@@ -26,7 +29,7 @@
 #include "SymbolFileDWARFDebugMap.h"
 #include "SymbolFileSymtab.h"
 #include "SymbolVendorMacOSX.h"
-
+#endif
 using namespace lldb_private;
 
 
@@ -47,6 +50,7 @@
         Log::Callbacks log_callbacks = { DisableLog, EnableLog, ListLogCategories };
 
         Log::RegisterLogChannel ("lldb", log_callbacks);
+#if 0
         ABIMacOSX_i386::Initialize();
         ABISysV_x86_64::Initialize();
         DisassemblerLLVM::Initialize();
@@ -61,6 +65,7 @@
         SymbolFileDWARFDebugMap::Initialize();
         SymbolFileSymtab::Initialize();
         SymbolVendorMacOSX::Initialize();
+#endif
     }
 }
 
@@ -74,6 +79,7 @@
 lldb_private::Terminate ()
 {
     Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
+#if 0
     DisassemblerLLVM::Terminate();
     DynamicLoaderMacOSXDYLD::Terminate();
     ObjectContainerUniversalMachO::Terminate();
@@ -86,6 +92,7 @@
     SymbolFileDWARFDebugMap::Terminate();
     SymbolFileSymtab::Terminate();
     SymbolVendorMacOSX::Terminate();
+#endif
 }
 
 const char *
@@ -94,7 +101,7 @@
     extern const double LLDBVersionNumber;
     static char g_version_string[32];
     if (g_version_string[0] == '\0')
-        ::snprintf (g_version_string, sizeof(g_version_string), "LLDB-%g", LLDBVersionNumber);
+        ::snprintf (g_version_string, sizeof(g_version_string), "LLDB-%g", 1337);
 
     return g_version_string;
 }
Index: tools/driver/Driver.cpp
===================================================================
--- tools/driver/Driver.cpp	(revision 105756)
+++ tools/driver/Driver.cpp	(working copy)
@@ -350,7 +350,7 @@
 
     // Prepare for & make calls to getopt_long.
 
-    optreset = 1;
+    //optreset = 1;
     optind = 1;
     int val;
     while (1)
Index: include/lldb/Core/Error.h
===================================================================
--- include/lldb/Core/Error.h	(revision 105756)
+++ include/lldb/Core/Error.h	(working copy)
@@ -11,7 +11,7 @@
 #define __DCError_h__
 #if defined(__cplusplus)
 
-#include <mach/mach.h>
+//#include <mach/mach.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <string>
@@ -90,7 +90,7 @@
     ///     A const reference to this object.
     //------------------------------------------------------------------
     const Error&
-    operator = (kern_return_t err);
+    operator = (int err);
 
     ~Error();
 
@@ -200,7 +200,7 @@
     ///     A mach error code.
     //------------------------------------------------------------------
     void
-    SetError (kern_return_t err);
+    SetError (int err);
 
     //------------------------------------------------------------------
     /// Set accesssor with an error value and type.
Index: include/lldb/lldb-types.h
===================================================================
--- include/lldb/lldb-types.h	(revision 105756)
+++ include/lldb/lldb-types.h	(working copy)
@@ -20,13 +20,10 @@
 //----------------------------------------------------------------------
 
 #include <assert.h>
-#include <mach/mach_types.h>
-#include <machine/endian.h>
 #include <pthread.h>
 #include <signal.h>
 #include <stdint.h>
 #include <stdbool.h>
-#include <sys/syslimits.h>
 #include <unistd.h>
 
 #ifndef NO_RTTI


More information about the lldb-dev mailing list