[Lldb-commits] [PATCH] D74780: [lldb/Plugin] Reject WASM and Hexagon in DynamicLoaderStatic

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 18 13:31:23 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGebf9a99bbdcd: [lldb/Plugin] Reject WASM and Hexagon in DynamicLoaderStatic (authored by JDevlieghere).

Changed prior to commit:
  https://reviews.llvm.org/D74780?vs=245212&id=245252#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74780/new/

https://reviews.llvm.org/D74780

Files:
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
  lldb/tools/lldb-test/SystemInitializerTest.cpp


Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===================================================================
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -144,9 +144,9 @@
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderHexagonDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderPosixDYLD);
-  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWasmDYLD); // Before DynamicLoaderStatic.
-  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWindowsDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderStatic);
+  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWasmDYLD);
+  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWindowsDYLD);
 
   // Scan for any system or user LLDB plug-ins
   PluginManager::Initialize();
@@ -233,9 +233,9 @@
   LLDB_PLUGIN_TERMINATE(DynamicLoaderHexagonDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderPosixDYLD);
+  LLDB_PLUGIN_TERMINATE(DynamicLoaderStatic);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderWasmDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderWindowsDYLD);
-  LLDB_PLUGIN_TERMINATE(DynamicLoaderStatic);
 
   LLDB_PLUGIN_TERMINATE(PlatformFreeBSD);
   LLDB_PLUGIN_TERMINATE(PlatformLinux);
Index: lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
+++ lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
@@ -29,8 +29,19 @@
     const llvm::Triple &triple_ref =
         process->GetTarget().GetArchitecture().GetTriple();
     const llvm::Triple::OSType os_type = triple_ref.getOS();
-    if ((os_type == llvm::Triple::UnknownOS))
-      create = true;
+    const llvm::Triple::ArchType arch_type = triple_ref.getArch();
+    if (os_type == llvm::Triple::UnknownOS) {
+      // The WASM and Hexagon plugin check the ArchType rather than the OSType,
+      // so explicitly reject those here.
+      switch(arch_type) {
+        case llvm::Triple::hexagon:
+        case llvm::Triple::wasm32:
+        case llvm::Triple::wasm64:
+          break;
+        default:
+          create = true;
+      }
+    }
   }
 
   if (!create) {
Index: lldb/source/API/SystemInitializerFull.cpp
===================================================================
--- lldb/source/API/SystemInitializerFull.cpp
+++ lldb/source/API/SystemInitializerFull.cpp
@@ -162,9 +162,9 @@
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderHexagonDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderPosixDYLD);
-  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWasmDYLD); // Before DynamicLoaderStatic.
-  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWindowsDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderStatic);
+  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWasmDYLD);
+  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWindowsDYLD);
 
   // Scan for any system or user LLDB plug-ins
   PluginManager::Initialize();
@@ -251,9 +251,9 @@
   LLDB_PLUGIN_TERMINATE(DynamicLoaderHexagonDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderPosixDYLD);
+  LLDB_PLUGIN_TERMINATE(DynamicLoaderStatic);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderWasmDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderWindowsDYLD);
-  LLDB_PLUGIN_TERMINATE(DynamicLoaderStatic);
 
   LLDB_PLUGIN_TERMINATE(PlatformFreeBSD);
   LLDB_PLUGIN_TERMINATE(PlatformLinux);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74780.245252.patch
Type: text/x-patch
Size: 3432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200218/0fde53ae/attachment-0001.bin>


More information about the lldb-commits mailing list