annotate lldb/source/Target/RemoteAwarePlatform.cpp @ 227:21e6aa2e49ef

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 19 Jul 2021 06:57:16 +0900
parents 2e18cbf3894f
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===-- RemoteAwarePlatform.cpp -------------------------------------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 #include "lldb/Target/RemoteAwarePlatform.h"
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
10 #include "lldb/Core/Module.h"
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
11 #include "lldb/Core/ModuleList.h"
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
12 #include "lldb/Core/ModuleSpec.h"
150
anatofuz
parents:
diff changeset
13 #include "lldb/Host/FileCache.h"
anatofuz
parents:
diff changeset
14 #include "lldb/Host/FileSystem.h"
anatofuz
parents:
diff changeset
15 #include "lldb/Host/Host.h"
anatofuz
parents:
diff changeset
16 #include "lldb/Host/HostInfo.h"
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
17 #include "lldb/Utility/StreamString.h"
150
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 using namespace lldb_private;
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
20 using namespace lldb;
150
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 bool RemoteAwarePlatform::GetModuleSpec(const FileSpec &module_file_spec,
anatofuz
parents:
diff changeset
23 const ArchSpec &arch,
anatofuz
parents:
diff changeset
24 ModuleSpec &module_spec) {
anatofuz
parents:
diff changeset
25 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
26 return m_remote_platform_sp->GetModuleSpec(module_file_spec, arch,
anatofuz
parents:
diff changeset
27 module_spec);
anatofuz
parents:
diff changeset
28
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
29 return false;
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
30 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
31
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
32 Status RemoteAwarePlatform::ResolveExecutable(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
33 const ModuleSpec &module_spec, ModuleSP &exe_module_sp,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
34 const FileSpecList *module_search_paths_ptr) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
35 Status error;
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
36 // Nothing special to do here, just use the actual file and architecture
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
37
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
38 char exe_path[PATH_MAX];
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
39 ModuleSpec resolved_module_spec(module_spec);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
40
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
41 if (IsHost()) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
42 // If we have "ls" as the exe_file, resolve the executable location based
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
43 // on the current path variables
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
44 if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
45 resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path));
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
46 resolved_module_spec.GetFileSpec().SetFile(exe_path,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
47 FileSpec::Style::native);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
48 FileSystem::Instance().Resolve(resolved_module_spec.GetFileSpec());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
49 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
50
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
51 if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()))
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
52 FileSystem::Instance().ResolveExecutableLocation(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
53 resolved_module_spec.GetFileSpec());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
54
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
55 // Resolve any executable within a bundle on MacOSX
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
56 Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
57
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
58 if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()))
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
59 error.Clear();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
60 else {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
61 const uint32_t permissions = FileSystem::Instance().GetPermissions(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
62 resolved_module_spec.GetFileSpec());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
63 if (permissions && (permissions & eFilePermissionsEveryoneR) == 0)
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
64 error.SetErrorStringWithFormat(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
65 "executable '%s' is not readable",
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
66 resolved_module_spec.GetFileSpec().GetPath().c_str());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
67 else
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
68 error.SetErrorStringWithFormat(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
69 "unable to find executable for '%s'",
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
70 resolved_module_spec.GetFileSpec().GetPath().c_str());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
71 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
72 } else {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
73 if (m_remote_platform_sp) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
74 return GetCachedExecutable(resolved_module_spec, exe_module_sp,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
75 module_search_paths_ptr,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
76 *m_remote_platform_sp);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
77 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
78
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
79 // We may connect to a process and use the provided executable (Don't use
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
80 // local $PATH).
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
81
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
82 // Resolve any executable within a bundle on MacOSX
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
83 Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
84
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
85 if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()))
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
86 error.Clear();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
87 else
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
88 error.SetErrorStringWithFormat("the platform is not currently "
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
89 "connected, and '%s' doesn't exist in "
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
90 "the system root.",
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
91 exe_path);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
92 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
93
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
94 if (error.Success()) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
95 if (resolved_module_spec.GetArchitecture().IsValid()) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
96 error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
97 module_search_paths_ptr, nullptr, nullptr);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
98 if (error.Fail()) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
99 // If we failed, it may be because the vendor and os aren't known. If
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
100 // that is the case, try setting them to the host architecture and give
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
101 // it another try.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
102 llvm::Triple &module_triple =
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
103 resolved_module_spec.GetArchitecture().GetTriple();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
104 bool is_vendor_specified =
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
105 (module_triple.getVendor() != llvm::Triple::UnknownVendor);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
106 bool is_os_specified =
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
107 (module_triple.getOS() != llvm::Triple::UnknownOS);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
108 if (!is_vendor_specified || !is_os_specified) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
109 const llvm::Triple &host_triple =
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
110 HostInfo::GetArchitecture(HostInfo::eArchKindDefault).GetTriple();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
111
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
112 if (!is_vendor_specified)
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
113 module_triple.setVendorName(host_triple.getVendorName());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
114 if (!is_os_specified)
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
115 module_triple.setOSName(host_triple.getOSName());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
116
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
117 error = ModuleList::GetSharedModule(resolved_module_spec,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
118 exe_module_sp, module_search_paths_ptr, nullptr, nullptr);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
119 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
120 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
121
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
122 // TODO find out why exe_module_sp might be NULL
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
123 if (error.Fail() || !exe_module_sp || !exe_module_sp->GetObjectFile()) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
124 exe_module_sp.reset();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
125 error.SetErrorStringWithFormat(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
126 "'%s' doesn't contain the architecture %s",
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
127 resolved_module_spec.GetFileSpec().GetPath().c_str(),
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
128 resolved_module_spec.GetArchitecture().GetArchitectureName());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
129 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
130 } else {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
131 // No valid architecture was specified, ask the platform for the
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
132 // architectures that we should be using (in the correct order) and see
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
133 // if we can find a match that way
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
134 StreamString arch_names;
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
135 for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
136 idx, resolved_module_spec.GetArchitecture());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
137 ++idx) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
138 error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
139 module_search_paths_ptr, nullptr, nullptr);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
140 // Did we find an executable using one of the
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
141 if (error.Success()) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
142 if (exe_module_sp && exe_module_sp->GetObjectFile())
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
143 break;
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
144 else
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
145 error.SetErrorToGenericError();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
146 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
147
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
148 if (idx > 0)
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
149 arch_names.PutCString(", ");
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
150 arch_names.PutCString(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
151 resolved_module_spec.GetArchitecture().GetArchitectureName());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
152 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
153
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
154 if (error.Fail() || !exe_module_sp) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
155 if (FileSystem::Instance().Readable(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
156 resolved_module_spec.GetFileSpec())) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
157 error.SetErrorStringWithFormat(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
158 "'%s' doesn't contain any '%s' platform architectures: %s",
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
159 resolved_module_spec.GetFileSpec().GetPath().c_str(),
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
160 GetPluginName().GetCString(), arch_names.GetData());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
161 } else {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
162 error.SetErrorStringWithFormat(
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
163 "'%s' is not readable",
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
164 resolved_module_spec.GetFileSpec().GetPath().c_str());
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
165 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
166 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
167 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
168 }
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
169
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
170 return error;
150
anatofuz
parents:
diff changeset
171 }
anatofuz
parents:
diff changeset
172
anatofuz
parents:
diff changeset
173 Status RemoteAwarePlatform::RunShellCommand(
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
174 llvm::StringRef command, const FileSpec &working_dir, int *status_ptr,
150
anatofuz
parents:
diff changeset
175 int *signo_ptr, std::string *command_output,
anatofuz
parents:
diff changeset
176 const Timeout<std::micro> &timeout) {
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
177 return RunShellCommand(llvm::StringRef(), command, working_dir, status_ptr,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
178 signo_ptr, command_output, timeout);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
179 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
180
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
181 Status RemoteAwarePlatform::RunShellCommand(
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
182 llvm::StringRef shell, llvm::StringRef command, const FileSpec &working_dir,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
183 int *status_ptr, int *signo_ptr, std::string *command_output,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
184 const Timeout<std::micro> &timeout) {
150
anatofuz
parents:
diff changeset
185 if (IsHost())
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
186 return Host::RunShellCommand(shell, command, working_dir, status_ptr,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
187 signo_ptr, command_output, timeout);
150
anatofuz
parents:
diff changeset
188 if (m_remote_platform_sp)
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
189 return m_remote_platform_sp->RunShellCommand(shell, command, working_dir,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
190 status_ptr, signo_ptr,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
191 command_output, timeout);
150
anatofuz
parents:
diff changeset
192 return Status("unable to run a remote command without a platform");
anatofuz
parents:
diff changeset
193 }
anatofuz
parents:
diff changeset
194
anatofuz
parents:
diff changeset
195 Status RemoteAwarePlatform::MakeDirectory(const FileSpec &file_spec,
anatofuz
parents:
diff changeset
196 uint32_t file_permissions) {
anatofuz
parents:
diff changeset
197 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
198 return m_remote_platform_sp->MakeDirectory(file_spec, file_permissions);
anatofuz
parents:
diff changeset
199 return Platform::MakeDirectory(file_spec, file_permissions);
anatofuz
parents:
diff changeset
200 }
anatofuz
parents:
diff changeset
201
anatofuz
parents:
diff changeset
202 Status RemoteAwarePlatform::GetFilePermissions(const FileSpec &file_spec,
anatofuz
parents:
diff changeset
203 uint32_t &file_permissions) {
anatofuz
parents:
diff changeset
204 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
205 return m_remote_platform_sp->GetFilePermissions(file_spec,
anatofuz
parents:
diff changeset
206 file_permissions);
anatofuz
parents:
diff changeset
207 return Platform::GetFilePermissions(file_spec, file_permissions);
anatofuz
parents:
diff changeset
208 }
anatofuz
parents:
diff changeset
209
anatofuz
parents:
diff changeset
210 Status RemoteAwarePlatform::SetFilePermissions(const FileSpec &file_spec,
anatofuz
parents:
diff changeset
211 uint32_t file_permissions) {
anatofuz
parents:
diff changeset
212 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
213 return m_remote_platform_sp->SetFilePermissions(file_spec,
anatofuz
parents:
diff changeset
214 file_permissions);
anatofuz
parents:
diff changeset
215 return Platform::SetFilePermissions(file_spec, file_permissions);
anatofuz
parents:
diff changeset
216 }
anatofuz
parents:
diff changeset
217
anatofuz
parents:
diff changeset
218 lldb::user_id_t RemoteAwarePlatform::OpenFile(const FileSpec &file_spec,
anatofuz
parents:
diff changeset
219 File::OpenOptions flags,
anatofuz
parents:
diff changeset
220 uint32_t mode, Status &error) {
anatofuz
parents:
diff changeset
221 if (IsHost())
anatofuz
parents:
diff changeset
222 return FileCache::GetInstance().OpenFile(file_spec, flags, mode, error);
anatofuz
parents:
diff changeset
223 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
224 return m_remote_platform_sp->OpenFile(file_spec, flags, mode, error);
anatofuz
parents:
diff changeset
225 return Platform::OpenFile(file_spec, flags, mode, error);
anatofuz
parents:
diff changeset
226 }
anatofuz
parents:
diff changeset
227
anatofuz
parents:
diff changeset
228 bool RemoteAwarePlatform::CloseFile(lldb::user_id_t fd, Status &error) {
anatofuz
parents:
diff changeset
229 if (IsHost())
anatofuz
parents:
diff changeset
230 return FileCache::GetInstance().CloseFile(fd, error);
anatofuz
parents:
diff changeset
231 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
232 return m_remote_platform_sp->CloseFile(fd, error);
anatofuz
parents:
diff changeset
233 return Platform::CloseFile(fd, error);
anatofuz
parents:
diff changeset
234 }
anatofuz
parents:
diff changeset
235
anatofuz
parents:
diff changeset
236 uint64_t RemoteAwarePlatform::ReadFile(lldb::user_id_t fd, uint64_t offset,
anatofuz
parents:
diff changeset
237 void *dst, uint64_t dst_len,
anatofuz
parents:
diff changeset
238 Status &error) {
anatofuz
parents:
diff changeset
239 if (IsHost())
anatofuz
parents:
diff changeset
240 return FileCache::GetInstance().ReadFile(fd, offset, dst, dst_len, error);
anatofuz
parents:
diff changeset
241 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
242 return m_remote_platform_sp->ReadFile(fd, offset, dst, dst_len, error);
anatofuz
parents:
diff changeset
243 return Platform::ReadFile(fd, offset, dst, dst_len, error);
anatofuz
parents:
diff changeset
244 }
anatofuz
parents:
diff changeset
245
anatofuz
parents:
diff changeset
246 uint64_t RemoteAwarePlatform::WriteFile(lldb::user_id_t fd, uint64_t offset,
anatofuz
parents:
diff changeset
247 const void *src, uint64_t src_len,
anatofuz
parents:
diff changeset
248 Status &error) {
anatofuz
parents:
diff changeset
249 if (IsHost())
anatofuz
parents:
diff changeset
250 return FileCache::GetInstance().WriteFile(fd, offset, src, src_len, error);
anatofuz
parents:
diff changeset
251 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
252 return m_remote_platform_sp->WriteFile(fd, offset, src, src_len, error);
anatofuz
parents:
diff changeset
253 return Platform::WriteFile(fd, offset, src, src_len, error);
anatofuz
parents:
diff changeset
254 }
anatofuz
parents:
diff changeset
255
anatofuz
parents:
diff changeset
256 lldb::user_id_t RemoteAwarePlatform::GetFileSize(const FileSpec &file_spec) {
anatofuz
parents:
diff changeset
257 if (IsHost()) {
anatofuz
parents:
diff changeset
258 uint64_t Size;
anatofuz
parents:
diff changeset
259 if (llvm::sys::fs::file_size(file_spec.GetPath(), Size))
anatofuz
parents:
diff changeset
260 return 0;
anatofuz
parents:
diff changeset
261 return Size;
anatofuz
parents:
diff changeset
262 }
anatofuz
parents:
diff changeset
263 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
264 return m_remote_platform_sp->GetFileSize(file_spec);
anatofuz
parents:
diff changeset
265 return Platform::GetFileSize(file_spec);
anatofuz
parents:
diff changeset
266 }
anatofuz
parents:
diff changeset
267
anatofuz
parents:
diff changeset
268 Status RemoteAwarePlatform::CreateSymlink(const FileSpec &src,
anatofuz
parents:
diff changeset
269 const FileSpec &dst) {
anatofuz
parents:
diff changeset
270 if (IsHost())
anatofuz
parents:
diff changeset
271 return FileSystem::Instance().Symlink(src, dst);
anatofuz
parents:
diff changeset
272 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
273 return m_remote_platform_sp->CreateSymlink(src, dst);
anatofuz
parents:
diff changeset
274 return Platform::CreateSymlink(src, dst);
anatofuz
parents:
diff changeset
275 }
anatofuz
parents:
diff changeset
276
anatofuz
parents:
diff changeset
277 bool RemoteAwarePlatform::GetFileExists(const FileSpec &file_spec) {
anatofuz
parents:
diff changeset
278 if (IsHost())
anatofuz
parents:
diff changeset
279 return FileSystem::Instance().Exists(file_spec);
anatofuz
parents:
diff changeset
280 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
281 return m_remote_platform_sp->GetFileExists(file_spec);
anatofuz
parents:
diff changeset
282 return Platform::GetFileExists(file_spec);
anatofuz
parents:
diff changeset
283 }
anatofuz
parents:
diff changeset
284
anatofuz
parents:
diff changeset
285 Status RemoteAwarePlatform::Unlink(const FileSpec &file_spec) {
anatofuz
parents:
diff changeset
286 if (IsHost())
anatofuz
parents:
diff changeset
287 return llvm::sys::fs::remove(file_spec.GetPath());
anatofuz
parents:
diff changeset
288 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
289 return m_remote_platform_sp->Unlink(file_spec);
anatofuz
parents:
diff changeset
290 return Platform::Unlink(file_spec);
anatofuz
parents:
diff changeset
291 }
anatofuz
parents:
diff changeset
292
anatofuz
parents:
diff changeset
293 bool RemoteAwarePlatform::CalculateMD5(const FileSpec &file_spec, uint64_t &low,
anatofuz
parents:
diff changeset
294 uint64_t &high) {
anatofuz
parents:
diff changeset
295 if (IsHost())
anatofuz
parents:
diff changeset
296 return Platform::CalculateMD5(file_spec, low, high);
anatofuz
parents:
diff changeset
297 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
298 return m_remote_platform_sp->CalculateMD5(file_spec, low, high);
anatofuz
parents:
diff changeset
299 return false;
anatofuz
parents:
diff changeset
300 }
anatofuz
parents:
diff changeset
301
anatofuz
parents:
diff changeset
302 FileSpec RemoteAwarePlatform::GetRemoteWorkingDirectory() {
anatofuz
parents:
diff changeset
303 if (IsRemote() && m_remote_platform_sp)
anatofuz
parents:
diff changeset
304 return m_remote_platform_sp->GetRemoteWorkingDirectory();
anatofuz
parents:
diff changeset
305 return Platform::GetRemoteWorkingDirectory();
anatofuz
parents:
diff changeset
306 }
anatofuz
parents:
diff changeset
307
anatofuz
parents:
diff changeset
308 bool RemoteAwarePlatform::SetRemoteWorkingDirectory(
anatofuz
parents:
diff changeset
309 const FileSpec &working_dir) {
anatofuz
parents:
diff changeset
310 if (IsRemote() && m_remote_platform_sp)
anatofuz
parents:
diff changeset
311 return m_remote_platform_sp->SetRemoteWorkingDirectory(working_dir);
anatofuz
parents:
diff changeset
312 return Platform::SetRemoteWorkingDirectory(working_dir);
anatofuz
parents:
diff changeset
313 }
anatofuz
parents:
diff changeset
314
anatofuz
parents:
diff changeset
315 Status RemoteAwarePlatform::GetFileWithUUID(const FileSpec &platform_file,
anatofuz
parents:
diff changeset
316 const UUID *uuid_ptr,
anatofuz
parents:
diff changeset
317 FileSpec &local_file) {
anatofuz
parents:
diff changeset
318 if (IsRemote() && m_remote_platform_sp)
anatofuz
parents:
diff changeset
319 return m_remote_platform_sp->GetFileWithUUID(platform_file, uuid_ptr,
anatofuz
parents:
diff changeset
320 local_file);
anatofuz
parents:
diff changeset
321
anatofuz
parents:
diff changeset
322 // Default to the local case
anatofuz
parents:
diff changeset
323 local_file = platform_file;
anatofuz
parents:
diff changeset
324 return Status();
anatofuz
parents:
diff changeset
325 }
anatofuz
parents:
diff changeset
326
anatofuz
parents:
diff changeset
327 bool RemoteAwarePlatform::GetRemoteOSVersion() {
anatofuz
parents:
diff changeset
328 if (m_remote_platform_sp) {
anatofuz
parents:
diff changeset
329 m_os_version = m_remote_platform_sp->GetOSVersion();
anatofuz
parents:
diff changeset
330 return !m_os_version.empty();
anatofuz
parents:
diff changeset
331 }
anatofuz
parents:
diff changeset
332 return false;
anatofuz
parents:
diff changeset
333 }
anatofuz
parents:
diff changeset
334
anatofuz
parents:
diff changeset
335 bool RemoteAwarePlatform::GetRemoteOSBuildString(std::string &s) {
anatofuz
parents:
diff changeset
336 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
337 return m_remote_platform_sp->GetRemoteOSBuildString(s);
anatofuz
parents:
diff changeset
338 s.clear();
anatofuz
parents:
diff changeset
339 return false;
anatofuz
parents:
diff changeset
340 }
anatofuz
parents:
diff changeset
341
anatofuz
parents:
diff changeset
342 bool RemoteAwarePlatform::GetRemoteOSKernelDescription(std::string &s) {
anatofuz
parents:
diff changeset
343 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
344 return m_remote_platform_sp->GetRemoteOSKernelDescription(s);
anatofuz
parents:
diff changeset
345 s.clear();
anatofuz
parents:
diff changeset
346 return false;
anatofuz
parents:
diff changeset
347 }
anatofuz
parents:
diff changeset
348
anatofuz
parents:
diff changeset
349 ArchSpec RemoteAwarePlatform::GetRemoteSystemArchitecture() {
anatofuz
parents:
diff changeset
350 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
351 return m_remote_platform_sp->GetRemoteSystemArchitecture();
anatofuz
parents:
diff changeset
352 return ArchSpec();
anatofuz
parents:
diff changeset
353 }
anatofuz
parents:
diff changeset
354
anatofuz
parents:
diff changeset
355 const char *RemoteAwarePlatform::GetHostname() {
anatofuz
parents:
diff changeset
356 if (IsHost())
anatofuz
parents:
diff changeset
357 return Platform::GetHostname();
anatofuz
parents:
diff changeset
358 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
359 return m_remote_platform_sp->GetHostname();
anatofuz
parents:
diff changeset
360 return nullptr;
anatofuz
parents:
diff changeset
361 }
anatofuz
parents:
diff changeset
362
anatofuz
parents:
diff changeset
363 UserIDResolver &RemoteAwarePlatform::GetUserIDResolver() {
anatofuz
parents:
diff changeset
364 if (IsHost())
anatofuz
parents:
diff changeset
365 return HostInfo::GetUserIDResolver();
anatofuz
parents:
diff changeset
366 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
367 return m_remote_platform_sp->GetUserIDResolver();
anatofuz
parents:
diff changeset
368 return UserIDResolver::GetNoopResolver();
anatofuz
parents:
diff changeset
369 }
anatofuz
parents:
diff changeset
370
anatofuz
parents:
diff changeset
371 Environment RemoteAwarePlatform::GetEnvironment() {
anatofuz
parents:
diff changeset
372 if (IsRemote()) {
anatofuz
parents:
diff changeset
373 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
374 return m_remote_platform_sp->GetEnvironment();
anatofuz
parents:
diff changeset
375 return Environment();
anatofuz
parents:
diff changeset
376 }
anatofuz
parents:
diff changeset
377 return Host::GetEnvironment();
anatofuz
parents:
diff changeset
378 }
anatofuz
parents:
diff changeset
379
anatofuz
parents:
diff changeset
380 bool RemoteAwarePlatform::IsConnected() const {
anatofuz
parents:
diff changeset
381 if (IsHost())
anatofuz
parents:
diff changeset
382 return true;
anatofuz
parents:
diff changeset
383 else if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
384 return m_remote_platform_sp->IsConnected();
anatofuz
parents:
diff changeset
385 return false;
anatofuz
parents:
diff changeset
386 }
anatofuz
parents:
diff changeset
387
anatofuz
parents:
diff changeset
388 bool RemoteAwarePlatform::GetProcessInfo(lldb::pid_t pid,
anatofuz
parents:
diff changeset
389 ProcessInstanceInfo &process_info) {
anatofuz
parents:
diff changeset
390 if (IsHost())
anatofuz
parents:
diff changeset
391 return Platform::GetProcessInfo(pid, process_info);
anatofuz
parents:
diff changeset
392 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
393 return m_remote_platform_sp->GetProcessInfo(pid, process_info);
anatofuz
parents:
diff changeset
394 return false;
anatofuz
parents:
diff changeset
395 }
anatofuz
parents:
diff changeset
396
anatofuz
parents:
diff changeset
397 uint32_t
anatofuz
parents:
diff changeset
398 RemoteAwarePlatform::FindProcesses(const ProcessInstanceInfoMatch &match_info,
anatofuz
parents:
diff changeset
399 ProcessInstanceInfoList &process_infos) {
anatofuz
parents:
diff changeset
400 if (IsHost())
anatofuz
parents:
diff changeset
401 return Platform::FindProcesses(match_info, process_infos);
anatofuz
parents:
diff changeset
402 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
403 return m_remote_platform_sp->FindProcesses(match_info, process_infos);
anatofuz
parents:
diff changeset
404 return 0;
anatofuz
parents:
diff changeset
405 }
anatofuz
parents:
diff changeset
406
anatofuz
parents:
diff changeset
407 lldb::ProcessSP RemoteAwarePlatform::ConnectProcess(llvm::StringRef connect_url,
anatofuz
parents:
diff changeset
408 llvm::StringRef plugin_name,
anatofuz
parents:
diff changeset
409 Debugger &debugger,
anatofuz
parents:
diff changeset
410 Target *target,
anatofuz
parents:
diff changeset
411 Status &error) {
anatofuz
parents:
diff changeset
412 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
413 return m_remote_platform_sp->ConnectProcess(connect_url, plugin_name,
anatofuz
parents:
diff changeset
414 debugger, target, error);
anatofuz
parents:
diff changeset
415 return Platform::ConnectProcess(connect_url, plugin_name, debugger, target,
anatofuz
parents:
diff changeset
416 error);
anatofuz
parents:
diff changeset
417 }
anatofuz
parents:
diff changeset
418
anatofuz
parents:
diff changeset
419 Status RemoteAwarePlatform::LaunchProcess(ProcessLaunchInfo &launch_info) {
anatofuz
parents:
diff changeset
420 Status error;
anatofuz
parents:
diff changeset
421
anatofuz
parents:
diff changeset
422 if (IsHost()) {
anatofuz
parents:
diff changeset
423 error = Platform::LaunchProcess(launch_info);
anatofuz
parents:
diff changeset
424 } else {
anatofuz
parents:
diff changeset
425 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
426 error = m_remote_platform_sp->LaunchProcess(launch_info);
anatofuz
parents:
diff changeset
427 else
anatofuz
parents:
diff changeset
428 error.SetErrorString("the platform is not currently connected");
anatofuz
parents:
diff changeset
429 }
anatofuz
parents:
diff changeset
430 return error;
anatofuz
parents:
diff changeset
431 }
anatofuz
parents:
diff changeset
432
anatofuz
parents:
diff changeset
433 Status RemoteAwarePlatform::KillProcess(const lldb::pid_t pid) {
anatofuz
parents:
diff changeset
434 if (IsHost())
anatofuz
parents:
diff changeset
435 return Platform::KillProcess(pid);
anatofuz
parents:
diff changeset
436 if (m_remote_platform_sp)
anatofuz
parents:
diff changeset
437 return m_remote_platform_sp->KillProcess(pid);
anatofuz
parents:
diff changeset
438 return Status("the platform is not currently connected");
anatofuz
parents:
diff changeset
439 }
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
440
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
441 size_t RemoteAwarePlatform::ConnectToWaitingProcesses(Debugger &debugger,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
442 Status &error) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
443 if (m_remote_platform_sp)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
444 return m_remote_platform_sp->ConnectToWaitingProcesses(debugger, error);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
445 return Platform::ConnectToWaitingProcesses(debugger, error);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
446 }