LLDB  mainline
SBTarget.cpp
Go to the documentation of this file.
1 //===-- SBTarget.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 
9 #include "lldb/API/SBTarget.h"
11 #include "lldb/Utility/LLDBLog.h"
12 #include "lldb/lldb-public.h"
13 
14 #include "lldb/API/SBBreakpoint.h"
15 #include "lldb/API/SBDebugger.h"
16 #include "lldb/API/SBEnvironment.h"
17 #include "lldb/API/SBEvent.h"
19 #include "lldb/API/SBFileSpec.h"
20 #include "lldb/API/SBListener.h"
21 #include "lldb/API/SBModule.h"
22 #include "lldb/API/SBModuleSpec.h"
23 #include "lldb/API/SBProcess.h"
25 #include "lldb/API/SBStream.h"
26 #include "lldb/API/SBStringList.h"
29 #include "lldb/API/SBTrace.h"
34 #include "lldb/Core/Address.h"
36 #include "lldb/Core/Debugger.h"
37 #include "lldb/Core/Disassembler.h"
38 #include "lldb/Core/Module.h"
39 #include "lldb/Core/ModuleSpec.h"
40 #include "lldb/Core/SearchFilter.h"
41 #include "lldb/Core/Section.h"
46 #include "lldb/Host/Host.h"
47 #include "lldb/Symbol/DeclVendor.h"
48 #include "lldb/Symbol/ObjectFile.h"
49 #include "lldb/Symbol/SymbolFile.h"
51 #include "lldb/Symbol/TypeSystem.h"
53 #include "lldb/Target/ABI.h"
54 #include "lldb/Target/Language.h"
56 #include "lldb/Target/Process.h"
57 #include "lldb/Target/StackFrame.h"
58 #include "lldb/Target/Target.h"
59 #include "lldb/Target/TargetList.h"
60 #include "lldb/Utility/ArchSpec.h"
61 #include "lldb/Utility/Args.h"
62 #include "lldb/Utility/FileSpec.h"
65 
68 #include "llvm/Support/PrettyStackTrace.h"
69 #include "llvm/Support/Regex.h"
70 
71 using namespace lldb;
72 using namespace lldb_private;
73 
74 #define DEFAULT_DISASM_BYTE_SIZE 32
75 
76 static Status AttachToProcess(ProcessAttachInfo &attach_info, Target &target) {
77  std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex());
78 
79  auto process_sp = target.GetProcessSP();
80  if (process_sp) {
81  const auto state = process_sp->GetState();
82  if (process_sp->IsAlive() && state == eStateConnected) {
83  // If we are already connected, then we have already specified the
84  // listener, so if a valid listener is supplied, we need to error out to
85  // let the client know.
86  if (attach_info.GetListener())
87  return Status("process is connected and already has a listener, pass "
88  "empty listener");
89  }
90  }
91 
92  return target.Attach(attach_info, nullptr);
93 }
94 
95 // SBTarget constructor
97 
98 SBTarget::SBTarget(const SBTarget &rhs) : m_opaque_sp(rhs.m_opaque_sp) {
99  LLDB_INSTRUMENT_VA(this, rhs);
100 }
101 
102 SBTarget::SBTarget(const TargetSP &target_sp) : m_opaque_sp(target_sp) {
103  LLDB_INSTRUMENT_VA(this, target_sp);
104 }
105 
107  LLDB_INSTRUMENT_VA(this, rhs);
108 
109  if (this != &rhs)
110  m_opaque_sp = rhs.m_opaque_sp;
111  return *this;
112 }
113 
114 // Destructor
115 SBTarget::~SBTarget() = default;
116 
118  LLDB_INSTRUMENT_VA(event);
119 
120  return Target::TargetEventData::GetEventDataFromEvent(event.get()) != nullptr;
121 }
122 
124  LLDB_INSTRUMENT_VA(event);
125 
126  return Target::TargetEventData::GetTargetFromEvent(event.get());
127 }
128 
130  LLDB_INSTRUMENT_VA(event);
131 
132  const ModuleList module_list =
133  Target::TargetEventData::GetModuleListFromEvent(event.get());
134  return module_list.GetSize();
135 }
136 
138  const SBEvent &event) {
139  LLDB_INSTRUMENT_VA(idx, event);
140 
141  const ModuleList module_list =
142  Target::TargetEventData::GetModuleListFromEvent(event.get());
143  return SBModule(module_list.GetModuleAtIndex(idx));
144 }
145 
147  LLDB_INSTRUMENT();
148 
149  return Target::GetStaticBroadcasterClass().AsCString();
150 }
151 
152 bool SBTarget::IsValid() const {
153  LLDB_INSTRUMENT_VA(this);
154  return this->operator bool();
155 }
156 SBTarget::operator bool() const {
157  LLDB_INSTRUMENT_VA(this);
158 
159  return m_opaque_sp.get() != nullptr && m_opaque_sp->IsValid();
160 }
161 
163  LLDB_INSTRUMENT_VA(this);
164 
165  SBProcess sb_process;
166  ProcessSP process_sp;
167  TargetSP target_sp(GetSP());
168  if (target_sp) {
169  process_sp = target_sp->GetProcessSP();
170  sb_process.SetSP(process_sp);
171  }
172 
173  return sb_process;
174 }
175 
177  LLDB_INSTRUMENT_VA(this);
178 
179  TargetSP target_sp(GetSP());
180  if (!target_sp)
181  return SBPlatform();
182 
183  SBPlatform platform;
184  platform.m_opaque_sp = target_sp->GetPlatform();
185 
186  return platform;
187 }
188 
190  LLDB_INSTRUMENT_VA(this);
191 
192  SBDebugger debugger;
193  TargetSP target_sp(GetSP());
194  if (target_sp)
195  debugger.reset(target_sp->GetDebugger().shared_from_this());
196  return debugger;
197 }
198 
200  LLDB_INSTRUMENT_VA(this);
201 
202  SBStructuredData data;
203  TargetSP target_sp(GetSP());
204  if (!target_sp)
205  return data;
206  std::string json_str =
207  llvm::formatv("{0:2}",
208  DebuggerStats::ReportStatistics(target_sp->GetDebugger(),
209  target_sp.get())).str();
210  data.m_impl_up->SetObjectSP(StructuredData::ParseJSON(json_str));
211  return data;
212 }
213 
215  LLDB_INSTRUMENT_VA(this, v);
216 
217  TargetSP target_sp(GetSP());
218  if (!target_sp)
219  return;
220  return DebuggerStats::SetCollectingStats(v);
221 }
222 
224  LLDB_INSTRUMENT_VA(this);
225 
226  TargetSP target_sp(GetSP());
227  if (!target_sp)
228  return false;
229  return DebuggerStats::GetCollectingStats();
230 }
231 
232 SBProcess SBTarget::LoadCore(const char *core_file) {
233  LLDB_INSTRUMENT_VA(this, core_file);
234 
235  lldb::SBError error; // Ignored
236  return LoadCore(core_file, error);
237 }
238 
240  LLDB_INSTRUMENT_VA(this, core_file, error);
241 
242  SBProcess sb_process;
243  TargetSP target_sp(GetSP());
244  if (target_sp) {
245  FileSpec filespec(core_file);
246  FileSystem::Instance().Resolve(filespec);
247  ProcessSP process_sp(target_sp->CreateProcess(
248  target_sp->GetDebugger().GetListener(), "", &filespec, false));
249  if (process_sp) {
250  error.SetError(process_sp->LoadCore());
251  if (error.Success())
252  sb_process.SetSP(process_sp);
253  } else {
254  error.SetErrorString("Failed to create the process");
255  }
256  } else {
257  error.SetErrorString("SBTarget is invalid");
258  }
259  return sb_process;
260 }
261 
262 SBProcess SBTarget::LaunchSimple(char const **argv, char const **envp,
263  const char *working_directory) {
264  LLDB_INSTRUMENT_VA(this, argv, envp, working_directory);
265 
266  TargetSP target_sp = GetSP();
267  if (!target_sp)
268  return SBProcess();
269 
270  SBLaunchInfo launch_info = GetLaunchInfo();
271 
272  if (Module *exe_module = target_sp->GetExecutableModulePointer())
273  launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(),
274  /*add_as_first_arg*/ true);
275  if (argv)
276  launch_info.SetArguments(argv, /*append*/ true);
277  if (envp)
278  launch_info.SetEnvironmentEntries(envp, /*append*/ false);
279  if (working_directory)
280  launch_info.SetWorkingDirectory(working_directory);
281 
282  SBError error;
283  return Launch(launch_info, error);
284 }
285 
287  LLDB_INSTRUMENT_VA(this);
288 
289  SBError sb_error;
290  TargetSP target_sp(GetSP());
291  if (target_sp) {
292  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
293  sb_error.ref() = target_sp->Install(nullptr);
294  }
295  return sb_error;
296 }
297 
298 SBProcess SBTarget::Launch(SBListener &listener, char const **argv,
299  char const **envp, const char *stdin_path,
300  const char *stdout_path, const char *stderr_path,
301  const char *working_directory,
302  uint32_t launch_flags, // See LaunchFlags
303  bool stop_at_entry, lldb::SBError &error) {
304  LLDB_INSTRUMENT_VA(this, listener, argv, envp, stdin_path, stdout_path,
305  stderr_path, working_directory, launch_flags,
306  stop_at_entry, error);
307 
308  SBProcess sb_process;
309  ProcessSP process_sp;
310  TargetSP target_sp(GetSP());
311 
312  if (target_sp) {
313  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
314 
315  if (stop_at_entry)
316  launch_flags |= eLaunchFlagStopAtEntry;
317 
318  if (getenv("LLDB_LAUNCH_FLAG_DISABLE_ASLR"))
319  launch_flags |= eLaunchFlagDisableASLR;
320 
321  StateType state = eStateInvalid;
322  process_sp = target_sp->GetProcessSP();
323  if (process_sp) {
324  state = process_sp->GetState();
325 
326  if (process_sp->IsAlive() && state != eStateConnected) {
327  if (state == eStateAttaching)
328  error.SetErrorString("process attach is in progress");
329  else
330  error.SetErrorString("a process is already being debugged");
331  return sb_process;
332  }
333  }
334 
335  if (state == eStateConnected) {
336  // If we are already connected, then we have already specified the
337  // listener, so if a valid listener is supplied, we need to error out to
338  // let the client know.
339  if (listener.IsValid()) {
340  error.SetErrorString("process is connected and already has a listener, "
341  "pass empty listener");
342  return sb_process;
343  }
344  }
345 
346  if (getenv("LLDB_LAUNCH_FLAG_DISABLE_STDIO"))
347  launch_flags |= eLaunchFlagDisableSTDIO;
348 
349  ProcessLaunchInfo launch_info(FileSpec(stdin_path), FileSpec(stdout_path),
350  FileSpec(stderr_path),
351  FileSpec(working_directory), launch_flags);
352 
353  Module *exe_module = target_sp->GetExecutableModulePointer();
354  if (exe_module)
355  launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
356  if (argv) {
357  launch_info.GetArguments().AppendArguments(argv);
358  } else {
359  auto default_launch_info = target_sp->GetProcessLaunchInfo();
360  launch_info.GetArguments().AppendArguments(
361  default_launch_info.GetArguments());
362  }
363  if (envp) {
364  launch_info.GetEnvironment() = Environment(envp);
365  } else {
366  auto default_launch_info = target_sp->GetProcessLaunchInfo();
367  launch_info.GetEnvironment() = default_launch_info.GetEnvironment();
368  }
369 
370  if (listener.IsValid())
371  launch_info.SetListener(listener.GetSP());
372 
373  error.SetError(target_sp->Launch(launch_info, nullptr));
374 
375  sb_process.SetSP(target_sp->GetProcessSP());
376  } else {
377  error.SetErrorString("SBTarget is invalid");
378  }
379 
380  return sb_process;
381 }
382 
384  LLDB_INSTRUMENT_VA(this, sb_launch_info, error);
385 
386  SBProcess sb_process;
387  TargetSP target_sp(GetSP());
388 
389  if (target_sp) {
390  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
391  StateType state = eStateInvalid;
392  {
393  ProcessSP process_sp = target_sp->GetProcessSP();
394  if (process_sp) {
395  state = process_sp->GetState();
396 
397  if (process_sp->IsAlive() && state != eStateConnected) {
398  if (state == eStateAttaching)
399  error.SetErrorString("process attach is in progress");
400  else
401  error.SetErrorString("a process is already being debugged");
402  return sb_process;
403  }
404  }
405  }
406 
407  lldb_private::ProcessLaunchInfo launch_info = sb_launch_info.ref();
408 
409  if (!launch_info.GetExecutableFile()) {
410  Module *exe_module = target_sp->GetExecutableModulePointer();
411  if (exe_module)
412  launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
413  }
414 
415  const ArchSpec &arch_spec = target_sp->GetArchitecture();
416  if (arch_spec.IsValid())
417  launch_info.GetArchitecture() = arch_spec;
418 
419  error.SetError(target_sp->Launch(launch_info, nullptr));
420  sb_launch_info.set_ref(launch_info);
421  sb_process.SetSP(target_sp->GetProcessSP());
422  } else {
423  error.SetErrorString("SBTarget is invalid");
424  }
425 
426  return sb_process;
427 }
428 
430  LLDB_INSTRUMENT_VA(this, sb_attach_info, error);
431 
432  SBProcess sb_process;
433  TargetSP target_sp(GetSP());
434 
435  if (target_sp) {
436  ProcessAttachInfo &attach_info = sb_attach_info.ref();
437  if (attach_info.ProcessIDIsValid() && !attach_info.UserIDIsValid()) {
438  PlatformSP platform_sp = target_sp->GetPlatform();
439  // See if we can pre-verify if a process exists or not
440  if (platform_sp && platform_sp->IsConnected()) {
441  lldb::pid_t attach_pid = attach_info.GetProcessID();
442  ProcessInstanceInfo instance_info;
443  if (platform_sp->GetProcessInfo(attach_pid, instance_info)) {
444  attach_info.SetUserID(instance_info.GetEffectiveUserID());
445  } else {
446  error.ref().SetErrorStringWithFormat(
447  "no process found with process ID %" PRIu64, attach_pid);
448  return sb_process;
449  }
450  }
451  }
452  error.SetError(AttachToProcess(attach_info, *target_sp));
453  if (error.Success())
454  sb_process.SetSP(target_sp->GetProcessSP());
455  } else {
456  error.SetErrorString("SBTarget is invalid");
457  }
458 
459  return sb_process;
460 }
461 
463  SBListener &listener,
464  lldb::pid_t pid, // The process ID to attach to
465  SBError &error // An error explaining what went wrong if attach fails
466 ) {
467  LLDB_INSTRUMENT_VA(this, listener, pid, error);
468 
469  SBProcess sb_process;
470  TargetSP target_sp(GetSP());
471 
472  if (target_sp) {
473  ProcessAttachInfo attach_info;
474  attach_info.SetProcessID(pid);
475  if (listener.IsValid())
476  attach_info.SetListener(listener.GetSP());
477 
478  ProcessInstanceInfo instance_info;
479  if (target_sp->GetPlatform()->GetProcessInfo(pid, instance_info))
480  attach_info.SetUserID(instance_info.GetEffectiveUserID());
481 
482  error.SetError(AttachToProcess(attach_info, *target_sp));
483  if (error.Success())
484  sb_process.SetSP(target_sp->GetProcessSP());
485  } else
486  error.SetErrorString("SBTarget is invalid");
487 
488  return sb_process;
489 }
490 
492  SBListener &listener,
493  const char *name, // basename of process to attach to
494  bool wait_for, // if true wait for a new instance of "name" to be launched
495  SBError &error // An error explaining what went wrong if attach fails
496 ) {
497  LLDB_INSTRUMENT_VA(this, listener, name, wait_for, error);
498 
499  SBProcess sb_process;
500  TargetSP target_sp(GetSP());
501 
502  if (name && target_sp) {
503  ProcessAttachInfo attach_info;
504  attach_info.GetExecutableFile().SetFile(name, FileSpec::Style::native);
505  attach_info.SetWaitForLaunch(wait_for);
506  if (listener.IsValid())
507  attach_info.SetListener(listener.GetSP());
508 
509  error.SetError(AttachToProcess(attach_info, *target_sp));
510  if (error.Success())
511  sb_process.SetSP(target_sp->GetProcessSP());
512  } else
513  error.SetErrorString("SBTarget is invalid");
514 
515  return sb_process;
516 }
517 
519  const char *plugin_name,
520  SBError &error) {
521  LLDB_INSTRUMENT_VA(this, listener, url, plugin_name, error);
522 
523  SBProcess sb_process;
524  ProcessSP process_sp;
525  TargetSP target_sp(GetSP());
526 
527  if (target_sp) {
528  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
529  if (listener.IsValid())
530  process_sp =
531  target_sp->CreateProcess(listener.m_opaque_sp, plugin_name, nullptr,
532  true);
533  else
534  process_sp = target_sp->CreateProcess(
535  target_sp->GetDebugger().GetListener(), plugin_name, nullptr, true);
536 
537  if (process_sp) {
538  sb_process.SetSP(process_sp);
539  error.SetError(process_sp->ConnectRemote(url));
540  } else {
541  error.SetErrorString("unable to create lldb_private::Process");
542  }
543  } else {
544  error.SetErrorString("SBTarget is invalid");
545  }
546 
547  return sb_process;
548 }
549 
551  LLDB_INSTRUMENT_VA(this);
552 
553  SBFileSpec exe_file_spec;
554  TargetSP target_sp(GetSP());
555  if (target_sp) {
556  Module *exe_module = target_sp->GetExecutableModulePointer();
557  if (exe_module)
558  exe_file_spec.SetFileSpec(exe_module->GetFileSpec());
559  }
560 
561  return exe_file_spec;
562 }
563 
564 bool SBTarget::operator==(const SBTarget &rhs) const {
565  LLDB_INSTRUMENT_VA(this, rhs);
566 
567  return m_opaque_sp.get() == rhs.m_opaque_sp.get();
568 }
569 
570 bool SBTarget::operator!=(const SBTarget &rhs) const {
571  LLDB_INSTRUMENT_VA(this, rhs);
572 
573  return m_opaque_sp.get() != rhs.m_opaque_sp.get();
574 }
575 
576 lldb::TargetSP SBTarget::GetSP() const { return m_opaque_sp; }
577 
578 void SBTarget::SetSP(const lldb::TargetSP &target_sp) {
579  m_opaque_sp = target_sp;
580 }
581 
583  LLDB_INSTRUMENT_VA(this, vm_addr);
584 
585  lldb::SBAddress sb_addr;
586  Address &addr = sb_addr.ref();
587  TargetSP target_sp(GetSP());
588  if (target_sp) {
589  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
590  if (target_sp->ResolveLoadAddress(vm_addr, addr))
591  return sb_addr;
592  }
593 
594  // We have a load address that isn't in a section, just return an address
595  // with the offset filled in (the address) and the section set to NULL
596  addr.SetRawAddress(vm_addr);
597  return sb_addr;
598 }
599 
601  LLDB_INSTRUMENT_VA(this, file_addr);
602 
603  lldb::SBAddress sb_addr;
604  Address &addr = sb_addr.ref();
605  TargetSP target_sp(GetSP());
606  if (target_sp) {
607  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
608  if (target_sp->ResolveFileAddress(file_addr, addr))
609  return sb_addr;
610  }
611 
612  addr.SetRawAddress(file_addr);
613  return sb_addr;
614 }
615 
617  lldb::addr_t vm_addr) {
618  LLDB_INSTRUMENT_VA(this, stop_id, vm_addr);
619 
620  lldb::SBAddress sb_addr;
621  Address &addr = sb_addr.ref();
622  TargetSP target_sp(GetSP());
623  if (target_sp) {
624  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
625  if (target_sp->ResolveLoadAddress(vm_addr, addr))
626  return sb_addr;
627  }
628 
629  // We have a load address that isn't in a section, just return an address
630  // with the offset filled in (the address) and the section set to NULL
631  addr.SetRawAddress(vm_addr);
632  return sb_addr;
633 }
634 
637  uint32_t resolve_scope) {
638  LLDB_INSTRUMENT_VA(this, addr, resolve_scope);
639 
640  SBSymbolContext sc;
641  SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
642  if (addr.IsValid()) {
643  TargetSP target_sp(GetSP());
644  if (target_sp)
645  target_sp->GetImages().ResolveSymbolContextForAddress(addr.ref(), scope,
646  sc.ref());
647  }
648  return sc;
649 }
650 
651 size_t SBTarget::ReadMemory(const SBAddress addr, void *buf, size_t size,
652  lldb::SBError &error) {
653  LLDB_INSTRUMENT_VA(this, addr, buf, size, error);
654 
655  SBError sb_error;
656  size_t bytes_read = 0;
657  TargetSP target_sp(GetSP());
658  if (target_sp) {
659  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
660  bytes_read =
661  target_sp->ReadMemory(addr.ref(), buf, size, sb_error.ref(), true);
662  } else {
663  sb_error.SetErrorString("invalid target");
664  }
665 
666  return bytes_read;
667 }
668 
670  uint32_t line) {
671  LLDB_INSTRUMENT_VA(this, file, line);
672 
673  return SBBreakpoint(
674  BreakpointCreateByLocation(SBFileSpec(file, false), line));
675 }
676 
679  uint32_t line) {
680  LLDB_INSTRUMENT_VA(this, sb_file_spec, line);
681 
682  return BreakpointCreateByLocation(sb_file_spec, line, 0);
683 }
684 
687  uint32_t line, lldb::addr_t offset) {
688  LLDB_INSTRUMENT_VA(this, sb_file_spec, line, offset);
689 
690  SBFileSpecList empty_list;
691  return BreakpointCreateByLocation(sb_file_spec, line, offset, empty_list);
692 }
693 
696  uint32_t line, lldb::addr_t offset,
697  SBFileSpecList &sb_module_list) {
698  LLDB_INSTRUMENT_VA(this, sb_file_spec, line, offset, sb_module_list);
699 
700  return BreakpointCreateByLocation(sb_file_spec, line, 0, offset,
701  sb_module_list);
702 }
703 
705  const SBFileSpec &sb_file_spec, uint32_t line, uint32_t column,
706  lldb::addr_t offset, SBFileSpecList &sb_module_list) {
707  LLDB_INSTRUMENT_VA(this, sb_file_spec, line, column, offset, sb_module_list);
708 
709  SBBreakpoint sb_bp;
710  TargetSP target_sp(GetSP());
711  if (target_sp && line != 0) {
712  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
713 
714  const LazyBool check_inlines = eLazyBoolCalculate;
715  const LazyBool skip_prologue = eLazyBoolCalculate;
716  const bool internal = false;
717  const bool hardware = false;
718  const LazyBool move_to_nearest_code = eLazyBoolCalculate;
719  const FileSpecList *module_list = nullptr;
720  if (sb_module_list.GetSize() > 0) {
721  module_list = sb_module_list.get();
722  }
723  sb_bp = target_sp->CreateBreakpoint(
724  module_list, *sb_file_spec, line, column, offset, check_inlines,
725  skip_prologue, internal, hardware, move_to_nearest_code);
726  }
727 
728  return sb_bp;
729 }
730 
732  const SBFileSpec &sb_file_spec, uint32_t line, uint32_t column,
733  lldb::addr_t offset, SBFileSpecList &sb_module_list,
734  bool move_to_nearest_code) {
735  LLDB_INSTRUMENT_VA(this, sb_file_spec, line, column, offset, sb_module_list,
736  move_to_nearest_code);
737 
738  SBBreakpoint sb_bp;
739  TargetSP target_sp(GetSP());
740  if (target_sp && line != 0) {
741  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
742 
743  const LazyBool check_inlines = eLazyBoolCalculate;
744  const LazyBool skip_prologue = eLazyBoolCalculate;
745  const bool internal = false;
746  const bool hardware = false;
747  const FileSpecList *module_list = nullptr;
748  if (sb_module_list.GetSize() > 0) {
749  module_list = sb_module_list.get();
750  }
751  sb_bp = target_sp->CreateBreakpoint(
752  module_list, *sb_file_spec, line, column, offset, check_inlines,
753  skip_prologue, internal, hardware,
754  move_to_nearest_code ? eLazyBoolYes : eLazyBoolNo);
755  }
756 
757  return sb_bp;
758 }
759 
761  const char *module_name) {
762  LLDB_INSTRUMENT_VA(this, symbol_name, module_name);
763 
764  SBBreakpoint sb_bp;
765  TargetSP target_sp(GetSP());
766  if (target_sp.get()) {
767  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
768 
769  const bool internal = false;
770  const bool hardware = false;
771  const LazyBool skip_prologue = eLazyBoolCalculate;
772  const lldb::addr_t offset = 0;
773  if (module_name && module_name[0]) {
774  FileSpecList module_spec_list;
775  module_spec_list.Append(FileSpec(module_name));
776  sb_bp = target_sp->CreateBreakpoint(
777  &module_spec_list, nullptr, symbol_name, eFunctionNameTypeAuto,
778  eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
779  } else {
780  sb_bp = target_sp->CreateBreakpoint(
781  nullptr, nullptr, symbol_name, eFunctionNameTypeAuto,
782  eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
783  }
784  }
785 
786  return sb_bp;
787 }
788 
790 SBTarget::BreakpointCreateByName(const char *symbol_name,
791  const SBFileSpecList &module_list,
792  const SBFileSpecList &comp_unit_list) {
793  LLDB_INSTRUMENT_VA(this, symbol_name, module_list, comp_unit_list);
794 
795  lldb::FunctionNameType name_type_mask = eFunctionNameTypeAuto;
796  return BreakpointCreateByName(symbol_name, name_type_mask,
797  eLanguageTypeUnknown, module_list,
798  comp_unit_list);
799 }
800 
802  const char *symbol_name, uint32_t name_type_mask,
803  const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list) {
804  LLDB_INSTRUMENT_VA(this, symbol_name, name_type_mask, module_list,
805  comp_unit_list);
806 
807  return BreakpointCreateByName(symbol_name, name_type_mask,
808  eLanguageTypeUnknown, module_list,
809  comp_unit_list);
810 }
811 
813  const char *symbol_name, uint32_t name_type_mask,
814  LanguageType symbol_language, const SBFileSpecList &module_list,
815  const SBFileSpecList &comp_unit_list) {
816  LLDB_INSTRUMENT_VA(this, symbol_name, name_type_mask, symbol_language,
817  module_list, comp_unit_list);
818 
819  SBBreakpoint sb_bp;
820  TargetSP target_sp(GetSP());
821  if (target_sp && symbol_name && symbol_name[0]) {
822  const bool internal = false;
823  const bool hardware = false;
824  const LazyBool skip_prologue = eLazyBoolCalculate;
825  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
826  FunctionNameType mask = static_cast<FunctionNameType>(name_type_mask);
827  sb_bp = target_sp->CreateBreakpoint(module_list.get(), comp_unit_list.get(),
828  symbol_name, mask, symbol_language, 0,
829  skip_prologue, internal, hardware);
830  }
831 
832  return sb_bp;
833 }
834 
836  const char *symbol_names[], uint32_t num_names, uint32_t name_type_mask,
837  const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list) {
838  LLDB_INSTRUMENT_VA(this, symbol_names, num_names, name_type_mask, module_list,
839  comp_unit_list);
840 
841  return BreakpointCreateByNames(symbol_names, num_names, name_type_mask,
842  eLanguageTypeUnknown, module_list,
843  comp_unit_list);
844 }
845 
847  const char *symbol_names[], uint32_t num_names, uint32_t name_type_mask,
848  LanguageType symbol_language, const SBFileSpecList &module_list,
849  const SBFileSpecList &comp_unit_list) {
850  LLDB_INSTRUMENT_VA(this, symbol_names, num_names, name_type_mask,
851  symbol_language, module_list, comp_unit_list);
852 
853  return BreakpointCreateByNames(symbol_names, num_names, name_type_mask,
854  eLanguageTypeUnknown, 0, module_list,
855  comp_unit_list);
856 }
857 
859  const char *symbol_names[], uint32_t num_names, uint32_t name_type_mask,
860  LanguageType symbol_language, lldb::addr_t offset,
861  const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list) {
862  LLDB_INSTRUMENT_VA(this, symbol_names, num_names, name_type_mask,
863  symbol_language, offset, module_list, comp_unit_list);
864 
865  SBBreakpoint sb_bp;
866  TargetSP target_sp(GetSP());
867  if (target_sp && num_names > 0) {
868  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
869  const bool internal = false;
870  const bool hardware = false;
871  FunctionNameType mask = static_cast<FunctionNameType>(name_type_mask);
872  const LazyBool skip_prologue = eLazyBoolCalculate;
873  sb_bp = target_sp->CreateBreakpoint(
874  module_list.get(), comp_unit_list.get(), symbol_names, num_names, mask,
875  symbol_language, offset, skip_prologue, internal, hardware);
876  }
877 
878  return sb_bp;
879 }
880 
881 SBBreakpoint SBTarget::BreakpointCreateByRegex(const char *symbol_name_regex,
882  const char *module_name) {
883  LLDB_INSTRUMENT_VA(this, symbol_name_regex, module_name);
884 
885  SBFileSpecList module_spec_list;
886  SBFileSpecList comp_unit_list;
887  if (module_name && module_name[0]) {
888  module_spec_list.Append(FileSpec(module_name));
889  }
890  return BreakpointCreateByRegex(symbol_name_regex, eLanguageTypeUnknown,
891  module_spec_list, comp_unit_list);
892 }
893 
895 SBTarget::BreakpointCreateByRegex(const char *symbol_name_regex,
896  const SBFileSpecList &module_list,
897  const SBFileSpecList &comp_unit_list) {
898  LLDB_INSTRUMENT_VA(this, symbol_name_regex, module_list, comp_unit_list);
899 
900  return BreakpointCreateByRegex(symbol_name_regex, eLanguageTypeUnknown,
901  module_list, comp_unit_list);
902 }
903 
905  const char *symbol_name_regex, LanguageType symbol_language,
906  const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list) {
907  LLDB_INSTRUMENT_VA(this, symbol_name_regex, symbol_language, module_list,
908  comp_unit_list);
909 
910  SBBreakpoint sb_bp;
911  TargetSP target_sp(GetSP());
912  if (target_sp && symbol_name_regex && symbol_name_regex[0]) {
913  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
914  RegularExpression regexp((llvm::StringRef(symbol_name_regex)));
915  const bool internal = false;
916  const bool hardware = false;
917  const LazyBool skip_prologue = eLazyBoolCalculate;
918 
919  sb_bp = target_sp->CreateFuncRegexBreakpoint(
920  module_list.get(), comp_unit_list.get(), std::move(regexp),
921  symbol_language, skip_prologue, internal, hardware);
922  }
923 
924  return sb_bp;
925 }
926 
928  LLDB_INSTRUMENT_VA(this, address);
929 
930  SBBreakpoint sb_bp;
931  TargetSP target_sp(GetSP());
932  if (target_sp) {
933  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
934  const bool hardware = false;
935  sb_bp = target_sp->CreateBreakpoint(address, false, hardware);
936  }
937 
938  return sb_bp;
939 }
940 
942  LLDB_INSTRUMENT_VA(this, sb_address);
943 
944  SBBreakpoint sb_bp;
945  TargetSP target_sp(GetSP());
946  if (!sb_address.IsValid()) {
947  return sb_bp;
948  }
949 
950  if (target_sp) {
951  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
952  const bool hardware = false;
953  sb_bp = target_sp->CreateBreakpoint(sb_address.ref(), false, hardware);
954  }
955 
956  return sb_bp;
957 }
958 
961  const lldb::SBFileSpec &source_file,
962  const char *module_name) {
963  LLDB_INSTRUMENT_VA(this, source_regex, source_file, module_name);
964 
965  SBFileSpecList module_spec_list;
966 
967  if (module_name && module_name[0]) {
968  module_spec_list.Append(FileSpec(module_name));
969  }
970 
971  SBFileSpecList source_file_list;
972  if (source_file.IsValid()) {
973  source_file_list.Append(source_file);
974  }
975 
976  return BreakpointCreateBySourceRegex(source_regex, module_spec_list,
977  source_file_list);
978 }
979 
981  const char *source_regex, const SBFileSpecList &module_list,
982  const lldb::SBFileSpecList &source_file_list) {
983  LLDB_INSTRUMENT_VA(this, source_regex, module_list, source_file_list);
984 
985  return BreakpointCreateBySourceRegex(source_regex, module_list,
986  source_file_list, SBStringList());
987 }
988 
990  const char *source_regex, const SBFileSpecList &module_list,
991  const lldb::SBFileSpecList &source_file_list,
992  const SBStringList &func_names) {
993  LLDB_INSTRUMENT_VA(this, source_regex, module_list, source_file_list,
994  func_names);
995 
996  SBBreakpoint sb_bp;
997  TargetSP target_sp(GetSP());
998  if (target_sp && source_regex && source_regex[0]) {
999  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1000  const bool hardware = false;
1001  const LazyBool move_to_nearest_code = eLazyBoolCalculate;
1002  RegularExpression regexp((llvm::StringRef(source_regex)));
1003  std::unordered_set<std::string> func_names_set;
1004  for (size_t i = 0; i < func_names.GetSize(); i++) {
1005  func_names_set.insert(func_names.GetStringAtIndex(i));
1006  }
1007 
1008  sb_bp = target_sp->CreateSourceRegexBreakpoint(
1009  module_list.get(), source_file_list.get(), func_names_set,
1010  std::move(regexp), false, hardware, move_to_nearest_code);
1011  }
1012 
1013  return sb_bp;
1014 }
1015 
1018  bool catch_bp, bool throw_bp) {
1019  LLDB_INSTRUMENT_VA(this, language, catch_bp, throw_bp);
1020 
1021  SBBreakpoint sb_bp;
1022  TargetSP target_sp(GetSP());
1023  if (target_sp) {
1024  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1025  const bool hardware = false;
1026  sb_bp = target_sp->CreateExceptionBreakpoint(language, catch_bp, throw_bp,
1027  hardware);
1028  }
1029 
1030  return sb_bp;
1031 }
1032 
1034  const char *class_name, SBStructuredData &extra_args,
1035  const SBFileSpecList &module_list, const SBFileSpecList &file_list,
1036  bool request_hardware) {
1037  LLDB_INSTRUMENT_VA(this, class_name, extra_args, module_list, file_list,
1038  request_hardware);
1039 
1040  SBBreakpoint sb_bp;
1041  TargetSP target_sp(GetSP());
1042  if (target_sp) {
1043  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1044  Status error;
1045 
1046  StructuredData::ObjectSP obj_sp = extra_args.m_impl_up->GetObjectSP();
1047  sb_bp =
1048  target_sp->CreateScriptedBreakpoint(class_name,
1049  module_list.get(),
1050  file_list.get(),
1051  false, /* internal */
1052  request_hardware,
1053  obj_sp,
1054  &error);
1055  }
1056 
1057  return sb_bp;
1058 }
1059 
1061  LLDB_INSTRUMENT_VA(this);
1062 
1063  TargetSP target_sp(GetSP());
1064  if (target_sp) {
1065  // The breakpoint list is thread safe, no need to lock
1066  return target_sp->GetBreakpointList().GetSize();
1067  }
1068  return 0;
1069 }
1070 
1072  LLDB_INSTRUMENT_VA(this, idx);
1073 
1074  SBBreakpoint sb_breakpoint;
1075  TargetSP target_sp(GetSP());
1076  if (target_sp) {
1077  // The breakpoint list is thread safe, no need to lock
1078  sb_breakpoint = target_sp->GetBreakpointList().GetBreakpointAtIndex(idx);
1079  }
1080  return sb_breakpoint;
1081 }
1082 
1084  LLDB_INSTRUMENT_VA(this, bp_id);
1085 
1086  bool result = false;
1087  TargetSP target_sp(GetSP());
1088  if (target_sp) {
1089  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1090  result = target_sp->RemoveBreakpointByID(bp_id);
1091  }
1092 
1093  return result;
1094 }
1095 
1097  LLDB_INSTRUMENT_VA(this, bp_id);
1098 
1099  SBBreakpoint sb_breakpoint;
1100  TargetSP target_sp(GetSP());
1101  if (target_sp && bp_id != LLDB_INVALID_BREAK_ID) {
1102  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1103  sb_breakpoint = target_sp->GetBreakpointByID(bp_id);
1104  }
1105 
1106  return sb_breakpoint;
1107 }
1108 
1109 bool SBTarget::FindBreakpointsByName(const char *name,
1110  SBBreakpointList &bkpts) {
1111  LLDB_INSTRUMENT_VA(this, name, bkpts);
1112 
1113  TargetSP target_sp(GetSP());
1114  if (target_sp) {
1115  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1116  llvm::Expected<std::vector<BreakpointSP>> expected_vector =
1117  target_sp->GetBreakpointList().FindBreakpointsByName(name);
1118  if (!expected_vector) {
1119  LLDB_LOG(GetLog(LLDBLog::Breakpoints), "invalid breakpoint name: {}",
1120  llvm::toString(expected_vector.takeError()));
1121  return false;
1122  }
1123  for (BreakpointSP bkpt_sp : *expected_vector) {
1124  bkpts.AppendByID(bkpt_sp->GetID());
1125  }
1126  }
1127  return true;
1128 }
1129 
1131  LLDB_INSTRUMENT_VA(this, names);
1132 
1133  names.Clear();
1134 
1135  TargetSP target_sp(GetSP());
1136  if (target_sp) {
1137  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1138 
1139  std::vector<std::string> name_vec;
1140  target_sp->GetBreakpointNames(name_vec);
1141  for (auto name : name_vec)
1142  names.AppendString(name.c_str());
1143  }
1144 }
1145 
1146 void SBTarget::DeleteBreakpointName(const char *name) {
1147  LLDB_INSTRUMENT_VA(this, name);
1148 
1149  TargetSP target_sp(GetSP());
1150  if (target_sp) {
1151  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1152  target_sp->DeleteBreakpointName(ConstString(name));
1153  }
1154 }
1155 
1157  LLDB_INSTRUMENT_VA(this);
1158 
1159  TargetSP target_sp(GetSP());
1160  if (target_sp) {
1161  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1162  target_sp->EnableAllowedBreakpoints();
1163  return true;
1164  }
1165  return false;
1166 }
1167 
1169  LLDB_INSTRUMENT_VA(this);
1170 
1171  TargetSP target_sp(GetSP());
1172  if (target_sp) {
1173  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1174  target_sp->DisableAllowedBreakpoints();
1175  return true;
1176  }
1177  return false;
1178 }
1179 
1181  LLDB_INSTRUMENT_VA(this);
1182 
1183  TargetSP target_sp(GetSP());
1184  if (target_sp) {
1185  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1186  target_sp->RemoveAllowedBreakpoints();
1187  return true;
1188  }
1189  return false;
1190 }
1191 
1193  SBBreakpointList &new_bps) {
1194  LLDB_INSTRUMENT_VA(this, source_file, new_bps);
1195 
1196  SBStringList empty_name_list;
1197  return BreakpointsCreateFromFile(source_file, empty_name_list, new_bps);
1198 }
1199 
1201  SBStringList &matching_names,
1202  SBBreakpointList &new_bps) {
1203  LLDB_INSTRUMENT_VA(this, source_file, matching_names, new_bps);
1204 
1205  SBError sberr;
1206  TargetSP target_sp(GetSP());
1207  if (!target_sp) {
1208  sberr.SetErrorString(
1209  "BreakpointCreateFromFile called with invalid target.");
1210  return sberr;
1211  }
1212  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1213 
1214  BreakpointIDList bp_ids;
1215 
1216  std::vector<std::string> name_vector;
1217  size_t num_names = matching_names.GetSize();
1218  for (size_t i = 0; i < num_names; i++)
1219  name_vector.push_back(matching_names.GetStringAtIndex(i));
1220 
1221  sberr.ref() = target_sp->CreateBreakpointsFromFile(source_file.ref(),
1222  name_vector, bp_ids);
1223  if (sberr.Fail())
1224  return sberr;
1225 
1226  size_t num_bkpts = bp_ids.GetSize();
1227  for (size_t i = 0; i < num_bkpts; i++) {
1228  BreakpointID bp_id = bp_ids.GetBreakpointIDAtIndex(i);
1229  new_bps.AppendByID(bp_id.GetBreakpointID());
1230  }
1231  return sberr;
1232 }
1233 
1235  LLDB_INSTRUMENT_VA(this, dest_file);
1236 
1237  SBError sberr;
1238  TargetSP target_sp(GetSP());
1239  if (!target_sp) {
1240  sberr.SetErrorString("BreakpointWriteToFile called with invalid target.");
1241  return sberr;
1242  }
1243  SBBreakpointList bkpt_list(*this);
1244  return BreakpointsWriteToFile(dest_file, bkpt_list);
1245 }
1246 
1248  SBBreakpointList &bkpt_list,
1249  bool append) {
1250  LLDB_INSTRUMENT_VA(this, dest_file, bkpt_list, append);
1251 
1252  SBError sberr;
1253  TargetSP target_sp(GetSP());
1254  if (!target_sp) {
1255  sberr.SetErrorString("BreakpointWriteToFile called with invalid target.");
1256  return sberr;
1257  }
1258 
1259  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1260  BreakpointIDList bp_id_list;
1261  bkpt_list.CopyToBreakpointIDList(bp_id_list);
1262  sberr.ref() = target_sp->SerializeBreakpointsToFile(dest_file.ref(),
1263  bp_id_list, append);
1264  return sberr;
1265 }
1266 
1268  LLDB_INSTRUMENT_VA(this);
1269 
1270  TargetSP target_sp(GetSP());
1271  if (target_sp) {
1272  // The watchpoint list is thread safe, no need to lock
1273  return target_sp->GetWatchpointList().GetSize();
1274  }
1275  return 0;
1276 }
1277 
1279  LLDB_INSTRUMENT_VA(this, idx);
1280 
1281  SBWatchpoint sb_watchpoint;
1282  TargetSP target_sp(GetSP());
1283  if (target_sp) {
1284  // The watchpoint list is thread safe, no need to lock
1285  sb_watchpoint.SetSP(target_sp->GetWatchpointList().GetByIndex(idx));
1286  }
1287  return sb_watchpoint;
1288 }
1289 
1291  LLDB_INSTRUMENT_VA(this, wp_id);
1292 
1293  bool result = false;
1294  TargetSP target_sp(GetSP());
1295  if (target_sp) {
1296  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1297  std::unique_lock<std::recursive_mutex> lock;
1298  target_sp->GetWatchpointList().GetListMutex(lock);
1299  result = target_sp->RemoveWatchpointByID(wp_id);
1300  }
1301 
1302  return result;
1303 }
1304 
1306  LLDB_INSTRUMENT_VA(this, wp_id);
1307 
1308  SBWatchpoint sb_watchpoint;
1309  lldb::WatchpointSP watchpoint_sp;
1310  TargetSP target_sp(GetSP());
1311  if (target_sp && wp_id != LLDB_INVALID_WATCH_ID) {
1312  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1313  std::unique_lock<std::recursive_mutex> lock;
1314  target_sp->GetWatchpointList().GetListMutex(lock);
1315  watchpoint_sp = target_sp->GetWatchpointList().FindByID(wp_id);
1316  sb_watchpoint.SetSP(watchpoint_sp);
1317  }
1318 
1319  return sb_watchpoint;
1320 }
1321 
1323  bool read, bool write,
1324  SBError &error) {
1325  LLDB_INSTRUMENT_VA(this, addr, size, read, write, error);
1326 
1327  SBWatchpoint sb_watchpoint;
1328  lldb::WatchpointSP watchpoint_sp;
1329  TargetSP target_sp(GetSP());
1330  if (target_sp && (read || write) && addr != LLDB_INVALID_ADDRESS &&
1331  size > 0) {
1332  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1333  uint32_t watch_type = 0;
1334  if (read)
1335  watch_type |= LLDB_WATCH_TYPE_READ;
1336  if (write)
1337  watch_type |= LLDB_WATCH_TYPE_WRITE;
1338  if (watch_type == 0) {
1339  error.SetErrorString(
1340  "Can't create a watchpoint that is neither read nor write.");
1341  return sb_watchpoint;
1342  }
1343 
1344  // Target::CreateWatchpoint() is thread safe.
1345  Status cw_error;
1346  // This API doesn't take in a type, so we can't figure out what it is.
1347  CompilerType *type = nullptr;
1348  watchpoint_sp =
1349  target_sp->CreateWatchpoint(addr, size, type, watch_type, cw_error);
1350  error.SetError(cw_error);
1351  sb_watchpoint.SetSP(watchpoint_sp);
1352  }
1353 
1354  return sb_watchpoint;
1355 }
1356 
1358  LLDB_INSTRUMENT_VA(this);
1359 
1360  TargetSP target_sp(GetSP());
1361  if (target_sp) {
1362  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1363  std::unique_lock<std::recursive_mutex> lock;
1364  target_sp->GetWatchpointList().GetListMutex(lock);
1365  target_sp->EnableAllWatchpoints();
1366  return true;
1367  }
1368  return false;
1369 }
1370 
1372  LLDB_INSTRUMENT_VA(this);
1373 
1374  TargetSP target_sp(GetSP());
1375  if (target_sp) {
1376  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1377  std::unique_lock<std::recursive_mutex> lock;
1378  target_sp->GetWatchpointList().GetListMutex(lock);
1379  target_sp->DisableAllWatchpoints();
1380  return true;
1381  }
1382  return false;
1383 }
1384 
1386  SBType type) {
1387  LLDB_INSTRUMENT_VA(this, name, addr, type);
1388 
1389  SBValue sb_value;
1390  lldb::ValueObjectSP new_value_sp;
1391  if (IsValid() && name && *name && addr.IsValid() && type.IsValid()) {
1392  lldb::addr_t load_addr(addr.GetLoadAddress(*this));
1393  ExecutionContext exe_ctx(
1395  CompilerType ast_type(type.GetSP()->GetCompilerType(true));
1396  new_value_sp = ValueObject::CreateValueObjectFromAddress(name, load_addr,
1397  exe_ctx, ast_type);
1398  }
1399  sb_value.SetSP(new_value_sp);
1400  return sb_value;
1401 }
1402 
1404  lldb::SBType type) {
1405  LLDB_INSTRUMENT_VA(this, name, data, type);
1406 
1407  SBValue sb_value;
1408  lldb::ValueObjectSP new_value_sp;
1409  if (IsValid() && name && *name && data.IsValid() && type.IsValid()) {
1410  DataExtractorSP extractor(*data);
1411  ExecutionContext exe_ctx(
1413  CompilerType ast_type(type.GetSP()->GetCompilerType(true));
1414  new_value_sp = ValueObject::CreateValueObjectFromData(name, *extractor,
1415  exe_ctx, ast_type);
1416  }
1417  sb_value.SetSP(new_value_sp);
1418  return sb_value;
1419 }
1420 
1422  const char *expr) {
1423  LLDB_INSTRUMENT_VA(this, name, expr);
1424 
1425  SBValue sb_value;
1426  lldb::ValueObjectSP new_value_sp;
1427  if (IsValid() && name && *name && expr && *expr) {
1428  ExecutionContext exe_ctx(
1430  new_value_sp =
1431  ValueObject::CreateValueObjectFromExpression(name, expr, exe_ctx);
1432  }
1433  sb_value.SetSP(new_value_sp);
1434  return sb_value;
1435 }
1436 
1438  LLDB_INSTRUMENT_VA(this);
1439 
1440  TargetSP target_sp(GetSP());
1441  if (target_sp) {
1442  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1443  std::unique_lock<std::recursive_mutex> lock;
1444  target_sp->GetWatchpointList().GetListMutex(lock);
1445  target_sp->RemoveAllWatchpoints();
1446  return true;
1447  }
1448  return false;
1449 }
1450 
1451 void SBTarget::AppendImageSearchPath(const char *from, const char *to,
1452  lldb::SBError &error) {
1453  LLDB_INSTRUMENT_VA(this, from, to, error);
1454 
1455  TargetSP target_sp(GetSP());
1456  if (!target_sp)
1457  return error.SetErrorString("invalid target");
1458 
1459  llvm::StringRef srFrom = from, srTo = to;
1460  if (srFrom.empty())
1461  return error.SetErrorString("<from> path can't be empty");
1462  if (srTo.empty())
1463  return error.SetErrorString("<to> path can't be empty");
1464 
1465  target_sp->GetImageSearchPathList().Append(srFrom, srTo, true);
1466 }
1467 
1468 lldb::SBModule SBTarget::AddModule(const char *path, const char *triple,
1469  const char *uuid_cstr) {
1470  LLDB_INSTRUMENT_VA(this, path, triple, uuid_cstr);
1471 
1472  return AddModule(path, triple, uuid_cstr, nullptr);
1473 }
1474 
1475 lldb::SBModule SBTarget::AddModule(const char *path, const char *triple,
1476  const char *uuid_cstr, const char *symfile) {
1477  LLDB_INSTRUMENT_VA(this, path, triple, uuid_cstr, symfile);
1478 
1479  lldb::SBModule sb_module;
1480  TargetSP target_sp(GetSP());
1481  if (target_sp) {
1482  ModuleSpec module_spec;
1483  if (path)
1484  module_spec.GetFileSpec().SetFile(path, FileSpec::Style::native);
1485 
1486  if (uuid_cstr)
1487  module_spec.GetUUID().SetFromStringRef(uuid_cstr);
1488 
1489  if (triple)
1490  module_spec.GetArchitecture() = Platform::GetAugmentedArchSpec(
1491  target_sp->GetPlatform().get(), triple);
1492  else
1493  module_spec.GetArchitecture() = target_sp->GetArchitecture();
1494 
1495  if (symfile)
1496  module_spec.GetSymbolFileSpec().SetFile(symfile, FileSpec::Style::native);
1497 
1498  sb_module.SetSP(target_sp->GetOrCreateModule(module_spec, true /* notify */));
1499  }
1500  return sb_module;
1501 }
1502 
1504  LLDB_INSTRUMENT_VA(this, module_spec);
1505 
1506  lldb::SBModule sb_module;
1507  TargetSP target_sp(GetSP());
1508  if (target_sp)
1509  sb_module.SetSP(target_sp->GetOrCreateModule(*module_spec.m_opaque_up,
1510  true /* notify */));
1511  return sb_module;
1512 }
1513 
1515  LLDB_INSTRUMENT_VA(this, module);
1516 
1517  TargetSP target_sp(GetSP());
1518  if (target_sp) {
1519  target_sp->GetImages().AppendIfNeeded(module.GetSP());
1520  return true;
1521  }
1522  return false;
1523 }
1524 
1526  LLDB_INSTRUMENT_VA(this);
1527 
1528  uint32_t num = 0;
1529  TargetSP target_sp(GetSP());
1530  if (target_sp) {
1531  // The module list is thread safe, no need to lock
1532  num = target_sp->GetImages().GetSize();
1533  }
1534 
1535  return num;
1536 }
1537 
1539  LLDB_INSTRUMENT_VA(this);
1540 
1541  m_opaque_sp.reset();
1542 }
1543 
1545  LLDB_INSTRUMENT_VA(this, sb_file_spec);
1546 
1547  SBModule sb_module;
1548  TargetSP target_sp(GetSP());
1549  if (target_sp && sb_file_spec.IsValid()) {
1550  ModuleSpec module_spec(*sb_file_spec);
1551  // The module list is thread safe, no need to lock
1552  sb_module.SetSP(target_sp->GetImages().FindFirstModule(module_spec));
1553  }
1554  return sb_module;
1555 }
1556 
1558  LLDB_INSTRUMENT_VA(this, sb_file_spec);
1559 
1560  SBSymbolContextList sb_sc_list;
1561  const TargetSP target_sp(GetSP());
1562  if (target_sp && sb_file_spec.IsValid())
1563  target_sp->GetImages().FindCompileUnits(*sb_file_spec, *sb_sc_list);
1564  return sb_sc_list;
1565 }
1566 
1568  LLDB_INSTRUMENT_VA(this);
1569 
1570  TargetSP target_sp(GetSP());
1571  if (target_sp)
1572  return target_sp->GetArchitecture().GetByteOrder();
1573  return eByteOrderInvalid;
1574 }
1575 
1576 const char *SBTarget::GetTriple() {
1577  LLDB_INSTRUMENT_VA(this);
1578 
1579  TargetSP target_sp(GetSP());
1580  if (target_sp) {
1581  std::string triple(target_sp->GetArchitecture().GetTriple().str());
1582  // Unique the string so we don't run into ownership issues since the const
1583  // strings put the string into the string pool once and the strings never
1584  // comes out
1585  ConstString const_triple(triple.c_str());
1586  return const_triple.GetCString();
1587  }
1588  return nullptr;
1589 }
1590 
1591 const char *SBTarget::GetABIName() {
1592  LLDB_INSTRUMENT_VA(this);
1593 
1594  TargetSP target_sp(GetSP());
1595  if (target_sp) {
1596  std::string abi_name(target_sp->GetABIName().str());
1597  ConstString const_name(abi_name.c_str());
1598  return const_name.GetCString();
1599  }
1600  return nullptr;
1601 }
1602 
1604  LLDB_INSTRUMENT_VA(this);
1605 
1606  TargetSP target_sp(GetSP());
1607  if (target_sp) {
1608  return target_sp->GetArchitecture().GetDataByteSize();
1609  }
1610  return 0;
1611 }
1612 
1614  LLDB_INSTRUMENT_VA(this);
1615 
1616  TargetSP target_sp(GetSP());
1617  if (target_sp) {
1618  return target_sp->GetArchitecture().GetCodeByteSize();
1619  }
1620  return 0;
1621 }
1622 
1624  LLDB_INSTRUMENT_VA(this);
1625 
1626  TargetSP target_sp(GetSP());
1627  if(target_sp){
1628  return target_sp->GetMaximumNumberOfChildrenToDisplay();
1629  }
1630  return 0;
1631 }
1632 
1634  LLDB_INSTRUMENT_VA(this);
1635 
1636  TargetSP target_sp(GetSP());
1637  if (target_sp)
1638  return target_sp->GetArchitecture().GetAddressByteSize();
1639  return sizeof(void *);
1640 }
1641 
1643  LLDB_INSTRUMENT_VA(this, idx);
1644 
1645  SBModule sb_module;
1646  ModuleSP module_sp;
1647  TargetSP target_sp(GetSP());
1648  if (target_sp) {
1649  // The module list is thread safe, no need to lock
1650  module_sp = target_sp->GetImages().GetModuleAtIndex(idx);
1651  sb_module.SetSP(module_sp);
1652  }
1653 
1654  return sb_module;
1655 }
1656 
1658  LLDB_INSTRUMENT_VA(this, module);
1659 
1660  TargetSP target_sp(GetSP());
1661  if (target_sp)
1662  return target_sp->GetImages().Remove(module.GetSP());
1663  return false;
1664 }
1665 
1667  LLDB_INSTRUMENT_VA(this);
1668 
1669  TargetSP target_sp(GetSP());
1670  SBBroadcaster broadcaster(target_sp.get(), false);
1671 
1672  return broadcaster;
1673 }
1674 
1676  lldb::DescriptionLevel description_level) {
1677  LLDB_INSTRUMENT_VA(this, description, description_level);
1678 
1679  Stream &strm = description.ref();
1680 
1681  TargetSP target_sp(GetSP());
1682  if (target_sp) {
1683  target_sp->Dump(&strm, description_level);
1684  } else
1685  strm.PutCString("No value");
1686 
1687  return true;
1688 }
1689 
1691  uint32_t name_type_mask) {
1692  LLDB_INSTRUMENT_VA(this, name, name_type_mask);
1693 
1694  lldb::SBSymbolContextList sb_sc_list;
1695  if (!name || !name[0])
1696  return sb_sc_list;
1697 
1698  TargetSP target_sp(GetSP());
1699  if (!target_sp)
1700  return sb_sc_list;
1701 
1702  ModuleFunctionSearchOptions function_options;
1703  function_options.include_symbols = true;
1704  function_options.include_inlines = true;
1705 
1706  FunctionNameType mask = static_cast<FunctionNameType>(name_type_mask);
1707  target_sp->GetImages().FindFunctions(ConstString(name), mask,
1708  function_options, *sb_sc_list);
1709  return sb_sc_list;
1710 }
1711 
1713  uint32_t max_matches,
1714  MatchType matchtype) {
1715  LLDB_INSTRUMENT_VA(this, name, max_matches, matchtype);
1716 
1717  lldb::SBSymbolContextList sb_sc_list;
1718  if (name && name[0]) {
1719  llvm::StringRef name_ref(name);
1720  TargetSP target_sp(GetSP());
1721  if (target_sp) {
1722  ModuleFunctionSearchOptions function_options;
1723  function_options.include_symbols = true;
1724  function_options.include_inlines = true;
1725 
1726  std::string regexstr;
1727  switch (matchtype) {
1728  case eMatchTypeRegex:
1729  target_sp->GetImages().FindFunctions(RegularExpression(name_ref),
1730  function_options, *sb_sc_list);
1731  break;
1732  case eMatchTypeStartsWith:
1733  regexstr = llvm::Regex::escape(name) + ".*";
1734  target_sp->GetImages().FindFunctions(RegularExpression(regexstr),
1735  function_options, *sb_sc_list);
1736  break;
1737  default:
1738  target_sp->GetImages().FindFunctions(ConstString(name),
1739  eFunctionNameTypeAny,
1740  function_options, *sb_sc_list);
1741  break;
1742  }
1743  }
1744  }
1745  return sb_sc_list;
1746 }
1747 
1748 lldb::SBType SBTarget::FindFirstType(const char *typename_cstr) {
1749  LLDB_INSTRUMENT_VA(this, typename_cstr);
1750 
1751  TargetSP target_sp(GetSP());
1752  if (typename_cstr && typename_cstr[0] && target_sp) {
1753  ConstString const_typename(typename_cstr);
1754  SymbolContext sc;
1755  const bool exact_match = false;
1756 
1757  const ModuleList &module_list = target_sp->GetImages();
1758  size_t count = module_list.GetSize();
1759  for (size_t idx = 0; idx < count; idx++) {
1760  ModuleSP module_sp(module_list.GetModuleAtIndex(idx));
1761  if (module_sp) {
1762  TypeSP type_sp(
1763  module_sp->FindFirstType(sc, const_typename, exact_match));
1764  if (type_sp)
1765  return SBType(type_sp);
1766  }
1767  }
1768 
1769  // Didn't find the type in the symbols; Try the loaded language runtimes
1770  if (auto process_sp = target_sp->GetProcessSP()) {
1771  for (auto *runtime : process_sp->GetLanguageRuntimes()) {
1772  if (auto vendor = runtime->GetDeclVendor()) {
1773  auto types = vendor->FindTypes(const_typename, /*max_matches*/ 1);
1774  if (!types.empty())
1775  return SBType(types.front());
1776  }
1777  }
1778  }
1779 
1780  // No matches, search for basic typename matches
1781  for (auto *type_system : target_sp->GetScratchTypeSystems())
1782  if (auto type = type_system->GetBuiltinTypeByName(const_typename))
1783  return SBType(type);
1784  }
1785 
1786  return SBType();
1787 }
1788 
1790  LLDB_INSTRUMENT_VA(this, type);
1791 
1792  TargetSP target_sp(GetSP());
1793  if (target_sp) {
1794  for (auto *type_system : target_sp->GetScratchTypeSystems())
1795  if (auto compiler_type = type_system->GetBasicTypeFromAST(type))
1796  return SBType(compiler_type);
1797  }
1798  return SBType();
1799 }
1800 
1801 lldb::SBTypeList SBTarget::FindTypes(const char *typename_cstr) {
1802  LLDB_INSTRUMENT_VA(this, typename_cstr);
1803 
1804  SBTypeList sb_type_list;
1805  TargetSP target_sp(GetSP());
1806  if (typename_cstr && typename_cstr[0] && target_sp) {
1807  ModuleList &images = target_sp->GetImages();
1808  ConstString const_typename(typename_cstr);
1809  bool exact_match = false;
1810  TypeList type_list;
1811  llvm::DenseSet<SymbolFile *> searched_symbol_files;
1812  images.FindTypes(nullptr, const_typename, exact_match, UINT32_MAX,
1813  searched_symbol_files, type_list);
1814 
1815  for (size_t idx = 0; idx < type_list.GetSize(); idx++) {
1816  TypeSP type_sp(type_list.GetTypeAtIndex(idx));
1817  if (type_sp)
1818  sb_type_list.Append(SBType(type_sp));
1819  }
1820 
1821  // Try the loaded language runtimes
1822  if (auto process_sp = target_sp->GetProcessSP()) {
1823  for (auto *runtime : process_sp->GetLanguageRuntimes()) {
1824  if (auto *vendor = runtime->GetDeclVendor()) {
1825  auto types =
1826  vendor->FindTypes(const_typename, /*max_matches*/ UINT32_MAX);
1827  for (auto type : types)
1828  sb_type_list.Append(SBType(type));
1829  }
1830  }
1831  }
1832 
1833  if (sb_type_list.GetSize() == 0) {
1834  // No matches, search for basic typename matches
1835  for (auto *type_system : target_sp->GetScratchTypeSystems())
1836  if (auto compiler_type =
1837  type_system->GetBuiltinTypeByName(const_typename))
1838  sb_type_list.Append(SBType(compiler_type));
1839  }
1840  }
1841  return sb_type_list;
1842 }
1843 
1845  uint32_t max_matches) {
1846  LLDB_INSTRUMENT_VA(this, name, max_matches);
1847 
1848  SBValueList sb_value_list;
1849 
1850  TargetSP target_sp(GetSP());
1851  if (name && target_sp) {
1852  VariableList variable_list;
1853  target_sp->GetImages().FindGlobalVariables(ConstString(name), max_matches,
1854  variable_list);
1855  if (!variable_list.Empty()) {
1856  ExecutionContextScope *exe_scope = target_sp->GetProcessSP().get();
1857  if (exe_scope == nullptr)
1858  exe_scope = target_sp.get();
1859  for (const VariableSP &var_sp : variable_list) {
1860  lldb::ValueObjectSP valobj_sp(
1861  ValueObjectVariable::Create(exe_scope, var_sp));
1862  if (valobj_sp)
1863  sb_value_list.Append(SBValue(valobj_sp));
1864  }
1865  }
1866  }
1867 
1868  return sb_value_list;
1869 }
1870 
1872  uint32_t max_matches,
1873  MatchType matchtype) {
1874  LLDB_INSTRUMENT_VA(this, name, max_matches, matchtype);
1875 
1876  SBValueList sb_value_list;
1877 
1878  TargetSP target_sp(GetSP());
1879  if (name && target_sp) {
1880  llvm::StringRef name_ref(name);
1881  VariableList variable_list;
1882 
1883  std::string regexstr;
1884  switch (matchtype) {
1885  case eMatchTypeNormal:
1886  target_sp->GetImages().FindGlobalVariables(ConstString(name), max_matches,
1887  variable_list);
1888  break;
1889  case eMatchTypeRegex:
1890  target_sp->GetImages().FindGlobalVariables(RegularExpression(name_ref),
1891  max_matches, variable_list);
1892  break;
1893  case eMatchTypeStartsWith:
1894  regexstr = llvm::Regex::escape(name) + ".*";
1895  target_sp->GetImages().FindGlobalVariables(RegularExpression(regexstr),
1896  max_matches, variable_list);
1897  break;
1898  }
1899  if (!variable_list.Empty()) {
1900  ExecutionContextScope *exe_scope = target_sp->GetProcessSP().get();
1901  if (exe_scope == nullptr)
1902  exe_scope = target_sp.get();
1903  for (const VariableSP &var_sp : variable_list) {
1904  lldb::ValueObjectSP valobj_sp(
1905  ValueObjectVariable::Create(exe_scope, var_sp));
1906  if (valobj_sp)
1907  sb_value_list.Append(SBValue(valobj_sp));
1908  }
1909  }
1910  }
1911 
1912  return sb_value_list;
1913 }
1914 
1916  LLDB_INSTRUMENT_VA(this, name);
1917 
1918  SBValueList sb_value_list(FindGlobalVariables(name, 1));
1919  if (sb_value_list.IsValid() && sb_value_list.GetSize() > 0)
1920  return sb_value_list.GetValueAtIndex(0);
1921  return SBValue();
1922 }
1923 
1925  LLDB_INSTRUMENT_VA(this);
1926 
1927  SBSourceManager source_manager(*this);
1928  return source_manager;
1929 }
1930 
1932  uint32_t count) {
1933  LLDB_INSTRUMENT_VA(this, base_addr, count);
1934 
1935  return ReadInstructions(base_addr, count, nullptr);
1936 }
1937 
1939  uint32_t count,
1940  const char *flavor_string) {
1941  LLDB_INSTRUMENT_VA(this, base_addr, count, flavor_string);
1942 
1943  SBInstructionList sb_instructions;
1944 
1945  TargetSP target_sp(GetSP());
1946  if (target_sp) {
1947  Address *addr_ptr = base_addr.get();
1948 
1949  if (addr_ptr) {
1950  DataBufferHeap data(
1951  target_sp->GetArchitecture().GetMaximumOpcodeByteSize() * count, 0);
1952  bool force_live_memory = true;
1954  lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
1955  const size_t bytes_read =
1956  target_sp->ReadMemory(*addr_ptr, data.GetBytes(), data.GetByteSize(),
1957  error, force_live_memory, &load_addr);
1958  const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
1959  sb_instructions.SetDisassembler(Disassembler::DisassembleBytes(
1960  target_sp->GetArchitecture(), nullptr, flavor_string, *addr_ptr,
1961  data.GetBytes(), bytes_read, count, data_from_file));
1962  }
1963  }
1964 
1965  return sb_instructions;
1966 }
1967 
1969  const void *buf,
1970  size_t size) {
1971  LLDB_INSTRUMENT_VA(this, base_addr, buf, size);
1972 
1973  return GetInstructionsWithFlavor(base_addr, nullptr, buf, size);
1974 }
1975 
1978  const char *flavor_string, const void *buf,
1979  size_t size) {
1980  LLDB_INSTRUMENT_VA(this, base_addr, flavor_string, buf, size);
1981 
1982  SBInstructionList sb_instructions;
1983 
1984  TargetSP target_sp(GetSP());
1985  if (target_sp) {
1986  Address addr;
1987 
1988  if (base_addr.get())
1989  addr = *base_addr.get();
1990 
1991  const bool data_from_file = true;
1992 
1993  sb_instructions.SetDisassembler(Disassembler::DisassembleBytes(
1994  target_sp->GetArchitecture(), nullptr, flavor_string, addr, buf, size,
1995  UINT32_MAX, data_from_file));
1996  }
1997 
1998  return sb_instructions;
1999 }
2000 
2002  const void *buf,
2003  size_t size) {
2004  LLDB_INSTRUMENT_VA(this, base_addr, buf, size);
2005 
2006  return GetInstructionsWithFlavor(ResolveLoadAddress(base_addr), nullptr, buf,
2007  size);
2008 }
2009 
2012  const char *flavor_string, const void *buf,
2013  size_t size) {
2014  LLDB_INSTRUMENT_VA(this, base_addr, flavor_string, buf, size);
2015 
2016  return GetInstructionsWithFlavor(ResolveLoadAddress(base_addr), flavor_string,
2017  buf, size);
2018 }
2019 
2021  lldb::addr_t section_base_addr) {
2022  LLDB_INSTRUMENT_VA(this, section, section_base_addr);
2023 
2024  SBError sb_error;
2025  TargetSP target_sp(GetSP());
2026  if (target_sp) {
2027  if (!section.IsValid()) {
2028  sb_error.SetErrorStringWithFormat("invalid section");
2029  } else {
2030  SectionSP section_sp(section.GetSP());
2031  if (section_sp) {
2032  if (section_sp->IsThreadSpecific()) {
2033  sb_error.SetErrorString(
2034  "thread specific sections are not yet supported");
2035  } else {
2036  ProcessSP process_sp(target_sp->GetProcessSP());
2037  if (target_sp->SetSectionLoadAddress(section_sp, section_base_addr)) {
2038  ModuleSP module_sp(section_sp->GetModule());
2039  if (module_sp) {
2040  ModuleList module_list;
2041  module_list.Append(module_sp);
2042  target_sp->ModulesDidLoad(module_list);
2043  }
2044  // Flush info in the process (stack frames, etc)
2045  if (process_sp)
2046  process_sp->Flush();
2047  }
2048  }
2049  }
2050  }
2051  } else {
2052  sb_error.SetErrorString("invalid target");
2053  }
2054  return sb_error;
2055 }
2056 
2058  LLDB_INSTRUMENT_VA(this, section);
2059 
2060  SBError sb_error;
2061 
2062  TargetSP target_sp(GetSP());
2063  if (target_sp) {
2064  if (!section.IsValid()) {
2065  sb_error.SetErrorStringWithFormat("invalid section");
2066  } else {
2067  SectionSP section_sp(section.GetSP());
2068  if (section_sp) {
2069  ProcessSP process_sp(target_sp->GetProcessSP());
2070  if (target_sp->SetSectionUnloaded(section_sp)) {
2071  ModuleSP module_sp(section_sp->GetModule());
2072  if (module_sp) {
2073  ModuleList module_list;
2074  module_list.Append(module_sp);
2075  target_sp->ModulesDidUnload(module_list, false);
2076  }
2077  // Flush info in the process (stack frames, etc)
2078  if (process_sp)
2079  process_sp->Flush();
2080  }
2081  } else {
2082  sb_error.SetErrorStringWithFormat("invalid section");
2083  }
2084  }
2085  } else {
2086  sb_error.SetErrorStringWithFormat("invalid target");
2087  }
2088  return sb_error;
2089 }
2090 
2092  int64_t slide_offset) {
2093  LLDB_INSTRUMENT_VA(this, module, slide_offset);
2094 
2095  SBError sb_error;
2096 
2097  TargetSP target_sp(GetSP());
2098  if (target_sp) {
2099  ModuleSP module_sp(module.GetSP());
2100  if (module_sp) {
2101  bool changed = false;
2102  if (module_sp->SetLoadAddress(*target_sp, slide_offset, true, changed)) {
2103  // The load was successful, make sure that at least some sections
2104  // changed before we notify that our module was loaded.
2105  if (changed) {
2106  ModuleList module_list;
2107  module_list.Append(module_sp);
2108  target_sp->ModulesDidLoad(module_list);
2109  // Flush info in the process (stack frames, etc)
2110  ProcessSP process_sp(target_sp->GetProcessSP());
2111  if (process_sp)
2112  process_sp->Flush();
2113  }
2114  }
2115  } else {
2116  sb_error.SetErrorStringWithFormat("invalid module");
2117  }
2118 
2119  } else {
2120  sb_error.SetErrorStringWithFormat("invalid target");
2121  }
2122  return sb_error;
2123 }
2124 
2126  LLDB_INSTRUMENT_VA(this, module);
2127 
2128  SBError sb_error;
2129 
2130  char path[PATH_MAX];
2131  TargetSP target_sp(GetSP());
2132  if (target_sp) {
2133  ModuleSP module_sp(module.GetSP());
2134  if (module_sp) {
2135  ObjectFile *objfile = module_sp->GetObjectFile();
2136  if (objfile) {
2137  SectionList *section_list = objfile->GetSectionList();
2138  if (section_list) {
2139  ProcessSP process_sp(target_sp->GetProcessSP());
2140 
2141  bool changed = false;
2142  const size_t num_sections = section_list->GetSize();
2143  for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx) {
2144  SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
2145  if (section_sp)
2146  changed |= target_sp->SetSectionUnloaded(section_sp);
2147  }
2148  if (changed) {
2149  ModuleList module_list;
2150  module_list.Append(module_sp);
2151  target_sp->ModulesDidUnload(module_list, false);
2152  // Flush info in the process (stack frames, etc)
2153  ProcessSP process_sp(target_sp->GetProcessSP());
2154  if (process_sp)
2155  process_sp->Flush();
2156  }
2157  } else {
2158  module_sp->GetFileSpec().GetPath(path, sizeof(path));
2159  sb_error.SetErrorStringWithFormat("no sections in object file '%s'",
2160  path);
2161  }
2162  } else {
2163  module_sp->GetFileSpec().GetPath(path, sizeof(path));
2164  sb_error.SetErrorStringWithFormat("no object file for module '%s'",
2165  path);
2166  }
2167  } else {
2168  sb_error.SetErrorStringWithFormat("invalid module");
2169  }
2170  } else {
2171  sb_error.SetErrorStringWithFormat("invalid target");
2172  }
2173  return sb_error;
2174 }
2175 
2177  lldb::SymbolType symbol_type) {
2178  LLDB_INSTRUMENT_VA(this, name, symbol_type);
2179 
2180  SBSymbolContextList sb_sc_list;
2181  if (name && name[0]) {
2182  TargetSP target_sp(GetSP());
2183  if (target_sp)
2184  target_sp->GetImages().FindSymbolsWithNameAndType(
2185  ConstString(name), symbol_type, *sb_sc_list);
2186  }
2187  return sb_sc_list;
2188 }
2189 
2191  LLDB_INSTRUMENT_VA(this, expr);
2192 
2193  TargetSP target_sp(GetSP());
2194  if (!target_sp)
2195  return SBValue();
2196 
2197  SBExpressionOptions options;
2198  lldb::DynamicValueType fetch_dynamic_value =
2199  target_sp->GetPreferDynamicValue();
2200  options.SetFetchDynamicValue(fetch_dynamic_value);
2201  options.SetUnwindOnError(true);
2202  return EvaluateExpression(expr, options);
2203 }
2204 
2206  const SBExpressionOptions &options) {
2207  LLDB_INSTRUMENT_VA(this, expr, options);
2208 
2209  Log *expr_log = GetLog(LLDBLog::Expressions);
2210  SBValue expr_result;
2211  ValueObjectSP expr_value_sp;
2212  TargetSP target_sp(GetSP());
2213  StackFrame *frame = nullptr;
2214  if (target_sp) {
2215  if (expr == nullptr || expr[0] == '\0') {
2216  return expr_result;
2217  }
2218 
2219  std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
2220  ExecutionContext exe_ctx(m_opaque_sp.get());
2221 
2222 
2223  frame = exe_ctx.GetFramePtr();
2224  Target *target = exe_ctx.GetTargetPtr();
2225 
2226  if (target) {
2227  target->EvaluateExpression(expr, frame, expr_value_sp, options.ref());
2228 
2229  expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
2230  }
2231  }
2232  LLDB_LOGF(expr_log,
2233  "** [SBTarget::EvaluateExpression] Expression result is "
2234  "%s, summary %s **",
2235  expr_result.GetValue(), expr_result.GetSummary());
2236  return expr_result;
2237 }
2238 
2240  LLDB_INSTRUMENT_VA(this);
2241 
2242  TargetSP target_sp(GetSP());
2243  if (target_sp) {
2244  ABISP abi_sp;
2245  ProcessSP process_sp(target_sp->GetProcessSP());
2246  if (process_sp)
2247  abi_sp = process_sp->GetABI();
2248  else
2249  abi_sp = ABI::FindPlugin(ProcessSP(), target_sp->GetArchitecture());
2250  if (abi_sp)
2251  return abi_sp->GetRedZoneSize();
2252  }
2253  return 0;
2254 }
2255 
2256 bool SBTarget::IsLoaded(const SBModule &module) const {
2257  LLDB_INSTRUMENT_VA(this, module);
2258 
2259  TargetSP target_sp(GetSP());
2260  if (!target_sp)
2261  return false;
2262 
2263  ModuleSP module_sp(module.GetSP());
2264  if (!module_sp)
2265  return false;
2266 
2267  return module_sp->IsLoadedInTarget(target_sp.get());
2268 }
2269 
2271  LLDB_INSTRUMENT_VA(this);
2272 
2273  lldb::SBLaunchInfo launch_info(nullptr);
2274  TargetSP target_sp(GetSP());
2275  if (target_sp)
2276  launch_info.set_ref(m_opaque_sp->GetProcessLaunchInfo());
2277  return launch_info;
2278 }
2279 
2281  LLDB_INSTRUMENT_VA(this, launch_info);
2282 
2283  TargetSP target_sp(GetSP());
2284  if (target_sp)
2285  m_opaque_sp->SetProcessLaunchInfo(launch_info.ref());
2286 }
2287 
2289  LLDB_INSTRUMENT_VA(this);
2290  TargetSP target_sp(GetSP());
2291 
2292  if (target_sp) {
2293  return SBEnvironment(target_sp->GetEnvironment());
2294  }
2295 
2296  return SBEnvironment();
2297 }
2298 
2300  LLDB_INSTRUMENT_VA(this);
2301  TargetSP target_sp(GetSP());
2302 
2303  if (target_sp)
2304  return SBTrace(target_sp->GetTrace());
2305 
2306  return SBTrace();
2307 }
2308 
2310  LLDB_INSTRUMENT_VA(this, error);
2311  TargetSP target_sp(GetSP());
2312  error.Clear();
2313 
2314  if (target_sp) {
2315  if (llvm::Expected<lldb::TraceSP> trace_sp = target_sp->CreateTrace()) {
2316  return SBTrace(*trace_sp);
2317  } else {
2318  error.SetErrorString(llvm::toString(trace_sp.takeError()).c_str());
2319  }
2320  } else {
2321  error.SetErrorString("missing target");
2322  }
2323  return SBTrace();
2324 }
lldb::SBValueList
Definition: SBValueList.h:18
LLDB_INVALID_WATCH_ID
#define LLDB_INVALID_WATCH_ID
Definition: lldb-defines.h:43
lldb_private::toString
const char * toString(AppleArm64ExceptionClass EC)
Definition: AppleArm64ExceptionClass.h:38
RegularExpression.h
lldb::SBTarget::GetAddressByteSize
uint32_t GetAddressByteSize()
Definition: SBTarget.cpp:1633
lldb::SBStringList
Definition: SBStringList.h:16
Instrumentation.h
lldb_private::ProcessInfo::GetArguments
Args & GetArguments()
Definition: ProcessInfo.h:74
lldb_private::ProcessInstanceInfo
Definition: ProcessInfo.h:106
lldb::SBTarget::BreakpointCreateByName
lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name, const char *module_name=nullptr)
Definition: SBTarget.cpp:760
lldb::SBLaunchInfo
Definition: SBLaunchInfo.h:23
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb::SBEvent::get
lldb_private::Event * get() const
Definition: SBEvent.cpp:133
lldb_private::DataBufferHeap::GetByteSize
lldb::offset_t GetByteSize() const override
Definition: DataBufferHeap.cpp:43
LLDB_WATCH_TYPE_WRITE
#define LLDB_WATCH_TYPE_WRITE
Definition: lldb-defines.h:46
lldb::SBModuleSpec
Definition: SBModuleSpec.h:17
lldb-public.h
lldb::SBStream::ref
lldb_private::Stream & ref()
Definition: SBStream.cpp:176
lldb::SBStringList::AppendString
void AppendString(const char *str)
Definition: SBStringList.cpp:58
lldb::SBTarget::GetBreakpointNames
void GetBreakpointNames(SBStringList &names)
Definition: SBTarget.cpp:1130
lldb_private::ArchSpec
Definition: ArchSpec.h:32
lldb::SBTarget::IsValid
bool IsValid() const
Definition: SBTarget.cpp:152
lldb::SBStringList::GetSize
uint32_t GetSize() const
Definition: SBStringList.cpp:96
lldb_private::RegularExpression
Definition: RegularExpression.h:18
lldb::SBTarget::Install
SBError Install()
Install any binaries that need to be installed.
Definition: SBTarget.cpp:286
lldb_private::ProcessInfo::ProcessIDIsValid
bool ProcessIDIsValid() const
Definition: ProcessInfo.h:70
lldb_private::ProcessInfo::SetExecutableFile
void SetExecutableFile(const FileSpec &exe_file, bool add_exe_file_as_first_arg)
Definition: ProcessInfo.cpp:60
lldb::SBTarget::SetLaunchInfo
void SetLaunchInfo(const lldb::SBLaunchInfo &launch_info)
Definition: SBTarget.cpp:2280
lldb::SBTarget::RemoveModule
bool RemoveModule(lldb::SBModule module)
Definition: SBTarget.cpp:1657
SBModule.h
lldb::SBTarget::DeleteWatchpoint
bool DeleteWatchpoint(lldb::watch_id_t watch_id)
Definition: SBTarget.cpp:1290
ModuleSpec.h
LLDB_WATCH_TYPE_READ
#define LLDB_WATCH_TYPE_READ
Definition: lldb-defines.h:45
lldb::SBValue::GetValue
const char * GetValue()
Definition: SBValue.cpp:353
lldb::MatchType
MatchType
String matching algorithm used by SBTarget.
Definition: lldb-enumerations.h:1058
lldb::SBModuleSpec::m_opaque_up
std::unique_ptr< lldb_private::ModuleSpec > m_opaque_up
Definition: SBModuleSpec.h:87
lldb::SBTarget::CreateTrace
lldb::SBTrace CreateTrace(SBError &error)
Create a Trace object for the current target using the using the default supported tracing technology...
Definition: SBTarget.cpp:2309
lldb::SBWatchpoint::SetSP
void SetSP(const lldb::WatchpointSP &sp)
Definition: SBWatchpoint.cpp:261
lldb::SBTarget::EvaluateExpression
lldb::SBValue EvaluateExpression(const char *expr)
Definition: SBTarget.cpp:2190
lldb::SBTarget::GetExecutable
lldb::SBFileSpec GetExecutable()
Definition: SBTarget.cpp:550
Host.h
lldb::SBExpressionOptions::GetFetchDynamicValue
lldb::DynamicValueType GetFetchDynamicValue() const
Definition: SBExpressionOptions.cpp:76
lldb::SBError
Definition: SBError.h:20
lldb::SBTarget::GetInstructions
lldb::SBInstructionList GetInstructions(lldb::SBAddress base_addr, const void *buf, size_t size)
Definition: SBTarget.cpp:1968
SBModuleSpec.h
lldb::eStateAttaching
@ eStateAttaching
Process is currently trying to attach.
Definition: lldb-enumerations.h:78
DeclVendor.h
lldb::SBTarget::GetEnvironment
SBEnvironment GetEnvironment()
Return the environment variables that would be used to launch a new process.
Definition: SBTarget.cpp:2288
lldb_private::ProcessLaunchInfo::SetListener
void SetListener(const lldb::ListenerSP &listener_sp)
Definition: ProcessLaunchInfo.h:127
lldb::SBTarget::ReadInstructions
lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr, uint32_t count)
Definition: SBTarget.cpp:1931
SBStringList.h
lldb_private::SectionList::GetSize
size_t GetSize() const
Definition: Section.h:74
lldb::SBTarget::GetLaunchInfo
lldb::SBLaunchInfo GetLaunchInfo() const
Definition: SBTarget.cpp:2270
lldb::SBTarget::GetModuleAtIndexFromEvent
static lldb::SBModule GetModuleAtIndexFromEvent(const uint32_t idx, const lldb::SBEvent &event)
Definition: SBTarget.cpp:137
lldb::SBProcess::SetSP
void SetSP(const lldb::ProcessSP &process_sp)
Definition: SBProcess.cpp:104
lldb::SBTarget::BreakpointCreateByLocation
lldb::SBBreakpoint BreakpointCreateByLocation(const char *file, uint32_t line)
Definition: SBTarget.cpp:669
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
lldb::SBTarget::GetCodeByteSize
uint32_t GetCodeByteSize()
Architecture code byte width accessor.
Definition: SBTarget.cpp:1613
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:344
lldb_private::Args::AppendArguments
void AppendArguments(const Args &rhs)
Definition: Args.cpp:298
lldb::SBTarget::GetProcess
lldb::SBProcess GetProcess()
Definition: SBTarget.cpp:162
lldb::SBValue
Definition: SBValue.h:21
Module.h
BreakpointLocation.h
lldb::SBListener::IsValid
bool IsValid() const
Definition: SBListener.cpp:49
lldb::SBTarget::GetDebugger
lldb::SBDebugger GetDebugger() const
Definition: SBTarget.cpp:189
lldb::SBBreakpointList::CopyToBreakpointIDList
void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list)
Definition: SBBreakpoint.cpp:940
lldb::SBSymbolContextList
Definition: SBSymbolContextList.h:17
lldb::SBTarget::GetBasicType
lldb::SBType GetBasicType(lldb::BasicType type)
Definition: SBTarget.cpp:1789
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::ProcessInfo::SetUserID
void SetUserID(uint32_t uid)
Definition: ProcessInfo.h:56
lldb_private::ProcessAttachInfo::GetListener
lldb::ListenerSP GetListener() const
Definition: Process.h:187
lldb::SBEnvironment
class LLDB_API SBEnvironment
Definition: SBDefines.h:51
lldb::SBTarget::ResolveLoadAddress
lldb::SBAddress ResolveLoadAddress(lldb::addr_t vm_addr)
Resolve a current load address into a section offset address.
Definition: SBTarget.cpp:582
lldb::SBExpressionOptions::SetUnwindOnError
void SetUnwindOnError(bool unwind=true)
Definition: SBExpressionOptions.cpp:58
lldb_private::Module
Definition: Module.h:85
lldb_private::ExecutionContext::GetFramePtr
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Definition: ExecutionContext.h:408
lldb_private::ProcessInfo::GetProcessID
lldb::pid_t GetProcessID() const
Definition: ProcessInfo.h:66
lldb_private::SectionList
Definition: Section.h:34
lldb::SBTarget::GetNumBreakpoints
uint32_t GetNumBreakpoints() const
Definition: SBTarget.cpp:1060
lldb::SBEvent
Definition: SBEvent.h:21
StackFrame.h
Disassembler.h
lldb_private::ProcessInfo::SetProcessID
void SetProcessID(lldb::pid_t pid)
Definition: ProcessInfo.h:68
CommandObjectBreakpoint.h
lldb::SBListener::GetSP
lldb::ListenerSP GetSP()
Definition: SBListener.cpp:286
LLDB_INSTRUMENT
#define LLDB_INSTRUMENT()
Definition: Instrumentation.h:95
lldb::SBProcess
Definition: SBProcess.h:23
lldb_private::Stream
Definition: Stream.h:28
lldb_private::TypeList::GetTypeAtIndex
lldb::TypeSP GetTypeAtIndex(uint32_t idx)
Definition: TypeList.cpp:66
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
Language.h
lldb::SBTarget::GetTargetFromEvent
static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event)
Definition: SBTarget.cpp:123
lldb::BasicType
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Definition: lldb-enumerations.h:747
lldb_private::ModuleFunctionSearchOptions::include_symbols
bool include_symbols
Include the symbol table.
Definition: Module.h:65
lldb::SBExpressionOptions::ref
lldb_private::EvaluateExpressionOptions & ref() const
Definition: SBExpressionOptions.cpp:256
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
AddressResolver.h
lldb::SBSymbolContext::ref
lldb_private::SymbolContext & ref()
Definition: SBSymbolContext.cpp:169
lldb::SBStringList
class LLDB_API SBStringList
Definition: SBDefines.h:81
lldb_private::ProcessAttachInfo::SetListener
void SetListener(const lldb::ListenerSP &listener_sp)
Definition: Process.h:189
CommandReturnObject.h
Debugger.h
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:469
Section.h
SBSymbolContextList.h
SBListener.h
lldb::SBFileSpec::SetFileSpec
void SetFileSpec(const lldb_private::FileSpec &fspec)
Definition: SBFileSpec.cpp:164
lldb::SBTarget::BreakpointsCreateFromFile
lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file, SBBreakpointList &new_bps)
Read breakpoints from source_file and return the newly created breakpoints in bkpt_list.
Definition: SBTarget.cpp:1192
lldb_private::ProcessInfo::UserIDIsValid
bool UserIDIsValid() const
Definition: ProcessInfo.h:52
ABI.h
lldb::SBInstructionList
Definition: SBInstructionList.h:18
lldb::SBType
class LLDB_API SBType
Definition: SBDefines.h:92
lldb_private::VariableList
Definition: VariableList.h:18
SBSourceManager.h
lldb::SBTarget::operator==
bool operator==(const lldb::SBTarget &rhs) const
Definition: SBTarget.cpp:564
lldb_private::ModuleSpec::GetSymbolFileSpec
FileSpec & GetSymbolFileSpec()
Definition: ModuleSpec.h:77
lldb::SBStructuredData::m_impl_up
StructuredDataImplUP m_impl_up
Definition: SBStructuredData.h:104
Process.h
lldb::SBTarget::CreateValueFromExpression
lldb::SBValue CreateValueFromExpression(const char *name, const char *expr)
Definition: SBTarget.cpp:1421
lldb_private::ModuleFunctionSearchOptions::include_inlines
bool include_inlines
Include inlined functions.
Definition: Module.h:67
lldb::SBTarget::GetNumModules
uint32_t GetNumModules() const
Definition: SBTarget.cpp:1525
lldb::SBPlatform::m_opaque_sp
lldb::PlatformSP m_opaque_sp
Definition: SBPlatform.h:184
SBExpressionOptions.h
lldb::SBValueList::GetValueAtIndex
lldb::SBValue GetValueAtIndex(uint32_t idx) const
Definition: SBValueList.cpp:154
lldb::SBTarget::FindFunctions
lldb::SBSymbolContextList FindFunctions(const char *name, uint32_t name_type_mask=lldb::eFunctionNameTypeAny)
Find functions by name.
Definition: SBTarget.cpp:1690
lldb::SBTarget::AttachToProcessWithID
lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid, lldb::SBError &error)
Attach to process with pid.
Definition: SBTarget.cpp:462
lldb_private::Module::GetPlatformFileSpec
const FileSpec & GetPlatformFileSpec() const
Get accessor for the module platform file specification.
Definition: Module.h:510
Target.h
lldb_private::ModuleSpec::GetUUID
UUID & GetUUID()
Definition: ModuleSpec.h:99
lldb::SBTarget::FindFirstType
lldb::SBType FindFirstType(const char *type)
Definition: SBTarget.cpp:1748
lldb::SBValueList::IsValid
bool IsValid() const
Definition: SBValueList.cpp:93
lldb::SBTrace
Definition: SBTrace.h:18
lldb::eMatchTypeStartsWith
@ eMatchTypeStartsWith
Definition: lldb-enumerations.h:1058
lldb_private::Module::GetFileSpec
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
Definition: Module.h:496
lldb::SBTarget
Definition: SBTarget.h:29
BreakpointList.h
lldb_private::FileSpec
Definition: FileSpec.h:55
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb::SBTarget::BreakpointCreateBySourceRegex
lldb::SBBreakpoint BreakpointCreateBySourceRegex(const char *source_regex, const SBFileSpec &source_file, const char *module_name=nullptr)
Definition: SBTarget.cpp:960
lldb::SBStringList::GetStringAtIndex
const char * GetStringAtIndex(size_t idx)
Definition: SBStringList.cpp:105
lldb_private::ObjectFile::GetSectionList
virtual SectionList * GetSectionList(bool update_module_section_list=true)
Gets the section list for the currently selected architecture (and object for archives).
Definition: ObjectFile.cpp:588
lldb_private::ModuleList::GetSize
size_t GetSize() const
Gets the size of the module list.
Definition: ModuleList.cpp:635
lldb::SBTarget::DeleteAllBreakpoints
bool DeleteAllBreakpoints()
Definition: SBTarget.cpp:1180
SBStream.h
lldb::SBTarget::Attach
SBProcess Attach(SBAttachInfo &attach_info, SBError &error)
Definition: SBTarget.cpp:429
ProcessInfo.h
TargetList.h
lldb::SBError::Fail
bool Fail() const
Definition: SBError.cpp:53
lldb::SBLaunchInfo::SetEnvironmentEntries
void SetEnvironmentEntries(const char **envp, bool append)
Update this object with the given environment variables.
Definition: SBLaunchInfo.cpp:180
lldb::SBTarget::FindCompileUnits
lldb::SBSymbolContextList FindCompileUnits(const lldb::SBFileSpec &sb_file_spec)
Find compile units related to *this target and passed source file.
Definition: SBTarget.cpp:1557
AttachToProcess
static Status AttachToProcess(ProcessAttachInfo &attach_info, Target &target)
Definition: SBTarget.cpp:76
bool
lldb::SBError::SetErrorStringWithFormat
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition: SBError.cpp:128
lldb_private::ProcessInstanceInfo::GetEffectiveUserID
uint32_t GetEffectiveUserID() const
Definition: ProcessInfo.h:121
lldb::SBTarget::GetInstructionsWithFlavor
lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size)
Definition: SBTarget.cpp:1977
lldb_private::ProcessLaunchInfo
Definition: ProcessLaunchInfo.h:31
lldb::SBListener::m_opaque_sp
lldb::ListenerSP m_opaque_sp
Definition: SBListener.h:102
lldb_private::ModuleList
Definition: ModuleList.h:82
lldb::SBDebugger
Definition: SBDebugger.h:34
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::Target::GetAPIMutex
std::recursive_mutex & GetAPIMutex()
Definition: Target.cpp:4746
Args.h
lldb::SBTarget::SBModule
friend class SBModule
Definition: SBTarget.h:874
lldb::SBAddress::GetLoadAddress
addr_t GetLoadAddress(const lldb::SBTarget &target) const
Definition: SBAddress.cpp:107
lldb::SBTarget::ResolveFileAddress
lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr)
Resolve a current file address into a section offset address.
Definition: SBTarget.cpp:600
SearchFilter.h
lldb::SBTarget::operator!=
bool operator!=(const lldb::SBTarget &rhs) const
Definition: SBTarget.cpp:570
lldb::SBTarget::GetWatchpointAtIndex
lldb::SBWatchpoint GetWatchpointAtIndex(uint32_t idx) const
Definition: SBTarget.cpp:1278
lldb::SBTarget::BreakpointCreateByAddress
lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address)
Definition: SBTarget.cpp:927
lldb::SBTarget::GetNumWatchpoints
uint32_t GetNumWatchpoints() const
Definition: SBTarget.cpp:1267
lldb::eStateConnected
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
Definition: lldb-enumerations.h:76
SBFileSpec.h
lldb::SBModule::SetSP
void SetSP(const ModuleSP &module_sp)
Definition: SBModule.cpp:211
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb::SBStringList::Clear
void Clear()
Definition: SBStringList.cpp:123
lldb::SBTarget::BreakpointsWriteToFile
lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file)
Write breakpoints to dest_file.
Definition: SBTarget.cpp:1234
lldb_private::TypeList::GetSize
uint32_t GetSize() const
Definition: TypeList.cpp:60
lldb::break_id_t
int32_t break_id_t
Definition: lldb-types.h:88
lldb::SBTarget::DisableAllWatchpoints
bool DisableAllWatchpoints()
Definition: SBTarget.cpp:1371
lldb_private::ConstString
Definition: ConstString.h:39
lldb::SBTarget::GetMaximumNumberOfChildrenToDisplay
uint32_t GetMaximumNumberOfChildrenToDisplay() const
Gets the target.max-children-count value It should be used to limit the number of children of large d...
Definition: SBTarget.cpp:1623
lldb::SBTarget::SetCollectingStats
void SetCollectingStats(bool v)
Sets whether we should collect statistics on lldb or not.
Definition: SBTarget.cpp:214
lldb::SBError::SetErrorString
void SetErrorString(const char *err_str)
Definition: SBError.cpp:121
lldb::SBTarget::DisableAllBreakpoints
bool DisableAllBreakpoints()
Definition: SBTarget.cpp:1168
lldb::SBTarget::BreakpointCreateByNames
lldb::SBBreakpoint BreakpointCreateByNames(const char *symbol_name[], uint32_t num_names, uint32_t name_type_mask, const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list)
Definition: SBTarget.cpp:835
lldb::SBTarget::SBValue
friend class SBValue
Definition: SBTarget.h:880
lldb_private::BreakpointID::GetBreakpointID
lldb::break_id_t GetBreakpointID() const
Definition: BreakpointID.h:29
lldb::SBTarget::AddModule
bool AddModule(lldb::SBModule &module)
Definition: SBTarget.cpp:1514
lldb::eMatchTypeNormal
@ eMatchTypeNormal
Definition: lldb-enumerations.h:1058
lldb::SBTarget::AttachToProcessWithName
lldb::SBProcess AttachToProcessWithName(SBListener &listener, const char *name, bool wait_for, lldb::SBError &error)
Attach to process with name.
Definition: SBTarget.cpp:491
lldb::SBValueList::Append
void Append(const lldb::SBValue &val_obj)
Definition: SBValueList.cpp:131
lldb::SBTarget::ClearSectionLoadAddress
lldb::SBError ClearSectionLoadAddress(lldb::SBSection section)
Clear the base load address for a module section.
Definition: SBTarget.cpp:2057
lldb::SBFileSpec::ref
const lldb_private::FileSpec & ref() const
Definition: SBFileSpec.cpp:162
lldb::SBFileSpec::IsValid
bool IsValid() const
Definition: SBFileSpec.cpp:76
lldb::SBAddress::IsValid
bool IsValid() const
Definition: SBAddress.cpp:72
lldb::SBTarget::EnableAllWatchpoints
bool EnableAllWatchpoints()
Definition: SBTarget.cpp:1357
lldb::SBTarget::GetABIName
const char * GetABIName()
Definition: SBTarget.cpp:1591
lldb::SBTarget::GetBroadcasterClassName
static const char * GetBroadcasterClassName()
Definition: SBTarget.cpp:146
lldb_private::SectionList::GetSectionAtIndex
lldb::SectionSP GetSectionAtIndex(size_t idx) const
Definition: Section.cpp:538
lldb::SBEnvironment
Definition: SBEnvironment.h:16
SBDebugger.h
lldb::SBSection
Definition: SBSection.h:17
lldb::SBTarget::FindBreakpointByID
lldb::SBBreakpoint FindBreakpointByID(break_id_t break_id)
Definition: SBTarget.cpp:1096
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
lldb::SBTarget::BreakpointCreateByRegex
lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex, const char *module_name=nullptr)
Definition: SBTarget.cpp:881
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb::watch_id_t
int32_t watch_id_t
Definition: lldb-types.h:89
lldb::SBDebugger::reset
void reset(const lldb::DebuggerSP &debugger_sp)
Definition: SBDebugger.cpp:1280
lldb::SBTarget::Clear
void Clear()
Definition: SBTarget.cpp:1538
lldb::SBAttachInfo::ref
lldb_private::ProcessAttachInfo & ref()
Definition: SBAttachInfo.cpp:58
lldb_private::ArchSpec::IsValid
bool IsValid() const
Tests if this ArchSpec is valid.
Definition: ArchSpec.h:352
lldb::SBBreakpoint
class LLDB_API SBBreakpoint
Definition: SBDefines.h:35
TypeSystem.h
lldb::SBTarget::FindModule
lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec)
Definition: SBTarget.cpp:1544
lldb::SymbolType
SymbolType
Symbol types.
Definition: lldb-enumerations.h:618
Address.h
VariableList.h
lldb::SBBreakpointList
Definition: SBBreakpoint.h:159
lldb_private::ProcessAttachInfo
Definition: Process.h:113
ObjectFile.h
lldb::SBType
Definition: SBType.h:104
lldb_private::ModuleFunctionSearchOptions
Options used by Module::FindFunctions.
Definition: Module.h:63
lldb_private::Address::SetRawAddress
void SetRawAddress(lldb::addr_t addr)
Definition: Address.h:444
lldb::SBTarget::GetTrace
lldb::SBTrace GetTrace()
Get a SBTrace object the can manage the processor trace information of this target.
Definition: SBTarget.cpp:2299
lldb::SBTarget::ReadMemory
size_t ReadMemory(const SBAddress addr, void *buf, size_t size, lldb::SBError &error)
Read target memory.
Definition: SBTarget.cpp:651
lldb::SBTypeList::GetSize
uint32_t GetSize()
Definition: SBType.cpp:635
LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:37
lldb::SBFileSpecList::get
const lldb_private::FileSpecList * get() const
Definition: SBFileSpecList.cpp:87
lldb::SBTarget::SetSectionLoadAddress
lldb::SBError SetSectionLoadAddress(lldb::SBSection section, lldb::addr_t section_base_addr)
Set the base load address for a module section.
Definition: SBTarget.cpp:2020
ValueObjectConstResult.h
lldb::SBExpressionOptions::SetFetchDynamicValue
void SetFetchDynamicValue(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition: SBExpressionOptions.cpp:82
lldb::SBTarget::FindWatchpointByID
lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id)
Definition: SBTarget.cpp:1305
lldb::SBTypeList
Definition: SBType.h:245
lldb::SBWatchpoint
Definition: SBWatchpoint.h:16
lldb::SBTarget::GetDataByteSize
uint32_t GetDataByteSize()
Architecture data byte width accessor.
Definition: SBTarget.cpp:1603
lldb::SBLaunchInfo::SetExecutableFile
void SetExecutableFile(SBFileSpec exe_file, bool add_as_first_arg)
Set the executable file that will be used to launch the process and optionally set it as the first ar...
Definition: SBLaunchInfo.cpp:121
lldb::SBTarget::GetCollectingStats
bool GetCollectingStats()
Returns whether statistics collection are enabled.
Definition: SBTarget.cpp:223
lldb_private::Target::Attach
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
Definition: Target.cpp:3212
lldb::SBTarget::ClearModuleLoadAddress
lldb::SBError ClearModuleLoadAddress(lldb::SBModule module)
Clear the section base load addresses for all sections in a module.
Definition: SBTarget.cpp:2125
lldb_private::Target::GetProcessSP
const lldb::ProcessSP & GetProcessSP() const
Definition: Target.cpp:217
lldb::SBTarget::GetTriple
const char * GetTriple()
Definition: SBTarget.cpp:1576
lldb::SBFileSpecList::GetSize
uint32_t GetSize() const
Definition: SBFileSpecList.cpp:44
lldb::SBTarget::GetBroadcaster
lldb::SBBroadcaster GetBroadcaster() const
Definition: SBTarget.cpp:1666
lldb::SBExpressionOptions
Definition: SBExpressionOptions.h:18
lldb_private::ModuleSpec::GetFileSpec
FileSpec & GetFileSpec()
Definition: ModuleSpec.h:53
lldb_private::ModuleSpec
Definition: ModuleSpec.h:27
lldb::SBTarget::SBProcess
friend class SBProcess
Definition: SBTarget.h:876
lldb_private::Status
Definition: Status.h:44
lldb::SBListener
Definition: SBListener.h:16
lldb::SBSymbolContext
Definition: SBSymbolContext.h:22
lldb::SBTarget::GetNumModulesFromEvent
static uint32_t GetNumModulesFromEvent(const lldb::SBEvent &event)
Definition: SBTarget.cpp:129
lldb::SBTarget::SetModuleLoadAddress
lldb::SBError SetModuleLoadAddress(lldb::SBModule module, int64_t sections_offset)
Slide all file addresses for all module sections so that module appears to loaded at these slide addr...
Definition: SBTarget.cpp:2091
lldb::SBTarget::LaunchSimple
SBProcess LaunchSimple(const char **argv, const char **envp, const char *working_directory)
Launch a new process with sensible defaults.
Definition: SBTarget.cpp:262
lldb::SBTarget::GetPlatform
lldb::SBPlatform GetPlatform()
Return the platform object associated with the target.
Definition: SBTarget.cpp:176
lldb::SBTarget::DeleteAllWatchpoints
bool DeleteAllWatchpoints()
Definition: SBTarget.cpp:1437
lldb::eByteOrderInvalid
@ eByteOrderInvalid
Definition: lldb-enumerations.h:139
lldb::eLanguageTypeUnknown
@ eLanguageTypeUnknown
Unknown or invalid language value.
Definition: lldb-enumerations.h:437
lldb::SBLaunchInfo::ref
const lldb_private::ProcessLaunchInfo & ref() const
Definition: SBLaunchInfo.cpp:65
BreakpointIDList.h
uint32_t
lldb::SBTarget::operator=
const lldb::SBTarget & operator=(const lldb::SBTarget &rhs)
Definition: SBTarget.cpp:106
lldb::SBTarget::FindSymbols
lldb::SBSymbolContextList FindSymbols(const char *name, lldb::SymbolType type=eSymbolTypeAny)
Definition: SBTarget.cpp:2176
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb_private::ProcessInfo::GetEnvironment
Environment & GetEnvironment()
Definition: ProcessInfo.h:86
lldb::SBTarget::SBPlatform
friend class SBPlatform
Definition: SBTarget.h:875
lldb::SBTarget::m_opaque_sp
lldb::TargetSP m_opaque_sp
Definition: SBTarget.h:891
lldb_private::Address
Definition: Address.h:59
lldb::SBStructuredData
Definition: SBStructuredData.h:17
lldb::SBBreakpoint
Definition: SBBreakpoint.h:18
lldb_private::Target::EvaluateExpression
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
Definition: Target.cpp:2475
lldb::SBValue::GetSummary
const char * GetSummary()
Definition: SBValue.cpp:420
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb::SBTarget::GetModuleAtIndex
lldb::SBModule GetModuleAtIndex(uint32_t idx)
Definition: SBTarget.cpp:1642
lldb_private::UUID::SetFromStringRef
bool SetFromStringRef(llvm::StringRef str)
Definition: UUID.cpp:97
lldb_private::BreakpointID
Definition: BreakpointID.h:22
lldb::SBTarget::Launch
lldb::SBProcess Launch(SBListener &listener, char const **argv, char const **envp, const char *stdin_path, const char *stdout_path, const char *stderr_path, const char *working_directory, uint32_t launch_flags, bool stop_at_entry, lldb::SBError &error)
Launch a new process.
Definition: SBTarget.cpp:298
lldb::SBTarget::GetByteOrder
lldb::ByteOrder GetByteOrder()
Definition: SBTarget.cpp:1567
lldb::SBTarget::FindBreakpointsByName
bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list)
Definition: SBTarget.cpp:1109
lldb::SBTrace
class LLDB_API SBTrace
Definition: SBDefines.h:90
lldb::SBModule
Definition: SBModule.h:20
lldb::SBData
Definition: SBData.h:20
lldb::SBInstructionList::SetDisassembler
void SetDisassembler(const lldb::DisassemblerSP &opaque_sp)
Definition: SBInstructionList.cpp:108
lldb::SBBreakpointList::AppendByID
void AppendByID(lldb::break_id_t id)
Definition: SBBreakpoint.cpp:915
lldb::SBType::GetSP
lldb::TypeImplSP GetSP()
Definition: SBType.cpp:77
lldb::SBSection::GetSP
lldb::SectionSP GetSP() const
Definition: SBSection.cpp:112
lldb::SBValue::SetSP
void SetSP(const lldb::ValueObjectSP &sp)
Definition: SBValue.cpp:1066
ArchSpec.h
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::Environment
Definition: Environment.h:18
lldb::SBData::IsValid
bool IsValid()
Definition: SBData.cpp:59
lldb::SBTarget::CreateValueFromData
lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data, lldb::SBType type)
Definition: SBTarget.cpp:1403
lldb::SBLaunchInfo::set_ref
void set_ref(const lldb_private::ProcessLaunchInfo &info)
Definition: SBLaunchInfo.cpp:69
lldb::SBTarget::ConnectRemote
lldb::SBProcess ConnectRemote(SBListener &listener, const char *url, const char *plugin_name, SBError &error)
Connect to a remote debug server with url.
Definition: SBTarget.cpp:518
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:215
lldb_private::ModuleSpec::GetArchitecture
ArchSpec & GetArchitecture()
Definition: ModuleSpec.h:89
lldb::SBTarget::WatchAddress
lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read, bool write, SBError &error)
Definition: SBTarget.cpp:1322
SBStructuredData.h
lldb::SBTarget::SBTarget
SBTarget()
Definition: SBTarget.cpp:96
lldb::SBTarget::BreakpointCreateForException
lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language, bool catch_bp, bool throw_bp)
Definition: SBTarget.cpp:1017
BreakpointID.h
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:337
lldb::SBModule::GetSP
ModuleSP GetSP() const
Definition: SBModule.cpp:209
lldb::SBFileSpec
Definition: SBFileSpec.h:16
SBTrace.h
StructuredDataImpl.h
SBEvent.h
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb::SBTarget::GetStatistics
lldb::SBStructuredData GetStatistics()
Returns a dump of the collected statistics.
Definition: SBTarget.cpp:199
lldb::SBTarget::IsLoaded
bool IsLoaded(const lldb::SBModule &module) const
Definition: SBTarget.cpp:2256
lldb::SBTarget::ResolveSymbolContextForAddress
SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr, uint32_t resolve_scope)
Definition: SBTarget.cpp:636
lldb::SBAddress
Definition: SBAddress.h:17
LanguageRuntime.h
lldb::SBTarget::SetSP
void SetSP(const lldb::TargetSP &target_sp)
Definition: SBTarget.cpp:578
SBEnvironment.h
lldb::SBTarget::AppendImageSearchPath
void AppendImageSearchPath(const char *from, const char *to, lldb::SBError &error)
Definition: SBTarget.cpp:1451
lldb::SBTarget::DeleteBreakpointName
void DeleteBreakpointName(const char *name)
Definition: SBTarget.cpp:1146
lldb::SBAddress::ref
lldb_private::Address & ref()
Definition: SBAddress.cpp:173
lldb::SBError::ref
lldb_private::Status & ref()
Definition: SBError.cpp:156
lldb_private::ProcessInfo::GetArchitecture
ArchSpec & GetArchitecture()
Definition: ProcessInfo.h:60
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::SBTarget::FindFirstGlobalVariable
lldb::SBValue FindFirstGlobalVariable(const char *name)
Find the first global (or static) variable by name.
Definition: SBTarget.cpp:1915
lldb::SBLaunchInfo::SetArguments
void SetArguments(const char **argv, bool append)
Definition: SBLaunchInfo.cpp:152
lldb::SBTarget::BreakpointDelete
bool BreakpointDelete(break_id_t break_id)
Definition: SBTarget.cpp:1083
lldb_private::eLazyBoolCalculate
@ eLazyBoolCalculate
Definition: lldb-private-enumerations.h:115
lldb_private::VariableList::Empty
bool Empty() const
Definition: VariableList.h:68
lldb::SBTarget::EventIsTargetEvent
static bool EventIsTargetEvent(const lldb::SBEvent &event)
Definition: SBTarget.cpp:117
lldb::eMatchTypeRegex
@ eMatchTypeRegex
Definition: lldb-enumerations.h:1058
lldb::SBTarget::CreateValueFromAddress
lldb::SBValue CreateValueFromAddress(const char *name, lldb::SBAddress addr, lldb::SBType type)
Definition: SBTarget.cpp:1385
lldb_private::ProcessInfo::GetExecutableFile
FileSpec & GetExecutableFile()
Definition: ProcessInfo.h:41
lldb_private::TypeList
Definition: TypeList.h:20
lldb_private::ModuleList::GetModuleAtIndex
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
Definition: ModuleList.cpp:411
FileSpec.h
lldb::SBLaunchInfo::SetWorkingDirectory
void SetWorkingDirectory(const char *working_dir)
Definition: SBLaunchInfo.cpp:213
lldb::eStateInvalid
@ eStateInvalid
Definition: lldb-enumerations.h:74
lldb::SBSection::IsValid
bool IsValid() const
Definition: SBSection.cpp:45
lldb::SBTarget::GetSP
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:576
LLDB_INSTRUMENT_VA
#define LLDB_INSTRUMENT_VA(...)
Definition: Instrumentation.h:98
lldb::SBAddress::get
lldb_private::Address * get()
Definition: SBAddress.cpp:186
lldb::SBTarget::EnableAllBreakpoints
bool EnableAllBreakpoints()
Definition: SBTarget.cpp:1156
lldb::SBTarget::GetBreakpointAtIndex
lldb::SBBreakpoint GetBreakpointAtIndex(uint32_t idx) const
Definition: SBTarget.cpp:1071
lldb_private::BreakpointIDList::GetSize
size_t GetSize() const
Definition: BreakpointIDList.cpp:28
lldb::SBBroadcaster
Definition: SBBroadcaster.h:16
lldb::SBTarget::FindTypes
lldb::SBTypeList FindTypes(const char *type)
Definition: SBTarget.cpp:1801
SBProcess.h
ValueObjectVariable.h
lldb::SBTypeList::Append
void Append(lldb::SBType type)
Definition: SBType.cpp:620
lldb_private::BreakpointIDList::GetBreakpointIDAtIndex
const BreakpointID & GetBreakpointIDAtIndex(size_t index) const
Definition: BreakpointIDList.cpp:31
lldb::SBTarget::FindGlobalVariables
lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches)
Find global and static variables by name.
Definition: SBTarget.cpp:1844
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::Log
Definition: Log.h:115
lldb_private::ModuleList::FindTypes
void FindTypes(Module *search_first, ConstString name, bool name_is_fully_qualified, size_t max_matches, llvm::DenseSet< SymbolFile * > &searched_symbol_files, TypeList &types) const
Find types by name.
Definition: ModuleList.cpp:569
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb::SBType::IsValid
bool IsValid() const
Definition: SBType.cpp:108
lldb_private::FileSpec::SetFile
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
Definition: FileSpec.cpp:172
lldb::SBTarget::BreakpointCreateFromScript
lldb::SBBreakpoint BreakpointCreateFromScript(const char *class_name, SBStructuredData &extra_args, const SBFileSpecList &module_list, const SBFileSpecList &file_list, bool request_hardware=false)
Create a breakpoint using a scripted resolver.
Definition: SBTarget.cpp:1033
lldb::SBTarget::GetSourceManager
SBSourceManager GetSourceManager()
Definition: SBTarget.cpp:1924
lldb::SBStream
Definition: SBStream.h:18
lldb::SBTarget::GetStackRedZoneSize
lldb::addr_t GetStackRedZoneSize()
Definition: SBTarget.cpp:2239
lldb::SBTarget::GetDescription
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBTarget.cpp:1675
SymbolVendor.h
PATH_MAX
#define PATH_MAX
Definition: windows/PosixApi.h:25
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
SBTarget.h
lldb::SBValueList::GetSize
uint32_t GetSize() const
Definition: SBValueList.cpp:164
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb::SBTarget::~SBTarget
~SBTarget()
lldb::SBPlatform
Definition: SBPlatform.h:93
lldb_private::DataBufferHeap
Definition: DataBufferHeap.h:30
lldb::SBFileSpecList::Append
void Append(const SBFileSpec &sb_file)
Definition: SBFileSpecList.cpp:50
lldb::SBTarget::ResolvePastLoadAddress
lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id, lldb::addr_t vm_addr)
Resolve a current load address into a section offset address using the process stop ID to identify a ...
Definition: SBTarget.cpp:616
lldb::SBAttachInfo
Definition: SBAttachInfo.h:18
lldb
Definition: SBAddress.h:15
lldb::SBTarget::BreakpointCreateBySBAddress
lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address)
Definition: SBTarget.cpp:941
lldb::SBFileSpec
class LLDB_API SBFileSpec
Definition: SBDefines.h:58
ValueObjectList.h
lldb_private::ProcessAttachInfo::SetWaitForLaunch
void SetWaitForLaunch(bool b)
Definition: Process.h:131
lldb_private::ExecutionContextRef
Execution context objects refer to objects in the execution of the program that is being debugged.
Definition: ExecutionContext.h:72
LLDBLog.h
lldb::SBTarget::FindGlobalFunctions
lldb::SBSymbolContextList FindGlobalFunctions(const char *name, uint32_t max_matches, MatchType matchtype)
Find global functions by their name with pattern matching.
Definition: SBTarget.cpp:1712
SymbolFile.h
lldb_private::BreakpointIDList
Definition: BreakpointIDList.h:25
lldb_private::ExecutionContext::GetTargetPtr
Target * GetTargetPtr() const
Returns a pointer to the target object.
Definition: ExecutionContext.cpp:198
lldb_private::ObjectFile
Definition: ObjectFile.h:60
lldb_private::ModuleList::Append
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
lldb::SBTarget::LoadCore
SBProcess LoadCore(const char *core_file)
Definition: SBTarget.cpp:232
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb::SBFileSpecList
Definition: SBFileSpecList.h:17
SBBreakpoint.h
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138
lldb::SBSourceManager
Definition: SBSourceManager.h:18