summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Target.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Target/Target.cpp')
-rw-r--r--lldb/source/Target/Target.cpp88
1 files changed, 75 insertions, 13 deletions
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 178e276d56c..fd9626a5de8 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2190,12 +2190,78 @@ Target::RunStopHooks ()
result.GetImmediateErrorStream()->Flush();
}
+const TargetPropertiesSP &
+Target::GetGlobalProperties()
+{
+ static TargetPropertiesSP g_settings_sp;
+ if (!g_settings_sp)
+ {
+ g_settings_sp.reset (new TargetProperties (NULL));
+ }
+ return g_settings_sp;
+}
+
+Error
+Target::Install (ProcessLaunchInfo *launch_info)
+{
+ Error error;
+ PlatformSP platform_sp (GetPlatform());
+ if (platform_sp)
+ {
+ if (platform_sp->IsRemote())
+ {
+ if (platform_sp->IsConnected())
+ {
+ // Install all files that have an install path, and always install the
+ // main executable when connected to a remote platform
+ const ModuleList& modules = GetImages();
+ const size_t num_images = modules.GetSize();
+ for (size_t idx = 0; idx < num_images; ++idx)
+ {
+ const bool is_main_executable = idx == 0;
+ ModuleSP module_sp(modules.GetModuleAtIndex(idx));
+ if (module_sp)
+ {
+ FileSpec local_file (module_sp->GetFileSpec());
+ if (local_file)
+ {
+ FileSpec remote_file (module_sp->GetRemoteInstallFileSpec());
+ if (!remote_file)
+ {
+ if (is_main_executable) // TODO: add setting for always installing main executable???
+ {
+ // Always install the main executable
+ remote_file.GetDirectory() = platform_sp->GetWorkingDirectory();
+ remote_file.GetFilename() = module_sp->GetFileSpec().GetFilename();
+ }
+ }
+ if (remote_file)
+ {
+ error = platform_sp->Install(local_file, remote_file);
+ if (error.Success())
+ {
+ module_sp->SetPlatformFileSpec(remote_file);
+ if (is_main_executable)
+ {
+ if (launch_info)
+ launch_info->SetExecutableFile(remote_file, false);
+ }
+ }
+ else
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return error;
+}
//--------------------------------------------------------------
-// class Target::StopHook
+// Target::StopHook
//--------------------------------------------------------------
-
-
Target::StopHook::StopHook (lldb::TargetSP target_sp, lldb::user_id_t uid) :
UserID (uid),
m_target_sp (target_sp),
@@ -2527,6 +2593,9 @@ protected:
mutable bool m_got_host_env;
};
+//----------------------------------------------------------------------
+// TargetProperties
+//----------------------------------------------------------------------
TargetProperties::TargetProperties (Target *target) :
Properties ()
{
@@ -2815,17 +2884,10 @@ TargetProperties::GetMemoryModuleLoadLevel() const
}
-const TargetPropertiesSP &
-Target::GetGlobalProperties()
-{
- static TargetPropertiesSP g_settings_sp;
- if (!g_settings_sp)
- {
- g_settings_sp.reset (new TargetProperties (NULL));
- }
- return g_settings_sp;
-}
+//----------------------------------------------------------------------
+// Target::TargetEventData
+//----------------------------------------------------------------------
const ConstString &
Target::TargetEventData::GetFlavorString ()
{
OpenPOWER on IntegriCloud