[Lldb-commits] [lldb] r166185 - in /lldb/branches/windows: source/ source/Host/common/ source/Plugins/ABI/ source/Plugins/ABI/MacOSX-arm/ source/Plugins/ABI/MacOSX-i386/ source/Plugins/LanguageRuntime/ source/Plugins/LanguageRuntime/ObjC/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Symbol/ tools/driver/

Carlo Kok ck at remobjects.com
Thu Oct 18 09:24:40 PDT 2012


Author: carlokok
Date: Thu Oct 18 11:24:40 2012
New Revision: 166185

URL: http://llvm.org/viewvc/llvm-project?rev=166185&view=rev
Log:
windows fixes in this commit:
Host.cpp: same fix as was done for pThread on Windows for the initialize once.
Cmake files for abi maosx-arm, abi macosx-i386 and the objcruntime.
some slight tweaks to replace the for in loops with regular for loops (so it compiles on vs2010)
symtab: the iterator trick used didn't work on the vc++ vector (which doesn't deletion of the iterated item)

Added:
    lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt
    lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt
Modified:
    lldb/branches/windows/source/Host/common/Host.cpp
    lldb/branches/windows/source/Plugins/ABI/CMakeLists.txt
    lldb/branches/windows/source/Plugins/LanguageRuntime/CMakeLists.txt
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
    lldb/branches/windows/source/Symbol/Symtab.cpp
    lldb/branches/windows/source/lldb.cpp
    lldb/branches/windows/tools/driver/CMakeLists.txt

Modified: lldb/branches/windows/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Host/common/Host.cpp?rev=166185&r1=166184&r2=166185&view=diff
==============================================================================
--- lldb/branches/windows/source/Host/common/Host.cpp (original)
+++ lldb/branches/windows/source/Host/common/Host.cpp Thu Oct 18 11:24:40 2012
@@ -667,6 +667,8 @@
 
 #ifndef _WIN32
 static pthread_once_t g_thread_map_once = PTHREAD_ONCE_INIT;
+#else
+static unsigned int g_thread_map_once = 0;
 #endif
 static ThreadSafeSTLMap<uint64_t, std::string> *g_thread_names_map_ptr;
 
@@ -687,6 +689,9 @@
     int success = ::pthread_once (&g_thread_map_once, InitThreadNamesMap);
     if (success != 0)
         return NULL;
+#else
+    if (InterlockedExchange(&g_thread_map_once, 1) == 0)
+        InitThreadNamesMap();
 #endif
     
     uint64_t pid_tid = ((uint64_t)pid << 32) | (uint64_t)tid;

Modified: lldb/branches/windows/source/Plugins/ABI/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/CMakeLists.txt?rev=166185&r1=166184&r2=166185&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/ABI/CMakeLists.txt Thu Oct 18 11:24:40 2012
@@ -1 +1,3 @@
 add_subdirectory(SysV-x86_64)
+add_subdirectory(MacOSX-i386)
+add_subdirectory(MacOSX-arm)

Added: lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt?rev=166185&view=auto
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt (added)
+++ lldb/branches/windows/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt Thu Oct 18 11:24:40 2012
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginABIMacOSX_arm
+  ABIMacOSX_arm.cpp
+  )

Added: lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt?rev=166185&view=auto
==============================================================================
--- lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt (added)
+++ lldb/branches/windows/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt Thu Oct 18 11:24:40 2012
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginABIMacOSX_i386
+  ABIMacOSX_i386.cpp
+  )

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/CMakeLists.txt?rev=166185&r1=166184&r2=166185&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/CMakeLists.txt Thu Oct 18 11:24:40 2012
@@ -1,2 +1,2 @@
 add_subdirectory(CPlusPlus)
-#add_subdirectory(ObjC)
+add_subdirectory(ObjC)

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=166185&r1=166184&r2=166185&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Thu Oct 18 11:24:40 2012
@@ -755,7 +755,8 @@
                    lldb::addr_t load_addr) :
         m_process_sp(process_sp),
         m_end_iterator(*this, -1ll),
