LLDB  mainline
DynamicLoaderPOSIXDYLD.cpp
Go to the documentation of this file.
1 //===-- DynamicLoaderPOSIXDYLD.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 // Main header include
10 #include "DynamicLoaderPOSIXDYLD.h"
11 
13 #include "lldb/Core/Module.h"
14 #include "lldb/Core/ModuleSpec.h"
16 #include "lldb/Core/Section.h"
17 #include "lldb/Symbol/Function.h"
18 #include "lldb/Symbol/ObjectFile.h"
20 #include "lldb/Target/Platform.h"
21 #include "lldb/Target/Target.h"
22 #include "lldb/Target/Thread.h"
24 #include "lldb/Utility/LLDBLog.h"
25 #include "lldb/Utility/Log.h"
27 
28 #include <memory>
29 
30 using namespace lldb;
31 using namespace lldb_private;
32 
33 LLDB_PLUGIN_DEFINE_ADV(DynamicLoaderPOSIXDYLD, DynamicLoaderPosixDYLD)
34 
35 void DynamicLoaderPOSIXDYLD::Initialize() {
36  PluginManager::RegisterPlugin(GetPluginNameStatic(),
37  GetPluginDescriptionStatic(), CreateInstance);
38 }
39 
41 
43  return "Dynamic loader plug-in that watches for shared library "
44  "loads/unloads in POSIX processes.";
45 }
46 
48  bool force) {
49  bool create = force;
50  if (!create) {
51  const llvm::Triple &triple_ref =
52  process->GetTarget().GetArchitecture().GetTriple();
53  if (triple_ref.getOS() == llvm::Triple::FreeBSD ||
54  triple_ref.getOS() == llvm::Triple::Linux ||
55  triple_ref.getOS() == llvm::Triple::NetBSD)
56  create = true;
57  }
58 
59  if (create)
60  return new DynamicLoaderPOSIXDYLD(process);
61  return nullptr;
62 }
63 
65  : DynamicLoader(process), m_rendezvous(process),
66  m_load_offset(LLDB_INVALID_ADDRESS), m_entry_point(LLDB_INVALID_ADDRESS),
67  m_auxv(), m_dyld_bid(LLDB_INVALID_BREAK_ID),
68  m_vdso_base(LLDB_INVALID_ADDRESS),
69  m_interpreter_base(LLDB_INVALID_ADDRESS), m_initial_modules_added(false) {
70 }
71 
76  }
77 }
78 
80  Log *log = GetLog(LLDBLog::DynamicLoader);
81  LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64, __FUNCTION__,
83  m_auxv = std::make_unique<AuxVector>(m_process->GetAuxvData());
84 
85  LLDB_LOGF(
86  log, "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " reloaded auxv data",
87  __FUNCTION__, m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
88 
89  ModuleSP executable_sp = GetTargetExecutable();
90  ResolveExecutableModule(executable_sp);
92 
93  // find the main process load offset
94  addr_t load_offset = ComputeLoadOffset();
95  LLDB_LOGF(log,
96  "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
97  " executable '%s', load_offset 0x%" PRIx64,
98  __FUNCTION__,
100  executable_sp ? executable_sp->GetFileSpec().GetPath().c_str()
101  : "<null executable>",
102  load_offset);
103 
105 
106  // if we dont have a load address we cant re-base
107  bool rebase_exec = load_offset != LLDB_INVALID_ADDRESS;
108 
109  // if we have a valid executable
110  if (executable_sp.get()) {
111  lldb_private::ObjectFile *obj = executable_sp->GetObjectFile();
112  if (obj) {
113  // don't rebase if the module already has a load address
114  Target &target = m_process->GetTarget();
115  Address addr = obj->GetImageInfoAddress(&target);
116  if (addr.GetLoadAddress(&target) != LLDB_INVALID_ADDRESS)
117  rebase_exec = false;
118  }
119  } else {
120  // no executable, nothing to re-base
121  rebase_exec = false;
122  }
123 
124  // if the target executable should be re-based
125  if (rebase_exec) {
126  ModuleList module_list;
127 
128  module_list.Append(executable_sp);
129  LLDB_LOGF(log,
130  "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
131  " added executable '%s' to module load list",
132  __FUNCTION__,
134  executable_sp->GetFileSpec().GetPath().c_str());
135 
136  UpdateLoadedSections(executable_sp, LLDB_INVALID_ADDRESS, load_offset,
137  true);
138 
140 
141  m_process->GetTarget().ModulesDidLoad(module_list);
142  if (log) {
143  LLDB_LOGF(log,
144  "DynamicLoaderPOSIXDYLD::%s told the target about the "
145  "modules that loaded:",
146  __FUNCTION__);
147  for (auto module_sp : module_list.Modules()) {
148  LLDB_LOGF(log, "-- [module] %s (pid %" PRIu64 ")",
149  module_sp ? module_sp->GetFileSpec().GetPath().c_str()
150  : "<null>",
152  }
153  }
154  }
155 
156  if (executable_sp.get()) {
157  if (!SetRendezvousBreakpoint()) {
158  // If we cannot establish rendezvous breakpoint right now we'll try again
159  // at entry point.
160  ProbeEntry();
161  }
162  }
163 }
164 
166  Log *log = GetLog(LLDBLog::DynamicLoader);
167  LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s()", __FUNCTION__);
168 
169  ModuleSP executable;
170  addr_t load_offset;
171 
172  m_auxv = std::make_unique<AuxVector>(m_process->GetAuxvData());
173 
174  executable = GetTargetExecutable();
175  load_offset = ComputeLoadOffset();
177 
178  if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) {
179  ModuleList module_list;
180  module_list.Append(executable);
181  UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset, true);
182 
183  LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()",
184  __FUNCTION__);
185 
186  if (!SetRendezvousBreakpoint()) {
187  // If we cannot establish rendezvous breakpoint right now we'll try again
188  // at entry point.
189  ProbeEntry();
190  }
191 
192  LoadVDSO();
193  m_process->GetTarget().ModulesDidLoad(module_list);
194  }
195 }
196 
198 
200  addr_t link_map_addr,
201  addr_t base_addr,
202  bool base_addr_is_offset) {
203  m_loaded_modules[module] = link_map_addr;
204  UpdateLoadedSectionsCommon(module, base_addr, base_addr_is_offset);
205 }
206 
207 void DynamicLoaderPOSIXDYLD::UnloadSections(const ModuleSP module) {
208  m_loaded_modules.erase(module);
209 
210  UnloadSectionsCommon(module);
211 }
212 
214  Log *log = GetLog(LLDBLog::DynamicLoader);
215 
216  const addr_t entry = GetEntryPoint();
217  if (entry == LLDB_INVALID_ADDRESS) {
218  LLDB_LOGF(
219  log,
220  "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
221  " GetEntryPoint() returned no address, not setting entry breakpoint",
222  __FUNCTION__, m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
223  return;
224  }
225 
226  LLDB_LOGF(log,
227  "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
228  " GetEntryPoint() returned address 0x%" PRIx64
229  ", setting entry breakpoint",
230  __FUNCTION__,
232 
233  if (m_process) {
234  Breakpoint *const entry_break =
235  m_process->GetTarget().CreateBreakpoint(entry, true, false).get();
236  entry_break->SetCallback(EntryBreakpointHit, this, true);
237  entry_break->SetBreakpointKind("shared-library-event");
238 
239  // Shoudn't hit this more than once.
240  entry_break->SetOneShot(true);
241  }
242 }
243 
244 // The runtime linker has run and initialized the rendezvous structure once the
245 // process has hit its entry point. When we hit the corresponding breakpoint
246 // we interrogate the rendezvous structure to get the load addresses of all
247 // dependent modules for the process. Similarly, we can discover the runtime
248 // linker function and setup a breakpoint to notify us of any dynamically
249 // loaded modules (via dlopen).
251  void *baton, StoppointCallbackContext *context, user_id_t break_id,
252  user_id_t break_loc_id) {
253  assert(baton && "null baton");
254  if (!baton)
255  return false;
256 
257  Log *log = GetLog(LLDBLog::DynamicLoader);
258  DynamicLoaderPOSIXDYLD *const dyld_instance =
259  static_cast<DynamicLoaderPOSIXDYLD *>(baton);
260  LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
261  __FUNCTION__,
262  dyld_instance->m_process ? dyld_instance->m_process->GetID()
264 
265  // Disable the breakpoint --- if a stop happens right after this, which we've
266  // seen on occasion, we don't want the breakpoint stepping thread-plan logic
267  // to show a breakpoint instruction at the disassembled entry point to the
268  // program. Disabling it prevents it. (One-shot is not enough - one-shot
269  // removal logic only happens after the breakpoint goes public, which wasn't
270  // happening in our scenario).
271  if (dyld_instance->m_process) {
272  BreakpointSP breakpoint_sp =
273  dyld_instance->m_process->GetTarget().GetBreakpointByID(break_id);
274  if (breakpoint_sp) {
275  LLDB_LOGF(log,
276  "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
277  " disabling breakpoint id %" PRIu64,
278  __FUNCTION__, dyld_instance->m_process->GetID(), break_id);
279  breakpoint_sp->SetEnabled(false);
280  } else {
281  LLDB_LOGF(log,
282  "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
283  " failed to find breakpoint for breakpoint id %" PRIu64,
284  __FUNCTION__, dyld_instance->m_process->GetID(), break_id);
285  }
286  } else {
287  LLDB_LOGF(log,
288  "DynamicLoaderPOSIXDYLD::%s breakpoint id %" PRIu64
289  " no Process instance! Cannot disable breakpoint",
290  __FUNCTION__, break_id);
291  }
292 
293  dyld_instance->LoadAllCurrentModules();
294  dyld_instance->SetRendezvousBreakpoint();
295  return false; // Continue running.
296 }
297 
299  Log *log = GetLog(LLDBLog::DynamicLoader);
301  LLDB_LOG(log,
302  "Rendezvous breakpoint breakpoint id {0} for pid {1}"
303  "is already set.",
304  m_dyld_bid,
306  return true;
307  }
308 
309  addr_t break_addr;
310  Target &target = m_process->GetTarget();
311  BreakpointSP dyld_break;
313  break_addr = m_rendezvous.GetBreakAddress();
314  LLDB_LOG(log, "Setting rendezvous break address for pid {0} at {1:x}",
316  break_addr);
317  dyld_break = target.CreateBreakpoint(break_addr, true, false);
318  } else {
319  LLDB_LOG(log, "Rendezvous structure is not set up yet. "
320  "Trying to locate rendezvous breakpoint in the interpreter "
321  "by symbol name.");
322  // Function names from different dynamic loaders that are known to be
323  // used as rendezvous between the loader and debuggers.
324  static std::vector<std::string> DebugStateCandidates{
325  "_dl_debug_state", "rtld_db_dlactivity", "__dl_rtld_db_dlactivity",
326  "r_debug_state", "_r_debug_state", "_rtld_debug_state",
327  };
328 
329  ModuleSP interpreter = LoadInterpreterModule();
330  if (!interpreter) {
331  FileSpecList containingModules;
332  containingModules.Append(
334 
335  dyld_break = target.CreateBreakpoint(
336  &containingModules, /*containingSourceFiles=*/nullptr,
337  DebugStateCandidates, eFunctionNameTypeFull, eLanguageTypeC,
338  /*m_offset=*/0,
339  /*skip_prologue=*/eLazyBoolNo,
340  /*internal=*/true,
341  /*request_hardware=*/false);
342  } else {
343  FileSpecList containingModules;
344  containingModules.Append(interpreter->GetFileSpec());
345  dyld_break = target.CreateBreakpoint(
346  &containingModules, /*containingSourceFiles=*/nullptr,
347  DebugStateCandidates, eFunctionNameTypeFull, eLanguageTypeC,
348  /*m_offset=*/0,
349  /*skip_prologue=*/eLazyBoolNo,
350  /*internal=*/true,
351  /*request_hardware=*/false);
352  }
353  }
354 
355  if (dyld_break->GetNumResolvedLocations() != 1) {
356  LLDB_LOG(
357  log,
358  "Rendezvous breakpoint has abnormal number of"
359  " resolved locations ({0}) in pid {1}. It's supposed to be exactly 1.",
360  dyld_break->GetNumResolvedLocations(),
362 
363  target.RemoveBreakpointByID(dyld_break->GetID());
364  return false;
365  }
366 
367  BreakpointLocationSP location = dyld_break->GetLocationAtIndex(0);
368  LLDB_LOG(log,
369  "Successfully set rendezvous breakpoint at address {0:x} "
370  "for pid {1}",
371  location->GetLoadAddress(),
373 
374  dyld_break->SetCallback(RendezvousBreakpointHit, this, true);
375  dyld_break->SetBreakpointKind("shared-library-event");
376  m_dyld_bid = dyld_break->GetID();
377  return true;
378 }
379 
381  void *baton, StoppointCallbackContext *context, user_id_t break_id,
382  user_id_t break_loc_id) {
383  assert(baton && "null baton");
384  if (!baton)
385  return false;
386 
387  Log *log = GetLog(LLDBLog::DynamicLoader);
388  DynamicLoaderPOSIXDYLD *const dyld_instance =
389  static_cast<DynamicLoaderPOSIXDYLD *>(baton);
390  LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
391  __FUNCTION__,
392  dyld_instance->m_process ? dyld_instance->m_process->GetID()
394 
395  dyld_instance->RefreshModules();
396 
397  // Return true to stop the target, false to just let the target run.
398  const bool stop_when_images_change = dyld_instance->GetStopWhenImagesChange();
399  LLDB_LOGF(log,
400  "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
401  " stop_when_images_change=%s",
402  __FUNCTION__,
403  dyld_instance->m_process ? dyld_instance->m_process->GetID()
405  stop_when_images_change ? "true" : "false");
406  return stop_when_images_change;
407 }
408 
410  if (!m_rendezvous.Resolve())
411  return;
412 
415 
416  ModuleList &loaded_modules = m_process->GetTarget().GetImages();
417 
419  ModuleList new_modules;
420 
421  // If this is the first time rendezvous breakpoint fires, we need
422  // to take care of adding all the initial modules reported by
423  // the loader. This is necessary to list ld-linux.so on Linux,
424  // and all DT_NEEDED entries on *BSD.
427  E = m_rendezvous.loaded_end();
428  } else {
429  I = m_rendezvous.begin();
430  E = m_rendezvous.end();
432  }
433  for (; I != E; ++I) {
434  ModuleSP module_sp =
435  LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true);
436  if (!module_sp.get())
437  continue;
438 
439  if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress(
441  ModuleSP interpreter_sp = m_interpreter_module.lock();
442  if (m_interpreter_module.lock() == nullptr) {
443  m_interpreter_module = module_sp;
444  } else if (module_sp == interpreter_sp) {
445  // Module already loaded.
446  continue;
447  } else {
448  // If this is a duplicate instance of ld.so, unload it. We may end
449  // up with it if we load it via a different path than before
450  // (symlink vs real path).
451  // TODO: remove this once we either fix library matching or avoid
452  // loading the interpreter when setting the rendezvous breakpoint.
453  UnloadSections(module_sp);
454  loaded_modules.Remove(module_sp);
455  continue;
456  }
457  }
458 
459  loaded_modules.AppendIfNeeded(module_sp);
460  new_modules.Append(module_sp);
461  }
462  m_process->GetTarget().ModulesDidLoad(new_modules);
463  }
464 
466  ModuleList old_modules;
467 
469  for (I = m_rendezvous.unloaded_begin(); I != E; ++I) {
470  ModuleSpec module_spec{I->file_spec};
471  ModuleSP module_sp = loaded_modules.FindFirstModule(module_spec);
472 
473  if (module_sp.get()) {
474  old_modules.Append(module_sp);
475  UnloadSections(module_sp);
476  }
477  }
478  loaded_modules.Remove(old_modules);
479  m_process->GetTarget().ModulesDidUnload(old_modules, false);
480  }
481 }
482 
483 ThreadPlanSP
485  bool stop) {
486  ThreadPlanSP thread_plan_sp;
487 
488  StackFrame *frame = thread.GetStackFrameAtIndex(0).get();
489  const SymbolContext &context = frame->GetSymbolContext(eSymbolContextSymbol);
490  Symbol *sym = context.symbol;
491 
492  if (sym == nullptr || !sym->IsTrampoline())
493  return thread_plan_sp;
494 
495  ConstString sym_name = sym->GetMangled().GetName(Mangled::ePreferMangled);
496  if (!sym_name)
497  return thread_plan_sp;
498 
499  SymbolContextList target_symbols;
500  Target &target = thread.GetProcess()->GetTarget();
501  const ModuleList &images = target.GetImages();
502 
503  images.FindSymbolsWithNameAndType(sym_name, eSymbolTypeCode, target_symbols);
504  size_t num_targets = target_symbols.GetSize();
505  if (!num_targets)
506  return thread_plan_sp;
507 
508  typedef std::vector<lldb::addr_t> AddressVector;
509  AddressVector addrs;
510  for (size_t i = 0; i < num_targets; ++i) {
511  SymbolContext context;
512  AddressRange range;
513  if (target_symbols.GetContextAtIndex(i, context)) {
514  context.GetAddressRange(eSymbolContextEverything, 0, false, range);
515  lldb::addr_t addr = range.GetBaseAddress().GetLoadAddress(&target);
516  if (addr != LLDB_INVALID_ADDRESS)
517  addrs.push_back(addr);
518  }
519  }
520 
521  if (addrs.size() > 0) {
522  AddressVector::iterator start = addrs.begin();
523  AddressVector::iterator end = addrs.end();
524 
525  llvm::sort(start, end);
526  addrs.erase(std::unique(start, end), end);
527  thread_plan_sp =
528  std::make_shared<ThreadPlanRunToAddress>(thread, addrs, stop);
529  }
530 
531  return thread_plan_sp;
532 }
533 
536  return;
537 
538  FileSpec file("[vdso]");
539 
540  MemoryRegionInfo info;
542  if (status.Fail()) {
543  Log *log = GetLog(LLDBLog::DynamicLoader);
544  LLDB_LOG(log, "Failed to get vdso region info: {0}", status);
545  return;
546  }
547 
548  if (ModuleSP module_sp = m_process->ReadModuleFromMemory(
549  file, m_vdso_base, info.GetRange().GetByteSize())) {
552  }
553 }
554 
557  return nullptr;
558 
559  MemoryRegionInfo info;
560  Target &target = m_process->GetTarget();
562  if (status.Fail() || info.GetMapped() != MemoryRegionInfo::eYes ||
563  info.GetName().IsEmpty()) {
564  Log *log = GetLog(LLDBLog::DynamicLoader);
565  LLDB_LOG(log, "Failed to get interpreter region info: {0}", status);
566  return nullptr;
567  }
568 
569  FileSpec file(info.GetName().GetCString());
570  ModuleSpec module_spec(file, target.GetArchitecture());
571 
572  if (ModuleSP module_sp = target.GetOrCreateModule(module_spec,
573  true /* notify */)) {
575  false);
576  m_interpreter_module = module_sp;
577  return module_sp;
578  }
579  return nullptr;
580 }
581 
583  addr_t link_map_addr,
584  addr_t base_addr,
585  bool base_addr_is_offset) {
586  if (ModuleSP module_sp = DynamicLoader::LoadModuleAtAddress(
587  file, link_map_addr, base_addr, base_addr_is_offset))
588  return module_sp;
589 
590  // This works around an dynamic linker "bug" on android <= 23, where the
591  // dynamic linker would report the application name
592  // (e.g. com.example.myapplication) instead of the main process binary
593  // (/system/bin/app_process(32)). The logic is not sound in general (it
594  // assumes base_addr is the real address, even though it actually is a load
595  // bias), but it happens to work on android because app_process has a file
596  // address of zero.
597  // This should be removed after we drop support for android-23.
598  if (m_process->GetTarget().GetArchitecture().GetTriple().isAndroid()) {
599  MemoryRegionInfo memory_info;
600  Status error = m_process->GetMemoryRegionInfo(base_addr, memory_info);
601  if (error.Success() && memory_info.GetMapped() &&
602  memory_info.GetRange().GetRangeBase() == base_addr &&
603  !(memory_info.GetName().IsEmpty())) {
604  if (ModuleSP module_sp = DynamicLoader::LoadModuleAtAddress(
605  FileSpec(memory_info.GetName().GetStringRef()), link_map_addr,
606  base_addr, base_addr_is_offset))
607  return module_sp;
608  }
609  }
610 
611  return nullptr;
612 }
613 
617  ModuleList module_list;
618  Log *log = GetLog(LLDBLog::DynamicLoader);
619 
620  LoadVDSO();
621 
622  if (!m_rendezvous.Resolve()) {
623  LLDB_LOGF(log,
624  "DynamicLoaderPOSIXDYLD::%s unable to resolve POSIX DYLD "
625  "rendezvous address",
626  __FUNCTION__);
627  return;
628  }
629 
630  // The rendezvous class doesn't enumerate the main module, so track that
631  // ourselves here.
632  ModuleSP executable = GetTargetExecutable();
634 
635  std::vector<FileSpec> module_names;
636  for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I)
637  module_names.push_back(I->file_spec);
639  module_names, m_process->GetTarget().GetArchitecture().GetTriple());
640 
641  for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I) {
642  ModuleSP module_sp =
643  LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true);
644  if (module_sp.get()) {
645  LLDB_LOG(log, "LoadAllCurrentModules loading module: {0}",
646  I->file_spec.GetFilename());
647  module_list.Append(module_sp);
648  } else {
649  Log *log = GetLog(LLDBLog::DynamicLoader);
650  LLDB_LOGF(
651  log,
652  "DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
653  __FUNCTION__, I->file_spec.GetPath().c_str(), I->base_addr);
654  }
655  }
656 
657  m_process->GetTarget().ModulesDidLoad(module_list);
659 }
660 
662  addr_t virt_entry;
663 
665  return m_load_offset;
666 
667  if ((virt_entry = GetEntryPoint()) == LLDB_INVALID_ADDRESS)
668  return LLDB_INVALID_ADDRESS;
669 
670  ModuleSP module = m_process->GetTarget().GetExecutableModule();
671  if (!module)
672  return LLDB_INVALID_ADDRESS;
673 
674  ObjectFile *exe = module->GetObjectFile();
675  if (!exe)
676  return LLDB_INVALID_ADDRESS;
677 
678  Address file_entry = exe->GetEntryPointAddress();
679 
680  if (!file_entry.IsValid())
681  return LLDB_INVALID_ADDRESS;
682 
683  m_load_offset = virt_entry - file_entry.GetFileAddress();
684  return m_load_offset;
685 }
686 
688  if (llvm::Optional<uint64_t> vdso_base =
690  m_vdso_base = *vdso_base;
691 
692  if (llvm::Optional<uint64_t> interpreter_base =
693  m_auxv->GetAuxValue(AuxVector::AUXV_AT_BASE))
694  m_interpreter_base = *interpreter_base;
695 }
696 
699  return m_entry_point;
700 
701  if (m_auxv == nullptr)
702  return LLDB_INVALID_ADDRESS;
703 
704  llvm::Optional<uint64_t> entry_point =
705  m_auxv->GetAuxValue(AuxVector::AUXV_AT_ENTRY);
706  if (!entry_point)
707  return LLDB_INVALID_ADDRESS;
708 
709  m_entry_point = static_cast<addr_t>(*entry_point);
710 
711  const ArchSpec &arch = m_process->GetTarget().GetArchitecture();
712 
713  // On ppc64, the entry point is actually a descriptor. Dereference it.
714  if (arch.GetMachine() == llvm::Triple::ppc64)
716 
717  return m_entry_point;
718 }
719 
721 DynamicLoaderPOSIXDYLD::GetThreadLocalData(const lldb::ModuleSP module_sp,
722  const lldb::ThreadSP thread,
723  lldb::addr_t tls_file_addr) {
724  auto it = m_loaded_modules.find(module_sp);
725  if (it == m_loaded_modules.end())
726  return LLDB_INVALID_ADDRESS;
727 
728  addr_t link_map = it->second;
729  if (link_map == LLDB_INVALID_ADDRESS)
730  return LLDB_INVALID_ADDRESS;
731 
733  if (!metadata.valid)
734  return LLDB_INVALID_ADDRESS;
735 
736  // Get the thread pointer.
737  addr_t tp = thread->GetThreadPointer();
738  if (tp == LLDB_INVALID_ADDRESS)
739  return LLDB_INVALID_ADDRESS;
740 
741  // Find the module's modid.
742  int modid_size = 4; // FIXME(spucci): This isn't right for big-endian 64-bit
743  int64_t modid = ReadUnsignedIntWithSizeInBytes(
744  link_map + metadata.modid_offset, modid_size);
745  if (modid == -1)
746  return LLDB_INVALID_ADDRESS;
747 
748  // Lookup the DTV structure for this thread.
749  addr_t dtv_ptr = tp + metadata.dtv_offset;
750  addr_t dtv = ReadPointer(dtv_ptr);
751  if (dtv == LLDB_INVALID_ADDRESS)
752  return LLDB_INVALID_ADDRESS;
753 
754  // Find the TLS block for this module.
755  addr_t dtv_slot = dtv + metadata.dtv_slot_size * modid;
756  addr_t tls_block = ReadPointer(dtv_slot + metadata.tls_offset);
757 
758  Log *log = GetLog(LLDBLog::DynamicLoader);
759  LLDB_LOGF(log,
760  "DynamicLoaderPOSIXDYLD::Performed TLS lookup: "
761  "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
762  ", modid=%" PRId64 ", tls_block=0x%" PRIx64 "\n",
763  module_sp->GetObjectName().AsCString(""), link_map, tp,
764  (int64_t)modid, tls_block);
765 
766  if (tls_block == LLDB_INVALID_ADDRESS)
767  return LLDB_INVALID_ADDRESS;
768  else
769  return tls_block + tls_file_addr;
770 }
771 
773  lldb::ModuleSP &module_sp) {
774  Log *log = GetLog(LLDBLog::DynamicLoader);
775 
776  if (m_process == nullptr)
777  return;
778 
779  auto &target = m_process->GetTarget();
780  const auto platform_sp = target.GetPlatform();
781 
782  ProcessInstanceInfo process_info;
783  if (!m_process->GetProcessInfo(process_info)) {
784  LLDB_LOGF(log,
785  "DynamicLoaderPOSIXDYLD::%s - failed to get process info for "
786  "pid %" PRIu64,
787  __FUNCTION__, m_process->GetID());
788  return;
789  }
790 
791  LLDB_LOGF(
792  log, "DynamicLoaderPOSIXDYLD::%s - got executable by pid %" PRIu64 ": %s",
793  __FUNCTION__, m_process->GetID(),
794  process_info.GetExecutableFile().GetPath().c_str());
795 
796  ModuleSpec module_spec(process_info.GetExecutableFile(),
797  process_info.GetArchitecture());
798  if (module_sp && module_sp->MatchesModuleSpec(module_spec))
799  return;
800 
801  const auto executable_search_paths(Target::GetDefaultExecutableSearchPaths());
802  auto error = platform_sp->ResolveExecutable(
803  module_spec, module_sp,
804  !executable_search_paths.IsEmpty() ? &executable_search_paths : nullptr);
805  if (error.Fail()) {
806  StreamString stream;
807  module_spec.Dump(stream);
808 
809  LLDB_LOGF(log,
810  "DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
811  "with module spec \"%s\": %s",
812  __FUNCTION__, stream.GetData(), error.AsCString());
813  return;
814  }
815 
816  target.SetExecutableModule(module_sp, eLoadDependentsNo);
817 }
818 
820  lldb_private::SymbolContext &sym_ctx) {
821  ModuleSP module_sp;
822  if (sym_ctx.symbol)
823  module_sp = sym_ctx.symbol->GetAddressRef().GetModule();
824  if (!module_sp && sym_ctx.function)
825  module_sp =
827  if (!module_sp)
828  return false;
829 
830  return module_sp->GetFileSpec().GetPath() == "[vdso]";
831 }
DYLDRendezvous::ModulesDidLoad
bool ModulesDidLoad() const
Definition: DYLDRendezvous.h:119
AuxVector::AUXV_AT_SYSINFO_EHDR
@ AUXV_AT_SYSINFO_EHDR
Definition: AuxVector.h:57
DYLDRendezvous::ThreadInfo
Definition: DYLDRendezvous.h:59
lldb_private::AddressRange::GetBaseAddress
Address & GetBaseAddress()
Get accessor for the base address of the range.
Definition: AddressRange.h:209
lldb_private::ProcessInstanceInfo
Definition: ProcessInfo.h:106
lldb_private::Range::GetRangeBase
BaseType GetRangeBase() const
Definition: RangeMap.h:46
DYLDRendezvous::loaded_begin
iterator loaded_begin() const
Iterators over all modules loaded into the inferior since the last call to Resolve().
Definition: DYLDRendezvous.h:175
DYLDRendezvous::UpdateExecutablePath
void UpdateExecutablePath()
Update the cached executable path.
Definition: DYLDRendezvous.cpp:115
DynamicLoaderPOSIXDYLD::DidLaunch
void DidLaunch() override
Called after launching a process.
Definition: DynamicLoaderPOSIXDYLD.cpp:165
lldb_private::ArchSpec
Definition: ArchSpec.h:32
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
lldb_private::Address::IsValid
bool IsValid() const
Check if the object state is valid.
Definition: Address.h:345
lldb_private::Breakpoint::SetOneShot
void SetOneShot(bool one_shot)
If one_shot is true, breakpoint will be deleted on first hit.
Definition: Breakpoint.cpp:338
lldb::eSymbolTypeCode
@ eSymbolTypeCode
Definition: lldb-enumerations.h:622
DynamicLoaderPOSIXDYLD::m_initial_modules_added
bool m_initial_modules_added
Indicates whether the initial set of modules was reported added.
Definition: DynamicLoaderPOSIXDYLD.h:105
lldb_private::ModuleList::Modules
ModuleIterable Modules() const
Definition: ModuleList.h:494
LLDB_INVALID_PROCESS_ID
#define LLDB_INVALID_PROCESS_ID
Definition: lldb-defines.h:81
lldb_private::ArchSpec::GetMachine
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:666
ModuleSpec.h
DynamicLoaderPOSIXDYLD::Terminate
static void Terminate()
Definition: DynamicLoaderPOSIXDYLD.cpp:40
lldb_private::Function::GetAddressRange
const AddressRange & GetAddressRange()
Definition: Function.h:457
lldb_private::Symbol
Definition: Symbol.h:20
DYLDRendezvous::end
iterator end() const
Definition: DYLDRendezvous.h:171
lldb_private::Target::GetOrCreateModule
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
Definition: Target.cpp:2073
lldb_private::SymbolContext::GetAddressRange
bool GetAddressRange(uint32_t scope, uint32_t range_idx, bool use_inline_block_range, AddressRange &range) const
Get the address range contained within a symbol context.
Definition: SymbolContext.cpp:380
lldb_private::Breakpoint::SetBreakpointKind
void SetBreakpointKind(const char *kind)
Set the "kind" description for a breakpoint.
Definition: Breakpoint.h:450
lldb_private::Process::GetMemoryRegionInfo
Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info)
Locate the memory region that contains load_addr.
Definition: Process.cpp:5874
DynamicLoaderPOSIXDYLD::GetEntryPoint
lldb::addr_t GetEntryPoint()
Computes a value for m_entry_point returning the computed address on success and LLDB_INVALID_ADDRESS...
Definition: DynamicLoaderPOSIXDYLD.cpp:697
DYLDRendezvous::ThreadInfo::modid_offset
uint32_t modid_offset
Definition: DYLDRendezvous.h:63
DynamicLoaderPOSIXDYLD::m_load_offset
lldb::addr_t m_load_offset
Virtual load address of the inferior process.
Definition: DynamicLoaderPOSIXDYLD.h:68
lldb_private::Process::ReadModuleFromMemory
lldb::ModuleSP ReadModuleFromMemory(const FileSpec &file_spec, lldb::addr_t header_addr, size_t size_to_read=512)
Definition: Process.cpp:2354
lldb_private::ModuleSpec::Dump
void Dump(Stream &strm) const
Definition: ModuleSpec.h:162
DYLDRendezvous::iterator
SOEntryList::const_iterator iterator
Definition: DYLDRendezvous.h:167
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:344
lldb_private::Process
Definition: Process.h:338
lldb_private::Target::GetExecutableModulePointer
Module * GetExecutableModulePointer()
Definition: Target.cpp:1383
DYLDRendezvous::begin
iterator begin() const
Iterators over all currently loaded modules.
Definition: DYLDRendezvous.h:170
DYLDRendezvous::ThreadInfo::dtv_slot_size
uint32_t dtv_slot_size
Definition: DYLDRendezvous.h:62
lldb_private::Target::GetExecutableModule
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition: Target.cpp:1369
Module.h
BreakpointLocation.h
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1219
DynamicLoaderPOSIXDYLD
Definition: DynamicLoaderPOSIXDYLD.h:23
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
lldb_private::SymbolContextList::GetContextAtIndex
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
Definition: SymbolContext.cpp:1258
lldb_private::DynamicLoader::UnloadSectionsCommon
void UnloadSectionsCommon(const lldb::ModuleSP module)
Definition: DynamicLoader.cpp:127
lldb_private::MemoryRegionInfo
Definition: MemoryRegionInfo.h:21
DYLDRendezvous::ThreadInfo::dtv_offset
uint32_t dtv_offset
Definition: DYLDRendezvous.h:61
AuxVector::AUXV_AT_BASE
@ AUXV_AT_BASE
Interpreter base address.
Definition: AuxVector.h:33
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:351
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:454
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
DynamicLoaderPOSIXDYLD::RefreshModules
void RefreshModules()
Helper method for RendezvousBreakpointHit.
Definition: DynamicLoaderPOSIXDYLD.cpp:409
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:469
Section.h
LLDB_PLUGIN_DEFINE_ADV
LLDB_PLUGIN_DEFINE_ADV(ObjectContainerUniversalMachO, ObjectContainerMachOArchive) void ObjectContainerUniversalMachO
Definition: ObjectContainerUniversalMachO.cpp:23
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:947
lldb_private::Process::PrefetchModuleSpecs
virtual void PrefetchModuleSpecs(llvm::ArrayRef< FileSpec > module_file_specs, const llvm::Triple &triple)
Definition: Process.h:2404
DYLDRendezvous::ModulesDidUnload
bool ModulesDidUnload() const
Definition: DYLDRendezvous.h:123
lldb_private::ModuleList::FindSymbolsWithNameAndType
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:509
Target.h
lldb_private::Target::GetPlatform
lldb::PlatformSP GetPlatform()
Definition: Target.h:1403
lldb_private::Module::GetFileSpec
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
Definition: Module.h:496
lldb_private::Thread::GetProcess
lldb::ProcessSP GetProcess() const
Definition: Thread.h:153
Platform.h
lldb_private::FileSpec
Definition: FileSpec.h:55
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::SymbolContext::symbol
Symbol * symbol
The Symbol for a given query.
Definition: SymbolContext.h:323
DYLDRendezvous::GetThreadInfo
const ThreadInfo & GetThreadInfo()
Definition: DYLDRendezvous.cpp:614
ProcessInfo.h
DynamicLoaderPOSIXDYLD::LoadVDSO
void LoadVDSO()
Definition: DynamicLoaderPOSIXDYLD.cpp:534
lldb_private::ModuleList::Remove
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
DYLDRendezvous::ThreadInfo::valid
bool valid
Definition: DYLDRendezvous.h:60
lldb_private::ConstString::GetStringRef
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:201
lldb_private::ModuleList
Definition: ModuleList.h:82
Log.h
lldb_private::ConstString::IsEmpty
bool IsEmpty() const
Test for empty string.
Definition: ConstString.h:303
lldb_private::eLoadDependentsNo
@ eLoadDependentsNo
Definition: lldb-private-enumerations.h:231
MemoryRegionInfo.h
DYLDRendezvous::GetBreakAddress
lldb::addr_t GetBreakAddress() const
A breakpoint should be set at this address and Resolve called on each hit.
Definition: DYLDRendezvous.h:105
lldb_private::Thread
Definition: Thread.h:61
DYLDRendezvous::unloaded_end
iterator unloaded_end() const
Definition: DYLDRendezvous.h:181
lldb_private::Status::Fail
bool Fail() const
Test for error condition.
Definition: Status.cpp:181
lldb_private::StreamString::GetData
const char * GetData() const
Definition: StreamString.h:43
DynamicLoaderPOSIXDYLD::m_loaded_modules
std::map< lldb::ModuleWP, lldb::addr_t, std::owner_less< lldb::ModuleWP > > m_loaded_modules
Loaded module list. (link map for each module)
Definition: DynamicLoaderPOSIXDYLD.h:92
lldb_private::DynamicLoader::ReadUnsignedIntWithSizeInBytes
int64_t ReadUnsignedIntWithSizeInBytes(lldb::addr_t addr, int size_in_bytes)
Definition: DynamicLoader.cpp:278
lldb_private::ObjectFile::GetImageInfoAddress
virtual lldb_private::Address GetImageInfoAddress(Target *target)
Similar to Process::GetImageInfoAddress().
Definition: ObjectFile.h:477
lldb_private::SymbolContext::function
Function * function
The Function for a given query.
Definition: SymbolContext.h:320
lldb_private::Address::GetFileAddress
lldb::addr_t GetFileAddress() const
Get the file address.
Definition: Address.cpp:291
lldb_private::Symbol::GetAddressRef
Address & GetAddressRef()
Definition: Symbol.h:57
DynamicLoaderPOSIXDYLD::m_interpreter_base
lldb::addr_t m_interpreter_base
Contains AT_BASE, which means a dynamic loader has been mapped to the address space.
Definition: DynamicLoaderPOSIXDYLD.h:85
lldb_private::DynamicLoader::ReadPointer
lldb::addr_t ReadPointer(lldb::addr_t addr)
Definition: DynamicLoader.cpp:289
lldb_private::SymbolContextList::GetSize
uint32_t GetSize() const
Get accessor for a symbol context list size.
Definition: SymbolContext.cpp:1274
DynamicLoaderPOSIXDYLD::m_vdso_base
lldb::addr_t m_vdso_base
Contains AT_SYSINFO_EHDR, which means a vDSO has been mapped to the address space.
Definition: DynamicLoaderPOSIXDYLD.h:81
lldb_private::ConstString
Definition: ConstString.h:39
lldb_private::Process::GetAuxvData
virtual DataExtractor GetAuxvData()
Definition: Process.cpp:2660
lldb_private::StreamString
Definition: StreamString.h:23
DynamicLoaderPOSIXDYLD::EntryBreakpointHit
static bool EntryBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Callback routine invoked when we hit the breakpoint on process entry.
Definition: DynamicLoaderPOSIXDYLD.cpp:250
lldb_private::AddressRange
Definition: AddressRange.h:25
DynamicLoaderPOSIXDYLD::DynamicLoaderPOSIXDYLD
DynamicLoaderPOSIXDYLD(lldb_private::Process *process)
Definition: DynamicLoaderPOSIXDYLD.cpp:64
lldb_private::ModuleList::FindFirstModule
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
Definition: ModuleList.cpp:623
lldb_private::DynamicLoader
Definition: DynamicLoader.h:52
lldb_private::DynamicLoader::m_process
Process * m_process
The process that this dynamic loader plug-in is tracking.
Definition: DynamicLoader.h:369
lldb_private::MemoryRegionInfo::GetName
ConstString GetName() const
Definition: MemoryRegionInfo.h:54
ThreadPlanRunToAddress.h
lldb_private::DynamicLoader::UpdateLoadedSectionsCommon
void UpdateLoadedSectionsCommon(lldb::ModuleSP module, lldb::addr_t base_addr, bool base_addr_is_offset)
Definition: DynamicLoader.cpp:115
DYLDRendezvous::IsValid
bool IsValid()
Definition: DYLDRendezvous.cpp:188
DYLDRendezvous::unloaded_begin
iterator unloaded_begin() const
Iterators over all modules unloaded from the inferior since the last call to Resolve().
Definition: DYLDRendezvous.h:180
Thread.h
lldb_private::Symbol::GetMangled
Mangled & GetMangled()
Definition: Symbol.h:131
AuxVector::AUXV_AT_ENTRY
@ AUXV_AT_ENTRY
Program entry point.
Definition: AuxVector.h:35
ObjectFile.h
DynamicLoaderPOSIXDYLD::RendezvousBreakpointHit
static bool RendezvousBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Callback routine which updates the current list of loaded modules based on the information supplied b...
Definition: DynamicLoaderPOSIXDYLD.cpp:380
LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:37
DynamicLoaderPOSIXDYLD::ComputeLoadOffset
lldb::addr_t ComputeLoadOffset()
Computes a value for m_load_offset returning the computed address on success and LLDB_INVALID_ADDRESS...
Definition: DynamicLoaderPOSIXDYLD.cpp:661
DynamicLoaderPOSIXDYLD::ResolveExecutableModule
void ResolveExecutableModule(lldb::ModuleSP &module_sp)
Loads Module from inferior process.
Definition: DynamicLoaderPOSIXDYLD.cpp:772
lldb_private::ModuleSpec
Definition: ModuleSpec.h:27
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:989
lldb_private::Status
Definition: Status.h:44
DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint
bool SetRendezvousBreakpoint()
If possible sets a breakpoint on a function called by the runtime linker each time a module is loaded...
Definition: DynamicLoaderPOSIXDYLD.cpp:298
DynamicLoaderPOSIXDYLD::GetPluginDescriptionStatic
static llvm::StringRef GetPluginDescriptionStatic()
Definition: DynamicLoaderPOSIXDYLD.cpp:42
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override
Provides a plan to step through the dynamic loader trampoline for the current state of thread.
Definition: DynamicLoaderPOSIXDYLD.cpp:484
DynamicLoaderPOSIXDYLD::AlwaysRelyOnEHUnwindInfo
bool AlwaysRelyOnEHUnwindInfo(lldb_private::SymbolContext &sym_ctx) override
Ask if the eh_frame information for the given SymbolContext should be relied on even when it's the fi...
Definition: DynamicLoaderPOSIXDYLD.cpp:819
DynamicLoaderPOSIXDYLD::EvalSpecialModulesStatus
void EvalSpecialModulesStatus()
Evaluate if Aux vectors contain vDSO and LD information in case they do, read and assign the address ...
Definition: DynamicLoaderPOSIXDYLD.cpp:687
lldb_private::Address
Definition: Address.h:59
lldb_private::Target::ModulesDidLoad
void ModulesDidLoad(ModuleList &module_list)
Definition: Target.cpp:1636
DynamicLoaderPOSIXDYLD::m_auxv
std::unique_ptr< AuxVector > m_auxv
Auxiliary vector of the inferior process.
Definition: DynamicLoaderPOSIXDYLD.h:74
DynamicLoaderPOSIXDYLD.h
DynamicLoaderPOSIXDYLD::LoadModuleAtAddress
lldb::ModuleSP LoadModuleAtAddress(const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset) override
Locates or creates a module given by file and updates/loads the resulting module at the virtual base ...
Definition: DynamicLoaderPOSIXDYLD.cpp:582
DYLDRendezvous::GetLinkMapAddress
lldb::addr_t GetLinkMapAddress() const
Definition: DYLDRendezvous.h:96
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::ModuleList::AppendIfNeeded
bool AppendIfNeeded(const lldb::ModuleSP &new_module, bool notify=true)
Append a module to the module list, if it is not already there.
DynamicLoaderPOSIXDYLD::UnloadSections
void UnloadSections(const lldb::ModuleSP module) override
Removes the loaded sections from the target in module.
Definition: DynamicLoaderPOSIXDYLD.cpp:207
lldb_private::Address::GetLoadAddress
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:311
DYLDRendezvous::loaded_end
iterator loaded_end() const
Definition: DYLDRendezvous.h:176
lldb_private::Range::GetByteSize
SizeType GetByteSize() const
Definition: RangeMap.h:87
lldb_private::DynamicLoader::GetStopWhenImagesChange
bool GetStopWhenImagesChange() const
Get whether the process should stop when images change.
Definition: DynamicLoader.cpp:68
DynamicLoaderPOSIXDYLD::m_entry_point
lldb::addr_t m_entry_point
Virtual entry address of the inferior process.
Definition: DynamicLoaderPOSIXDYLD.h:71
DynamicLoaderPOSIXDYLD::CreateInstance
static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force)
Definition: DynamicLoaderPOSIXDYLD.cpp:47
PluginManager.h
lldb_private::DynamicLoader::GetTargetExecutable
lldb::ModuleSP GetTargetExecutable()
Checks to see if the target module has changed, updates the target accordingly and returns the target...
Definition: DynamicLoader.cpp:76
lldb_private::Target::RemoveBreakpointByID
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:951
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
DYLDRendezvous::ThreadInfo::tls_offset
uint32_t tls_offset
Definition: DYLDRendezvous.h:64
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:337
DynamicLoaderPOSIXDYLD::m_rendezvous
DYLDRendezvous m_rendezvous
Runtime linker rendezvous structure.
Definition: DynamicLoaderPOSIXDYLD.h:65
Function.h
lldb_private::Process::GetID
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
Definition: Process.h:526
lldb_private::MemoryRegionInfo::GetRange
RangeType & GetRange()
Definition: MemoryRegionInfo.h:38
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::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
DYLDRendezvous::Resolve
bool Resolve()
Update the internal snapshot of runtime linker rendezvous and recompute the currently loaded modules.
Definition: DYLDRendezvous.cpp:132
DynamicLoaderPOSIXDYLD::UpdateLoadedSections
void UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset) override
Updates the load address of every allocatable section in module.
Definition: DynamicLoaderPOSIXDYLD.cpp:199
DynamicLoaderPOSIXDYLD::CanLoadImage
lldb_private::Status CanLoadImage() override
Ask if it is ok to try and load or unload an shared library (image).
Definition: DynamicLoaderPOSIXDYLD.cpp:197
DynamicLoaderPOSIXDYLD::LoadInterpreterModule
lldb::ModuleSP LoadInterpreterModule()
Definition: DynamicLoaderPOSIXDYLD.cpp:555
lldb_private::ProcessInfo::GetExecutableFile
FileSpec & GetExecutableFile()
Definition: ProcessInfo.h:41
DynamicLoaderPOSIXDYLD::LoadAllCurrentModules
virtual void LoadAllCurrentModules()
Helper for the entry breakpoint callback.
Definition: DynamicLoaderPOSIXDYLD.cpp:614
lldb_private::Symbol::IsTrampoline
bool IsTrampoline() const
Definition: Symbol.cpp:173
DynamicLoaderPOSIXDYLD::~DynamicLoaderPOSIXDYLD
~DynamicLoaderPOSIXDYLD() override
Definition: DynamicLoaderPOSIXDYLD.cpp:72
DynamicLoaderPOSIXDYLD::m_dyld_bid
lldb::break_id_t m_dyld_bid
Rendezvous breakpoint.
Definition: DynamicLoaderPOSIXDYLD.h:77
lldb_private::Address::GetModule
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
Definition: Address.cpp:283
lldb_private::Log
Definition: Log.h:115
DynamicLoaderPOSIXDYLD::ProbeEntry
void ProbeEntry()
Resolves the entry point for the current inferior process and sets a breakpoint at that address.
Definition: DynamicLoaderPOSIXDYLD.cpp:213
lldb_private::Target::GetBreakpointByID
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:323
lldb_private::Thread::GetStackFrameAtIndex
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
Definition: Thread.h:399
lldb_private::Target::ModulesDidUnload
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
Definition: Target.cpp:1668
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::FileSpec::GetPath
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:364
lldb_private::StackFrame
Definition: StackFrame.h:40
DynamicLoaderPOSIXDYLD::DidAttach
void DidAttach() override
Called after attaching a process.
Definition: DynamicLoaderPOSIXDYLD.cpp:79
lldb_private::MemoryRegionInfo::GetMapped
OptionalBool GetMapped() const
Definition: MemoryRegionInfo.h:52
lldb
Definition: SBAddress.h:15
DynamicLoaderPOSIXDYLD::GetThreadLocalData
lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr) override
Retrieves the per-module TLS block for a given thread.
Definition: DynamicLoaderPOSIXDYLD.cpp:721
DynamicLoaderPOSIXDYLD::m_interpreter_module
std::weak_ptr< lldb_private::Module > m_interpreter_module
Contains the pointer to the interpret module, if loaded.
Definition: DynamicLoaderPOSIXDYLD.h:88
lldb_private::StackFrame::GetSymbolContext
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
Definition: StackFrame.cpp:300
LLDBLog.h
lldb_private::ObjectFile::GetEntryPointAddress
virtual lldb_private::Address GetEntryPointAddress()
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry...
Definition: ObjectFile.h:487
lldb_private::ObjectFile
Definition: ObjectFile.h:60
lldb_private::Process::GetProcessInfo
virtual bool GetProcessInfo(ProcessInstanceInfo &info)
Definition: Process.cpp:5767
lldb_private::ModuleList::Append
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
lldb_private::Breakpoint
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition: Breakpoint.h:80