[lldb/Plugin] Fix some issues on Windows
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 18 Feb 2020 01:20:47 +0000 (17:20 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 18 Feb 2020 01:22:18 +0000 (17:22 -0800)
 - Don't initialize NativePDB.
 - Initialize ProcessWindows after any Process*Core plugins.
 - Don't initialize DynamicLoaderDarwinKernel on non-Darwin platforms.

lldb/source/Plugins/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/CMakeLists.txt
lldb/source/Plugins/Plugins.def.in
lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

index 2ab2920..7e6276e 100644 (file)
@@ -27,16 +27,20 @@ get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
 
 set(LLDB_ENUM_PLUGINS "")
 
-# FIXME: This is a hack to make the DynamicLoaderWasmDYLD happy.
-set(LLDB_DYNAMIC_LOADER_STATIC "")
+# Some plugins depend on other plugins being loaded before. This hacks around
+# that issue by loading them last. Note that there's no order guarantee within
+# this category.
+set(LLDB_ENUM_PLUGINS_LOADED_LAST "")
 
 foreach(p ${LLDB_ALL_PLUGINS})
   # Strip lldbPlugin form the plugin name.
   string(SUBSTRING ${p} 10 -1 pStripped)
   if(${pStripped} MATCHES "^ScriptInterpreter*")
     set(LLDB_ENUM_PLUGINS "${LLDB_ENUM_PLUGINS}LLDB_SCRIPT_PLUGIN(${pStripped})\n")
+  elseif(${pStripped} MATCHES "^ProcessWindows*")
+    set(LLDB_ENUM_PLUGINS_LOADED_LAST "${LLDB_ENUM_PLUGINS_LOADED_LAST}LLDB_PLUGIN(${pStripped})\n")
   elseif(${pStripped} STREQUAL "DynamicLoaderStatic")
-    set(LLDB_DYNAMIC_LOADER_STATIC "${LLDB_DYNAMIC_LOADER_STATIC}LLDB_PLUGIN(${pStripped})\n")
+    set(LLDB_ENUM_PLUGINS_LOADED_LAST "${LLDB_ENUM_PLUGINS_LOADED_LAST}LLDB_PLUGIN(${pStripped})\n")
   else()
     set(LLDB_ENUM_PLUGINS "${LLDB_ENUM_PLUGINS}LLDB_PLUGIN(${pStripped})\n")
   endif()
index f357fea..bb0776d 100644 (file)
@@ -1,4 +1,6 @@
-add_subdirectory(Darwin-Kernel)
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  add_subdirectory(Darwin-Kernel)
+endif()
 add_subdirectory(MacOSX-DYLD)
 add_subdirectory(POSIX-DYLD)
 add_subdirectory(Static)
index 98977fc..63a68a1 100644 (file)
@@ -30,7 +30,7 @@
 #endif
 
 @LLDB_ENUM_PLUGINS@
-@LLDB_DYNAMIC_LOADER_STATIC@
+@LLDB_ENUM_PLUGINS_LOADED_LAST@
 
 #undef LLDB_PLUGIN
 #undef LLDB_SCRIPT_PLUGIN
index 4f19231..7dab937 100644 (file)
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginSymbolFileNativePDB PLUGIN
+add_lldb_library(lldbPluginSymbolFileNativePDB
   CodeViewRegisterMapping.cpp
   CompileUnitIndex.cpp
   DWARFLocationExpression.cpp
index e681909..73dec53 100644 (file)
@@ -66,8 +66,6 @@ using namespace npdb;
 using namespace llvm::codeview;
 using namespace llvm::pdb;
 
-LLDB_PLUGIN_DEFINE(SymbolFileNativePDB)
-
 char SymbolFileNativePDB::ID;
 
 static lldb::LanguageType TranslateLanguage(PDB_Lang lang) {