LLDB  mainline
DynamicLoaderMacOS.cpp
Go to the documentation of this file.
1 //===-- DynamicLoaderMacOS.cpp --------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "lldb/Core/Debugger.h"
11 #include "lldb/Core/Module.h"
13 #include "lldb/Core/Section.h"
14 #include "lldb/Symbol/ObjectFile.h"
16 #include "lldb/Target/ABI.h"
18 #include "lldb/Target/StackFrame.h"
19 #include "lldb/Target/Target.h"
20 #include "lldb/Target/Thread.h"
21 #include "lldb/Utility/LLDBLog.h"
22 #include "lldb/Utility/Log.h"
23 #include "lldb/Utility/State.h"
24 
25 #include "DynamicLoaderDarwin.h"
26 #include "DynamicLoaderMacOS.h"
27 
29 
30 using namespace lldb;
31 using namespace lldb_private;
32 
33 // Create an instance of this class. This function is filled into the plugin
34 // info class that gets handed out by the plugin factory and allows the lldb to
35 // instantiate an instance of this class.
37  bool force) {
38  bool create = force;
39  if (!create) {
40  create = true;
41  Module *exe_module = process->GetTarget().GetExecutableModulePointer();
42  if (exe_module) {
43  ObjectFile *object_file = exe_module->GetObjectFile();
44  if (object_file) {
45  create = (object_file->GetStrata() == ObjectFile::eStrataUser);
46  }
47  }
48 
49  if (create) {
50  const llvm::Triple &triple_ref =
51  process->GetTarget().GetArchitecture().GetTriple();
52  switch (triple_ref.getOS()) {
53  case llvm::Triple::Darwin:
54  case llvm::Triple::MacOSX:
55  case llvm::Triple::IOS:
56  case llvm::Triple::TvOS:
57  case llvm::Triple::WatchOS:
58  // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS:
59  create = triple_ref.getVendor() == llvm::Triple::Apple;
60  break;
61  default:
62  create = false;
63  break;
64  }
65  }
66  }
67 
68  if (!UseDYLDSPI(process)) {
69  create = false;
70  }
71 
72  if (create)
73  return new DynamicLoaderMacOS(process);
74  return nullptr;
75 }
76 
77 // Constructor
79  : DynamicLoaderDarwin(process), m_image_infos_stop_id(UINT32_MAX),
80  m_break_id(LLDB_INVALID_BREAK_ID),
81  m_dyld_handover_break_id(LLDB_INVALID_BREAK_ID), m_mutex(),
82  m_maybe_image_infos_address(LLDB_INVALID_ADDRESS) {}
83 
84 // Destructor
90 }
91 
93  std::lock_guard<std::recursive_mutex> baseclass_guard(GetMutex());
94  bool did_exec = false;
95  if (m_process) {
96  // If we are stopped after an exec, we will have only one thread...
97  if (m_process->GetThreadList().GetSize() == 1) {
98  // Maybe we still have an image infos address around? If so see
99  // if that has changed, and if so we have exec'ed.
101  lldb::addr_t image_infos_address = m_process->GetImageInfoAddress();
102  if (image_infos_address != m_maybe_image_infos_address) {
103  // We don't really have to reset this here, since we are going to
104  // call DoInitialImageFetch right away to handle the exec. But in
105  // case anybody looks at it in the meantime, it can't hurt.
106  m_maybe_image_infos_address = image_infos_address;
107  did_exec = true;
108  }
109  }
110 
111  if (!did_exec) {
112  // See if we are stopped at '_dyld_start'
113  ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
114  if (thread_sp) {
115  lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
116  if (frame_sp) {
117  const Symbol *symbol =
118  frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
119  if (symbol) {
120  if (symbol->GetName() == "_dyld_start")
121  did_exec = true;
122  }
123  }
124  }
125  }
126  }
127  }
128 
129  if (did_exec) {
130  m_libpthread_module_wp.reset();
132  }
133  return did_exec;
134 }
135 
136 // Clear out the state of this class.
138  std::lock_guard<std::recursive_mutex> guard(m_mutex);
139 
144 
147 }
148 
149 // Check if we have found DYLD yet
152 }
153 
158  }
159 }
160 
161 // Try and figure out where dyld is by first asking the Process if it knows
162 // (which currently calls down in the lldb::Process to get the DYLD info
163 // (available on SnowLeopard only). If that fails, then check in the default
164 // addresses.
166  Log *log = GetLog(LLDBLog::DynamicLoader);
167 
168  // Remove any binaries we pre-loaded in the Target before
169  // launching/attaching. If the same binaries are present in the process,
170  // we'll get them from the shared module cache, we won't need to re-load them
171  // from disk.
172  UnloadAllImages();
173 
174  StructuredData::ObjectSP all_image_info_json_sp(
176  ImageInfo::collection image_infos;
177  if (all_image_info_json_sp.get() &&
178  all_image_info_json_sp->GetAsDictionary() &&
179  all_image_info_json_sp->GetAsDictionary()->HasKey("images") &&
180  all_image_info_json_sp->GetAsDictionary()
181  ->GetValueForKey("images")
182  ->GetAsArray()) {
183  if (JSONImageInformationIntoImageInfo(all_image_info_json_sp,
184  image_infos)) {
185  LLDB_LOGF(log, "Initial module fetch: Adding %" PRId64 " modules.\n",
186  (uint64_t)image_infos.size());
187 
189  AddModulesUsingImageInfos(image_infos);
190  }
191  }
192 
195 }
196 
198 
199 // Static callback function that gets called when our DYLD notification
200 // breakpoint gets hit. We update all of our image infos and then let our super
201 // class DynamicLoader class decide if we should stop or not (based on global
202 // preference).
204  StoppointCallbackContext *context,
205  lldb::user_id_t break_id,
206  lldb::user_id_t break_loc_id) {
207  // Let the event know that the images have changed
208  // DYLD passes three arguments to the notification breakpoint.
209  // Arg1: enum dyld_notify_mode mode - 0 = adding, 1 = removing, 2 = remove
210  // all Arg2: unsigned long icount - Number of shared libraries
211  // added/removed Arg3: uint64_t mach_headers[] - Array of load addresses
212  // of binaries added/removed
213 
214  DynamicLoaderMacOS *dyld_instance = (DynamicLoaderMacOS *)baton;
215 
216  ExecutionContext exe_ctx(context->exe_ctx_ref);
217  Process *process = exe_ctx.GetProcessPtr();
218 
219  // This is a sanity check just in case this dyld_instance is an old dyld
220  // plugin's breakpoint still lying around.
221  if (process != dyld_instance->m_process)
222  return false;
223 
224  if (dyld_instance->m_image_infos_stop_id != UINT32_MAX &&
225  process->GetStopID() < dyld_instance->m_image_infos_stop_id) {
226  return false;
227  }
228 
229  const lldb::ABISP &abi = process->GetABI();
230  if (abi) {
231  // Build up the value array to store the three arguments given above, then
232  // get the values from the ABI:
233 
234  TypeSystemClang *clang_ast_context =
235  ScratchTypeSystemClang::GetForTarget(process->GetTarget());
236  if (!clang_ast_context)
237  return false;
238 
239  ValueList argument_values;
240 
241  Value mode_value; // enum dyld_notify_mode { dyld_notify_adding=0,
242  // dyld_notify_removing=1, dyld_notify_remove_all=2 };
243  Value count_value; // unsigned long count
244  Value headers_value; // uint64_t machHeaders[] (aka void*)
245 
246  CompilerType clang_void_ptr_type =
247  clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
248  CompilerType clang_uint32_type =
249  clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(
250  lldb::eEncodingUint, 32);
251  CompilerType clang_uint64_type =
252  clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(
253  lldb::eEncodingUint, 32);
254 
255  mode_value.SetValueType(Value::ValueType::Scalar);
256  mode_value.SetCompilerType(clang_uint32_type);
257 
258  if (process->GetTarget().GetArchitecture().GetAddressByteSize() == 4) {
259  count_value.SetValueType(Value::ValueType::Scalar);
260  count_value.SetCompilerType(clang_uint32_type);
261  } else {
262  count_value.SetValueType(Value::ValueType::Scalar);
263  count_value.SetCompilerType(clang_uint64_type);
264  }
265 
266  headers_value.SetValueType(Value::ValueType::Scalar);
267  headers_value.SetCompilerType(clang_void_ptr_type);
268 
269  argument_values.PushValue(mode_value);
270  argument_values.PushValue(count_value);
271  argument_values.PushValue(headers_value);
272 
273  if (abi->GetArgumentValues(exe_ctx.GetThreadRef(), argument_values)) {
274  uint32_t dyld_mode =
275  argument_values.GetValueAtIndex(0)->GetScalar().UInt(-1);
276  if (dyld_mode != static_cast<uint32_t>(-1)) {
277  // Okay the mode was right, now get the number of elements, and the
278  // array of new elements...
279  uint32_t image_infos_count =
280  argument_values.GetValueAtIndex(1)->GetScalar().UInt(-1);
281  if (image_infos_count != static_cast<uint32_t>(-1)) {
282  addr_t header_array =
283  argument_values.GetValueAtIndex(2)->GetScalar().ULongLong(-1);
284  if (header_array != static_cast<uint64_t>(-1)) {
285  std::vector<addr_t> image_load_addresses;
286  for (uint64_t i = 0; i < image_infos_count; i++) {
287  Status error;
288  addr_t addr = process->ReadUnsignedIntegerFromMemory(
289  header_array + (8 * i), 8, LLDB_INVALID_ADDRESS, error);
290  if (addr != LLDB_INVALID_ADDRESS) {
291  image_load_addresses.push_back(addr);
292  }
293  }
294  if (dyld_mode == 0) {
295  // dyld_notify_adding
296  if (process->GetTarget().GetImages().GetSize() == 0) {
297  // When all images have been removed, we're doing the
298  // dyld handover from a launch-dyld to a shared-cache-dyld,
299  // and we've just hit our one-shot address breakpoint in
300  // the sc-dyld. Note that the image addresses passed to
301  // this function are inferior sizeof(void*) not uint64_t's
302  // like our normal notification, so don't even look at
303  // image_load_addresses.
304 
305  dyld_instance->ClearDYLDHandoverBreakpoint();
306 
307  dyld_instance->DoInitialImageFetch();
308  dyld_instance->SetNotificationBreakpoint();
309  } else {
310  dyld_instance->AddBinaries(image_load_addresses);
311  }
312  } else if (dyld_mode == 1) {
313  // dyld_notify_removing
314  dyld_instance->UnloadImages(image_load_addresses);
315  } else if (dyld_mode == 2) {
316  // dyld_notify_remove_all
317  dyld_instance->UnloadAllImages();
318  } else if (dyld_mode == 3 && image_infos_count == 1) {
319  // dyld_image_dyld_moved
320 
321  dyld_instance->ClearNotificationBreakpoint();
322  dyld_instance->UnloadAllImages();
323  dyld_instance->ClearDYLDModule();
324  process->GetTarget().GetImages().Clear();
325  process->GetTarget().GetSectionLoadList().Clear();
326 
327  addr_t all_image_infos = process->GetImageInfoAddress();
328  int addr_size =
330  addr_t notification_location = all_image_infos + 4 + // version
331  4 + // infoArrayCount
332  addr_size; // infoArray
333  Status error;
334  addr_t notification_addr =
335  process->ReadPointerFromMemory(notification_location, error);
336  if (ABISP abi_sp = process->GetABI())
337  notification_addr = abi_sp->FixCodeAddress(notification_addr);
338 
339  dyld_instance->SetDYLDHandoverBreakpoint(notification_addr);
340  }
341  }
342  }
343  }
344  }
345  } else {
346  Target &target = process->GetTarget();
347  Debugger::ReportWarning(
348  "no ABI plugin located for triple " +
349  target.GetArchitecture().GetTriple().getTriple() +
350  ": shared libraries will not be registered",
351  target.GetDebugger().GetID());
352  }
353 
354  // Return true to stop the target, false to just let the target run
355  return dyld_instance->GetStopWhenImagesChange();
356 }
357 
359  const std::vector<lldb::addr_t> &load_addresses) {
360  Log *log = GetLog(LLDBLog::DynamicLoader);
361  ImageInfo::collection image_infos;
362 
363  LLDB_LOGF(log, "Adding %" PRId64 " modules.",
364  (uint64_t)load_addresses.size());
365  StructuredData::ObjectSP binaries_info_sp =
366  m_process->GetLoadedDynamicLibrariesInfos(load_addresses);
367  if (binaries_info_sp.get() && binaries_info_sp->GetAsDictionary() &&
368  binaries_info_sp->GetAsDictionary()->HasKey("images") &&
369  binaries_info_sp->GetAsDictionary()
370  ->GetValueForKey("images")
371  ->GetAsArray() &&
372  binaries_info_sp->GetAsDictionary()
373  ->GetValueForKey("images")
374  ->GetAsArray()
375  ->GetSize() == load_addresses.size()) {
376  if (JSONImageInformationIntoImageInfo(binaries_info_sp, image_infos)) {
378  AddModulesUsingImageInfos(image_infos);
379  }
381  }
382 }
383 
384 // Dump the _dyld_all_image_infos members and all current image infos that we
385 // have parsed to the file handle provided.
387  if (log == nullptr)
388  return;
389 }
390 
393  ModuleSP dyld_sp(GetDYLDModule());
394  if (dyld_sp) {
395  bool internal = true;
396  bool hardware = false;
397  LazyBool skip_prologue = eLazyBoolNo;
398  FileSpecList *source_files = nullptr;
399  FileSpecList dyld_filelist;
400  dyld_filelist.Append(dyld_sp->GetFileSpec());
401 
402  Breakpoint *breakpoint =
404  .CreateBreakpoint(&dyld_filelist, source_files,
405  "_dyld_debugger_notification",
406  eFunctionNameTypeFull, eLanguageTypeC, 0,
407  skip_prologue, internal, hardware)
408  .get();
410  true);
411  breakpoint->SetBreakpointKind("shared-library-event");
412  m_break_id = breakpoint->GetID();
413  }
414  }
416 }
417 
419  addr_t notification_address) {
421  BreakpointSP dyld_handover_bp = m_process->GetTarget().CreateBreakpoint(
422  notification_address, true, false);
423  dyld_handover_bp->SetCallback(DynamicLoaderMacOS::NotifyBreakpointHit, this,
424  true);
425  dyld_handover_bp->SetOneShot(true);
426  m_dyld_handover_break_id = dyld_handover_bp->GetID();
427  return true;
428  }
429  return false;
430 }
431 
436 }
437 
438 addr_t
440  SymbolContext sc;
441  Target &target = m_process->GetTarget();
442  if (Symtab *symtab = module->GetSymtab()) {
443  std::vector<uint32_t> match_indexes;
444  ConstString g_symbol_name("_dyld_global_lock_held");
445  uint32_t num_matches = 0;
446  num_matches =
447  symtab->AppendSymbolIndexesWithName(g_symbol_name, match_indexes);
448  if (num_matches == 1) {
449  Symbol *symbol = symtab->SymbolAtIndex(match_indexes[0]);
450  if (symbol &&
451  (symbol->ValueIsAddress() || symbol->GetAddressRef().IsValid())) {
452  return symbol->GetAddressRef().GetOpcodeLoadAddress(&target);
453  }
454  }
455  }
456  return LLDB_INVALID_ADDRESS;
457 }
458 
459 // Look for this symbol:
460 //
461 // int __attribute__((visibility("hidden"))) _dyld_global_lock_held =
462 // 0;
463 //
464 // in libdyld.dylib.
466  Status error;
467  addr_t symbol_address = LLDB_INVALID_ADDRESS;
468  ConstString g_libdyld_name("libdyld.dylib");
469  Target &target = m_process->GetTarget();
470  const ModuleList &target_modules = target.GetImages();
471  std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
472 
473  // Find any modules named "libdyld.dylib" and look for the symbol there first
474  for (ModuleSP module_sp : target.GetImages().ModulesNoLocking()) {
475  if (module_sp) {
476  if (module_sp->GetFileSpec().GetFilename() == g_libdyld_name) {
477  symbol_address = GetDyldLockVariableAddressFromModule(module_sp.get());
478  if (symbol_address != LLDB_INVALID_ADDRESS)
479  break;
480  }
481  }
482  }
483 
484  // Search through all modules looking for the symbol in them
485  if (symbol_address == LLDB_INVALID_ADDRESS) {
486  for (ModuleSP module_sp : target.GetImages().Modules()) {
487  if (module_sp) {
488  addr_t symbol_address =
489  GetDyldLockVariableAddressFromModule(module_sp.get());
490  if (symbol_address != LLDB_INVALID_ADDRESS)
491  break;
492  }
493  }
494  }
495 
496  // Default assumption is that it is OK to load images. Only say that we
497  // cannot load images if we find the symbol in libdyld and it indicates that
498  // we cannot.
499 
500  if (symbol_address != LLDB_INVALID_ADDRESS) {
501  {
502  int lock_held =
503  m_process->ReadUnsignedIntegerFromMemory(symbol_address, 4, 0, error);
504  if (lock_held != 0) {
505  error.SetErrorString("dyld lock held - unsafe to load images.");
506  }
507  }
508  } else {
509  // If we were unable to find _dyld_global_lock_held in any modules, or it
510  // is not loaded into memory yet, we may be at process startup (sitting at
511  // _dyld_start) - so we should not allow dlopen calls. But if we found more
512  // than one module then we are clearly past _dyld_start so in that case
513  // we'll default to "it's safe".
514  if (target.GetImages().GetSize() <= 1)
515  error.SetErrorString("could not find the dyld library or "
516  "the dyld lock symbol");
517  }
518  return error;
519 }
520 
522  lldb::addr_t &base_address, UUID &uuid, LazyBool &using_shared_cache,
523  LazyBool &private_shared_cache) {
524  base_address = LLDB_INVALID_ADDRESS;
525  uuid.Clear();
526  using_shared_cache = eLazyBoolCalculate;
527  private_shared_cache = eLazyBoolCalculate;
528 
529  if (m_process) {
531  StructuredData::Dictionary *info_dict = nullptr;
532  if (info.get() && info->GetAsDictionary()) {
533  info_dict = info->GetAsDictionary();
534  }
535 
536  // {"shared_cache_base_address":140735683125248,"shared_cache_uuid
537  // ":"DDB8D70C-
538  // C9A2-3561-B2C8-BE48A4F33F96","no_shared_cache":false,"shared_cache_private_cache":false}
539 
540  if (info_dict && info_dict->HasKey("shared_cache_uuid") &&
541  info_dict->HasKey("no_shared_cache") &&
542  info_dict->HasKey("shared_cache_base_address")) {
543  base_address = info_dict->GetValueForKey("shared_cache_base_address")
544  ->GetIntegerValue(LLDB_INVALID_ADDRESS);
545  std::string uuid_str = std::string(
546  info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue());
547  if (!uuid_str.empty())
548  uuid.SetFromStringRef(uuid_str);
549  if (!info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue())
550  using_shared_cache = eLazyBoolYes;
551  else
552  using_shared_cache = eLazyBoolNo;
553  if (info_dict->GetValueForKey("shared_cache_private_cache")
554  ->GetBooleanValue())
555  private_shared_cache = eLazyBoolYes;
556  else
557  private_shared_cache = eLazyBoolNo;
558 
559  return true;
560  }
561  }
562  return false;
563 }
564 
566  PluginManager::RegisterPlugin(GetPluginNameStatic(),
568 }
569 
571  PluginManager::UnregisterPlugin(CreateInstance);
572 }
573 
575  return "Dynamic loader plug-in that watches for shared library loads/unloads "
576  "in MacOSX user processes.";
577 }
lldb_private::UUID
Definition: UUID.h:23
lldb_private::Module::GetObjectFile
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
Definition: Module.cpp:1266
LLDB_BREAK_ID_IS_VALID
#define LLDB_BREAK_ID_IS_VALID(bid)
Definition: lldb-defines.h:39
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::StructuredData::Dictionary
Definition: StructuredData.h:368
DynamicLoaderMacOS::GetDyldLockVariableAddressFromModule
lldb::addr_t GetDyldLockVariableAddressFromModule(lldb_private::Module *module)
Definition: DynamicLoaderMacOS.cpp:439
lldb_private::StoppointCallbackContext
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
Definition: StoppointCallbackContext.h:26
DynamicLoaderMacOS::CanLoadImage
lldb_private::Status CanLoadImage() override
Ask if it is ok to try and load or unload an shared library (image).
Definition: DynamicLoaderMacOS.cpp:465
DynamicLoaderMacOS::DoInitialImageFetch
void DoInitialImageFetch() override
Definition: DynamicLoaderMacOS.cpp:165
lldb_private::Stoppoint::GetID
lldb::break_id_t GetID() const
Definition: Stoppoint.cpp:22
lldb_private::Address::IsValid
bool IsValid() const
Check if the object state is valid.
Definition: Address.h:345
lldb_private::Address::Clear
void Clear()
Clear the object's state.
Definition: Address.h:178
lldb_private::ModuleList::Modules
ModuleIterable Modules() const
Definition: ModuleList.h:507
lldb_private::DynamicLoaderDarwin::GetDYLDModule
lldb::ModuleSP GetDYLDModule()
Definition: DynamicLoaderDarwin.cpp:628
lldb_private::StructuredData::Dictionary::GetValueForKey
ObjectSP GetValueForKey(llvm::StringRef key) const
Definition: StructuredData.h:405
lldb_private::Value
Definition: Value.h:38
lldb_private::Symbol
Definition: Symbol.h:20
lldb_private::Value::SetValueType
void SetValueType(ValueType value_type)
Definition: Value.h:89
lldb_private::Symbol::ValueIsAddress
bool ValueIsAddress() const
Definition: Symbol.cpp:117
lldb_private::ExecutionContext::GetProcessPtr
Process * GetProcessPtr() const
Returns a pointer to the process object.
Definition: ExecutionContext.cpp:206
DynamicLoaderMacOS::m_image_infos_stop_id
uint32_t m_image_infos_stop_id
Definition: DynamicLoaderMacOS.h:98
lldb_private::Breakpoint::SetBreakpointKind
void SetBreakpointKind(const char *kind)
Set the "kind" description for a breakpoint.
Definition: Breakpoint.h:453
lldb_private::Module::GetSymtab
Symtab * GetSymtab()
Definition: Module.cpp:1067
lldb_private::DynamicLoaderDarwin::JSONImageInformationIntoImageInfo
bool JSONImageInformationIntoImageInfo(lldb_private::StructuredData::ObjectSP image_details, ImageInfo::collection &image_infos)
Definition: DynamicLoaderDarwin.cpp:356
lldb_private::DynamicLoaderDarwin::m_pthread_getspecific_addr
lldb_private::Address m_pthread_getspecific_addr
Definition: DynamicLoaderDarwin.h:231
lldb_private::DynamicLoaderDarwin::ImageInfo::collection
std::vector< ImageInfo > collection
Definition: DynamicLoaderDarwin.h:170
lldb_private::ValueList::GetValueAtIndex
Value * GetValueAtIndex(size_t idx)
Definition: Value.cpp:669
lldb_private::SectionLoadList::Clear
void Clear()
Definition: SectionLoadList.cpp:43
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:344
DynamicLoaderMacOS::Initialize
static void Initialize()
Definition: DynamicLoaderMacOS.cpp:565
DynamicLoaderMacOS::CreateInstance
static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force)
Definition: DynamicLoaderMacOS.cpp:36
lldb_private::DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos
void UpdateSpecialBinariesFromNewImageInfos(ImageInfo::collection &image_infos)
Definition: DynamicLoaderDarwin.cpp:532
lldb_private::Process
Definition: Process.h:338
lldb_private::Target::GetExecutableModulePointer
Module * GetExecutableModulePointer()
Definition: Target.cpp:1385
lldb_private::ModuleList::GetMutex
std::recursive_mutex & GetMutex() const
Definition: ModuleList.h:209
lldb_private::TypeSystemClang::GetBuiltinTypeForEncodingAndBitSize
CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override
Definition: TypeSystemClang.cpp:796
Module.h
DynamicLoaderDarwin.h
lldb_private::Process::GetThreadList
ThreadList & GetThreadList()
Definition: Process.h:2086
lldb_private::StoppointCallbackContext::exe_ctx_ref
ExecutionContextRef exe_ctx_ref
Definition: StoppointCallbackContext.h:43
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1219
lldb_private::DynamicLoaderDarwin::GetMutex
std::recursive_mutex & GetMutex() const
Definition: DynamicLoaderDarwin.h:196
StoppointCallbackContext.h
DynamicLoaderMacOS::DidSetNotificationBreakpoint
bool DidSetNotificationBreakpoint() override
Definition: DynamicLoaderMacOS.cpp:150
DynamicLoaderMacOS::~DynamicLoaderMacOS
~DynamicLoaderMacOS() override
Definition: DynamicLoaderMacOS.cpp:85
lldb_private::Module
Definition: Module.h:86
SectionLoadList.h
lldb_private::ValueList
Definition: Value.h:157
StackFrame.h
DynamicLoaderMacOS::SetNotificationBreakpoint
bool SetNotificationBreakpoint() override
Definition: DynamicLoaderMacOS.cpp:391
lldb::eLanguageTypeC
@ eLanguageTypeC
Non-standardized C, such as K&R.
Definition: lldb-enumerations.h:440
lldb_private::Target::CreateBreakpoint
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
Definition: Target.cpp:353
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:463
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
DynamicLoaderMacOS
Definition: DynamicLoaderMacOS.h:31
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
DynamicLoaderMacOS::NeedToDoInitialImageFetch
bool NeedToDoInitialImageFetch() override
Definition: DynamicLoaderMacOS.cpp:197
lldb_private::Target::GetDebugger
Debugger & GetDebugger()
Definition: Target.h:1030
Debugger.h
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:469
lldb_private::Address::GetOpcodeLoadAddress
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
Definition: Address.cpp:368
Section.h
lldb_private::ModuleList::Clear
void Clear()
Clear the object's state.
Definition: ModuleList.cpp:393
DynamicLoaderMacOS::PutToLog
void PutToLog(lldb_private::Log *log) const
Definition: DynamicLoaderMacOS.cpp:386
lldb_private::DynamicLoaderDarwin::ClearDYLDModule
void ClearDYLDModule()
Definition: DynamicLoaderDarwin.cpp:633
ABI.h
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:947
lldb_private::Value::SetCompilerType
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:251
Target.h
lldb_private::Value::GetScalar
const Scalar & GetScalar() const
Definition: Value.h:112
DynamicLoaderMacOS::GetPluginNameStatic
static llvm::StringRef GetPluginNameStatic()
Definition: DynamicLoaderMacOS.h:42
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ModuleList::GetSize
size_t GetSize() const
Gets the size of the module list.
Definition: ModuleList.cpp:635
lldb_private::ValueList::PushValue
void PushValue(const Value &value)
Definition: Value.cpp:665
lldb_private::DynamicLoaderDarwin::AddModulesUsingImageInfos
bool AddModulesUsingImageInfos(ImageInfo::collection &image_infos)
Definition: DynamicLoaderDarwin.cpp:635
DynamicLoaderMacOS::GetPluginDescriptionStatic
static llvm::StringRef GetPluginDescriptionStatic()
Definition: DynamicLoaderMacOS.cpp:574
lldb_private::DynamicLoaderDarwin::m_dyld_image_infos_stop_id
uint32_t m_dyld_image_infos_stop_id
Definition: DynamicLoaderDarwin.h:235
lldb_private::ModuleList
Definition: ModuleList.h:82
lldb_private::Scalar::ULongLong
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition: Scalar.cpp:334
Log.h
TypeSystemClang.h
lldb_private::ModuleList::ModulesNoLocking
ModuleIterableNoLocking ModulesNoLocking() const
Definition: ModuleList.h:513
DynamicLoaderMacOS::NotifyBreakpointHit
static bool NotifyBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Definition: DynamicLoaderMacOS.cpp:203
lldb_private::Process::GetLoadedDynamicLibrariesInfos
virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos(lldb::addr_t image_list_address, lldb::addr_t image_count)
Retrieve the list of shared libraries that are loaded for this process This method is used on pre-mac...
Definition: Process.h:1295
DynamicLoaderMacOS::AddBinaries
void AddBinaries(const std::vector< lldb::addr_t > &load_addresses)
Definition: DynamicLoaderMacOS.cpp:358
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::Symbol::GetAddressRef
Address & GetAddressRef()
Definition: Symbol.h:57
lldb::eEncodingUint
@ eEncodingUint
unsigned integer
Definition: lldb-enumerations.h:149
lldb_private::ConstString
Definition: ConstString.h:39
DynamicLoaderMacOS::ClearDYLDHandoverBreakpoint
void ClearDYLDHandoverBreakpoint()
Definition: DynamicLoaderMacOS.cpp:432
DynamicLoaderMacOS.h
lldb_private::Scalar::UInt
unsigned int UInt(unsigned int fail_value=0) const
Definition: Scalar.cpp:320
lldb_private::DynamicLoader
Definition: DynamicLoader.h:52
DynamicLoaderMacOS::DynamicLoaderMacOS
DynamicLoaderMacOS(lldb_private::Process *process)
Definition: DynamicLoaderMacOS.cpp:78
lldb_private::DynamicLoader::m_process
Process * m_process
The process that this dynamic loader plug-in is tracking.
Definition: DynamicLoader.h:369
lldb::eBasicTypeVoid
@ eBasicTypeVoid
Definition: lldb-enumerations.h:750
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
DynamicLoaderMacOS::m_dyld_handover_break_id
lldb::user_id_t m_dyld_handover_break_id
Definition: DynamicLoaderMacOS.h:101
lldb_private::ThreadList::GetThreadAtIndex
lldb::ThreadSP GetThreadAtIndex(uint32_t idx, bool can_update=true)
Definition: ThreadList.cpp:91
Thread.h
lldb_private::DynamicLoaderDarwin
Definition: DynamicLoaderDarwin.h:27
lldb_private::ArchSpec::GetAddressByteSize
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:694
DynamicLoaderMacOS::Terminate
static void Terminate()
Definition: DynamicLoaderMacOS.cpp:570
ObjectFile.h
lldb_private::UserID::GetID
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47
LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:37
DynamicLoaderMacOS::m_maybe_image_infos_address
lldb::addr_t m_maybe_image_infos_address
Definition: DynamicLoaderMacOS.h:103
lldb_private::UUID::Clear
void Clear()
Definition: UUID.h:62
lldb_private::Symbol::GetName
ConstString GetName() const
Definition: Symbol.cpp:500
lldb_private::ExecutionContext::GetThreadRef
Thread & GetThreadRef() const
Returns a reference to the thread object.
Definition: ExecutionContext.cpp:234
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:989
DynamicLoaderMacOS::ClearNotificationBreakpoint
void ClearNotificationBreakpoint() override
Definition: DynamicLoaderMacOS.cpp:154
lldb_private::Status
Definition: Status.h:44
lldb_private::CompilerType::GetPointerType
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
Definition: CompilerType.cpp:466
lldb_private::Symtab
Definition: Symtab.h:22
uint32_t
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb_private::DynamicLoaderDarwin::UnloadAllImages
void UnloadAllImages()
Definition: DynamicLoaderDarwin.cpp:212
lldb_private::UUID::SetFromStringRef
bool SetFromStringRef(llvm::StringRef str)
Definition: UUID.cpp:97
lldb_private::ObjectFile::GetStrata
Strata GetStrata()
Definition: ObjectFile.h:643
lldb_private::StructuredData::Object::GetAsDictionary
Dictionary * GetAsDictionary()
Definition: StructuredData.h:91
lldb_private::Breakpoint::SetCallback
void SetCallback(BreakpointHitCallback callback, void *baton, bool is_synchronous=false)
Set the callback action invoked when the breakpoint is hit.
Definition: Breakpoint.cpp:418
lldb_private::DynamicLoaderDarwin::UnloadImages
void UnloadImages(const std::vector< lldb::addr_t > &solib_addresses)
Definition: DynamicLoaderDarwin.cpp:164
lldb_private::ThreadList::GetSize
uint32_t GetSize(bool can_update=true)
Definition: ThreadList.cpp:83
lldb_private::DynamicLoader::GetStopWhenImagesChange
bool GetStopWhenImagesChange() const
Get whether the process should stop when images change.
Definition: DynamicLoader.cpp:68
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::StructuredData::Dictionary::HasKey
bool HasKey(llvm::StringRef key) const
Definition: StructuredData.h:514
PluginManager.h
lldb_private::Target::RemoveBreakpointByID
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:953
DynamicLoaderMacOS::GetSharedCacheInformation
bool GetSharedCacheInformation(lldb::addr_t &base_address, lldb_private::UUID &uuid, lldb_private::LazyBool &using_shared_cache, lldb_private::LazyBool &private_shared_cache) override
Get information about the shared cache for a process, if possible.
Definition: DynamicLoaderMacOS.cpp:521
lldb_private::Target::GetSectionLoadList
SectionLoadList & GetSectionLoadList()
Definition: Target.h:1102
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:35
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
DynamicLoaderMacOS::SetDYLDHandoverBreakpoint
bool SetDYLDHandoverBreakpoint(lldb::addr_t notification_address)
Definition: DynamicLoaderMacOS.cpp:418
lldb_private::Process::GetImageInfoAddress
virtual lldb::addr_t GetImageInfoAddress()
Get the image information address for the current process.
Definition: Process.cpp:1484
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
DynamicLoaderMacOS::DoClear
void DoClear() override
Definition: DynamicLoaderMacOS.cpp:137
lldb_private::eLazyBoolCalculate
@ eLazyBoolCalculate
Definition: lldb-private-enumerations.h:115
lldb_private::TypeSystemClang::GetBasicType
CompilerType GetBasicType(lldb::BasicType type)
Definition: TypeSystemClang.cpp:931
lldb_private::TypeSystemClang
A TypeSystem implementation based on Clang.
Definition: TypeSystemClang.h:105
lldb_private::Process::GetABI
const lldb::ABISP & GetABI()
Definition: Process.cpp:1486
State.h
lldb_private::Process::ReadUnsignedIntegerFromMemory
uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, Status &error)
Reads an unsigned integer of the specified byte size from process memory.
Definition: Process.cpp:2066
lldb_private::Process::GetSharedCacheInfo
virtual lldb_private::StructuredData::ObjectSP GetSharedCacheInfo()
Definition: Process.h:1320
lldb_private::Log
Definition: Log.h:115
lldb_private::Process::ReadPointerFromMemory
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition: Process.cpp:2088
DynamicLoaderMacOS::ProcessDidExec
bool ProcessDidExec() override
Called after attaching a process.
Definition: DynamicLoaderMacOS.cpp:92
DynamicLoaderMacOS::m_break_id
lldb::user_id_t m_break_id
Definition: DynamicLoaderMacOS.h:100
lldb_private::DynamicLoaderDarwin::m_libpthread_module_wp
lldb::ModuleWP m_libpthread_module_wp
Definition: DynamicLoaderDarwin.h:230
SymbolVendor.h
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
lldb_private::Process::GetStopID
uint32_t GetStopID() const
Definition: Process.h:1378
lldb
Definition: SBAddress.h:15
DynamicLoaderMacOS::m_mutex
std::recursive_mutex m_mutex
Definition: DynamicLoaderMacOS.h:102
LLDBLog.h
lldb_private::ObjectFile
Definition: ObjectFile.h:60
lldb_private::Breakpoint
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition: Breakpoint.h:80