LLDB  mainline
TargetList.cpp
Go to the documentation of this file.
1 //===-- TargetList.cpp ----------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "lldb/Core/Debugger.h"
11 #include "lldb/Core/Module.h"
12 #include "lldb/Core/ModuleSpec.h"
13 #include "lldb/Host/Host.h"
14 #include "lldb/Host/HostInfo.h"
17 #include "lldb/Symbol/ObjectFile.h"
18 #include "lldb/Target/Platform.h"
19 #include "lldb/Target/Process.h"
21 #include "lldb/Utility/Event.h"
22 #include "lldb/Utility/State.h"
24 #include "lldb/Utility/Timer.h"
25 
26 #include "llvm/ADT/SmallString.h"
27 #include "llvm/Support/FileSystem.h"
28 
29 using namespace lldb;
30 using namespace lldb_private;
31 
32 ConstString &TargetList::GetStaticBroadcasterClass() {
33  static ConstString class_name("lldb.targetList");
34  return class_name;
35 }
36 
37 // TargetList constructor
38 TargetList::TargetList(Debugger &debugger)
39  : Broadcaster(debugger.GetBroadcasterManager(),
40  TargetList::GetStaticBroadcasterClass().AsCString()),
41  m_target_list(), m_target_list_mutex(), m_selected_target_idx(0) {
43 }
44 
46  llvm::StringRef user_exe_path,
47  llvm::StringRef triple_str,
48  LoadDependentFiles load_dependent_files,
49  const OptionGroupPlatform *platform_options,
50  TargetSP &target_sp) {
51  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
53  debugger, user_exe_path, triple_str, load_dependent_files,
54  platform_options, target_sp);
55 
56  if (target_sp && result.Success())
57  AddTargetInternal(target_sp, /*do_select*/ true);
58  return result;
59 }
60 
62  llvm::StringRef user_exe_path,
63  const ArchSpec &specified_arch,
64  LoadDependentFiles load_dependent_files,
65  PlatformSP &platform_sp, TargetSP &target_sp) {
66  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
68  debugger, user_exe_path, specified_arch, load_dependent_files,
69  platform_sp, target_sp);
70 
71  if (target_sp && result.Success())
72  AddTargetInternal(target_sp, /*do_select*/ true);
73  return result;
74 }
75 
77  Debugger &debugger, llvm::StringRef user_exe_path,
78  llvm::StringRef triple_str, LoadDependentFiles load_dependent_files,
79  const OptionGroupPlatform *platform_options, TargetSP &target_sp) {
80  Status error;
81 
82  PlatformList &platform_list = debugger.GetPlatformList();
83  // Let's start by looking at the selected platform.
84  PlatformSP platform_sp = platform_list.GetSelectedPlatform();
85 
86  // This variable corresponds to the architecture specified by the triple
87  // string. If that string was empty the currently selected platform will
88  // determine the architecture.
89  const ArchSpec arch(triple_str);
90  if (!triple_str.empty() && !arch.IsValid()) {
91  error.SetErrorStringWithFormat("invalid triple '%s'",
92  triple_str.str().c_str());
93  return error;
94  }
95 
96  ArchSpec platform_arch(arch);
97 
98  // Create a new platform if a platform was specified in the platform options
99  // and doesn't match the selected platform.
100  if (platform_options && platform_options->PlatformWasSpecified() &&
101  !platform_options->PlatformMatches(platform_sp)) {
102  const bool select_platform = true;
103  platform_sp = platform_options->CreatePlatformWithOptions(
104  debugger.GetCommandInterpreter(), arch, select_platform, error,
105  platform_arch);
106  if (!platform_sp)
107  return error;
108  }
109 
110  bool prefer_platform_arch = false;
111  auto update_platform_arch = [&](const ArchSpec &module_arch) {
112  // If the OS or vendor weren't specified, then adopt the module's
113  // architecture so that the platform matching can be more accurate.
114  if (!platform_arch.TripleOSWasSpecified() ||
115  !platform_arch.TripleVendorWasSpecified()) {
116  prefer_platform_arch = true;
117  platform_arch = module_arch;
118  }
119  };
120 
121  if (!user_exe_path.empty()) {
122  ModuleSpec module_spec(FileSpec(user_exe_path, FileSpec::Style::native));
123  FileSystem::Instance().Resolve(module_spec.GetFileSpec());
124 
125  // Try to resolve the exe based on PATH and/or platform-specific suffixes,
126  // but only if using the host platform.
127  if (platform_sp->IsHost() &&
128  !FileSystem::Instance().Exists(module_spec.GetFileSpec()))
130  module_spec.GetFileSpec());
131 
132  // Resolve the executable in case we are given a path to a application
133  // bundle like a .app bundle on MacOSX.
134  Host::ResolveExecutableInBundle(module_spec.GetFileSpec());
135 
136  lldb::offset_t file_offset = 0;
137  lldb::offset_t file_size = 0;
138  ModuleSpecList module_specs;
139  const size_t num_specs = ObjectFile::GetModuleSpecifications(
140  module_spec.GetFileSpec(), file_offset, file_size, module_specs);
141 
142  if (num_specs > 0) {
143  ModuleSpec matching_module_spec;
144 
145  if (num_specs == 1) {
146  if (module_specs.GetModuleSpecAtIndex(0, matching_module_spec)) {
147  if (platform_arch.IsValid()) {
148  if (platform_arch.IsCompatibleMatch(
149  matching_module_spec.GetArchitecture())) {
150  // If the OS or vendor weren't specified, then adopt the module's
151  // architecture so that the platform matching can be more
152  // accurate.
153  update_platform_arch(matching_module_spec.GetArchitecture());
154  } else {
155  StreamString platform_arch_strm;
156  StreamString module_arch_strm;
157 
158  platform_arch.DumpTriple(platform_arch_strm.AsRawOstream());
159  matching_module_spec.GetArchitecture().DumpTriple(
160  module_arch_strm.AsRawOstream());
161  error.SetErrorStringWithFormat(
162  "the specified architecture '%s' is not compatible with '%s' "
163  "in '%s'",
164  platform_arch_strm.GetData(), module_arch_strm.GetData(),
165  module_spec.GetFileSpec().GetPath().c_str());
166  return error;
167  }
168  } else {
169  // Only one arch and none was specified.
170  prefer_platform_arch = true;
171  platform_arch = matching_module_spec.GetArchitecture();
172  }
173  }
174  } else if (arch.IsValid()) {
175  // Fat binary. A (valid) architecture was specified.
176  module_spec.GetArchitecture() = arch;
177  if (module_specs.FindMatchingModuleSpec(module_spec,
178  matching_module_spec))
179  update_platform_arch(matching_module_spec.GetArchitecture());
180  } else {
181  // Fat binary. No architecture specified, check if there is
182  // only one platform for all of the architectures.
183  std::vector<PlatformSP> candidates;
184  std::vector<ArchSpec> archs;
185  for (const ModuleSpec &spec : module_specs.ModuleSpecs())
186  archs.push_back(spec.GetArchitecture());
187  if (PlatformSP platform_for_archs_sp =
188  platform_list.GetOrCreate(archs, {}, candidates)) {
189  platform_sp = platform_for_archs_sp;
190  } else if (candidates.empty()) {
191  error.SetErrorString("no matching platforms found for this file");
192  return error;
193  } else {
194  // More than one platform claims to support this file.
195  StreamString error_strm;
196  std::set<llvm::StringRef> platform_set;
197  error_strm.Printf(
198  "more than one platform supports this executable (");
199  for (const auto &candidate : candidates) {
200  llvm::StringRef platform_name = candidate->GetName();
201  if (platform_set.count(platform_name))
202  continue;
203  if (!platform_set.empty())
204  error_strm.PutCString(", ");
205  error_strm.PutCString(platform_name);
206  platform_set.insert(platform_name);
207  }
208  error_strm.Printf("), specify an architecture to disambiguate");
209  error.SetErrorString(error_strm.GetString());
210  return error;
211  }
212  }
213  }
214  }
215 
216  // If we have a valid architecture, make sure the current platform is
217  // compatible with that architecture.
218  if (!prefer_platform_arch && arch.IsValid()) {
219  if (!platform_sp->IsCompatibleArchitecture(arch, {}, false, nullptr)) {
220  platform_sp = platform_list.GetOrCreate(arch, {}, &platform_arch);
221  if (platform_sp)
222  platform_list.SetSelectedPlatform(platform_sp);
223  }
224  } else if (platform_arch.IsValid()) {
225  // If "arch" isn't valid, yet "platform_arch" is, it means we have an
226  // executable file with a single architecture which should be used.
227  ArchSpec fixed_platform_arch;
228  if (!platform_sp->IsCompatibleArchitecture(platform_arch, {}, false, nullptr)) {
229  platform_sp =
230  platform_list.GetOrCreate(platform_arch, {}, &fixed_platform_arch);
231  if (platform_sp)
232  platform_list.SetSelectedPlatform(platform_sp);
233  }
234  }
235 
236  if (!platform_arch.IsValid())
237  platform_arch = arch;
238 
239  return TargetList::CreateTargetInternal(debugger, user_exe_path,
240  platform_arch, load_dependent_files,
241  platform_sp, target_sp);
242 }
243 
245  llvm::StringRef user_exe_path,
246  const ArchSpec &specified_arch,
247  LoadDependentFiles load_dependent_files,
248  lldb::PlatformSP &platform_sp,
249  lldb::TargetSP &target_sp) {
250  LLDB_SCOPED_TIMERF("TargetList::CreateTarget (file = '%s', arch = '%s')",
251  user_exe_path.str().c_str(),
252  specified_arch.GetArchitectureName());
253  Status error;
254  const bool is_dummy_target = false;
255 
256  ArchSpec arch(specified_arch);
257 
258  if (arch.IsValid()) {
259  if (!platform_sp ||
260  !platform_sp->IsCompatibleArchitecture(arch, {}, false, nullptr))
261  platform_sp =
262  debugger.GetPlatformList().GetOrCreate(specified_arch, {}, &arch);
263  }
264 
265  if (!platform_sp)
266  platform_sp = debugger.GetPlatformList().GetSelectedPlatform();
267 
268  if (!arch.IsValid())
269  arch = specified_arch;
270 
271  FileSpec file(user_exe_path);
272  if (!FileSystem::Instance().Exists(file) && user_exe_path.startswith("~")) {
273  // we want to expand the tilde but we don't want to resolve any symbolic
274  // links so we can't use the FileSpec constructor's resolve flag
275  llvm::SmallString<64> unglobbed_path;
277  Resolver.ResolveFullPath(user_exe_path, unglobbed_path);
278 
279  if (unglobbed_path.empty())
280  file = FileSpec(user_exe_path);
281  else
282  file = FileSpec(unglobbed_path.c_str());
283  }
284 
285  bool user_exe_path_is_bundle = false;
286  char resolved_bundle_exe_path[PATH_MAX];
287  resolved_bundle_exe_path[0] = '\0';
288  if (file) {
289  if (FileSystem::Instance().IsDirectory(file))
290  user_exe_path_is_bundle = true;
291 
292  if (file.IsRelative() && !user_exe_path.empty()) {
293  llvm::SmallString<64> cwd;
294  if (! llvm::sys::fs::current_path(cwd)) {
295  FileSpec cwd_file(cwd.c_str());
296  cwd_file.AppendPathComponent(file);
297  if (FileSystem::Instance().Exists(cwd_file))
298  file = cwd_file;
299  }
300  }
301 
302  ModuleSP exe_module_sp;
303  if (platform_sp) {
304  FileSpecList executable_search_paths(
306  ModuleSpec module_spec(file, arch);
307  error = platform_sp->ResolveExecutable(module_spec, exe_module_sp,
308  executable_search_paths.GetSize()
309  ? &executable_search_paths
310  : nullptr);
311  }
312 
313  if (error.Success() && exe_module_sp) {
314  if (exe_module_sp->GetObjectFile() == nullptr) {
315  if (arch.IsValid()) {
316  error.SetErrorStringWithFormat(
317  "\"%s\" doesn't contain architecture %s", file.GetPath().c_str(),
318  arch.GetArchitectureName());
319  } else {
320  error.SetErrorStringWithFormat("unsupported file type \"%s\"",
321  file.GetPath().c_str());
322  }
323  return error;
324  }
325  target_sp.reset(new Target(debugger, arch, platform_sp, is_dummy_target));
326  target_sp->SetExecutableModule(exe_module_sp, load_dependent_files);
327  if (user_exe_path_is_bundle)
328  exe_module_sp->GetFileSpec().GetPath(resolved_bundle_exe_path,
329  sizeof(resolved_bundle_exe_path));
330  if (target_sp->GetPreloadSymbols())
331  exe_module_sp->PreloadSymbols();
332  }
333  } else {
334  // No file was specified, just create an empty target with any arch if a
335  // valid arch was specified
336  target_sp.reset(new Target(debugger, arch, platform_sp, is_dummy_target));
337  }
338 
339  if (!target_sp)
340  return error;
341 
342  // Set argv0 with what the user typed, unless the user specified a
343  // directory. If the user specified a directory, then it is probably a
344  // bundle that was resolved and we need to use the resolved bundle path
345  if (!user_exe_path.empty()) {
346  // Use exactly what the user typed as the first argument when we exec or
347  // posix_spawn
348  if (user_exe_path_is_bundle && resolved_bundle_exe_path[0]) {
349  target_sp->SetArg0(resolved_bundle_exe_path);
350  } else {
351  // Use resolved path
352  target_sp->SetArg0(file.GetPath().c_str());
353  }
354  }
355  if (file.GetDirectory()) {
356  FileSpec file_dir;
357  file_dir.GetDirectory() = file.GetDirectory();
358  target_sp->AppendExecutableSearchPaths(file_dir);
359  }
360 
361  // Now prime this from the dummy target:
362  target_sp->PrimeFromDummyTarget(debugger.GetDummyTarget());
363 
364  return error;
365 }
366 
367 bool TargetList::DeleteTarget(TargetSP &target_sp) {
368  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
369  auto it = std::find(m_target_list.begin(), m_target_list.end(), target_sp);
370  if (it == m_target_list.end())
371  return false;
372 
373  m_target_list.erase(it);
374  return true;
375 }
376 
378  const FileSpec &exe_file_spec, const ArchSpec *exe_arch_ptr) const {
379  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
380  auto it = std::find_if(m_target_list.begin(), m_target_list.end(),
381  [&exe_file_spec, exe_arch_ptr](const TargetSP &item) {
382  Module *exe_module = item->GetExecutableModulePointer();
383  if (!exe_module ||
384  !FileSpec::Match(exe_file_spec, exe_module->GetFileSpec()))
385  return false;
386 
387  return !exe_arch_ptr ||
388  exe_arch_ptr->IsCompatibleMatch(exe_module->GetArchitecture());
389  });
390 
391  if (it != m_target_list.end())
392  return *it;
393 
394  return TargetSP();
395 }
396 
398  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
399  auto it = std::find_if(m_target_list.begin(), m_target_list.end(),
400  [pid](const TargetSP &item) {
401  auto *process_ptr = item->GetProcessSP().get();
402  return process_ptr && (process_ptr->GetID() == pid);
403  });
404 
405  if (it != m_target_list.end())
406  return *it;
407 
408  return TargetSP();
409 }
410 
411 TargetSP TargetList::FindTargetWithProcess(Process *process) const {
412  TargetSP target_sp;
413  if (!process)
414  return target_sp;
415 
416  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
417  auto it = std::find_if(m_target_list.begin(), m_target_list.end(),
418  [process](const TargetSP &item) {
419  return item->GetProcessSP().get() == process;
420  });
421 
422  if (it != m_target_list.end())
423  target_sp = *it;
424 
425  return target_sp;
426 }
427 
428 TargetSP TargetList::GetTargetSP(Target *target) const {
429  TargetSP target_sp;
430  if (!target)
431  return target_sp;
432 
433  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
434  auto it = std::find_if(m_target_list.begin(), m_target_list.end(),
435  [target](const TargetSP &item) { return item.get() == target; });
436  if (it != m_target_list.end())
437  target_sp = *it;
438 
439  return target_sp;
440 }
441 
443  uint32_t num_async_interrupts_sent = 0;
444 
445  if (pid != LLDB_INVALID_PROCESS_ID) {
446  TargetSP target_sp(FindTargetWithProcessID(pid));
447  if (target_sp) {
448  Process *process = target_sp->GetProcessSP().get();
449  if (process) {
450  process->SendAsyncInterrupt();
451  ++num_async_interrupts_sent;
452  }
453  }
454  } else {
455  // We don't have a valid pid to broadcast to, so broadcast to the target
456  // list's async broadcaster...
458  }
459 
460  return num_async_interrupts_sent;
461 }
462 
464  uint32_t num_signals_sent = 0;
465  Process *process = nullptr;
466  if (pid == LLDB_INVALID_PROCESS_ID) {
467  // Signal all processes with signal
468  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
469  for (const auto &target_sp : m_target_list) {
470  process = target_sp->GetProcessSP().get();
471  if (process && process->IsAlive()) {
472  ++num_signals_sent;
473  process->Signal(signo);
474  }
475  }
476  } else {
477  // Signal a specific process with signal
478  TargetSP target_sp(FindTargetWithProcessID(pid));
479  if (target_sp) {
480  process = target_sp->GetProcessSP().get();
481  if (process && process->IsAlive()) {
482  ++num_signals_sent;
483  process->Signal(signo);
484  }
485  }
486  }
487  return num_signals_sent;
488 }
489 
491  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
492  return m_target_list.size();
493 }
494 
495 lldb::TargetSP TargetList::GetTargetAtIndex(uint32_t idx) const {
496  TargetSP target_sp;
497  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
498  if (idx < m_target_list.size())
499  target_sp = m_target_list[idx];
500  return target_sp;
501 }
502 
503 uint32_t TargetList::GetIndexOfTarget(lldb::TargetSP target_sp) const {
504  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
505  auto it = std::find(m_target_list.begin(), m_target_list.end(), target_sp);
506  if (it != m_target_list.end())
507  return std::distance(m_target_list.begin(), it);
508  return UINT32_MAX;
509 }
510 
511 void TargetList::AddTargetInternal(TargetSP target_sp, bool do_select) {
512  lldbassert(std::find(m_target_list.begin(), m_target_list.end(), target_sp) ==
513  m_target_list.end() &&
514  "target already exists it the list");
515  m_target_list.push_back(std::move(target_sp));
516  if (do_select)
518 }
519 
521  lldbassert(!m_target_list.empty());
522  m_selected_target_idx = index < m_target_list.size() ? index : 0;
523 }
524 
526  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
528 }
529 
530 void TargetList::SetSelectedTarget(const TargetSP &target_sp) {
531  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
532  auto it = std::find(m_target_list.begin(), m_target_list.end(), target_sp);
533  SetSelectedTargetInternal(std::distance(m_target_list.begin(), it));
534 }
535 
537  std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
538  if (m_selected_target_idx >= m_target_list.size())
541 }
lldb_private::Broadcaster::CheckInWithManager
void CheckInWithManager()
Definition: Broadcaster.cpp:46
lldb_private::Host::ResolveExecutableInBundle
static bool ResolveExecutableInBundle(FileSpec &file)
When executable files may live within a directory, where the directory represents an executable bundl...
Definition: common/Host.cpp:329
LLDB_SCOPED_TIMERF
#define LLDB_SCOPED_TIMERF(...)
Definition: Timer.h:86
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::StandardTildeExpressionResolver
Definition: TildeExpressionResolver.h:56
lldb_private::TargetList::m_selected_target_idx
uint32_t m_selected_target_idx
Definition: TargetList.h:195
lldb_private::Process::eBroadcastBitInterrupt
@ eBroadcastBitInterrupt
Definition: Process.h:355
lldb_private::Process::SendAsyncInterrupt
void SendAsyncInterrupt()
Definition: Process.cpp:3623
LLDB_INVALID_PROCESS_ID
#define LLDB_INVALID_PROCESS_ID
Definition: lldb-defines.h:81
ModuleSpec.h
lldb_private::ObjectFile::GetModuleSpecifications
static size_t GetModuleSpecifications(const FileSpec &file, lldb::offset_t file_offset, lldb::offset_t file_size, ModuleSpecList &specs, lldb::DataBufferSP data_sp=lldb::DataBufferSP())
lldb_private::Debugger::GetCommandInterpreter
CommandInterpreter & GetCommandInterpreter()
Definition: Debugger.h:172
Host.h
lldb_private::Debugger::GetDummyTarget
Target & GetDummyTarget()
Definition: Debugger.h:380
lldb_private::ModuleSpecList::ModuleSpecs
ModuleSpecIterable ModuleSpecs()
Definition: ModuleSpec.h:396
lldb_private::LoadDependentFiles
LoadDependentFiles
Definition: Target.h:62
lldb_private::ModuleSpecList
Definition: ModuleSpec.h:275
lldb_private::Process
Definition: Process.h:338
Module.h
lldb_private::OptionGroupPlatform::CreatePlatformWithOptions
lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter, const ArchSpec &arch, bool make_selected, Status &error, ArchSpec &platform_arch) const
Definition: OptionGroupPlatform.cpp:18
lldb_private::TargetList
Definition: TargetList.h:21
lldb_private::TargetList::DeleteTarget
bool DeleteTarget(lldb::TargetSP &target_sp)
Delete a Target object from the list.
Definition: TargetList.cpp:367
lldb_private::FileSystem::ResolveExecutableLocation
bool ResolveExecutableLocation(FileSpec &file_spec)
Call into the Host to see if it can help find the file.
Definition: common/FileSystem.cpp:330
lldb_private::TargetList::GetIndexOfTarget
uint32_t GetIndexOfTarget(lldb::TargetSP target_sp) const
Definition: TargetList.cpp:503
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::FileSystem::Exists
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
Definition: common/FileSystem.cpp:150
lldb_private::Process::IsAlive
virtual bool IsAlive()
Check if a process is still alive.
Definition: Process.cpp:1084
Debugger.h
lldb_private::Target
Definition: Target.h:473
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::OptionGroupPlatform
Definition: OptionGroupPlatform.h:21
lldb_private::TargetList::FindTargetWithProcess
lldb::TargetSP FindTargetWithProcess(lldb_private::Process *process) const
Definition: TargetList.cpp:411
lldb_private::TargetList::SetSelectedTargetInternal
void SetSelectedTargetInternal(uint32_t index)
Definition: TargetList.cpp:520
Process.h
lldb_private::Process::Signal
Status Signal(int signal)
Sends a process a UNIX signal signal.
Definition: Process.cpp:3321
Broadcaster.h
lldb_private::ArchSpec::DumpTriple
void DumpTriple(llvm::raw_ostream &s) const
Definition: ArchSpec.cpp:1467
Platform.h
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
TargetList.h
lldb_private::PlatformList::GetSelectedPlatform
lldb::PlatformSP GetSelectedPlatform()
Select the active platform.
Definition: Platform.h:980
lldb_private::TargetList::SetSelectedTarget
void SetSelectedTarget(uint32_t index)
Definition: TargetList.cpp:525
lldb_private::TargetList::SendAsyncInterrupt
uint32_t SendAsyncInterrupt(lldb::pid_t pid=LLDB_INVALID_PROCESS_ID)
Send an async interrupt to one or all processes.
Definition: TargetList.cpp:442
lldb_private::StreamString::GetData
const char * GetData() const
Definition: StreamString.h:43
lldb_private::TildeExpressionResolver::ResolveFullPath
bool ResolveFullPath(llvm::StringRef Expr, llvm::SmallVectorImpl< char > &Output)
Resolve an entire path that begins with a tilde expression, replacing the username portion with the m...
Definition: TildeExpressionResolver.cpp:76
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::StreamString
Definition: StreamString.h:23
Timer.h
OptionGroupPlatform.h
lldb_private::TargetList::CreateTarget
Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, LoadDependentFiles get_dependent_modules, const OptionGroupPlatform *platform_options, lldb::TargetSP &target_sp)
Create a new Target.
lldb_private::OptionGroupPlatform::PlatformMatches
bool PlatformMatches(const lldb::PlatformSP &platform_sp) const
Definition: OptionGroupPlatform.cpp:128
lldb_private::TargetList::GetNumTargets
int GetNumTargets() const
Definition: TargetList.cpp:490
lldb_private::Debugger
Definition: Debugger.h:74
HostInfo.h
lldb_private::FileSystem::Resolve
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
Definition: common/FileSystem.cpp:235
lldb_private::PlatformList
Definition: Platform.h:946
lldb_private::ArchSpec::IsValid
bool IsValid() const
Tests if this ArchSpec is valid.
Definition: ArchSpec.h:353
lldb_private::ModuleSpecList::FindMatchingModuleSpec
bool FindMatchingModuleSpec(const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
Definition: ModuleSpec.h:333
lldb_private::TargetList::SignalIfRunning
uint32_t SignalIfRunning(lldb::pid_t pid, int signo)
Definition: TargetList.cpp:463
Event.h
ObjectFile.h
lldb_private::OptionGroupPlatform::PlatformWasSpecified
bool PlatformWasSpecified() const
Definition: OptionGroupPlatform.h:41
lldb_private::TargetList::GetTargetSP
lldb::TargetSP GetTargetSP(Target *target) const
Definition: TargetList.cpp:428
lldbassert
#define lldbassert(x)
Definition: LLDBAssert.h:15
lldb_private::TargetList::CreateTargetInternal
static Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, LoadDependentFiles load_dependent_files, const OptionGroupPlatform *platform_options, lldb::TargetSP &target_sp)
lldb_private::TargetList::FindTargetWithProcessID
lldb::TargetSP FindTargetWithProcessID(lldb::pid_t pid) const
Find the target that contains a process with process ID pid.
Definition: TargetList.cpp:397
lldb_private::Target::GetDefaultExecutableSearchPaths
static FileSpecList GetDefaultExecutableSearchPaths()
Definition: Target.cpp:2433
lldb_private::Broadcaster::BroadcastEvent
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
Definition: Broadcaster.h:262
lldb_private::ModuleSpec
Definition: ModuleSpec.h:27
lldb_private::PlatformList::SetSelectedPlatform
void SetSelectedPlatform(const lldb::PlatformSP &platform_sp)
Definition: Platform.h:988
lldb_private::Status
Definition: Status.h:44
lldb_private::TargetList::m_target_list
collection m_target_list
Definition: TargetList.h:193
TildeExpressionResolver.h
lldb_private::FileSpec::IsRelative
bool IsRelative() const
Returns true if the filespec represents a relative path.
Definition: FileSpec.cpp:474
lldb_private::ArchSpec::GetArchitectureName
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Definition: ArchSpec.cpp:539
uint32_t
lldb_private::Debugger::GetPlatformList
PlatformList & GetPlatformList()
Definition: Debugger.h:204
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb_private::Stream::AsRawOstream
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition: Stream.h:357
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::ModuleSpec::GetArchitecture
ArchSpec & GetArchitecture()
Definition: ModuleSpec.h:89
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private::TargetList::AddTargetInternal
void AddTargetInternal(lldb::TargetSP target_sp, bool do_select)
Definition: TargetList.cpp:511
lldb_private::FileSystem::Instance
static FileSystem & Instance()
Definition: common/FileSystem.cpp:46
lldb_private::FileSpec::AppendPathComponent
void AppendPathComponent(llvm::StringRef component)
Definition: FileSpec.cpp:434
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::TargetList::GetTargetAtIndex
lldb::TargetSP GetTargetAtIndex(uint32_t index) const
Definition: TargetList.cpp:495
CommandInterpreter.h
lldb_private::FileSpec::GetDirectory
ConstString & GetDirectory()
Directory string get accessor.
Definition: FileSpec.cpp:334
lldb_private::ModuleSpecList::GetModuleSpecAtIndex
bool GetModuleSpecAtIndex(size_t i, ModuleSpec &module_spec) const
Definition: ModuleSpec.h:323
State.h
lldb_private::TargetList::FindTargetWithExecutableAndArchitecture
lldb::TargetSP FindTargetWithExecutableAndArchitecture(const FileSpec &exe_file_spec, const ArchSpec *exe_arch_ptr=nullptr) const
Find the target that contains has an executable whose path matches exe_file_spec, and whose architect...
Definition: TargetList.cpp:377
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::TargetList::GetSelectedTarget
lldb::TargetSP GetSelectedTarget()
Definition: TargetList.cpp:536
lldb_private::TargetList::m_target_list_mutex
std::recursive_mutex m_target_list_mutex
Definition: TargetList.h:194
PATH_MAX
#define PATH_MAX
Definition: windows/PosixApi.h:25
lldb_private::Broadcaster
Definition: Broadcaster.h:242
lldb_private::FileSpec::GetPath
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:347
lldb_private::PlatformList::GetOrCreate
lldb::PlatformSP GetOrCreate(llvm::StringRef name)
Definition: Platform.cpp:1952
lldb
Definition: SBAddress.h:15