LLDB  mainline
DynamicLoaderHexagonDYLD.cpp
Go to the documentation of this file.
1 //===-- DynamicLoaderHexagonDYLD.cpp --------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "lldb/Core/Module.h"
11 #include "lldb/Core/ModuleSpec.h"
13 #include "lldb/Core/Section.h"
14 #include "lldb/Symbol/ObjectFile.h"
15 #include "lldb/Target/Process.h"
16 #include "lldb/Target/Target.h"
17 #include "lldb/Target/Thread.h"
19 #include "lldb/Utility/Log.h"
20 
22 
23 #include <memory>
24 
25 using namespace lldb;
26 using namespace lldb_private;
27 
29 
30 // Aidan 21/05/2014
31 //
32 // Notes about hexagon dynamic loading:
33 //
34 // When we connect to a target we find the dyld breakpoint address. We put
35 // a
36 // breakpoint there with a callback 'RendezvousBreakpointHit()'.
37 //
38 // It is possible to find the dyld structure address from the ELF symbol
39 // table,
40 // but in the case of the simulator it has not been initialized before the
41 // target calls dlinit().
42 //
43 // We can only safely parse the dyld structure after we hit the dyld
44 // breakpoint
45 // since at that time we know dlinit() must have been called.
46 //
47 
48 // Find the load address of a symbol
49 static lldb::addr_t findSymbolAddress(Process *proc, ConstString findName) {
50  assert(proc != nullptr);
51 
52  ModuleSP module = proc->GetTarget().GetExecutableModule();
53  assert(module.get() != nullptr);
54 
55  ObjectFile *exe = module->GetObjectFile();
56  assert(exe != nullptr);
57 
58  lldb_private::Symtab *symtab = exe->GetSymtab();
59  assert(symtab != nullptr);
60 
61  for (size_t i = 0; i < symtab->GetNumSymbols(); i++) {
62  const Symbol *sym = symtab->SymbolAtIndex(i);
63  assert(sym != nullptr);
64  ConstString symName = sym->GetName();
65 
66  if (ConstString::Compare(findName, symName) == 0) {
67  Address addr = sym->GetAddress();
68  return addr.GetLoadAddress(&proc->GetTarget());
69  }
70  }
71  return LLDB_INVALID_ADDRESS;
72 }
73 
75  PluginManager::RegisterPlugin(GetPluginNameStatic(),
76  GetPluginDescriptionStatic(), CreateInstance);
77 }
78 
80 
82  return GetPluginNameStatic();
83 }
84 
86  static ConstString g_name("hexagon-dyld");
87  return g_name;
88 }
89 
91  return "Dynamic loader plug-in that watches for shared library "
92  "loads/unloads in Hexagon processes.";
93 }
94 
96  bool force) {
97  bool create = force;
98  if (!create) {
99  const llvm::Triple &triple_ref =
100  process->GetTarget().GetArchitecture().GetTriple();
101  if (triple_ref.getArch() == llvm::Triple::hexagon)
102  create = true;
103  }
104 
105  if (create)
106  return new DynamicLoaderHexagonDYLD(process);
107  return nullptr;
108 }
109 
111  : DynamicLoader(process), m_rendezvous(process),
112  m_load_offset(LLDB_INVALID_ADDRESS), m_entry_point(LLDB_INVALID_ADDRESS),
113  m_dyld_bid(LLDB_INVALID_BREAK_ID) {}
114 
119  }
120 }
121 
123  ModuleSP executable;
124  addr_t load_offset;
125 
126  executable = GetTargetExecutable();
127 
128  // Find the difference between the desired load address in the elf file and
129  // the real load address in memory
130  load_offset = ComputeLoadOffset();
131 
132  // Check that there is a valid executable
133  if (executable.get() == nullptr)
134  return;
135 
136  // Disable JIT for hexagon targets because its not supported
137  m_process->SetCanJIT(false);
138 
139  // Enable Interpreting of function call expressions
141 
142  // Add the current executable to the module list
143  ModuleList module_list;
144  module_list.Append(executable);
145 
146  // Map the loaded sections of this executable
147  if (load_offset != LLDB_INVALID_ADDRESS)
148  UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset, true);
149 
150  // AD: confirm this?
151  // Load into LLDB all of the currently loaded executables in the stub
153 
154  // AD: confirm this?
155  // Callback for the target to give it the loaded module list
156  m_process->GetTarget().ModulesDidLoad(module_list);
157 
158  // Try to set a breakpoint at the rendezvous breakpoint. DidLaunch uses
159  // ProbeEntry() instead. That sets a breakpoint, at the dyld breakpoint
160  // address, with a callback so that when hit, the dyld structure can be
161  // parsed.
162  if (!SetRendezvousBreakpoint()) {
163  // fail
164  }
165 }
166 
168 
169 /// Checks to see if the target module has changed, updates the target
170 /// accordingly and returns the target executable module.
172  Target &target = m_process->GetTarget();
173  ModuleSP executable = target.GetExecutableModule();
174 
175  // There is no executable
176  if (!executable.get())
177  return executable;
178 
179  // The target executable file does not exits
180  if (!FileSystem::Instance().Exists(executable->GetFileSpec()))
181  return executable;
182 
183  // Prep module for loading
184  ModuleSpec module_spec(executable->GetFileSpec(),
185  executable->GetArchitecture());
186  ModuleSP module_sp(new Module(module_spec));
187 
188  // Check if the executable has changed and set it to the target executable if
189  // they differ.
190  if (module_sp.get() && module_sp->GetUUID().IsValid() &&
191  executable->GetUUID().IsValid()) {
192  // if the executable has changed ??
193  if (module_sp->GetUUID() != executable->GetUUID())
194  executable.reset();
195  } else if (executable->FileHasChanged())
196  executable.reset();
197 
198  if (executable.get())
199  return executable;
200 
201  // TODO: What case is this code used?
202  executable = target.GetOrCreateModule(module_spec, true /* notify */);
203  if (executable.get() != target.GetExecutableModulePointer()) {
204  // Don't load dependent images since we are in dyld where we will know and
205  // find out about all images that are loaded
206  target.SetExecutableModule(executable, eLoadDependentsNo);
207  }
208 
209  return executable;
210 }
211 
212 // AD: Needs to be updated?
214 
216  addr_t link_map_addr,
217  addr_t base_addr,
218  bool base_addr_is_offset) {
219  Target &target = m_process->GetTarget();
220  const SectionList *sections = GetSectionListFromModule(module);
221 
222  assert(sections && "SectionList missing from loaded module.");
223 
224  m_loaded_modules[module] = link_map_addr;
225 
226  const size_t num_sections = sections->GetSize();
227 
228  for (unsigned i = 0; i < num_sections; ++i) {
229  SectionSP section_sp(sections->GetSectionAtIndex(i));
230  lldb::addr_t new_load_addr = section_sp->GetFileAddress() + base_addr;
231 
232  // AD: 02/05/14
233  // since our memory map starts from address 0, we must not ignore
234  // sections that load to address 0. This violates the reference
235  // ELF spec, however is used for Hexagon.
236 
237  // If the file address of the section is zero then this is not an
238  // allocatable/loadable section (property of ELF sh_addr). Skip it.
239  // if (new_load_addr == base_addr)
240  // continue;
241 
242  target.SetSectionLoadAddress(section_sp, new_load_addr);
243  }
244 }
245 
246 /// Removes the loaded sections from the target in \p module.
247 ///
248 /// \param module The module to traverse.
249 void DynamicLoaderHexagonDYLD::UnloadSections(const ModuleSP module) {
250  Target &target = m_process->GetTarget();
251  const SectionList *sections = GetSectionListFromModule(module);
252 
253  assert(sections && "SectionList missing from unloaded module.");
254 
255  m_loaded_modules.erase(module);
256 
257  const size_t num_sections = sections->GetSize();
258  for (size_t i = 0; i < num_sections; ++i) {
259  SectionSP section_sp(sections->GetSectionAtIndex(i));
260  target.SetSectionUnloaded(section_sp);
261  }
262 }
263 
264 // Place a breakpoint on <_rtld_debug_state>
267 
268  // This is the original code, which want to look in the rendezvous structure
269  // to find the breakpoint address. Its backwards for us, since we can easily
270  // find the breakpoint address, since it is exported in our executable. We
271  // however know that we cant read the Rendezvous structure until we have hit
272  // the breakpoint once.
273  const ConstString dyldBpName("_rtld_debug_state");
274  addr_t break_addr = findSymbolAddress(m_process, dyldBpName);
275 
276  Target &target = m_process->GetTarget();
277 
278  // Do not try to set the breakpoint if we don't know where to put it
279  if (break_addr == LLDB_INVALID_ADDRESS) {
280  LLDB_LOGF(log, "Unable to locate _rtld_debug_state breakpoint address");
281 
282  return false;
283  }
284 
285  // Save the address of the rendezvous structure
286  m_rendezvous.SetBreakAddress(break_addr);
287 
288  // If we haven't set the breakpoint before then set it
290  Breakpoint *dyld_break =
291  target.CreateBreakpoint(break_addr, true, false).get();
292  dyld_break->SetCallback(RendezvousBreakpointHit, this, true);
293  dyld_break->SetBreakpointKind("shared-library-event");
294  m_dyld_bid = dyld_break->GetID();
295 
296  // Make sure our breakpoint is at the right address.
297  assert(target.GetBreakpointByID(m_dyld_bid)
298  ->FindLocationByAddress(break_addr)
299  ->GetBreakpoint()
300  .GetID() == m_dyld_bid);
301 
302  if (log && dyld_break == nullptr)
303  LLDB_LOGF(log, "Failed to create _rtld_debug_state breakpoint");
304 
305  // check we have successfully set bp
306  return (dyld_break != nullptr);
307  } else
308  // rendezvous already set
309  return true;
310 }
311 
312 // We have just hit our breakpoint at <_rtld_debug_state>
314  void *baton, StoppointCallbackContext *context, user_id_t break_id,
315  user_id_t break_loc_id) {
317 
318  LLDB_LOGF(log, "Rendezvous breakpoint hit!");
319 
320  DynamicLoaderHexagonDYLD *dyld_instance = nullptr;
321  dyld_instance = static_cast<DynamicLoaderHexagonDYLD *>(baton);
322 
323  // if the dyld_instance is still not valid then try to locate it on the
324  // symbol table
325  if (!dyld_instance->m_rendezvous.IsValid()) {
326  Process *proc = dyld_instance->m_process;
327 
328  const ConstString dyldStructName("_rtld_debug");
329  addr_t structAddr = findSymbolAddress(proc, dyldStructName);
330 
331  if (structAddr != LLDB_INVALID_ADDRESS) {
332  dyld_instance->m_rendezvous.SetRendezvousAddress(structAddr);
333 
334  LLDB_LOGF(log, "Found _rtld_debug structure @ 0x%08" PRIx64, structAddr);
335  } else {
336  LLDB_LOGF(log, "Unable to resolve the _rtld_debug structure");
337  }
338  }
339 
340  dyld_instance->RefreshModules();
341 
342  // Return true to stop the target, false to just let the target run.
343  return dyld_instance->GetStopWhenImagesChange();
344 }
345 
346 /// Helper method for RendezvousBreakpointHit. Updates LLDB's current set
347 /// of loaded modules.
350 
351  if (!m_rendezvous.Resolve())
352  return;
353 
356 
357  ModuleList &loaded_modules = m_process->GetTarget().GetImages();
358 
360  ModuleList new_modules;
361 
362  E = m_rendezvous.loaded_end();
363  for (I = m_rendezvous.loaded_begin(); I != E; ++I) {
364  FileSpec file(I->path);
365  FileSystem::Instance().Resolve(file);
366  ModuleSP module_sp =
367  LoadModuleAtAddress(file, I->link_addr, I->base_addr, true);
368  if (module_sp.get()) {
369  loaded_modules.AppendIfNeeded(module_sp);
370  new_modules.Append(module_sp);
371  }
372 
373  if (log) {
374  LLDB_LOGF(log, "Target is loading '%s'", I->path.c_str());
375  if (!module_sp.get())
376  LLDB_LOGF(log, "LLDB failed to load '%s'", I->path.c_str());
377  else
378  LLDB_LOGF(log, "LLDB successfully loaded '%s'", I->path.c_str());
379  }
380  }
381  m_process->GetTarget().ModulesDidLoad(new_modules);
382  }
383 
385  ModuleList old_modules;
386 
388  for (I = m_rendezvous.unloaded_begin(); I != E; ++I) {
389  FileSpec file(I->path);
390  FileSystem::Instance().Resolve(file);
391  ModuleSpec module_spec(file);
392  ModuleSP module_sp = loaded_modules.FindFirstModule(module_spec);
393 
394  if (module_sp.get()) {
395  old_modules.Append(module_sp);
396  UnloadSections(module_sp);
397  }
398 
399  LLDB_LOGF(log, "Target is unloading '%s'", I->path.c_str());
400  }
401  loaded_modules.Remove(old_modules);
402  m_process->GetTarget().ModulesDidUnload(old_modules, false);
403  }
404 }
405 
406 // AD: This is very different to the Static Loader code.
407 // It may be wise to look over this and its relation to stack
408 // unwinding.
409 ThreadPlanSP
411  bool stop) {
412  ThreadPlanSP thread_plan_sp;
413 
414  StackFrame *frame = thread.GetStackFrameAtIndex(0).get();
415  const SymbolContext &context = frame->GetSymbolContext(eSymbolContextSymbol);
416  Symbol *sym = context.symbol;
417 
418  if (sym == nullptr || !sym->IsTrampoline())
419  return thread_plan_sp;
420 
421  const ConstString sym_name =
422  sym->GetMangled().GetName(Mangled::ePreferMangled);
423  if (!sym_name)
424  return thread_plan_sp;
425 
426  SymbolContextList target_symbols;
427  Target &target = thread.GetProcess()->GetTarget();
428  const ModuleList &images = target.GetImages();
429 
430  images.FindSymbolsWithNameAndType(sym_name, eSymbolTypeCode, target_symbols);
431  size_t num_targets = target_symbols.GetSize();
432  if (!num_targets)
433  return thread_plan_sp;
434 
435  typedef std::vector<lldb::addr_t> AddressVector;
436  AddressVector addrs;
437  for (size_t i = 0; i < num_targets; ++i) {
438  SymbolContext context;
439  AddressRange range;
440  if (target_symbols.GetContextAtIndex(i, context)) {
441  context.GetAddressRange(eSymbolContextEverything, 0, false, range);
442  lldb::addr_t addr = range.GetBaseAddress().GetLoadAddress(&target);
443  if (addr != LLDB_INVALID_ADDRESS)
444  addrs.push_back(addr);
445  }
446  }
447 
448  if (addrs.size() > 0) {
449  AddressVector::iterator start = addrs.begin();
450  AddressVector::iterator end = addrs.end();
451 
452  llvm::sort(start, end);
453  addrs.erase(std::unique(start, end), end);
454  thread_plan_sp =
455  std::make_shared<ThreadPlanRunToAddress>(thread, addrs, stop);
456  }
457 
458  return thread_plan_sp;
459 }
460 
461 /// Helper for the entry breakpoint callback. Resolves the load addresses
462 /// of all dependent modules.
466  ModuleList module_list;
467 
468  if (!m_rendezvous.Resolve()) {
470  LLDB_LOGF(
471  log,
472  "DynamicLoaderHexagonDYLD::%s unable to resolve rendezvous address",
473  __FUNCTION__);
474  return;
475  }
476 
477  // The rendezvous class doesn't enumerate the main module, so track that
478  // ourselves here.
479  ModuleSP executable = GetTargetExecutable();
481 
482  for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I) {
483  const char *module_path = I->path.c_str();
484  FileSpec file(module_path);
485  ModuleSP module_sp =
486  LoadModuleAtAddress(file, I->link_addr, I->base_addr, true);
487  if (module_sp.get()) {
488  module_list.Append(module_sp);
489  } else {
491  LLDB_LOGF(log,
492  "DynamicLoaderHexagonDYLD::%s failed loading module %s at "
493  "0x%" PRIx64,
494  __FUNCTION__, module_path, I->base_addr);
495  }
496  }
497 
498  m_process->GetTarget().ModulesDidLoad(module_list);
499 }
500 
501 /// Computes a value for m_load_offset returning the computed address on
502 /// success and LLDB_INVALID_ADDRESS on failure.
504  // Here we could send a GDB packet to know the load offset
505  //
506  // send: $qOffsets#4b
507  // get: Text=0;Data=0;Bss=0
508  //
509  // Currently qOffsets is not supported by pluginProcessGDBRemote
510  //
511  return 0;
512 }
513 
514 // Here we must try to read the entry point directly from the elf header. This
515 // is possible if the process is not relocatable or dynamically linked.
516 //
517 // an alternative is to look at the PC if we can be sure that we have connected
518 // when the process is at the entry point.
519 // I dont think that is reliable for us.
522  return m_entry_point;
523  // check we have a valid process
524  if (m_process == nullptr)
525  return LLDB_INVALID_ADDRESS;
526  // Get the current executable module
527  Module &module = *(m_process->GetTarget().GetExecutableModule().get());
528  // Get the object file (elf file) for this module
529  lldb_private::ObjectFile &object = *(module.GetObjectFile());
530  // Check if the file is executable (ie, not shared object or relocatable)
531  if (object.IsExecutable()) {
532  // Get the entry point address for this object
533  lldb_private::Address entry = object.GetEntryPointAddress();
534  // Return the entry point address
535  return entry.GetFileAddress();
536  }
537  // No idea so back out
538  return LLDB_INVALID_ADDRESS;
539 }
540 
542  const ModuleSP module) const {
543  SectionList *sections = nullptr;
544  if (module.get()) {
545  ObjectFile *obj_file = module->GetObjectFile();
546  if (obj_file) {
547  sections = obj_file->GetSectionList();
548  }
549  }
550  return sections;
551 }
552 
553 static int ReadInt(Process *process, addr_t addr) {
554  Status error;
555  int value = (int)process->ReadUnsignedIntegerFromMemory(
556  addr, sizeof(uint32_t), 0, error);
557  if (error.Fail())
558  return -1;
559  else
560  return value;
561 }
562 
565  const lldb::ThreadSP thread,
566  lldb::addr_t tls_file_addr) {
567  auto it = m_loaded_modules.find(module);
568  if (it == m_loaded_modules.end())
569  return LLDB_INVALID_ADDRESS;
570 
571  addr_t link_map = it->second;
572  if (link_map == LLDB_INVALID_ADDRESS)
573  return LLDB_INVALID_ADDRESS;
574 
575  const HexagonDYLDRendezvous::ThreadInfo &metadata =
577  if (!metadata.valid)
578  return LLDB_INVALID_ADDRESS;
579 
580  // Get the thread pointer.
581  addr_t tp = thread->GetThreadPointer();
582  if (tp == LLDB_INVALID_ADDRESS)
583  return LLDB_INVALID_ADDRESS;
584 
585  // Find the module's modid.
586  int modid = ReadInt(m_process, link_map + metadata.modid_offset);
587  if (modid == -1)
588  return LLDB_INVALID_ADDRESS;
589 
590  // Lookup the DTV structure for this thread.
591  addr_t dtv_ptr = tp + metadata.dtv_offset;
592  addr_t dtv = ReadPointer(dtv_ptr);
593  if (dtv == LLDB_INVALID_ADDRESS)
594  return LLDB_INVALID_ADDRESS;
595 
596  // Find the TLS block for this module.
597  addr_t dtv_slot = dtv + metadata.dtv_slot_size * modid;
598  addr_t tls_block = ReadPointer(dtv_slot + metadata.tls_offset);
599 
600  Module *mod = module.get();
602  LLDB_LOGF(log,
603  "DynamicLoaderHexagonDYLD::Performed TLS lookup: "
604  "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
605  ", modid=%i, tls_block=0x%" PRIx64,
606  mod->GetObjectName().AsCString(""), link_map, tp, modid, tls_block);
607 
608  if (tls_block == LLDB_INVALID_ADDRESS)
609  return LLDB_INVALID_ADDRESS;
610  else
611  return tls_block + tls_file_addr;
612 }
lldb_private::AddressRange::GetBaseAddress
Address & GetBaseAddress()
Get accessor for the base address of the range.
Definition: AddressRange.h:209
lldb_private::Module::GetObjectFile
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
Definition: Module.cpp:1238
DynamicLoaderHexagonDYLD::UnloadSections
void UnloadSections(const lldb::ModuleSP module) override
Removes the loaded sections from the target in module.
Definition: DynamicLoaderHexagonDYLD.cpp:249
HexagonDYLDRendezvous::ThreadInfo::dtv_offset
uint32_t dtv_offset
Definition: HexagonDYLDRendezvous.h:52
LIBLLDB_LOG_DYNAMIC_LOADER
#define LIBLLDB_LOG_DYNAMIC_LOADER
Definition: Logging.h:17
DynamicLoaderHexagonDYLD.h
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
HexagonDYLDRendezvous::GetLinkMapAddress
lldb::addr_t GetLinkMapAddress() const
Definition: HexagonDYLDRendezvous.h:87
lldb_private::Stoppoint::GetID
lldb::break_id_t GetID() const
Definition: Stoppoint.cpp:22
lldb::eSymbolTypeCode
@ eSymbolTypeCode
Definition: lldb-enumerations.h:616
HexagonDYLDRendezvous::iterator
SOEntryList::const_iterator iterator
Definition: HexagonDYLDRendezvous.h:165
ModuleSpec.h
lldb_private::Symbol
Definition: Symbol.h:20
HexagonDYLDRendezvous::ModulesDidUnload
bool ModulesDidUnload() const
Definition: HexagonDYLDRendezvous.h:119
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:1979
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
DynamicLoaderHexagonDYLD::DidLaunch
void DidLaunch() override
Called after launching a process.
Definition: DynamicLoaderHexagonDYLD.cpp:167
lldb_private::ObjectFile::GetSymtab
virtual Symtab * GetSymtab()=0
Gets the symbol table for the currently selected architecture (and object for archives).
lldb_private::Breakpoint::SetBreakpointKind
void SetBreakpointKind(const char *kind)
Set the "kind" description for a breakpoint.
Definition: Breakpoint.h:442
findSymbolAddress
static lldb::addr_t findSymbolAddress(Process *proc, ConstString findName)
Definition: DynamicLoaderHexagonDYLD.cpp:49
lldb_private::SectionList::GetSize
size_t GetSize() const
Definition: Section.h:74
HexagonDYLDRendezvous::ModulesDidLoad
bool ModulesDidLoad() const
Definition: HexagonDYLDRendezvous.h:115
DynamicLoaderHexagonDYLD::~DynamicLoaderHexagonDYLD
~DynamicLoaderHexagonDYLD() override
Definition: DynamicLoaderHexagonDYLD.cpp:115
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:249
lldb_private::Process
Definition: Process.h:340
lldb_private::Target::GetExecutableModulePointer
Module * GetExecutableModulePointer()
Definition: Target.cpp:1362
lldb_private::Target::GetExecutableModule
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition: Target.cpp:1348
Module.h
BreakpointLocation.h
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1212
DynamicLoaderHexagonDYLD::GetEntryPoint
lldb::addr_t GetEntryPoint()
Computes a value for m_entry_point returning the computed address on success and LLDB_INVALID_ADDRESS...
Definition: DynamicLoaderHexagonDYLD.cpp:520
HexagonDYLDRendezvous::end
iterator end() const
Definition: HexagonDYLDRendezvous.h:169
lldb_private::Process::SetCanInterpretFunctionCalls
void SetCanInterpretFunctionCalls(bool can_interpret_function_calls)
Sets whether executing function calls using the interpreter is possible for this process.
Definition: Process.h:1903
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:1262
lldb_private::Module
Definition: Module.h:84
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:193
lldb_private::SectionList
Definition: Section.h:34
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:331
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:444
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::Symtab::SymbolAtIndex
Symbol * SymbolAtIndex(size_t idx)
Definition: Symtab.cpp:210
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:450
Section.h
DynamicLoaderHexagonDYLD::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: DynamicLoaderHexagonDYLD.cpp:313
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:924
DynamicLoaderHexagonDYLD::CreateInstance
static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force)
Definition: DynamicLoaderHexagonDYLD.cpp:95
Process.h
HexagonDYLDRendezvous::ThreadInfo::valid
bool valid
Definition: HexagonDYLDRendezvous.h:51
lldb_private::ModuleList::FindSymbolsWithNameAndType
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:462
Target.h
lldb_private::Thread::GetProcess
lldb::ProcessSP GetProcess() const
Definition: Thread.h:152
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
lldb_private::ObjectFile::GetSectionList
virtual SectionList * GetSectionList(bool update_module_section_list=true)
Gets the section list for the currently selected architecture (and object for archives).
Definition: ObjectFile.cpp:583
DynamicLoaderHexagonDYLD::LoadAllCurrentModules
void LoadAllCurrentModules()
Helper for the entry breakpoint callback.
Definition: DynamicLoaderHexagonDYLD.cpp:463
DynamicLoaderHexagonDYLD
Definition: DynamicLoaderHexagonDYLD.h:17
DynamicLoaderHexagonDYLD::GetPluginNameStatic
static lldb_private::ConstString GetPluginNameStatic()
Definition: DynamicLoaderHexagonDYLD.cpp:85
lldb_private::ModuleList::Remove
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
lldb_private::ModuleList
Definition: ModuleList.h:72
HexagonDYLDRendezvous::ThreadInfo::tls_offset
uint32_t tls_offset
Definition: HexagonDYLDRendezvous.h:55
Log.h
lldb_private::ModuleList::AppendIfNeeded
bool AppendIfNeeded(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list, if it is not already there.
lldb_private::eLoadDependentsNo
@ eLoadDependentsNo
Definition: Target.h:63
HexagonDYLDRendezvous::IsValid
bool IsValid()
Definition: HexagonDYLDRendezvous.cpp:107
DynamicLoaderHexagonDYLD::RefreshModules
void RefreshModules()
Helper method for RendezvousBreakpointHit.
Definition: DynamicLoaderHexagonDYLD.cpp:348
lldb_private::Target::SetSectionLoadAddress
bool SetSectionLoadAddress(const lldb::SectionSP &section, lldb::addr_t load_addr, bool warn_multiple=false)
Definition: Target.cpp:2824
lldb_private::Thread
Definition: Thread.h:60
Compare
static bool Compare(BreakpointLocationSP lhs, lldb::break_id_t val)
Definition: BreakpointLocationList.cpp:64
DynamicLoaderHexagonDYLD::DidAttach
void DidAttach() override
Called after attaching a process.
Definition: DynamicLoaderHexagonDYLD.cpp:122
DynamicLoaderHexagonDYLD::ComputeLoadOffset
lldb::addr_t ComputeLoadOffset()
Computes a value for m_load_offset returning the computed address on success and LLDB_INVALID_ADDRESS...
Definition: DynamicLoaderHexagonDYLD.cpp:503
lldb_private::Address::GetFileAddress
lldb::addr_t GetFileAddress() const
Get the file address.
Definition: Address.cpp:290
DynamicLoaderHexagonDYLD::DynamicLoaderHexagonDYLD
DynamicLoaderHexagonDYLD(lldb_private::Process *process)
Definition: DynamicLoaderHexagonDYLD.cpp:110
ReadInt
static int ReadInt(Process *process, addr_t addr)
Definition: DynamicLoaderHexagonDYLD.cpp:553
HexagonDYLDRendezvous::Resolve
bool Resolve()
Update the internal snapshot of runtime linker rendezvous and recompute the currently loaded modules.
Definition: HexagonDYLDRendezvous.cpp:61
HexagonDYLDRendezvous::ThreadInfo
Definition: HexagonDYLDRendezvous.h:50
HexagonDYLDRendezvous::loaded_end
iterator loaded_end() const
Definition: HexagonDYLDRendezvous.h:174
lldb_private::DynamicLoader::ReadPointer
lldb::addr_t ReadPointer(lldb::addr_t addr)
Definition: DynamicLoader.cpp:229
lldb_private::SymbolContextList::GetSize
uint32_t GetSize() const
Get accessor for a symbol context list size.
Definition: SymbolContext.cpp:1278
lldb_private::ConstString
Definition: ConstString.h:40
HexagonDYLDRendezvous::loaded_begin
iterator loaded_begin() const
Iterators over all modules loaded into the inferior since the last call to Resolve().
Definition: HexagonDYLDRendezvous.h:173
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::ModuleList::FindFirstModule
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
Definition: ModuleList.cpp:582
HexagonDYLDRendezvous::ThreadInfo::dtv_slot_size
uint32_t dtv_slot_size
Definition: HexagonDYLDRendezvous.h:53
HexagonDYLDRendezvous::SetBreakAddress
void SetBreakAddress(lldb::addr_t addr)
In hexagon it is possible that we can know the dyld breakpoint without having to find it from the ren...
Definition: HexagonDYLDRendezvous.h:101
DynamicLoaderHexagonDYLD::m_entry_point
lldb::addr_t m_entry_point
Virtual entry address of the inferior process.
Definition: DynamicLoaderHexagonDYLD.h:60
lldb_private::SectionList::GetSectionAtIndex
lldb::SectionSP GetSectionAtIndex(size_t idx) const
Definition: Section.cpp:476
lldb_private::Module::GetObjectName
ConstString GetObjectName() const
Definition: Module.cpp:1236
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:312
DynamicLoaderHexagonDYLD::GetPluginName
lldb_private::ConstString GetPluginName() override
Definition: DynamicLoaderHexagonDYLD.cpp:81
ThreadPlanRunToAddress.h
DynamicLoaderHexagonDYLD::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: DynamicLoaderHexagonDYLD.h:67
Thread.h
HexagonDYLDRendezvous::GetThreadInfo
const ThreadInfo & GetThreadInfo()
Definition: HexagonDYLDRendezvous.cpp:316
lldb_private::Symbol::GetMangled
Mangled & GetMangled()
Definition: Symbol.h:121
DynamicLoaderHexagonDYLD::CanLoadImage
lldb_private::Status CanLoadImage() override
Ask if it is ok to try and load or unload an shared library (image).
Definition: DynamicLoaderHexagonDYLD.cpp:213
DynamicLoaderHexagonDYLD::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: DynamicLoaderHexagonDYLD.cpp:564
ObjectFile.h
lldb_private::Target::SetExecutableModule
void SetExecutableModule(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Set the main executable module.
Definition: Target.cpp:1397
LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:49
lldb_private::Symtab::GetNumSymbols
size_t GetNumSymbols() const
Definition: Symtab.cpp:71
lldb_private::Symbol::GetName
ConstString GetName() const
Definition: Symbol.cpp:500
DynamicLoaderHexagonDYLD::Terminate
static void Terminate()
Definition: DynamicLoaderHexagonDYLD.cpp:79
HexagonDYLDRendezvous::begin
iterator begin() const
Iterators over all currently loaded modules.
Definition: HexagonDYLDRendezvous.h:168
lldb_private::ModuleSpec
Definition: ModuleSpec.h:26
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:966
lldb_private::Target::SetSectionUnloaded
bool SetSectionUnloaded(const lldb::SectionSP &section_sp)
Definition: Target.cpp:2873
lldb_private::Status
Definition: Status.h:44
lldb_private::Symtab
Definition: Symtab.h:22
DynamicLoaderHexagonDYLD::GetPluginDescriptionStatic
static const char * GetPluginDescriptionStatic()
Definition: DynamicLoaderHexagonDYLD.cpp:90
uint32_t
DynamicLoaderHexagonDYLD::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: DynamicLoaderHexagonDYLD.cpp:410
DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint
bool SetRendezvousBreakpoint()
Enables a breakpoint on a function called by the runtime linker each time a module is loaded or unloa...
Definition: DynamicLoaderHexagonDYLD.cpp:265
lldb_private::Address
Definition: Address.h:59
lldb_private::Target::ModulesDidLoad
void ModulesDidLoad(ModuleList &module_list)
Definition: Target.cpp:1613
lldb_private::DynamicLoader::LoadModuleAtAddress
virtual lldb::ModuleSP LoadModuleAtAddress(const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset)
Locates or creates a module given by file and updates/loads the resulting module at the virtual base ...
Definition: DynamicLoader.cpp:150
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:412
lldb_private::Address::GetLoadAddress
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:310
lldb_private::DynamicLoader::GetStopWhenImagesChange
bool GetStopWhenImagesChange() const
Get whether the process should stop when images change.
Definition: DynamicLoader.cpp:66
PluginManager.h
lldb_private::Target::RemoveBreakpointByID
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:934
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
HexagonDYLDRendezvous::ThreadInfo::modid_offset
uint32_t modid_offset
Definition: HexagonDYLDRendezvous.h:54
DynamicLoaderHexagonDYLD::Initialize
static void Initialize()
Definition: DynamicLoaderHexagonDYLD.cpp:74
DynamicLoaderHexagonDYLD::m_rendezvous
HexagonDYLDRendezvous m_rendezvous
Runtime linker rendezvous structure.
Definition: DynamicLoaderHexagonDYLD.h:54
HexagonDYLDRendezvous::unloaded_begin
iterator unloaded_begin() const
Iterators over all modules unloaded from the inferior since the last call to Resolve().
Definition: HexagonDYLDRendezvous.h:178
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::Symbol::IsTrampoline
bool IsTrampoline() const
Definition: Symbol.cpp:173
lldb_private::Process::ReadUnsignedIntegerFromMemory
uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, Status &error)
Reads an unsigned integer of the specified byte size from process memory.
Definition: Process.cpp:2100
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
lldb_private::Log
Definition: Log.h:49
DynamicLoaderHexagonDYLD::GetSectionListFromModule
const lldb_private::SectionList * GetSectionListFromModule(const lldb::ModuleSP module) const
Definition: DynamicLoaderHexagonDYLD.cpp:541
HexagonDYLDRendezvous::unloaded_end
iterator unloaded_end() const
Definition: HexagonDYLDRendezvous.h:179
lldb_private::Target::GetBreakpointByID
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:303
lldb_private::Thread::GetStackFrameAtIndex
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
Definition: Thread.h:397
lldb_private::Target::ModulesDidUnload
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
Definition: Target.cpp:1645
lldb_private::GetLogIfAnyCategoriesSet
Log * GetLogIfAnyCategoriesSet(uint32_t mask)
Definition: Logging.cpp:62
HexagonDYLDRendezvous::SetRendezvousAddress
void SetRendezvousAddress(lldb::addr_t)
Provide the dyld structure address.
Definition: HexagonDYLDRendezvous.cpp:103
lldb_private::Process::SetCanJIT
void SetCanJIT(bool can_jit)
Sets whether executing JIT-compiled code in this process is possible.
Definition: Process.cpp:2359
DynamicLoaderHexagonDYLD::m_dyld_bid
lldb::break_id_t m_dyld_bid
Rendezvous breakpoint.
Definition: DynamicLoaderHexagonDYLD.h:63
lldb_private::StackFrame
Definition: StackFrame.h:40
DynamicLoaderHexagonDYLD::GetTargetExecutable
lldb::ModuleSP GetTargetExecutable()
Checks to see if the target module has changed, updates the target accordingly and returns the target...
Definition: DynamicLoaderHexagonDYLD.cpp:171
lldb
Definition: SBAddress.h:15
lldb_private::StackFrame::GetSymbolContext
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
Definition: StackFrame.cpp:298
lldb_private::ObjectFile
Definition: ObjectFile.h:58
lldb_private::ModuleList::Append
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
DynamicLoaderHexagonDYLD::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: DynamicLoaderHexagonDYLD.cpp:215
lldb_private::Breakpoint
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition: Breakpoint.h:79
lldb_private::Symbol::GetAddress
Address GetAddress() const
Definition: Symbol.h:73