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"
17 #include "lldb/Target/StackFrame.h"
18 #include "lldb/Target/Target.h"
19 #include "lldb/Target/Thread.h"
20 #include "lldb/Utility/Log.h"
21 #include "lldb/Utility/State.h"
22 
23 #include "DynamicLoaderDarwin.h"
24 #include "DynamicLoaderMacOS.h"
25 
27 
28 using namespace lldb;
29 using namespace lldb_private;
30 
31 // Create an instance of this class. This function is filled into the plugin
32 // info class that gets handed out by the plugin factory and allows the lldb to
33 // instantiate an instance of this class.
35  bool force) {
36  bool create = force;
37  if (!create) {
38  create = true;
39  Module *exe_module = process->GetTarget().GetExecutableModulePointer();
40  if (exe_module) {
41  ObjectFile *object_file = exe_module->GetObjectFile();
42  if (object_file) {
43  create = (object_file->GetStrata() == ObjectFile::eStrataUser);
44  }
45  }
46 
47  if (create) {
48  const llvm::Triple &triple_ref =
49  process->GetTarget().GetArchitecture().GetTriple();
50  switch (triple_ref.getOS()) {
51  case llvm::Triple::Darwin:
52  case llvm::Triple::MacOSX:
53  case llvm::Triple::IOS:
54  case llvm::Triple::TvOS:
55  case llvm::Triple::WatchOS:
56  // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS:
57  create = triple_ref.getVendor() == llvm::Triple::Apple;
58  break;
59  default:
60  create = false;
61  break;
62  }
63  }
64  }
65 
66  if (!UseDYLDSPI(process)) {
67  create = false;
68  }
69 
70  if (create)
71  return new DynamicLoaderMacOS(process);
72  return nullptr;
73 }
74 
75 // Constructor
77  : DynamicLoaderDarwin(process), m_image_infos_stop_id(UINT32_MAX),
78  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex(),
79  m_maybe_image_infos_address(LLDB_INVALID_ADDRESS) {}
80 
81 // Destructor
85 }
86 
88  std::lock_guard<std::recursive_mutex> baseclass_guard(GetMutex());
89  bool did_exec = false;
90  if (m_process) {
91  // If we are stopped after an exec, we will have only one thread...
92  if (m_process->GetThreadList().GetSize() == 1) {
93  // Maybe we still have an image infos address around? If so see
94  // if that has changed, and if so we have exec'ed.
96  lldb::addr_t image_infos_address = m_process->GetImageInfoAddress();
97  if (image_infos_address != m_maybe_image_infos_address) {
98  // We don't really have to reset this here, since we are going to
99  // call DoInitialImageFetch right away to handle the exec. But in
100  // case anybody looks at it in the meantime, it can't hurt.
101  m_maybe_image_infos_address = image_infos_address;
102  did_exec = true;
103  }
104  }
105 
106  if (!did_exec) {
107  // See if we are stopped at '_dyld_start'
108  ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
109  if (thread_sp) {
110  lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
111  if (frame_sp) {
112  const Symbol *symbol =
113  frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
114  if (symbol) {
115  if (symbol->GetName() == "_dyld_start")
116  did_exec = true;
117  }
118  }
119  }
120  }
121  }
122  }
123 
124  if (did_exec) {
125  m_libpthread_module_wp.reset();
127  }
128  return did_exec;
129 }
130 
131 // Clear out the state of this class.
133  std::lock_guard<std::recursive_mutex> guard(m_mutex);
134 
137 
139 }
140 
141 // Check if we have found DYLD yet
144 }
145 
150  }
151 }
152 
153 // Try and figure out where dyld is by first asking the Process if it knows
154 // (which currently calls down in the lldb::Process to get the DYLD info
155 // (available on SnowLeopard only). If that fails, then check in the default
156 // addresses.
159 
160  // Remove any binaries we pre-loaded in the Target before
161  // launching/attaching. If the same binaries are present in the process,
162  // we'll get them from the shared module cache, we won't need to re-load them
163  // from disk.
164  UnloadAllImages();
165 
166  StructuredData::ObjectSP all_image_info_json_sp(
168  ImageInfo::collection image_infos;
169  if (all_image_info_json_sp.get() &&
170  all_image_info_json_sp->GetAsDictionary() &&
171  all_image_info_json_sp->GetAsDictionary()->HasKey("images") &&
172  all_image_info_json_sp->GetAsDictionary()
173  ->GetValueForKey("images")
174  ->GetAsArray()) {
175  if (JSONImageInformationIntoImageInfo(all_image_info_json_sp,
176  image_infos)) {
177  LLDB_LOGF(log, "Initial module fetch: Adding %" PRId64 " modules.\n",
178  (uint64_t)image_infos.size());
179 
181  AddModulesUsingImageInfos(image_infos);
182  }
183  }
184 
187 }
188 
190 
191 // Static callback function that gets called when our DYLD notification
192 // breakpoint gets hit. We update all of our image infos and then let our super
193 // class DynamicLoader class decide if we should stop or not (based on global
194 // preference).
196  StoppointCallbackContext *context,
197  lldb::user_id_t break_id,
198  lldb::user_id_t break_loc_id) {
199  // Let the event know that the images have changed
200  // DYLD passes three arguments to the notification breakpoint.
201  // Arg1: enum dyld_notify_mode mode - 0 = adding, 1 = removing, 2 = remove
202  // all Arg2: unsigned long icount - Number of shared libraries
203  // added/removed Arg3: uint64_t mach_headers[] - Array of load addresses
204  // of binaries added/removed
205 
206  DynamicLoaderMacOS *dyld_instance = (DynamicLoaderMacOS *)baton;
207 
208  ExecutionContext exe_ctx(context->exe_ctx_ref);
209  Process *process = exe_ctx.GetProcessPtr();
210 
211  // This is a sanity check just in case this dyld_instance is an old dyld
212  // plugin's breakpoint still lying around.
213  if (process != dyld_instance->m_process)
214  return false;
215 
216  if (dyld_instance->m_image_infos_stop_id != UINT32_MAX &&
217  process->GetStopID() < dyld_instance->m_image_infos_stop_id) {
218  return false;
219  }
220 
221  const lldb::ABISP &abi = process->GetABI();
222  if (abi) {
223  // Build up the value array to store the three arguments given above, then
224  // get the values from the ABI:
225 
226  TypeSystemClang *clang_ast_context =
227  ScratchTypeSystemClang::GetForTarget(process->GetTarget());
228  if (!clang_ast_context)
229  return false;
230 
231  ValueList argument_values;
232 
233  Value mode_value; // enum dyld_notify_mode { dyld_notify_adding=0,
234  // dyld_notify_removing=1, dyld_notify_remove_all=2 };
235  Value count_value; // unsigned long count
236  Value headers_value; // uint64_t machHeaders[] (aka void*)
237 
238  CompilerType clang_void_ptr_type =
239  clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
240  CompilerType clang_uint32_type =
241  clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(
242  lldb::eEncodingUint, 32);
243  CompilerType clang_uint64_type =
244  clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(
245  lldb::eEncodingUint, 32);
246 
247  mode_value.SetValueType(Value::ValueType::Scalar);
248  mode_value.SetCompilerType(clang_uint32_type);
249 
250  if (process->GetTarget().GetArchitecture().GetAddressByteSize() == 4) {
251  count_value.SetValueType(Value::ValueType::Scalar);
252  count_value.SetCompilerType(clang_uint32_type);
253  } else {
254  count_value.SetValueType(Value::ValueType::Scalar);
255  count_value.SetCompilerType(clang_uint64_type);
256  }
257 
258  headers_value.SetValueType(Value::ValueType::Scalar);
259  headers_value.SetCompilerType(clang_void_ptr_type);
260 
261  argument_values.PushValue(mode_value);
262  argument_values.PushValue(count_value);
263  argument_values.PushValue(headers_value);
264 
265  if (abi->GetArgumentValues(exe_ctx.GetThreadRef(), argument_values)) {
266  uint32_t dyld_mode =
267  argument_values.GetValueAtIndex(0)->GetScalar().UInt(-1);
268  if (dyld_mode != static_cast<uint32_t>(-1)) {
269  // Okay the mode was right, now get the number of elements, and the
270  // array of new elements...
271  uint32_t image_infos_count =
272  argument_values.GetValueAtIndex(1)->GetScalar().UInt(-1);
273  if (image_infos_count != static_cast<uint32_t>(-1)) {
274  addr_t header_array =
275  argument_values.GetValueAtIndex(2)->GetScalar().ULongLong(-1);
276  if (header_array != static_cast<uint64_t>(-1)) {
277  std::vector<addr_t> image_load_addresses;
278  for (uint64_t i = 0; i < image_infos_count; i++) {
279  Status error;
280  addr_t addr = process->ReadUnsignedIntegerFromMemory(
281  header_array + (8 * i), 8, LLDB_INVALID_ADDRESS, error);
282  if (addr != LLDB_INVALID_ADDRESS) {
283  image_load_addresses.push_back(addr);
284  }
285  }
286  if (dyld_mode == 0) {
287  // dyld_notify_adding
288  dyld_instance->AddBinaries(image_load_addresses);
289  } else if (dyld_mode == 1) {
290  // dyld_notify_removing
291  dyld_instance->UnloadImages(image_load_addresses);
292  } else if (dyld_mode == 2) {
293  // dyld_notify_remove_all
294  dyld_instance->UnloadAllImages();
295  }
296  }
297  }
298  }
299  }
300  } else {
301  process->GetTarget().GetDebugger().GetAsyncErrorStream()->Printf(
302  "No ABI plugin located for triple %s -- shared libraries will not be "
303  "registered!\n",
304  process->GetTarget().GetArchitecture().GetTriple().getTriple().c_str());
305  }
306 
307  // Return true to stop the target, false to just let the target run
308  return dyld_instance->GetStopWhenImagesChange();
309 }
310 
312  const std::vector<lldb::addr_t> &load_addresses) {
314  ImageInfo::collection image_infos;
315 
316  LLDB_LOGF(log, "Adding %" PRId64 " modules.",
317  (uint64_t)load_addresses.size());
318  StructuredData::ObjectSP binaries_info_sp =
319  m_process->GetLoadedDynamicLibrariesInfos(load_addresses);
320  if (binaries_info_sp.get() && binaries_info_sp->GetAsDictionary() &&
321  binaries_info_sp->GetAsDictionary()->HasKey("images") &&
322  binaries_info_sp->GetAsDictionary()
323  ->GetValueForKey("images")
324  ->GetAsArray() &&
325  binaries_info_sp->GetAsDictionary()
326  ->GetValueForKey("images")
327  ->GetAsArray()
328  ->GetSize() == load_addresses.size()) {
329  if (JSONImageInformationIntoImageInfo(binaries_info_sp, image_infos)) {
331  AddModulesUsingImageInfos(image_infos);
332  }
334  }
335 }
336 
337 // Dump the _dyld_all_image_infos members and all current image infos that we
338 // have parsed to the file handle provided.
340  if (log == nullptr)
341  return;
342 }
343 
346  ModuleSP dyld_sp(GetDYLDModule());
347  if (dyld_sp) {
348  bool internal = true;
349  bool hardware = false;
350  LazyBool skip_prologue = eLazyBoolNo;
351  FileSpecList *source_files = nullptr;
352  FileSpecList dyld_filelist;
353  dyld_filelist.Append(dyld_sp->GetObjectFile()->GetFileSpec());
354 
355  Breakpoint *breakpoint =
357  .CreateBreakpoint(&dyld_filelist, source_files,
358  "_dyld_debugger_notification",
359  eFunctionNameTypeFull, eLanguageTypeC, 0,
360  skip_prologue, internal, hardware)
361  .get();
363  true);
364  breakpoint->SetBreakpointKind("shared-library-event");
365  m_break_id = breakpoint->GetID();
366  }
367  }
369 }
370 
371 addr_t
373  SymbolContext sc;
374  Target &target = m_process->GetTarget();
375  if (Symtab *symtab = module->GetSymtab()) {
376  std::vector<uint32_t> match_indexes;
377  ConstString g_symbol_name("_dyld_global_lock_held");
378  uint32_t num_matches = 0;
379  num_matches =
380  symtab->AppendSymbolIndexesWithName(g_symbol_name, match_indexes);
381  if (num_matches == 1) {
382  Symbol *symbol = symtab->SymbolAtIndex(match_indexes[0]);
383  if (symbol &&
384  (symbol->ValueIsAddress() || symbol->GetAddressRef().IsValid())) {
385  return symbol->GetAddressRef().GetOpcodeLoadAddress(&target);
386  }
387  }
388  }
389  return LLDB_INVALID_ADDRESS;
390 }
391 
392 // Look for this symbol:
393 //
394 // int __attribute__((visibility("hidden"))) _dyld_global_lock_held =
395 // 0;
396 //
397 // in libdyld.dylib.
399  Status error;
400  addr_t symbol_address = LLDB_INVALID_ADDRESS;
401  ConstString g_libdyld_name("libdyld.dylib");
402  Target &target = m_process->GetTarget();
403  const ModuleList &target_modules = target.GetImages();
404  std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
405 
406  // Find any modules named "libdyld.dylib" and look for the symbol there first
407  for (ModuleSP module_sp : target.GetImages().ModulesNoLocking()) {
408  if (module_sp) {
409  if (module_sp->GetFileSpec().GetFilename() == g_libdyld_name) {
410  symbol_address = GetDyldLockVariableAddressFromModule(module_sp.get());
411  if (symbol_address != LLDB_INVALID_ADDRESS)
412  break;
413  }
414  }
415  }
416 
417  // Search through all modules looking for the symbol in them
418  if (symbol_address == LLDB_INVALID_ADDRESS) {
419  for (ModuleSP module_sp : target.GetImages().Modules()) {
420  if (module_sp) {
421  addr_t symbol_address =
422  GetDyldLockVariableAddressFromModule(module_sp.get());
423  if (symbol_address != LLDB_INVALID_ADDRESS)
424  break;
425  }
426  }
427  }
428 
429  // Default assumption is that it is OK to load images. Only say that we
430  // cannot load images if we find the symbol in libdyld and it indicates that
431  // we cannot.
432 
433  if (symbol_address != LLDB_INVALID_ADDRESS) {
434  {
435  int lock_held =
436  m_process->ReadUnsignedIntegerFromMemory(symbol_address, 4, 0, error);
437  if (lock_held != 0) {
438  error.SetErrorString("dyld lock held - unsafe to load images.");
439  }
440  }
441  } else {
442  // If we were unable to find _dyld_global_lock_held in any modules, or it
443  // is not loaded into memory yet, we may be at process startup (sitting at
444  // _dyld_start) - so we should not allow dlopen calls. But if we found more
445  // than one module then we are clearly past _dyld_start so in that case
446  // we'll default to "it's safe".
447  if (target.GetImages().GetSize() <= 1)
448  error.SetErrorString("could not find the dyld library or "
449  "the dyld lock symbol");
450  }
451  return error;
452 }
453 
455  lldb::addr_t &base_address, UUID &uuid, LazyBool &using_shared_cache,
456  LazyBool &private_shared_cache) {
457  base_address = LLDB_INVALID_ADDRESS;
458  uuid.Clear();
459  using_shared_cache = eLazyBoolCalculate;
460  private_shared_cache = eLazyBoolCalculate;
461 
462  if (m_process) {
464  StructuredData::Dictionary *info_dict = nullptr;
465  if (info.get() && info->GetAsDictionary()) {
466  info_dict = info->GetAsDictionary();
467  }
468 
469  // {"shared_cache_base_address":140735683125248,"shared_cache_uuid
470  // ":"DDB8D70C-
471  // C9A2-3561-B2C8-BE48A4F33F96","no_shared_cache":false,"shared_cache_private_cache":false}
472 
473  if (info_dict && info_dict->HasKey("shared_cache_uuid") &&
474  info_dict->HasKey("no_shared_cache") &&
475  info_dict->HasKey("shared_cache_base_address")) {
476  base_address = info_dict->GetValueForKey("shared_cache_base_address")
477  ->GetIntegerValue(LLDB_INVALID_ADDRESS);
478  std::string uuid_str = std::string(
479  info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue());
480  if (!uuid_str.empty())
481  uuid.SetFromStringRef(uuid_str);
482  if (!info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue())
483  using_shared_cache = eLazyBoolYes;
484  else
485  using_shared_cache = eLazyBoolNo;
486  if (info_dict->GetValueForKey("shared_cache_private_cache")
487  ->GetBooleanValue())
488  private_shared_cache = eLazyBoolYes;
489  else
490  private_shared_cache = eLazyBoolNo;
491 
492  return true;
493  }
494  }
495  return false;
496 }
497 
499  PluginManager::RegisterPlugin(GetPluginNameStatic(),
501 }
502 
504  PluginManager::UnregisterPlugin(CreateInstance);
505 }
506 
508  static ConstString g_name("macos-dyld");
509  return g_name;
510 }
511 
513  return "Dynamic loader plug-in that watches for shared library loads/unloads "
514  "in MacOSX user processes.";
515 }
516 
517 // PluginInterface protocol
519  return GetPluginNameStatic();
520 }
521 
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:1242
LLDB_BREAK_ID_IS_VALID
#define LLDB_BREAK_ID_IS_VALID(bid)
Definition: lldb-defines.h:51
lldb_private::ExecutionContext
Definition: ExecutionContext.h:291
lldb_private::StructuredData::Dictionary
Definition: StructuredData.h:352
LIBLLDB_LOG_DYNAMIC_LOADER
#define LIBLLDB_LOG_DYNAMIC_LOADER
Definition: Logging.h:17
DynamicLoaderMacOS::GetDyldLockVariableAddressFromModule
lldb::addr_t GetDyldLockVariableAddressFromModule(lldb_private::Module *module)
Definition: DynamicLoaderMacOS.cpp:372
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:398
DynamicLoaderMacOS::DoInitialImageFetch
void DoInitialImageFetch() override
Definition: DynamicLoaderMacOS.cpp:157
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:332
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:480
lldb_private::DynamicLoaderDarwin::GetDYLDModule
lldb::ModuleSP GetDYLDModule()
Definition: DynamicLoaderDarwin.cpp:625
lldb_private::StructuredData::Dictionary::GetValueForKey
ObjectSP GetValueForKey(llvm::StringRef key) const
Definition: StructuredData.h:379
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:118
lldb_private::ExecutionContext::GetProcessPtr
Process * GetProcessPtr() const
Returns a pointer to the process object.
Definition: ExecutionContext.cpp:208
DynamicLoaderMacOS::m_image_infos_stop_id
uint32_t m_image_infos_stop_id
Definition: DynamicLoaderMacOS.h:96
lldb_private::Breakpoint::SetBreakpointKind
void SetBreakpointKind(const char *kind)
Set the "kind" description for a breakpoint.
Definition: Breakpoint.h:442
lldb_private::Module::GetSymtab
Symtab * GetSymtab()
Definition: Module.cpp:1055
lldb_private::DynamicLoaderDarwin::JSONImageInformationIntoImageInfo
bool JSONImageInformationIntoImageInfo(lldb_private::StructuredData::ObjectSP image_details, ImageInfo::collection &image_infos)
Definition: DynamicLoaderDarwin.cpp:355
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:682
DynamicLoaderMacOS::GetPluginName
lldb_private::ConstString GetPluginName() override
Definition: DynamicLoaderMacOS.cpp:518
DynamicLoaderMacOS::GetPluginVersion
uint32_t GetPluginVersion() override
Definition: DynamicLoaderMacOS.cpp:522
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:249
DynamicLoaderMacOS::Initialize
static void Initialize()
Definition: DynamicLoaderMacOS.cpp:498
DynamicLoaderMacOS::CreateInstance
static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force)
Definition: DynamicLoaderMacOS.cpp:34
lldb_private::DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos
void UpdateSpecialBinariesFromNewImageInfos(ImageInfo::collection &image_infos)
Definition: DynamicLoaderDarwin.cpp:531
lldb_private::Process
Definition: Process.h:343
lldb_private::Target::GetExecutableModulePointer
Module * GetExecutableModulePointer()
Definition: Target.cpp:1367
lldb_private::ModuleList::GetMutex
std::recursive_mutex & GetMutex() const
Definition: ModuleList.h:198
lldb_private::TypeSystemClang::GetBuiltinTypeForEncodingAndBitSize
CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override
Definition: TypeSystemClang.cpp:805
Module.h
DynamicLoaderDarwin.h
lldb_private::Process::GetThreadList
ThreadList & GetThreadList()
Definition: Process.h:2047
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:1196
lldb_private::DynamicLoaderDarwin::GetMutex
std::recursive_mutex & GetMutex() const
Definition: DynamicLoaderDarwin.h:196
StoppointCallbackContext.h
DynamicLoaderMacOS::DidSetNotificationBreakpoint
bool DidSetNotificationBreakpoint() override
Definition: DynamicLoaderMacOS.cpp:142
DynamicLoaderMacOS::~DynamicLoaderMacOS
~DynamicLoaderMacOS() override
Definition: DynamicLoaderMacOS.cpp:82
lldb_private::Module
Definition: Module.h:75
DynamicLoaderMacOS::GetPluginDescriptionStatic
static const char * GetPluginDescriptionStatic()
Definition: DynamicLoaderMacOS.cpp:512
lldb_private::ValueList
Definition: Value.h:157
StackFrame.h
DynamicLoaderMacOS::SetNotificationBreakpoint
bool SetNotificationBreakpoint() override
Definition: DynamicLoaderMacOS.cpp:344
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:329
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:444
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:189
lldb_private::Target::GetDebugger
Debugger & GetDebugger()
Definition: Target.h:996
Debugger.h
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:447
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:367
Section.h
DynamicLoaderMacOS::PutToLog
void PutToLog(lldb_private::Log *log) const
Definition: DynamicLoaderMacOS.cpp:339
ABI.h
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:921
lldb_private::Value::SetCompilerType
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:257
Target.h
lldb_private::Value::GetScalar
const Scalar & GetScalar() const
Definition: Value.h:112
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:596
lldb_private::ValueList::PushValue
void PushValue(const Value &value)
Definition: Value.cpp:678
lldb_private::DynamicLoaderDarwin::AddModulesUsingImageInfos
bool AddModulesUsingImageInfos(ImageInfo::collection &image_infos)
Definition: DynamicLoaderDarwin.cpp:630
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:71
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:486
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:195
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:1272
DynamicLoaderMacOS::AddBinaries
void AddBinaries(const std::vector< lldb::addr_t > &load_addresses)
Definition: DynamicLoaderMacOS.cpp:311
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::Symbol::GetAddressRef
Address & GetAddressRef()
Definition: Symbol.h:57
lldb_private::Debugger::GetAsyncErrorStream
lldb::StreamSP GetAsyncErrorStream()
Definition: Debugger.cpp:1056
lldb::eEncodingUint
@ eEncodingUint
unsigned integer
Definition: lldb-enumerations.h:148
lldb_private::ConstString
Definition: ConstString.h:40
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:76
lldb_private::DynamicLoader::m_process
Process * m_process
The process that this dynamic loader plug-in is tracking.
Definition: DynamicLoader.h:312
lldb::eBasicTypeVoid
@ eBasicTypeVoid
Definition: lldb-enumerations.h:742
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:38
lldb_private::ThreadList::GetThreadAtIndex
lldb::ThreadSP GetThreadAtIndex(uint32_t idx, bool can_update=true)
Definition: ThreadList.cpp:90
Thread.h
DynamicLoaderMacOS::GetPluginNameStatic
static lldb_private::ConstString GetPluginNameStatic()
Definition: DynamicLoaderMacOS.cpp:507
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:683
DynamicLoaderMacOS::Terminate
static void Terminate()
Definition: DynamicLoaderMacOS.cpp:503
ObjectFile.h
LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:49
DynamicLoaderMacOS::m_maybe_image_infos_address
lldb::addr_t m_maybe_image_infos_address
Definition: DynamicLoaderMacOS.h:100
lldb_private::UUID::Clear
void Clear()
Definition: UUID.h:72
lldb_private::Symbol::GetName
ConstString GetName() const
Definition: Symbol.cpp:499
lldb_private::ExecutionContext::GetThreadRef
Thread & GetThreadRef() const
Returns a reference to the thread object.
Definition: ExecutionContext.cpp:236
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:963
DynamicLoaderMacOS::ClearNotificationBreakpoint
void ClearNotificationBreakpoint() override
Definition: DynamicLoaderMacOS.cpp:146
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:407
lldb_private::Symtab
Definition: Symtab.h:21
uint32_t
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb_private::DynamicLoaderDarwin::UnloadAllImages
void UnloadAllImages()
Definition: DynamicLoaderDarwin.cpp:211
lldb_private::UUID::SetFromStringRef
bool SetFromStringRef(llvm::StringRef str)
Definition: UUID.cpp:96
lldb_private::ObjectFile::GetStrata
Strata GetStrata()
Definition: ObjectFile.h:611
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:429
lldb_private::DynamicLoaderDarwin::UnloadImages
void UnloadImages(const std::vector< lldb::addr_t > &solib_addresses)
Definition: DynamicLoaderDarwin.cpp:163
lldb_private::ThreadList::GetSize
uint32_t GetSize(bool can_update=true)
Definition: ThreadList.cpp:82
lldb_private::DynamicLoader::GetStopWhenImagesChange
bool GetStopWhenImagesChange() const
Get whether the process should stop when images change.
Definition: DynamicLoader.cpp:66
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb_private::StructuredData::Dictionary::HasKey
bool HasKey(llvm::StringRef key) const
Definition: StructuredData.h:488
PluginManager.h
lldb_private::Target::RemoveBreakpointByID
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:927
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:454
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
Definition: lldb-defines.h:85
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb::eLanguageTypeC
@ eLanguageTypeC
Non-standardized C, such as K&R.
Definition: lldb-enumerations.h:439
lldb_private::Process::GetImageInfoAddress
virtual lldb::addr_t GetImageInfoAddress()
Get the image information address for the current process.
Definition: Process.cpp:1451
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:132
lldb_private::eLazyBoolCalculate
@ eLazyBoolCalculate
Definition: lldb-private-enumerations.h:115
lldb_private::TypeSystemClang::GetBasicType
CompilerType GetBasicType(lldb::BasicType type)
Definition: TypeSystemClang.cpp:940
lldb_private::TypeSystemClang
A TypeSystem implementation based on Clang.
Definition: TypeSystemClang.h:106
lldb_private::Process::GetABI
const lldb::ABISP & GetABI()
Definition: Process.cpp:1453
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:2076
lldb_private::Process::GetSharedCacheInfo
virtual lldb_private::StructuredData::ObjectSP GetSharedCacheInfo()
Definition: Process.h:1297
lldb_private::Log
Definition: Log.h:49
DynamicLoaderMacOS::ProcessDidExec
bool ProcessDidExec() override
Called after attaching a process.
Definition: DynamicLoaderMacOS.cpp:87
DynamicLoaderMacOS::m_break_id
lldb::user_id_t m_break_id
Definition: DynamicLoaderMacOS.h:98
lldb_private::GetLogIfAnyCategoriesSet
Log * GetLogIfAnyCategoriesSet(uint32_t mask)
Definition: Logging.cpp:62
lldb_private::DynamicLoaderDarwin::m_libpthread_module_wp
lldb::ModuleWP m_libpthread_module_wp
Definition: DynamicLoaderDarwin.h:230
SymbolVendor.h
lldb_private::Process::GetStopID
uint32_t GetStopID() const
Definition: Process.h:1355
lldb
Definition: SBAddress.h:15
DynamicLoaderMacOS::m_mutex
std::recursive_mutex m_mutex
Definition: DynamicLoaderMacOS.h:99
lldb_private::ObjectFile
Definition: ObjectFile.h:58
lldb_private::Breakpoint
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition: Breakpoint.h:79