summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2015-07-08 09:08:53 +0000
committerPavel Labath <labath@google.com>2015-07-08 09:08:53 +0000
commit235c8405ebd3b6cc4d200e12ddb1da25813d6396 (patch)
tree53953ca4f639da52b94854685a33eb3138cb0c82 /lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
parent752de5dff2f4acada054b6b534483d78baa91329 (diff)
downloadbcm5719-llvm-235c8405ebd3b6cc4d200e12ddb1da25813d6396.tar.gz
bcm5719-llvm-235c8405ebd3b6cc4d200e12ddb1da25813d6396.zip
Avoid going through Platform when creating a NativeProcessProtocol instance
Summary: This commit avoids the Platform instance when spawning or attaching to a process in lldb-server. Instead, I have the server call a (static) method of NativeProcessProtocol directly. The reason for this is that I believe that NativeProcessProtocol should be decoupled from the Platform (after all, it always knows which platform it is running on, unlike the rest of lldb). Additionally, the kind of platform actions a NativeProcessProtocol instance is likely to differ greatly from the platform actions of the lldb client, so I think the separation makes sense. After this, the only dependency NativeProcessLinux has on PlatformLinux is the ResolveExecutable method, which needs additional refactoring. Reviewers: ovyalov, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10996 llvm-svn: 241672
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp')
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 41d6b7674a0..ae25fb4b4f1 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -824,15 +824,22 @@ NativeProcessLinux::LaunchArgs::~LaunchArgs()
// -----------------------------------------------------------------------------
Error
-NativeProcessLinux::LaunchProcess (
- Module *exe_module,
+NativeProcessProtocol::Launch (
ProcessLaunchInfo &launch_info,
NativeProcessProtocol::NativeDelegate &native_delegate,
NativeProcessProtocolSP &native_process_sp)
{
Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
- Error error;
+ lldb::ModuleSP exe_module_sp;
+ PlatformSP platform_sp (Platform::GetHostPlatform ());
+ Error error = platform_sp->ResolveExecutable(
+ ModuleSpec(launch_info.GetExecutableFile(), launch_info.GetArchitecture()),
+ exe_module_sp,
+ nullptr);
+
+ if (! error.Success())
+ return error;
// Verify the working directory is valid if one was specified.
FileSpec working_dir{launch_info.GetWorkingDirectory()};
@@ -906,7 +913,7 @@ NativeProcessLinux::LaunchProcess (
}
std::static_pointer_cast<NativeProcessLinux> (native_process_sp)->LaunchInferior (
- exe_module,
+ exe_module_sp.get(),
launch_info.GetArguments ().GetConstArgumentVector (),
launch_info.GetEnvironmentEntries ().GetConstArgumentVector (),
stdin_file_spec,
@@ -930,7 +937,7 @@ NativeProcessLinux::LaunchProcess (
}
Error
-NativeProcessLinux::AttachToProcess (
+NativeProcessProtocol::Attach (
lldb::pid_t pid,
NativeProcessProtocol::NativeDelegate &native_delegate,
NativeProcessProtocolSP &native_process_sp)
OpenPOWER on IntegriCloud