[Lldb-commits] [lldb] r274125 - Remove platform plugins from lldb-server
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 29 06:58:28 PDT 2016
Author: labath
Date: Wed Jun 29 08:58:27 2016
New Revision: 274125
URL: http://llvm.org/viewvc/llvm-project?rev=274125&view=rev
Log:
Remove platform plugins from lldb-server
Summary:
This removes the last usage of Platform plugins in lldb-server -- it was used for launching child
processes, where it can be trivially replaced by Host::LaunchProces (as lldb-server is always
running on the host).
Removing platform plugins enables us to remove a lot of other unused code, which was pulled in as
a transitive dependency, and it reduces lldb-server size by 4%--9% (depending on build type and
architecture).
Reviewers: clayborg
Subscribers: tberghammer, danalbert, srhines, lldb-commits
Differential Revision: http://reviews.llvm.org/D20440
Modified:
lldb/trunk/source/API/SystemInitializerFull.cpp
lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=274125&r1=274124&r2=274125&view=diff
==============================================================================
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Wed Jun 29 08:58:27 2016
@@ -42,9 +42,9 @@
#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
-#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
+#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
#include "Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h"
@@ -62,8 +62,16 @@
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
-#include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
#include "Plugins/OperatingSystem/Go/OperatingSystemGo.h"
+#include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
+#include "Plugins/Platform/Android/PlatformAndroid.h"
+#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
+#include "Plugins/Platform/Kalimba/PlatformKalimba.h"
+#include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
+#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
+#include "Plugins/Platform/Windows/PlatformWindows.h"
#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
#include "Plugins/Process/elf-core/ProcessElfCore.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
@@ -78,14 +86,16 @@
#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
#if defined(__APPLE__)
-#include "Plugins/Process/mach-core/ProcessMachCore.h"
-#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
-#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
+#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
+#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
-#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
+#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
+#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
+#include "Plugins/Process/mach-core/ProcessMachCore.h"
+#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
#endif
#if defined(__FreeBSD__)
@@ -281,6 +291,19 @@ SystemInitializerFull::Initialize()
ScriptInterpreterPython::Initialize();
#endif
+ platform_freebsd::PlatformFreeBSD::Initialize();
+ platform_linux::PlatformLinux::Initialize();
+ platform_netbsd::PlatformNetBSD::Initialize();
+ PlatformWindows::Initialize();
+ PlatformKalimba::Initialize();
+ platform_android::PlatformAndroid::Initialize();
+ PlatformRemoteiOS::Initialize();
+ PlatformMacOSX::Initialize();
+#if defined(__APPLE__)
+ PlatformiOSSimulator::Initialize();
+ PlatformDarwinKernel::Initialize();
+#endif
+
// Initialize LLVM and Clang
llvm::InitializeAllTargets();
llvm::InitializeAllAsmPrinters();
@@ -492,6 +515,19 @@ SystemInitializerFull::Terminate()
#endif
OperatingSystemGo::Terminate();
+ platform_freebsd::PlatformFreeBSD::Terminate();
+ platform_linux::PlatformLinux::Terminate();
+ platform_netbsd::PlatformNetBSD::Terminate();
+ PlatformWindows::Terminate();
+ PlatformKalimba::Terminate();
+ platform_android::PlatformAndroid::Terminate();
+ PlatformMacOSX::Terminate();
+ PlatformRemoteiOS::Terminate();
+#if defined(__APPLE__)
+ PlatformiOSSimulator::Terminate();
+ PlatformDarwinKernel::Terminate();
+#endif
+
// Now shutdown the common parts, in reverse order.
SystemInitializerCommon::Terminate();
}
Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=274125&r1=274124&r2=274125&view=diff
==============================================================================
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original)
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Wed Jun 29 08:58:27 2016
@@ -20,20 +20,10 @@
#include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h"
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
-#include "Plugins/Platform/Android/PlatformAndroid.h"
-#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
-#include "Plugins/Platform/Kalimba/PlatformKalimba.h"
-#include "Plugins/Platform/Linux/PlatformLinux.h"
-#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
-#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
-#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
-#include "Plugins/Platform/Windows/PlatformWindows.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
#if defined(__APPLE__)
-#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
-#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
#endif
#if defined(__linux__)
@@ -99,12 +89,6 @@ SystemInitializerCommon::Initialize()
ObjectContainerBSDArchive::Initialize();
ObjectFileELF::Initialize();
ObjectFilePECOFF::Initialize();
- platform_freebsd::PlatformFreeBSD::Initialize();
- platform_linux::PlatformLinux::Initialize();
- platform_netbsd::PlatformNetBSD::Initialize();
- PlatformWindows::Initialize();
- PlatformKalimba::Initialize();
- platform_android::PlatformAndroid::Initialize();
EmulateInstructionARM::Initialize();
EmulateInstructionMIPS::Initialize();
@@ -115,12 +99,8 @@ SystemInitializerCommon::Initialize()
//----------------------------------------------------------------------
ObjectContainerUniversalMachO::Initialize();
- PlatformRemoteiOS::Initialize();
- PlatformMacOSX::Initialize();
#if defined(__APPLE__)
- PlatformiOSSimulator::Initialize();
- PlatformDarwinKernel::Initialize();
ObjectFileMachO::Initialize();
#endif
#if defined(__linux__)
@@ -139,24 +119,14 @@ SystemInitializerCommon::Terminate()
ObjectContainerBSDArchive::Terminate();
ObjectFileELF::Terminate();
ObjectFilePECOFF::Terminate();
- platform_freebsd::PlatformFreeBSD::Terminate();
- platform_linux::PlatformLinux::Terminate();
- platform_netbsd::PlatformNetBSD::Terminate();
- PlatformWindows::Terminate();
- PlatformKalimba::Terminate();
- platform_android::PlatformAndroid::Terminate();
- ObjectContainerUniversalMachO::Terminate();
- PlatformMacOSX::Terminate();
- PlatformRemoteiOS::Terminate();
EmulateInstructionARM::Terminate();
EmulateInstructionMIPS::Terminate();
EmulateInstructionMIPS64::Terminate();
+ ObjectContainerUniversalMachO::Terminate();
#if defined(__APPLE__)
- PlatformiOSSimulator::Terminate();
ObjectFileMachO::Terminate();
- PlatformDarwinKernel::Terminate();
#endif
#if defined(_MSC_VER)
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=274125&r1=274124&r2=274125&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Wed Jun 29 08:58:27 2016
@@ -39,7 +39,6 @@
#include "lldb/Host/TimeValue.h"
#include "lldb/Target/FileAction.h"
#include "lldb/Target/MemoryRegionInfo.h"
-#include "lldb/Target/Platform.h"
#include "lldb/Host/common/NativeRegisterContext.h"
#include "lldb/Host/common/NativeProcessProtocol.h"
#include "lldb/Host/common/NativeThreadProtocol.h"
@@ -76,10 +75,8 @@ namespace
//----------------------------------------------------------------------
// GDBRemoteCommunicationServerLLGS constructor
//----------------------------------------------------------------------
-GDBRemoteCommunicationServerLLGS::GDBRemoteCommunicationServerLLGS(const lldb::PlatformSP &platform_sp,
- MainLoop &mainloop)
+GDBRemoteCommunicationServerLLGS::GDBRemoteCommunicationServerLLGS(MainLoop &mainloop)
: GDBRemoteCommunicationServerCommon("gdb-remote.server", "gdb-remote.server.rx_packet"),
- m_platform_sp(platform_sp),
m_mainloop(mainloop),
m_current_tid(LLDB_INVALID_THREAD_ID),
m_continue_tid(LLDB_INVALID_THREAD_ID),
@@ -93,7 +90,6 @@ GDBRemoteCommunicationServerLLGS::GDBRem
m_next_saved_registers_id(1),
m_handshake_completed(false)
{
- assert(platform_sp);
RegisterPacketHandlers();
}
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h?rev=274125&r1=274124&r2=274125&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h Wed Jun 29 08:58:27 2016
@@ -40,7 +40,7 @@ public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- GDBRemoteCommunicationServerLLGS(const lldb::PlatformSP& platform_sp, MainLoop &mainloop);
+ GDBRemoteCommunicationServerLLGS(MainLoop &mainloop);
//------------------------------------------------------------------
/// Specify the program to launch and its arguments.
@@ -114,7 +114,6 @@ public:
InitializeConnection (std::unique_ptr<Connection> &&connection);
protected:
- lldb::PlatformSP m_platform_sp;
MainLoop &m_mainloop;
MainLoop::ReadHandleUP m_network_handle_up;
lldb::tid_t m_current_tid;
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp?rev=274125&r1=274124&r2=274125&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp Wed Jun 29 08:58:27 2016
@@ -53,7 +53,6 @@ GDBRemoteCommunicationServerPlatform::GD
m_socket_protocol(socket_protocol),
m_socket_scheme(socket_scheme),
m_spawned_pids_mutex(),
- m_platform_sp(Platform::GetHostPlatform()),
m_port_map(),
m_port_offset(0)
{
@@ -463,7 +462,7 @@ GDBRemoteCommunicationServerPlatform::La
std::bind(&GDBRemoteCommunicationServerPlatform::DebugserverProcessReaped, this, std::placeholders::_1),
false);
- Error error = m_platform_sp->LaunchProcess (m_process_launch_info);
+ Error error = Host::LaunchProcess(m_process_launch_info);
if (!error.Success ())
{
fprintf (stderr, "%s: failed to launch executable %s", __FUNCTION__, m_process_launch_info.GetArguments ().GetArgumentAtIndex (0));
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h?rev=274125&r1=274124&r2=274125&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h Wed Jun 29 08:58:27 2016
@@ -85,7 +85,6 @@ protected:
const std::string m_socket_scheme;
std::recursive_mutex m_spawned_pids_mutex;
std::set<lldb::pid_t> m_spawned_pids;
- lldb::PlatformSP m_platform_sp;
PortMap m_port_map;
uint16_t m_port_offset;
Modified: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp?rev=274125&r1=274124&r2=274125&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Wed Jun 29 08:58:27 2016
@@ -32,7 +32,6 @@
#include "lldb/Host/Pipe.h"
#include "lldb/Host/Socket.h"
#include "lldb/Host/StringConvert.h"
-#include "lldb/Target/Platform.h"
#include "Acceptor.h"
#include "LLDBServerUtilities.h"
#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h"
@@ -62,7 +61,6 @@ static int g_verbose = 0;
static struct option g_long_options[] =
{
{ "debug", no_argument, &g_debug, 1 },
- { "platform", required_argument, NULL, 'p' },
{ "verbose", no_argument, &g_verbose, 1 },
{ "log-file", required_argument, NULL, 'l' },
{ "log-channels", required_argument, NULL, 'c' },
@@ -121,7 +119,6 @@ display_usage (const char *progname, con
fprintf(stderr, "Usage:\n %s %s "
"[--log-file log-file-name] "
"[--log-channels log-channel-list] "
- "[--platform platform_name] "
"[--setsid] "
"[--named-pipe named-pipe-path] "
"[--native-regs] "
@@ -131,66 +128,6 @@ display_usage (const char *progname, con
exit(0);
}
-static void
-dump_available_platforms (FILE *output_file)
-{
- fprintf (output_file, "Available platform plugins:\n");
- for (int i = 0; ; ++i)
- {
- const char *plugin_name = PluginManager::GetPlatformPluginNameAtIndex (i);
- const char *plugin_desc = PluginManager::GetPlatformPluginDescriptionAtIndex (i);
-
- if (!plugin_name || !plugin_desc)
- break;
-
- fprintf (output_file, "%s\t%s\n", plugin_name, plugin_desc);
- }
-
- if ( Platform::GetHostPlatform () )
- {
- // add this since the default platform doesn't necessarily get registered by
- // the plugin name (e.g. 'host' doesn't show up as a
- // registered platform plugin even though it's the default).
- fprintf (output_file, "%s\tDefault platform for this host.\n", Platform::GetHostPlatform ()->GetPluginName ().AsCString ());
- }
-}
-
-static lldb::PlatformSP
-setup_platform (const std::string &platform_name)
-{
- lldb::PlatformSP platform_sp;
-
- if (platform_name.empty())
- {
- printf ("using the default platform: ");
- platform_sp = Platform::GetHostPlatform ();
- printf ("%s\n", platform_sp->GetPluginName ().AsCString ());
- return platform_sp;
- }
-
- Error error;
- platform_sp = Platform::Create (lldb_private::ConstString(platform_name), error);
- if (error.Fail ())
- {
- // the host platform isn't registered with that name (at
- // least, not always. Check if the given name matches
- // the default platform name. If so, use it.
- if ( Platform::GetHostPlatform () && ( Platform::GetHostPlatform ()->GetPluginName () == ConstString (platform_name.c_str()) ) )
- {
- platform_sp = Platform::GetHostPlatform ();
- }
- else
- {
- fprintf (stderr, "error: failed to create platform with name '%s'\n", platform_name.c_str());
- dump_available_platforms (stderr);
- exit (1);
- }
- }
- printf ("using platform: %s\n", platform_name.c_str ());
-
- return platform_sp;
-}
-
void
handle_attach_to_pid (GDBRemoteCommunicationServerLLGS &gdb_server, lldb::pid_t pid)
{
@@ -421,7 +358,6 @@ main_gdbserver (int argc, char *argv[])
argv++;
int long_option_index = 0;
int ch;
- std::string platform_name;
std::string attach_target;
std::string named_pipe_path;
std::string log_file;
@@ -460,11 +396,6 @@ main_gdbserver (int argc, char *argv[])
log_channels = StringRef(optarg);
break;
- case 'p': // platform name
- if (optarg && optarg[0])
- platform_name = optarg;
- break;
-
case 'N': // named pipe
if (optarg && optarg[0])
named_pipe_path = optarg;
@@ -548,10 +479,7 @@ main_gdbserver (int argc, char *argv[])
exit(255);
}
- // Setup the platform that GDBRemoteCommunicationServerLLGS will use.
- lldb::PlatformSP platform_sp = setup_platform (platform_name);
-
- GDBRemoteCommunicationServerLLGS gdb_server (platform_sp, mainloop);
+ GDBRemoteCommunicationServerLLGS gdb_server(mainloop);
const char *const host_and_port = argv[0];
argc -= 1;
More information about the lldb-commits
mailing list