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