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  if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress(
439  module_sp != m_interpreter_module.lock()) {
440  if (m_interpreter_module.lock() == nullptr) {
441  m_interpreter_module = module_sp;
442  } else {
443  // If this is a duplicate instance of ld.so, unload it. We may end
444  // up with it if we load it via a different path than before
445  // (symlink vs real path).
446  // TODO: remove this once we either fix library matching or avoid
447  // loading the interpreter when setting the rendezvous breakpoint.
448  UnloadSections(module_sp);
449  loaded_modules.Remove(module_sp);
450  continue;
451  }
452  }
453 
454  loaded_modules.AppendIfNeeded(module_sp);
455  new_modules.Append(module_sp);
456  }
457  }
458  m_process->GetTarget().ModulesDidLoad(new_modules);
459  }
460 
462  ModuleList old_modules;
463 
465  for (I = m_rendezvous.unloaded_begin(); I != E; ++I) {
466  ModuleSpec module_spec{I->file_spec};
467  ModuleSP module_sp = loaded_modules.FindFirstModule(module_spec);
468 
469  if (module_sp.get()) {
470  old_modules.Append(module_sp);
471  UnloadSections(module_sp);
472  }
473  }
474  loaded_modules.Remove(old_modules);
475  m_process->GetTarget().ModulesDidUnload(old_modules, false);
476  }
477 }
478 
479 ThreadPlanSP
481  bool stop) {
482  ThreadPlanSP thread_plan_sp;
483 
484  StackFrame *frame = thread.GetStackFrameAtIndex(0).get();
485  const SymbolContext &context = frame->GetSymbolContext(eSymbolContextSymbol);
486  Symbol *sym = context.symbol;
487 
488  if (sym == nullptr || !sym->IsTrampoline())
489  return thread_plan_sp;
490 
491  ConstString sym_name = sym->GetName();
492  if (!sym_name)
493  return thread_plan_sp;
494 
495  SymbolContextList target_symbols;
496  Target &target = thread.GetProcess()->GetTarget();
497  const ModuleList &images = target.GetImages();
498 
499  images.FindSymbolsWithNameAndType(sym_name, eSymbolTypeCode, target_symbols);
500  size_t num_targets = target_symbols.GetSize();
501  if (!num_targets)
502  return thread_plan_sp;
503 
504  typedef std::vector<lldb::addr_t> AddressVector;
505  AddressVector addrs;
506  for (size_t i = 0; i < num_targets; ++i) {
507  SymbolContext context;
508  AddressRange range;
509  if (target_symbols.GetContextAtIndex(i, context)) {
510  context.GetAddressRange(eSymbolContextEverything, 0, false, range);
511  lldb::addr_t addr = range.GetBaseAddress().GetLoadAddress(&target);
512  if (addr != LLDB_INVALID_ADDRESS)
513  addrs.push_back(addr);
514  }
515  }
516 
517  if (addrs.size() > 0) {
518  AddressVector::iterator start = addrs.begin();
519  AddressVector::iterator end = addrs.end();
520 
521  llvm::sort(start, end);
522  addrs.erase(std::unique(start, end), end);
523  thread_plan_sp =
524  std::make_shared<ThreadPlanRunToAddress>(thread, addrs, stop);
525  }
526 
527  return thread_plan_sp;
528 }
529 
532  return;
533 
534  FileSpec file("[vdso]");
535 
536  MemoryRegionInfo info;
538  if (status.Fail()) {
539  Log *log = GetLog(LLDBLog::DynamicLoader);
540  LLDB_LOG(log, "Failed to get vdso region info: {0}", status);
541  return;
542  }
543 
544  if (ModuleSP module_sp = m_process->ReadModuleFromMemory(
545  file, m_vdso_base, info.GetRange().GetByteSize())) {
548  }
549 }
550 
553  return nullptr;
554 
555  MemoryRegionInfo info;
556  Target &target = m_process->GetTarget();
558  if (status.Fail() || info.GetMapped() != MemoryRegionInfo::eYes ||
559  info.GetName().IsEmpty()) {
560  Log *log = GetLog(LLDBLog::DynamicLoader);
561  LLDB_LOG(log, "Failed to get interpreter region info: {0}", status);
562  return nullptr;
563  }
564 
565  FileSpec file(info.GetName().GetCString());
566  ModuleSpec module_spec(file, target.GetArchitecture());
567 
568  if (ModuleSP module_sp = target.GetOrCreateModule(module_spec,
569  true /* notify */)) {
571  false);
572  m_interpreter_module = module_sp;
573  return module_sp;
574  }
575  return nullptr;
576 }
577 
579  addr_t link_map_addr,
580  addr_t base_addr,
581  bool base_addr_is_offset) {
582  if (ModuleSP module_sp = DynamicLoader::LoadModuleAtAddress(
583  file, link_map_addr, base_addr, base_addr_is_offset))
584  return module_sp;
585 
586  // This works around an dynamic linker "bug" on android <= 23, where the
587  // dynamic linker would report the application name
588  // (e.g. com.example.myapplication) instead of the main process binary
589  // (/system/bin/app_process(32)). The logic is not sound in general (it
590  // assumes base_addr is the real address, even though it actually is a load
591  // bias), but it happens to work on adroid because app_process has a file
592  // address of zero.
593  // This should be removed after we drop support for android-23.
594  if (m_process->GetTarget().GetArchitecture().GetTriple().isAndroid()) {
595  MemoryRegionInfo memory_info;
596  Status error = m_process->GetMemoryRegionInfo(base_addr, memory_info);
597  if (error.Success() && memory_info.GetMapped() &&
598  memory_info.GetRange().GetRangeBase() == base_addr &&
599  !(memory_info.GetName().IsEmpty())) {
600  if (ModuleSP module_sp = DynamicLoader::LoadModuleAtAddress(
601  FileSpec(memory_info.GetName().GetStringRef()), link_map_addr,
602  base_addr, base_addr_is_offset))
603  return module_sp;
604  }
605  }
606 
607  return nullptr;
608 }
609 
613  ModuleList module_list;
614  Log *log = GetLog(LLDBLog::DynamicLoader);
615 
616  LoadVDSO();
617 
618  if (!m_rendezvous.Resolve()) {
619  LLDB_LOGF(log,
620  "DynamicLoaderPOSIXDYLD::%s unable to resolve POSIX DYLD "
621  "rendezvous address",
622  __FUNCTION__);
623  return;
624  }
625 
626  // The rendezvous class doesn't enumerate the main module, so track that
627  // ourselves here.
628  ModuleSP executable = GetTargetExecutable();
630 
631  std::vector<FileSpec> module_names;
632  for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I)
633  module_names.push_back(I->file_spec);
635  module_names, m_process->GetTarget().GetArchitecture().GetTriple());
636 
637  for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I) {
638  ModuleSP module_sp =
639  LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true);
640  if (module_sp.get()) {
641  LLDB_LOG(log, "LoadAllCurrentModules loading module: {0}",
642  I->file_spec.GetFilename());
643  module_list.Append(module_sp);
644  } else {
645  Log *log = GetLog(LLDBLog::DynamicLoader);
646  LLDB_LOGF(
647  log,
648  "DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
649  __FUNCTION__, I->file_spec.GetCString(), I->base_addr);
650  }
651  }
652 
653  m_process->GetTarget().ModulesDidLoad(module_list);
655 }
656 
658  addr_t virt_entry;
659 
661  return m_load_offset;
662 
663  if ((virt_entry = GetEntryPoint()) == LLDB_INVALID_ADDRESS)
664  return LLDB_INVALID_ADDRESS;
665 
666  ModuleSP module = m_process->GetTarget().GetExecutableModule();
667  if (!module)
668  return LLDB_INVALID_ADDRESS;
669 
670  ObjectFile *exe = module->GetObjectFile();
671  if (!exe)
672  return LLDB_INVALID_ADDRESS;
673 
674  Address file_entry = exe->GetEntryPointAddress();
675 
676  if (!file_entry.IsValid())
677  return LLDB_INVALID_ADDRESS;
678 
679  m_load_offset = virt_entry - file_entry.GetFileAddress();
680  return m_load_offset;
681 }
682 
684  if (llvm::Optional<uint64_t> vdso_base =
686  m_vdso_base = *vdso_base;
687 
688  if (llvm::Optional<uint64_t> interpreter_base =
689  m_auxv->GetAuxValue(AuxVector::AUXV_AT_BASE))
690  m_interpreter_base = *interpreter_base;
691 }
692 
695  return m_entry_point;
696 
697  if (m_auxv == nullptr)
698  return LLDB_INVALID_ADDRESS;
699 
700  llvm::Optional<uint64_t> entry_point =
701  m_auxv->GetAuxValue(AuxVector::AUXV_AT_ENTRY);
702  if (!entry_point)
703  return LLDB_INVALID_ADDRESS;
704 
705  m_entry_point = static_cast<addr_t>(*entry_point);
706 
707  const ArchSpec &arch = m_process->GetTarget().GetArchitecture();
708 
709  // On ppc64, the entry point is actually a descriptor. Dereference it.
710  if (arch.GetMachine() == llvm::Triple::ppc64)
712 
713  return m_entry_point;
714 }
715 
717 DynamicLoaderPOSIXDYLD::GetThreadLocalData(const lldb::ModuleSP module_sp,
718  const lldb::ThreadSP thread,
719  lldb::addr_t tls_file_addr) {
720  auto it = m_loaded_modules.find(module_sp);
721  if (it == m_loaded_modules.end())
722  return LLDB_INVALID_ADDRESS;
723 
724  addr_t link_map = it->second;
725  if (link_map == LLDB_INVALID_ADDRESS)
726  return LLDB_INVALID_ADDRESS;
727 
729  if (!metadata.valid)
730  return LLDB_INVALID_ADDRESS;
731 
732  // Get the thread pointer.
733  addr_t tp = thread->GetThreadPointer();
734  if (tp == LLDB_INVALID_ADDRESS)
735  return LLDB_INVALID_ADDRESS;
736 
737  // Find the module's modid.
738  int modid_size = 4; // FIXME(spucci): This isn't right for big-endian 64-bit
739  int64_t modid = ReadUnsignedIntWithSizeInBytes(
740  link_map + metadata.modid_offset, modid_size);
741  if (modid == -1)
742  return LLDB_INVALID_ADDRESS;
743 
744  // Lookup the DTV structure for this thread.
745  addr_t dtv_ptr = tp + metadata.dtv_offset;
746  addr_t dtv = ReadPointer(dtv_ptr);
747  if (dtv == LLDB_INVALID_ADDRESS)
748  return LLDB_INVALID_ADDRESS;
749 
750  // Find the TLS block for this module.
751  addr_t dtv_slot = dtv + metadata.dtv_slot_size * modid;
752  addr_t tls_block = ReadPointer(dtv_slot + metadata.tls_offset);
753 
754  Log *log = GetLog(LLDBLog::DynamicLoader);
755  LLDB_LOGF(log,
756  "DynamicLoaderPOSIXDYLD::Performed TLS lookup: "
757  "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
758  ", modid=%" PRId64 ", tls_block=0x%" PRIx64 "\n",
759  module_sp->GetObjectName().AsCString(""), link_map, tp,
760  (int64_t)modid, tls_block);
761 
762  if (tls_block == LLDB_INVALID_ADDRESS)
763  return LLDB_INVALID_ADDRESS;
764  else
765  return tls_block + tls_file_addr;
766 }
767 
769  lldb::ModuleSP &module_sp) {
770  Log *log = GetLog(LLDBLog::DynamicLoader);
771 
772  if (m_process == nullptr)
773  return;
774 
775  auto &target = m_process->GetTarget();
776  const auto platform_sp = target.GetPlatform();
777 
778  ProcessInstanceInfo process_info;
779  if (!m_process->GetProcessInfo(process_info)) {
780  LLDB_LOGF(log,
781  "DynamicLoaderPOSIXDYLD::%s - failed to get process info for "
782  "pid %" PRIu64,
783  __FUNCTION__, m_process->GetID());
784  return;
785  }
786 
787  LLDB_LOGF(
788  log, "DynamicLoaderPOSIXDYLD::%s - got executable by pid %" PRIu64 ": %s",
789  __FUNCTION__, m_process->GetID(),
790  process_info.GetExecutableFile().GetPath().c_str());
791 
792  ModuleSpec module_spec(process_info.GetExecutableFile(),
793  process_info.GetArchitecture());
794  if (module_sp && module_sp->MatchesModuleSpec(module_spec))
795  return;
796 
797  const auto executable_search_paths(Target::GetDefaultExecutableSearchPaths());
798  auto error = platform_sp->ResolveExecutable(
799  module_spec, module_sp,
800  !executable_search_paths.IsEmpty() ? &executable_search_paths : nullptr);
801  if (error.Fail()) {
802  StreamString stream;
803  module_spec.Dump(stream);
804 
805  LLDB_LOGF(log,
806  "DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
807  "with module spec \"%s\": %s",
808  __FUNCTION__, stream.GetData(), error.AsCString());
809  return;
810  }
811 
812  target.SetExecutableModule(module_sp, eLoadDependentsNo);
813 }
814 
816  lldb_private::SymbolContext &sym_ctx) {
817  ModuleSP module_sp;
818  if (sym_ctx.symbol)
819  module_sp = sym_ctx.symbol->GetAddressRef().GetModule();
820  if (!module_sp && sym_ctx.function)
821  module_sp =
823  if (!module_sp)
824  return false;
825 
826  return module_sp->GetFileSpec().GetPath() == "[vdso]";
827 }
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:108
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:33
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:333
lldb::eSymbolTypeCode
@ eSymbolTypeCode
Definition: lldb-enumerations.h:616
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:491
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:668
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:2052
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:379
lldb_private::Breakpoint::SetBreakpointKind
void SetBreakpointKind(const char *kind)
Set the "kind" description for a breakpoint.
Definition: Breakpoint.h:447
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:5831
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:693
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:2344
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:270
lldb_private::Process
Definition: Process.h:338
lldb_private::Target::GetExecutableModulePointer
Module * GetExecutableModulePointer()
Definition: Target.cpp:1371
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:1357
Module.h
BreakpointLocation.h
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1206
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:1263
lldb_private::DynamicLoader::UnloadSectionsCommon
void UnloadSectionsCommon(const lldb::ModuleSP module)
Definition: DynamicLoader.cpp:123
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:345
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:455
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:464
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:938
lldb_private::Process::PrefetchModuleSpecs
virtual void PrefetchModuleSpecs(llvm::ArrayRef< FileSpec > module_file_specs, const llvm::Triple &triple)
Definition: Process.h:2391
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:504
Target.h
lldb_private::Target::GetPlatform
lldb::PlatformSP GetPlatform()
Definition: Target.h:1389
lldb_private::Module::GetFileSpec
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
Definition: Module.h:477
lldb_private::Thread::GetProcess
lldb::ProcessSP GetProcess() const
Definition: Thread.h:153
Platform.h
lldb_private::FileSpec
Definition: FileSpec.h:56
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:623
ProcessInfo.h
DynamicLoaderPOSIXDYLD::LoadVDSO
void LoadVDSO()
Definition: DynamicLoaderPOSIXDYLD.cpp:530
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:202
lldb_private::ModuleList
Definition: ModuleList.h:81
Log.h
lldb_private::ConstString::IsEmpty
bool IsEmpty() const
Test for empty string.
Definition: ConstString.h:304
lldb_private::eLoadDependentsNo
@ eLoadDependentsNo
Definition: Target.h:65
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:174
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:185
lldb_private::SymbolContextList::GetSize
uint32_t GetSize() const
Get accessor for a symbol context list size.
Definition: SymbolContext.cpp:1279
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:40
lldb_private::Process::GetAuxvData
virtual DataExtractor GetAuxvData()
Definition: Process.cpp:2639
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:618
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:317
lldb_private::MemoryRegionInfo::GetName
ConstString GetName() const
Definition: MemoryRegionInfo.h:50
ThreadPlanRunToAddress.h
lldb_private::DynamicLoader::UpdateLoadedSectionsCommon
void UpdateLoadedSectionsCommon(lldb::ModuleSP module, lldb::addr_t base_addr, bool base_addr_is_offset)
Definition: DynamicLoader.cpp:111
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
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
lldb_private::Symbol::GetName
ConstString GetName() const
Definition: Symbol.cpp:501
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:657
DynamicLoaderPOSIXDYLD::ResolveExecutableModule
void ResolveExecutableModule(lldb::ModuleSP &module_sp)
Loads Module from inferior process.
Definition: DynamicLoaderPOSIXDYLD.cpp:768
lldb_private::ModuleSpec
Definition: ModuleSpec.h:27
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:980
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:480
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:815
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:683
lldb_private::Address
Definition: Address.h:59
lldb_private::Target::ModulesDidLoad
void ModulesDidLoad(ModuleList &module_list)
Definition: Target.cpp:1623
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:578
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:413
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:82
lldb_private::DynamicLoader::GetStopWhenImagesChange
bool GetStopWhenImagesChange() const
Get whether the process should stop when images change.
Definition: DynamicLoader.cpp:64
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:72
lldb_private::Target::RemoveBreakpointByID
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:943
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:216
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:263
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:535
lldb_private::MemoryRegionInfo::GetRange
RangeType & GetRange()
Definition: MemoryRegionInfo.h:36
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:61
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:551
lldb_private::ProcessInfo::GetExecutableFile
FileSpec & GetExecutableFile()
Definition: ProcessInfo.h:42
DynamicLoaderPOSIXDYLD::LoadAllCurrentModules
virtual void LoadAllCurrentModules()
Helper for the entry breakpoint callback.
Definition: DynamicLoaderPOSIXDYLD.cpp:610
lldb_private::Symbol::IsTrampoline
bool IsTrampoline() const
Definition: Symbol.cpp:174
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:48
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:317
lldb_private::Thread::GetStackFrameAtIndex
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
Definition: Thread.h:398
lldb_private::Target::ModulesDidUnload
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
Definition: Target.cpp:1655
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:235
lldb_private::FileSpec::GetPath
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:347
lldb_private::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:48
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:717
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:299
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:5724
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