[Lldb-commits] [lldb] ebf9a99 - [lldb/Plugin] Reject WASM and Hexagon in DynamicLoaderStatic
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 18 13:29:40 PST 2020
Author: Jonas Devlieghere
Date: 2020-02-18T13:29:34-08:00
New Revision: ebf9a99bbdcd88f15f16480f4d9b8f39d280f105
URL: https://github.com/llvm/llvm-project/commit/ebf9a99bbdcd88f15f16480f4d9b8f39d280f105
DIFF: https://github.com/llvm/llvm-project/commit/ebf9a99bbdcd88f15f16480f4d9b8f39d280f105.diff
LOG: [lldb/Plugin] Reject WASM and Hexagon in DynamicLoaderStatic
The WASM and Hexagon plugin check the ArchType rather than the OSType,
so explicitly reject those in the DynamicLoaderStatic.
Differential revision: https://reviews.llvm.org/D74780
Added:
Modified:
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
lldb/tools/lldb-test/SystemInitializerTest.cpp
Removed:
################################################################################
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index 0613cd5a9e1f..dfada58700c3 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -162,9 +162,9 @@ llvm::Error SystemInitializerFull::Initialize() {
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 @@ void SystemInitializerFull::Terminate() {
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);
diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
index 13aad5f4ccb6..48762fe6e0c3 100644
--- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
@@ -29,8 +29,19 @@ DynamicLoader *DynamicLoaderStatic::CreateInstance(Process *process,
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) {
diff --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp b/lldb/tools/lldb-test/SystemInitializerTest.cpp
index 020533554602..eceee50b5a4f 100644
--- a/lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -144,9 +144,9 @@ llvm::Error SystemInitializerTest::Initialize() {
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 @@ void SystemInitializerTest::Terminate() {
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);
More information about the lldb-commits
mailing list