[Lldb-commits] [PATCH] D146668: [lldb-server] Use Platform plugin corresponding to the host

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 22 16:21:32 PDT 2023


bulbazord created this revision.
bulbazord added a reviewer: rupprecht.
Herald added a subscriber: krytarowski.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

In ee232506b870ce5282cc4da5ca493d41d361feb3 <https://reviews.llvm.org/rGee232506b870ce5282cc4da5ca493d41d361feb3> I moved UnixSignal
initialization from lldbTarget to the various platform plugins. This
inadvertently broke lldb-server because lldb-server doesn't use
Platform plugins. lldb-server still needs to be able to create a
UnixSignals object for the host platform so we can add the relevant
platform plugin to lldb-server to make sure we always have a
HostPlatform.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146668

Files:
  lldb/tools/lldb-server/CMakeLists.txt
  lldb/tools/lldb-server/SystemInitializerLLGS.cpp


Index: lldb/tools/lldb-server/SystemInitializerLLGS.cpp
===================================================================
--- lldb/tools/lldb-server/SystemInitializerLLGS.cpp
+++ lldb/tools/lldb-server/SystemInitializerLLGS.cpp
@@ -11,12 +11,29 @@
 #if defined(__APPLE__)
 #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
 using HostObjectFile = ObjectFileMachO;
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
+using HostPlatform = lldb_private::PlatformMacOSX;
 #elif defined(_WIN32)
 #include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
 using HostObjectFile = ObjectFilePECOFF;
+#include "Plugins/Platform/Windows/PlatformWindows.h"
+using HostPlatform = lldb_private::PlatformWindows;
 #else
 #include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
 using HostObjectFile = ObjectFileELF;
+#if defined(__ANDROID__)
+#include "Plugins/Platform/Android/PlatformAndroid.h"
+using HostPlatform = lldb_private::platform_android::PlatformAndroid;
+#elif defined(__FreeBSD__)
+#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
+using HostPlatform = lldb_private::platform_freebsd::PlatformFreeBSD;
+#elif defined(__linux__)
+#include "Plugins/Platform/Linux/PlatformLinux.h"
+using HostPlatform = lldb_private::platform_linux::PlatformLinux;
+#elif defined(__NetBSD__)
+#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
+using HostPlatform = lldb_private::platform_netbsd::PlatformNetBSD;
+#endif
 #endif
 
 #if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
@@ -58,6 +75,7 @@
     return e;
 
   HostObjectFile::Initialize();
+  HostPlatform::Initialize();
 
 #if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)
   EmulateInstructionARM::Initialize();
@@ -80,6 +98,7 @@
 
 void SystemInitializerLLGS::Terminate() {
   HostObjectFile::Terminate();
+  HostPlatform::Terminate();
 
 #if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)
   EmulateInstructionARM::Terminate();
Index: lldb/tools/lldb-server/CMakeLists.txt
===================================================================
--- lldb/tools/lldb-server/CMakeLists.txt
+++ lldb/tools/lldb-server/CMakeLists.txt
@@ -7,20 +7,29 @@
 
 if(CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
   list(APPEND LLDB_PLUGINS lldbPluginProcessLinux)
+  if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+    list(APPEND LLDB_PLUGINS lldbPluginPlatformLinux)
+  else()
+    list(APPEND LLDB_PLUGINS lldbPluginPlatformAndroid)
+  endif()
 endif()
 
 if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
   list(APPEND LLDB_PLUGINS lldbPluginProcessFreeBSD)
+  list(APPEND LLDB_PLUGINS lldbPluginPlatformFreeBSD)
 endif()
 
 if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
   list(APPEND LLDB_PLUGINS lldbPluginProcessNetBSD)
+  list(APPEND LLDB_PLUGINS lldbPluginPlatformNetBSD)
 endif()
 
 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
   list(APPEND LLDB_PLUGINS lldbPluginObjectFileMachO)
+  list(APPEND LLDB_PLUGINS lldbPluginPlatformMacOSX)
 elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
   list(APPEND LLDB_PLUGINS lldbPluginObjectFilePECOFF)
+  list(APPEND LLDB_PLUGINS lldbPluginPlatformWindows)
 else()
   list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146668.507542.patch
Type: text/x-patch
Size: 3112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230322/1d8a4565/attachment.bin>


More information about the lldb-commits mailing list