-        m_load_addr(load_addr)
+        m_load_addr(load_addr),
+        m_classheader_size((sizeof(int32_t) * 2))
     {
         lldb::addr_t cursor = load_addr;
         
@@ -968,7 +969,7 @@
     lldb::ProcessSP                     m_process_sp;
     const_iterator                      m_end_iterator;
     lldb::addr_t                        m_load_addr;
-    const size_t                        m_classheader_size = (sizeof(int32_t) * 2);
+    const size_t                        m_classheader_size;
 };
 
 class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor
@@ -1745,8 +1746,10 @@
             {
                 RemoteNXMapTable gdb_objc_realized_classes(process_sp, gdb_objc_realized_classes_nxmaptable_ptr);
             
-                for (RemoteNXMapTable::element elt : gdb_objc_realized_classes)
+                //for (RemoteNXMapTable::element elt : gdb_objc_realized_classes)
+                for (RemoteNXMapTable::const_iterator it = gdb_objc_realized_classes.begin(); it != gdb_objc_realized_classes.end(); ++it)
                 {
+                    RemoteNXMapTable::element elt = *it;
                     ++num_map_table_isas;
                     
                     if (m_isa_to_descriptor_cache.count(elt.second))
@@ -1784,9 +1787,10 @@
                     if (objc_opt_ptr != LLDB_INVALID_ADDRESS)
                     {
                         RemoteObjCOpt objc_opt(process_sp, objc_opt_ptr);
-                        
-                        for (ObjCLanguageRuntime::ObjCISA objc_isa : objc_opt)
+                                                
+                        for (RemoteObjCOpt::const_iterator it = objc_opt.begin(); it != objc_opt.end(); ++it)
                         {
+                            ObjCLanguageRuntime::ObjCISA objc_isa = *it;
                             ++num_objc_opt_ro_isas;
                             if (m_isa_to_descriptor_cache.count(objc_isa))
                                 continue;

Modified: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp?rev=166185&r1=166184&r2=166185&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp (original)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp Thu Oct 18 11:24:40 2012
@@ -342,7 +342,7 @@
         
         while (*name_cursor != '\0')
         {
-            char *colon_loc = strchr(name_cursor, ':');
+            char *colon_loc = (char*)strchr(name_cursor, ':');
             if (!colon_loc)
             {
                 selector_components.push_back(&ast_ctx.Idents.get(llvm::StringRef(name_cursor)));

Added: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt?rev=166185&view=auto
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt (added)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt Thu Oct 18 11:24:40 2012
@@ -0,0 +1,10 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginAppleObjCRuntime
+  AppleObjCRuntime.cpp
+  AppleObjCRuntimeV1.cpp
+  AppleObjCRuntimeV2.cpp
+  AppleObjCTrampolineHandler.cpp
+  AppleObjCTypeVendor.cpp
+  AppleThreadPlanStepThroughObjCTrampoline.cpp
+  )

Added: lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt?rev=166185&view=auto
==============================================================================
--- lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt (added)
+++ lldb/branches/windows/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt Thu Oct 18 11:24:40 2012
@@ -0,0 +1 @@
+add_subdirectory(AppleObjCRuntime)

Modified: lldb/branches/windows/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Symtab.cpp?rev=166185&r1=166184&r2=166185&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Symtab.cpp (original)
+++ lldb/branches/windows/source/Symbol/Symtab.cpp Thu Oct 18 11:24:40 2012
@@ -562,14 +562,11 @@
 
     if (AppendSymbolIndexesWithName(symbol_name, indexes) > 0)
     {
-        std::vector<uint32_t>::iterator pos = indexes.begin();
-        while (pos != indexes.end())
+        for (int i = indexes.size()-1; i>= 0; i -- )
         {
-            if (symbol_type == eSymbolTypeAny || m_symbols[*pos].GetType() == symbol_type)
-                ++pos;
-            else
-                indexes.erase(pos);
-        }
+            if (!(symbol_type == eSymbolTypeAny || m_symbols[indexes[i]].GetType() == symbol_type))
+                indexes.erase(indexes.begin() + i);
+        }       
     }
     return indexes.size();
 }
@@ -581,14 +578,11 @@
 
     if (AppendSymbolIndexesWithName(symbol_name, symbol_debug_type, symbol_visibility, indexes) > 0)
     {
-        std::vector<uint32_t>::iterator pos = indexes.begin();
-        while (pos != indexes.end())
+        for (int i = indexes.size() - 1; i>= 0; i -- )
         {
-            if (symbol_type == eSymbolTypeAny || m_symbols[*pos].GetType() == symbol_type)
-                ++pos;
-            else
-                indexes.erase(pos);
-        }
+            if (!(symbol_type == eSymbolTypeAny || m_symbols[indexes[i]].GetType() == symbol_type))
+                indexes.erase(indexes.begin() + i);
+        }       
     }
     return indexes.size();
 }

Modified: lldb/branches/windows/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/lldb.cpp?rev=166185&r1=166184&r2=166185&view=diff
==============================================================================
--- lldb/branches/windows/source/lldb.cpp (original)
+++ lldb/branches/windows/source/lldb.cpp Thu Oct 18 11:24:40 2012
@@ -45,13 +45,13 @@
 #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
 
 #include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
-#if defined (__APPLE__)
-#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
-#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
-#include "Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h"
 #include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
 #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
 #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
+#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
+#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
+#if defined (__APPLE__)
+#include "Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h"
 #include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
 #endif
@@ -103,10 +103,10 @@
         PlatformWindows::Initialize();
 #endif
 
-#ifndef _WIN32
         ABIMacOSX_i386::Initialize();
         ABIMacOSX_arm::Initialize();
         ABISysV_x86_64::Initialize();
+#ifndef _WIN32
         DisassemblerLLVMC::Initialize();
         DisassemblerLLVM::Initialize();
         ObjectContainerBSDArchive::Initialize();
@@ -127,14 +127,14 @@
         ObjectContainerUniversalMachO::Initialize();
         ObjectFileMachO::Initialize();
         DynamicLoaderDarwinKernel::Initialize();
+        ItaniumABILanguageRuntime::Initialize();
+        AppleObjCRuntimeV2::Initialize();
+        AppleObjCRuntimeV1::Initialize();
 #if defined (__APPLE__)
         //----------------------------------------------------------------------
         // Apple/Darwin hosted plugins
         //----------------------------------------------------------------------
         OperatingSystemDarwinKernel::Initialize();
-        ItaniumABILanguageRuntime::Initialize();
-        AppleObjCRuntimeV2::Initialize();
-        AppleObjCRuntimeV1::Initialize();
         ProcessGDBRemote::Initialize();
         ProcessKDP::Initialize();
         ProcessMachCore::Initialize();
@@ -188,10 +188,10 @@
     // Terminate and unload and loaded system or user LLDB plug-ins
     PluginManager::Terminate();
 
-#ifndef _WIN32
     ABIMacOSX_i386::Terminate();
     ABIMacOSX_arm::Terminate();
     ABISysV_x86_64::Terminate();
+#ifndef _WIN32
     DisassemblerLLVMC::Terminate();
     DisassemblerLLVM::Terminate();
     ObjectContainerBSDArchive::Terminate();
@@ -210,11 +210,11 @@
 
     DynamicLoaderMacOSXDYLD::Terminate();
     DynamicLoaderDarwinKernel::Terminate();
-#if defined (__APPLE__)
-    OperatingSystemDarwinKernel::Terminate();
     ItaniumABILanguageRuntime::Terminate();
     AppleObjCRuntimeV2::Terminate();
     AppleObjCRuntimeV1::Terminate();
+#if defined (__APPLE__)
+    OperatingSystemDarwinKernel::Terminate();
     ProcessMachCore::Terminate();
     ProcessGDBRemote::Terminate();
     ProcessKDP::Terminate();

Modified: lldb/branches/windows/tools/driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/driver/CMakeLists.txt?rev=166185&r1=166184&r2=166185&view=diff
==============================================================================
--- lldb/branches/windows/tools/driver/CMakeLists.txt (original)
+++ lldb/branches/windows/tools/driver/CMakeLists.txt Thu Oct 18 11:24:40 2012
@@ -35,6 +35,11 @@
   lldbPluginUnwindAssemblyInstEmulation
   lldbPluginUnwindAssemblyX86
   lldbPluginDynamicLoaderDarwinKernel
+  lldbPluginAppleObjCRuntime
+  lldbPluginCXXItaniumABI
+  lldbPluginABIMacOSX_arm
+  lldbPluginABIMacOSX_i386
+  lldbPluginABISysV_x86_64
 
   
   # Windows





More information about the lldb-commits mailing list