LLDB  mainline
SymbolFileDWARFDebugMap.cpp
Go to the documentation of this file.
1 //===-- SymbolFileDWARFDebugMap.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 "DWARFCompileUnit.h"
11 #include "DWARFDebugAranges.h"
12 #include "DWARFDebugInfo.h"
13 
14 #include "lldb/Core/Module.h"
15 #include "lldb/Core/ModuleList.h"
17 #include "lldb/Core/Section.h"
18 #include "lldb/Host/FileSystem.h"
19 #include "lldb/Utility/RangeMap.h"
21 #include "lldb/Utility/Timer.h"
23 
24 //#define DEBUG_OSO_DMAP // DO NOT CHECKIN WITH THIS NOT COMMENTED OUT
25 #if defined(DEBUG_OSO_DMAP)
26 #include "lldb/Core/StreamFile.h"
27 #endif
28 
30 #include "lldb/Symbol/LineTable.h"
31 #include "lldb/Symbol/ObjectFile.h"
33 #include "lldb/Symbol/TypeMap.h"
35 #include "llvm/Support/ScopedPrinter.h"
36 
37 #include "lldb/Target/StackFrame.h"
38 
39 #include "LogChannelDWARF.h"
40 #include "SymbolFileDWARF.h"
41 
42 #include <memory>
43 
44 using namespace lldb;
45 using namespace lldb_private;
46 
48 
49 // Subclass lldb_private::Module so we can intercept the
50 // "Module::GetObjectFile()" (so we can fixup the object file sections) and
51 // also for "Module::GetSymbolFile()" (so we can fixup the symbol file id.
52 
55  SymbolFileDWARFDebugMap *exe_symfile) {
56  if (file_range_map_valid)
57  return file_range_map;
58 
59  file_range_map_valid = true;
60 
61  Module *oso_module = exe_symfile->GetModuleByCompUnitInfo(this);
62  if (!oso_module)
63  return file_range_map;
64 
65  ObjectFile *oso_objfile = oso_module->GetObjectFile();
66  if (!oso_objfile)
67  return file_range_map;
68 
69  Log *log = GetLog(DWARFLog::DebugMap);
70  LLDB_LOGF(
71  log,
72  "%p: SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap ('%s')",
73  static_cast<void *>(this),
74  oso_module->GetSpecificationDescription().c_str());
75 
76  std::vector<SymbolFileDWARFDebugMap::CompileUnitInfo *> cu_infos;
77  if (exe_symfile->GetCompUnitInfosForModule(oso_module, cu_infos)) {
78  for (auto comp_unit_info : cu_infos) {
79  Symtab *exe_symtab = exe_symfile->GetObjectFile()->GetSymtab();
80  ModuleSP oso_module_sp(oso_objfile->GetModule());
81  Symtab *oso_symtab = oso_objfile->GetSymtab();
82 
83  /// const uint32_t fun_resolve_flags = SymbolContext::Module |
84  /// eSymbolContextCompUnit | eSymbolContextFunction;
85  // SectionList *oso_sections = oso_objfile->Sections();
86  // Now we need to make sections that map from zero based object file
87  // addresses to where things ended up in the main executable.
88 
89  assert(comp_unit_info->first_symbol_index != UINT32_MAX);
90  // End index is one past the last valid symbol index
91  const uint32_t oso_end_idx = comp_unit_info->last_symbol_index + 1;
92  for (uint32_t idx = comp_unit_info->first_symbol_index +
93  2; // Skip the N_SO and N_OSO
94  idx < oso_end_idx; ++idx) {
95  Symbol *exe_symbol = exe_symtab->SymbolAtIndex(idx);
96  if (exe_symbol) {
97  if (!exe_symbol->IsDebug())
98  continue;
99 
100  switch (exe_symbol->GetType()) {
101  default:
102  break;
103 
104  case eSymbolTypeCode: {
105  // For each N_FUN, or function that we run into in the debug map we
106  // make a new section that we add to the sections found in the .o
107  // file. This new section has the file address set to what the
108  // addresses are in the .o file, and the load address is adjusted
109  // to match where it ended up in the final executable! We do this
110  // before we parse any dwarf info so that when it goes get parsed
111  // all section/offset addresses that get registered will resolve
112  // correctly to the new addresses in the main executable.
113 
114  // First we find the original symbol in the .o file's symbol table
115  Symbol *oso_fun_symbol = oso_symtab->FindFirstSymbolWithNameAndType(
116  exe_symbol->GetMangled().GetName(Mangled::ePreferMangled),
117  eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny);
118  if (oso_fun_symbol) {
119  // Add the inverse OSO file address to debug map entry mapping
120  exe_symfile->AddOSOFileRange(
121  this, exe_symbol->GetAddressRef().GetFileAddress(),
122  exe_symbol->GetByteSize(),
123  oso_fun_symbol->GetAddressRef().GetFileAddress(),
124  oso_fun_symbol->GetByteSize());
125  }
126  } break;
127 
128  case eSymbolTypeData: {
129  // For each N_GSYM we remap the address for the global by making a
130  // new section that we add to the sections found in the .o file.
131  // This new section has the file address set to what the addresses
132  // are in the .o file, and the load address is adjusted to match
133  // where it ended up in the final executable! We do this before we
134  // parse any dwarf info so that when it goes get parsed all
135  // section/offset addresses that get registered will resolve
136  // correctly to the new addresses in the main executable. We
137  // initially set the section size to be 1 byte, but will need to
138  // fix up these addresses further after all globals have been
139  // parsed to span the gaps, or we can find the global variable
140  // sizes from the DWARF info as we are parsing.
141 
142  // Next we find the non-stab entry that corresponds to the N_GSYM
143  // in the .o file
144  Symbol *oso_gsym_symbol =
145  oso_symtab->FindFirstSymbolWithNameAndType(
146  exe_symbol->GetMangled().GetName(Mangled::ePreferMangled),
147  eSymbolTypeData, Symtab::eDebugNo, Symtab::eVisibilityAny);
148  if (exe_symbol && oso_gsym_symbol && exe_symbol->ValueIsAddress() &&
149  oso_gsym_symbol->ValueIsAddress()) {
150  // Add the inverse OSO file address to debug map entry mapping
151  exe_symfile->AddOSOFileRange(
152  this, exe_symbol->GetAddressRef().GetFileAddress(),
153  exe_symbol->GetByteSize(),
154  oso_gsym_symbol->GetAddressRef().GetFileAddress(),
155  oso_gsym_symbol->GetByteSize());
156  }
157  } break;
158  }
159  }
160  }
161 
162  exe_symfile->FinalizeOSOFileRanges(this);
163  // We don't need the symbols anymore for the .o files
164  oso_objfile->ClearSymtab();
165  }
166  }
167  return file_range_map;
168 }
169 
170 class DebugMapModule : public Module {
171 public:
172  DebugMapModule(const ModuleSP &exe_module_sp, uint32_t cu_idx,
173  const FileSpec &file_spec, const ArchSpec &arch,
174  const ConstString *object_name, off_t object_offset,
175  const llvm::sys::TimePoint<> object_mod_time)
176  : Module(file_spec, arch, object_name, object_offset, object_mod_time),
177  m_exe_module_wp(exe_module_sp), m_cu_idx(cu_idx) {}
178 
179  ~DebugMapModule() override = default;
180 
181  SymbolFile *
182  GetSymbolFile(bool can_create = true,
183  lldb_private::Stream *feedback_strm = nullptr) override {
184  // Scope for locker
185  if (m_symfile_up.get() || !can_create)
186  return m_symfile_up ? m_symfile_up->GetSymbolFile() : nullptr;
187 
188  ModuleSP exe_module_sp(m_exe_module_wp.lock());
189  if (exe_module_sp) {
190  // Now get the object file outside of a locking scope
191  ObjectFile *oso_objfile = GetObjectFile();
192  if (oso_objfile) {
193  std::lock_guard<std::recursive_mutex> guard(m_mutex);
194  if (SymbolFile *symfile =
195  Module::GetSymbolFile(can_create, feedback_strm)) {
196  // Set a pointer to this class to set our OSO DWARF file know that
197  // the DWARF is being used along with a debug map and that it will
198  // have the remapped sections that we do below.
199  SymbolFileDWARF *oso_symfile =
201 
202  if (!oso_symfile)
203  return nullptr;
204 
205  ObjectFile *exe_objfile = exe_module_sp->GetObjectFile();
206  SymbolFile *exe_symfile = exe_module_sp->GetSymbolFile();
207 
208  if (exe_objfile && exe_symfile) {
209  oso_symfile->SetDebugMapModule(exe_module_sp);
210  // Set the ID of the symbol file DWARF to the index of the OSO
211  // shifted left by 32 bits to provide a unique prefix for any
212  // UserID's that get created in the symbol file.
213  oso_symfile->SetID(((uint64_t)m_cu_idx + 1ull) << 32ull);
214  }
215  return symfile;
216  }
217  }
218  }
219  return nullptr;
220  }
221 
222 protected:
223  ModuleWP m_exe_module_wp;
225 };
226 
228  PluginManager::RegisterPlugin(GetPluginNameStatic(),
229  GetPluginDescriptionStatic(), CreateInstance);
230 }
231 
233  PluginManager::UnregisterPlugin(CreateInstance);
234 }
235 
237  return "DWARF and DWARF3 debug symbol file reader (debug map).";
238 }
239 
241  return new SymbolFileDWARFDebugMap(std::move(objfile_sp));
242 }
243 
245  : SymbolFileCommon(std::move(objfile_sp)), m_flags(), m_compile_unit_infos(),
246  m_func_indexes(), m_glob_indexes(),
247  m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate) {}
248 
250 
252 
254  if (m_flags.test(kHaveInitializedOSOs))
255  return;
256 
258 
259  // If the object file has been stripped, there is no sense in looking further
260  // as all of the debug symbols for the debug map will not be available
261  if (m_objfile_sp->IsStripped())
262  return;
263 
264  // Also make sure the file type is some sort of executable. Core files, debug
265  // info files (dSYM), object files (.o files), and stub libraries all can
266  switch (m_objfile_sp->GetType()) {
267  case ObjectFile::eTypeInvalid:
268  case ObjectFile::eTypeCoreFile:
269  case ObjectFile::eTypeDebugInfo:
270  case ObjectFile::eTypeObjectFile:
271  case ObjectFile::eTypeStubLibrary:
272  case ObjectFile::eTypeUnknown:
273  case ObjectFile::eTypeJIT:
274  return;
275 
276  case ObjectFile::eTypeExecutable:
277  case ObjectFile::eTypeDynamicLinker:
278  case ObjectFile::eTypeSharedLibrary:
279  break;
280  }
281 
282  // In order to get the abilities of this plug-in, we look at the list of
283  // N_OSO entries (object files) from the symbol table and make sure that
284  // these files exist and also contain valid DWARF. If we get any of that then
285  // we return the abilities of the first N_OSO's DWARF.
286 
287  Symtab *symtab = m_objfile_sp->GetSymtab();
288  if (symtab) {
289  Log *log = GetLog(DWARFLog::DebugMap);
290 
291  std::vector<uint32_t> oso_indexes;
292  // When a mach-o symbol is encoded, the n_type field is encoded in bits
293  // 23:16, and the n_desc field is encoded in bits 15:0.
294  //
295  // To find all N_OSO entries that are part of the DWARF + debug map we find
296  // only object file symbols with the flags value as follows: bits 23:16 ==
297  // 0x66 (N_OSO) bits 15: 0 == 0x0001 (specifies this is a debug map object
298  // file)
299  const uint32_t k_oso_symbol_flags_value = 0x660001u;
300 
301  const uint32_t oso_index_count =
303  eSymbolTypeObjectFile, k_oso_symbol_flags_value, oso_indexes);
304 
305  if (oso_index_count > 0) {
306  symtab->AppendSymbolIndexesWithType(eSymbolTypeCode, Symtab::eDebugYes,
307  Symtab::eVisibilityAny,
309  symtab->AppendSymbolIndexesWithType(eSymbolTypeData, Symtab::eDebugYes,
310  Symtab::eVisibilityAny,
312 
315 
316  for (uint32_t sym_idx : m_func_indexes) {
317  const Symbol *symbol = symtab->SymbolAtIndex(sym_idx);
318  lldb::addr_t file_addr = symbol->GetAddressRef().GetFileAddress();
319  lldb::addr_t byte_size = symbol->GetByteSize();
320  DebugMap::Entry debug_map_entry(
321  file_addr, byte_size, OSOEntry(sym_idx, LLDB_INVALID_ADDRESS));
322  m_debug_map.Append(debug_map_entry);
323  }
324  for (uint32_t sym_idx : m_glob_indexes) {
325  const Symbol *symbol = symtab->SymbolAtIndex(sym_idx);
326  lldb::addr_t file_addr = symbol->GetAddressRef().GetFileAddress();
327  lldb::addr_t byte_size = symbol->GetByteSize();
328  DebugMap::Entry debug_map_entry(
329  file_addr, byte_size, OSOEntry(sym_idx, LLDB_INVALID_ADDRESS));
330  m_debug_map.Append(debug_map_entry);
331  }
332  m_debug_map.Sort();
333 
334  m_compile_unit_infos.resize(oso_index_count);
335 
336  for (uint32_t i = 0; i < oso_index_count; ++i) {
337  const uint32_t so_idx = oso_indexes[i] - 1;
338  const uint32_t oso_idx = oso_indexes[i];
339  const Symbol *so_symbol = symtab->SymbolAtIndex(so_idx);
340  const Symbol *oso_symbol = symtab->SymbolAtIndex(oso_idx);
341  if (so_symbol && oso_symbol &&
342  so_symbol->GetType() == eSymbolTypeSourceFile &&
343  oso_symbol->GetType() == eSymbolTypeObjectFile) {
344  m_compile_unit_infos[i].so_file.SetFile(
345  so_symbol->GetName().AsCString(), FileSpec::Style::native);
346  m_compile_unit_infos[i].oso_path = oso_symbol->GetName();
347  m_compile_unit_infos[i].oso_mod_time =
348  llvm::sys::toTimePoint(oso_symbol->GetIntegerValue(0));
349  uint32_t sibling_idx = so_symbol->GetSiblingIndex();
350  // The sibling index can't be less that or equal to the current index
351  // "i"
352  if (sibling_idx == UINT32_MAX) {
353  m_objfile_sp->GetModule()->ReportError(
354  "N_SO in symbol with UID %u has invalid sibling in debug map, "
355  "please file a bug and attach the binary listed in this error",
356  so_symbol->GetID());
357  } else {
358  const Symbol *last_symbol = symtab->SymbolAtIndex(sibling_idx - 1);
359  m_compile_unit_infos[i].first_symbol_index = so_idx;
360  m_compile_unit_infos[i].last_symbol_index = sibling_idx - 1;
361  m_compile_unit_infos[i].first_symbol_id = so_symbol->GetID();
362  m_compile_unit_infos[i].last_symbol_id = last_symbol->GetID();
363 
364  LLDB_LOGF(log, "Initialized OSO 0x%8.8x: file=%s", i,
365  oso_symbol->GetName().GetCString());
366  }
367  } else {
368  if (oso_symbol == nullptr)
369  m_objfile_sp->GetModule()->ReportError(
370  "N_OSO symbol[%u] can't be found, please file a bug and attach "
371  "the binary listed in this error",
372  oso_idx);
373  else if (so_symbol == nullptr)
374  m_objfile_sp->GetModule()->ReportError(
375  "N_SO not found for N_OSO symbol[%u], please file a bug and "
376  "attach the binary listed in this error",
377  oso_idx);
378  else if (so_symbol->GetType() != eSymbolTypeSourceFile)
379  m_objfile_sp->GetModule()->ReportError(
380  "N_SO has incorrect symbol type (%u) for N_OSO symbol[%u], "
381  "please file a bug and attach the binary listed in this error",
382  so_symbol->GetType(), oso_idx);
383  else if (oso_symbol->GetType() != eSymbolTypeSourceFile)
384  m_objfile_sp->GetModule()->ReportError(
385  "N_OSO has incorrect symbol type (%u) for N_OSO symbol[%u], "
386  "please file a bug and attach the binary listed in this error",
387  oso_symbol->GetType(), oso_idx);
388  }
389  }
390  }
391  }
392 }
393 
395  const uint32_t cu_count = GetNumCompileUnits();
396  if (oso_idx < cu_count)
398  return nullptr;
399 }
400 
402  CompileUnitInfo *comp_unit_info) {
403  if (!comp_unit_info->oso_sp) {
404  auto pos = m_oso_map.find(
405  {comp_unit_info->oso_path, comp_unit_info->oso_mod_time});
406  if (pos != m_oso_map.end()) {
407  comp_unit_info->oso_sp = pos->second;
408  } else {
409  ObjectFile *obj_file = GetObjectFile();
410  comp_unit_info->oso_sp = std::make_shared<OSOInfo>();
411  m_oso_map[{comp_unit_info->oso_path, comp_unit_info->oso_mod_time}] =
412  comp_unit_info->oso_sp;
413  const char *oso_path = comp_unit_info->oso_path.GetCString();
414  FileSpec oso_file(oso_path);
415  ConstString oso_object;
416  if (FileSystem::Instance().Exists(oso_file)) {
417  // The modification time returned by the FS can have a higher precision
418  // than the one from the CU.
419  auto oso_mod_time = std::chrono::time_point_cast<std::chrono::seconds>(
420  FileSystem::Instance().GetModificationTime(oso_file));
421  // A timestamp of 0 means that the linker was in deterministic mode. In
422  // that case, we should skip the check against the filesystem last
423  // modification timestamp, since it will never match.
424  if (comp_unit_info->oso_mod_time != llvm::sys::TimePoint<>() &&
425  oso_mod_time != comp_unit_info->oso_mod_time) {
427  "debug map object file \"%s\" changed (actual: 0x%8.8x, debug "
428  "map: 0x%8.8x) since this executable was linked, debug info "
429  "will not be loaded", oso_file.GetPath().c_str(),
430  (uint32_t)llvm::sys::toTimeT(oso_mod_time),
431  (uint32_t)llvm::sys::toTimeT(comp_unit_info->oso_mod_time));
432  obj_file->GetModule()->ReportError("%s",
433  comp_unit_info->oso_load_error.AsCString());
434  return nullptr;
435  }
436 
437  } else {
438  const bool must_exist = true;
439 
440  if (!ObjectFile::SplitArchivePathWithObject(oso_path, oso_file,
441  oso_object, must_exist)) {
443  "debug map object file \"%s\" containing debug info does not "
444  "exist, debug info will not be loaded",
445  comp_unit_info->oso_path.GetCString());
446  return nullptr;
447  }
448  }
449  // Always create a new module for .o files. Why? Because we use the debug
450  // map, to add new sections to each .o file and even though a .o file
451  // might not have changed, the sections that get added to the .o file can
452  // change.
453  ArchSpec oso_arch;
454  // Only adopt the architecture from the module (not the vendor or OS)
455  // since .o files for "i386-apple-ios" will historically show up as "i386
456  // -apple-macosx" due to the lack of a LC_VERSION_MIN_MACOSX or
457  // LC_VERSION_MIN_IPHONEOS load command...
458  oso_arch.SetTriple(m_objfile_sp->GetModule()
459  ->GetArchitecture()
460  .GetTriple()
461  .getArchName()
462  .str()
463  .c_str());
464  comp_unit_info->oso_sp->module_sp = std::make_shared<DebugMapModule>(
465  obj_file->GetModule(), GetCompUnitInfoIndex(comp_unit_info), oso_file,
466  oso_arch, oso_object ? &oso_object : nullptr, 0,
467  oso_object ? comp_unit_info->oso_mod_time : llvm::sys::TimePoint<>());
468 
469  if (!comp_unit_info->oso_sp->module_sp || !comp_unit_info->oso_sp->module_sp->GetObjectFile()) {
470  if (oso_object && FileSystem::Instance().Exists(oso_file)) {
471  // If we are loading a .o file from a .a file the "oso_object" will
472  // have a valid value name and if the .a file exists, either the .o
473  // file didn't exist in the .a file or the mod time didn't match.
475  "\"%s\" object from the \"%s\" archive: "
476  "either the .o file doesn't exist in the archive or the "
477  "modification time (0x%8.8x) of the .o file doesn't match",
478  oso_object.AsCString(), oso_file.GetPath().c_str(),
479  (uint32_t)llvm::sys::toTimeT(comp_unit_info->oso_mod_time));
480  }
481  }
482  }
483  }
484  if (comp_unit_info->oso_sp)
485  return comp_unit_info->oso_sp->module_sp.get();
486  return nullptr;
487 }
488 
490  FileSpec &file_spec) {
491  if (oso_idx < m_compile_unit_infos.size()) {
492  if (m_compile_unit_infos[oso_idx].so_file) {
493  file_spec = m_compile_unit_infos[oso_idx].so_file;
494  return true;
495  }
496  }
497  return false;
498 }
499 
501  Module *oso_module = GetModuleByOSOIndex(oso_idx);
502  if (oso_module)
503  return oso_module->GetObjectFile();
504  return nullptr;
505 }
506 
509  return GetSymbolFile(*sc.comp_unit);
510 }
511 
514  CompileUnitInfo *comp_unit_info = GetCompUnitInfo(comp_unit);
515  if (comp_unit_info)
516  return GetSymbolFileByCompUnitInfo(comp_unit_info);
517  return nullptr;
518 }
519 
521  CompileUnitInfo *comp_unit_info) {
522  Module *oso_module = GetModuleByCompUnitInfo(comp_unit_info);
523  if (oso_module)
524  return oso_module->GetObjectFile();
525  return nullptr;
526 }
527 
529  const CompileUnitInfo *comp_unit_info) {
530  if (!m_compile_unit_infos.empty()) {
531  const CompileUnitInfo *first_comp_unit_info = &m_compile_unit_infos.front();
532  const CompileUnitInfo *last_comp_unit_info = &m_compile_unit_infos.back();
533  if (first_comp_unit_info <= comp_unit_info &&
534  comp_unit_info <= last_comp_unit_info)
535  return comp_unit_info - first_comp_unit_info;
536  }
537  return UINT32_MAX;
538 }
539 
542  unsigned size = m_compile_unit_infos.size();
543  if (oso_idx < size)
545  return nullptr;
546 }
547 
550  if (sym_file &&
552  return static_cast<SymbolFileDWARF *>(sym_file);
553  return nullptr;
554 }
555 
557  CompileUnitInfo *comp_unit_info) {
558  if (Module *oso_module = GetModuleByCompUnitInfo(comp_unit_info))
559  return GetSymbolFileAsSymbolFileDWARF(oso_module->GetSymbolFile());
560  return nullptr;
561 }
562 
564  // In order to get the abilities of this plug-in, we look at the list of
565  // N_OSO entries (object files) from the symbol table and make sure that
566  // these files exist and also contain valid DWARF. If we get any of that then
567  // we return the abilities of the first N_OSO's DWARF.
568 
569  const uint32_t oso_index_count = GetNumCompileUnits();
570  if (oso_index_count > 0) {
571  InitOSO();
572  if (!m_compile_unit_infos.empty()) {
573  return SymbolFile::CompileUnits | SymbolFile::Functions |
574  SymbolFile::Blocks | SymbolFile::GlobalVariables |
575  SymbolFile::LocalVariables | SymbolFile::VariableTypes |
576  SymbolFile::LineTables;
577  }
578  }
579  return 0;
580 }
581 
583  InitOSO();
584  return m_compile_unit_infos.size();
585 }
586 
588  CompUnitSP comp_unit_sp;
589  const uint32_t cu_count = GetNumCompileUnits();
590 
591  if (cu_idx < cu_count) {
592  auto &cu_info = m_compile_unit_infos[cu_idx];
593  Module *oso_module = GetModuleByCompUnitInfo(&cu_info);
594  if (oso_module) {
595  FileSpec so_file_spec;
596  if (GetFileSpecForSO(cu_idx, so_file_spec)) {
597  // User zero as the ID to match the compile unit at offset zero in each
598  // .o file.
599  lldb::user_id_t cu_id = 0;
600  cu_info.compile_units_sps.push_back(
601  std::make_shared<CompileUnit>(
602  m_objfile_sp->GetModule(), nullptr, so_file_spec, cu_id,
604  cu_info.id_to_index_map.insert({0, 0});
605  SetCompileUnitAtIndex(cu_idx, cu_info.compile_units_sps[0]);
606  // If there's a symbol file also register all the extra compile units.
607  if (SymbolFileDWARF *oso_symfile =
608  GetSymbolFileByCompUnitInfo(&cu_info)) {
609  auto num_dwarf_units = oso_symfile->DebugInfo().GetNumUnits();
610  for (size_t i = 0; i < num_dwarf_units; ++i) {
611  auto *dwarf_unit = oso_symfile->DebugInfo().GetUnitAtIndex(i);
612  if (auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(dwarf_unit)) {
613  // The "main" one was already registered.
614  if (dwarf_cu->GetID() == 0)
615  continue;
616  cu_info.compile_units_sps.push_back(std::make_shared<CompileUnit>(
617  m_objfile_sp->GetModule(), nullptr, so_file_spec,
618  dwarf_cu->GetID(), eLanguageTypeUnknown, eLazyBoolCalculate));
619  cu_info.id_to_index_map.insert(
620  {dwarf_cu->GetID(), cu_info.compile_units_sps.size() - 1});
621  }
622  }
623  }
624  }
625  }
626  if (!cu_info.compile_units_sps.empty())
627  comp_unit_sp = cu_info.compile_units_sps[0];
628  }
629 
630  return comp_unit_sp;
631 }
632 
635  return GetCompUnitInfo(*sc.comp_unit);
636 }
637 
640  const uint32_t cu_count = GetNumCompileUnits();
641  for (uint32_t i = 0; i < cu_count; ++i) {
642  auto &id_to_index_map = m_compile_unit_infos[i].id_to_index_map;
643 
644  auto it = id_to_index_map.find(comp_unit.GetID());
645  if (it != id_to_index_map.end() &&
646  &comp_unit ==
647  m_compile_unit_infos[i].compile_units_sps[it->getSecond()].get())
648  return &m_compile_unit_infos[i];
649  }
650  return nullptr;
651 }
652 
654  const lldb_private::Module *module,
655  std::vector<CompileUnitInfo *> &cu_infos) {
656  const uint32_t cu_count = GetNumCompileUnits();
657  for (uint32_t i = 0; i < cu_count; ++i) {
659  cu_infos.push_back(&m_compile_unit_infos[i]);
660  }
661  return cu_infos.size();
662 }
663 
666  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
667  SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
668  if (oso_dwarf)
669  return oso_dwarf->ParseLanguage(comp_unit);
670  return eLanguageTypeUnknown;
671 }
672 
674  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
675  SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
676  if (oso_dwarf)
677  return oso_dwarf->ParseXcodeSDK(comp_unit);
678  return {};
679 }
680 
682  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
683  SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
684  if (oso_dwarf)
685  return oso_dwarf->ParseFunctions(comp_unit);
686  return 0;
687 }
688 
690  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
691  SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
692  if (oso_dwarf)
693  return oso_dwarf->ParseLineTable(comp_unit);
694  return false;
695 }
696 
698  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
699  SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
700  if (oso_dwarf)
701  return oso_dwarf->ParseDebugMacros(comp_unit);
702  return false;
703 }
704 
706  CompileUnit &comp_unit,
707  llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files,
708  llvm::function_ref<bool(Module &)> f) {
709  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
710  SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
711  if (oso_dwarf)
712  return oso_dwarf->ForEachExternalModule(comp_unit, visited_symbol_files, f);
713  return false;
714 }
715 
717  FileSpecList &support_files) {
718  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
719  SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
720  if (oso_dwarf)
721  return oso_dwarf->ParseSupportFiles(comp_unit, support_files);
722  return false;
723 }
724 
726  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
727  SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
728  if (oso_dwarf)
729  return oso_dwarf->ParseIsOptimized(comp_unit);
730  return false;
731 }
732 
734  const SymbolContext &sc, std::vector<SourceModule> &imported_modules) {
735  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
736  SymbolFileDWARF *oso_dwarf = GetSymbolFile(sc);
737  if (oso_dwarf)
738  return oso_dwarf->ParseImportedModules(sc, imported_modules);
739  return false;
740 }
741 
743  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
744  CompileUnit *comp_unit = func.GetCompileUnit();
745  if (!comp_unit)
746  return 0;
747 
748  SymbolFileDWARF *oso_dwarf = GetSymbolFile(*comp_unit);
749  if (oso_dwarf)
750  return oso_dwarf->ParseBlocksRecursive(func);
751  return 0;
752 }
753 
755  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
756  SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
757  if (oso_dwarf)
758  return oso_dwarf->ParseTypes(comp_unit);
759  return 0;
760 }
761 
762 size_t
764  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
765  SymbolFileDWARF *oso_dwarf = GetSymbolFile(sc);
766  if (oso_dwarf)
767  return oso_dwarf->ParseVariablesForContext(sc);
768  return 0;
769 }
770 
772  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
773  const uint64_t oso_idx = GetOSOIndexFromUserID(type_uid);
774  SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx);
775  if (oso_dwarf)
776  return oso_dwarf->ResolveTypeUID(type_uid);
777  return nullptr;
778 }
779 
780 llvm::Optional<SymbolFile::ArrayInfo>
782  lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
783  const uint64_t oso_idx = GetOSOIndexFromUserID(type_uid);
784  SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx);
785  if (oso_dwarf)
786  return oso_dwarf->GetDynamicArrayInfoForUID(type_uid, exe_ctx);
787  return llvm::None;
788 }
789 
791  bool success = false;
792  if (compiler_type) {
793  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
794  if (oso_dwarf->HasForwardDeclForClangType(compiler_type)) {
795  oso_dwarf->CompleteType(compiler_type);
796  success = true;
797  return true;
798  }
799  return false;
800  });
801  }
802  return success;
803 }
804 
805 uint32_t
807  SymbolContextItem resolve_scope,
808  SymbolContext &sc) {
809  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
810  uint32_t resolved_flags = 0;
811  Symtab *symtab = m_objfile_sp->GetSymtab();
812  if (symtab) {
813  const addr_t exe_file_addr = exe_so_addr.GetFileAddress();
814 
815  const DebugMap::Entry *debug_map_entry =
816  m_debug_map.FindEntryThatContains(exe_file_addr);
817  if (debug_map_entry) {
818 
819  sc.symbol =
820  symtab->SymbolAtIndex(debug_map_entry->data.GetExeSymbolIndex());
821 
822  if (sc.symbol != nullptr) {
823  resolved_flags |= eSymbolContextSymbol;
824 
825  uint32_t oso_idx = 0;
826  CompileUnitInfo *comp_unit_info =
828  if (comp_unit_info) {
829  comp_unit_info->GetFileRangeMap(this);
830  Module *oso_module = GetModuleByCompUnitInfo(comp_unit_info);
831  if (oso_module) {
832  lldb::addr_t oso_file_addr =
833  exe_file_addr - debug_map_entry->GetRangeBase() +
834  debug_map_entry->data.GetOSOFileAddress();
835  Address oso_so_addr;
836  if (oso_module->ResolveFileAddress(oso_file_addr, oso_so_addr)) {
837  resolved_flags |=
838  oso_module->GetSymbolFile()->ResolveSymbolContext(
839  oso_so_addr, resolve_scope, sc);
840  }
841  }
842  }
843  }
844  }
845  }
846  return resolved_flags;
847 }
848 
850  const SourceLocationSpec &src_location_spec,
851  SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
852  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
853  const uint32_t initial = sc_list.GetSize();
854  const uint32_t cu_count = GetNumCompileUnits();
855 
856  for (uint32_t i = 0; i < cu_count; ++i) {
857  // If we are checking for inlines, then we need to look through all compile
858  // units no matter if "file_spec" matches.
859  bool resolve = src_location_spec.GetCheckInlines();
860 
861  if (!resolve) {
862  FileSpec so_file_spec;
863  if (GetFileSpecForSO(i, so_file_spec))
864  resolve =
865  FileSpec::Match(src_location_spec.GetFileSpec(), so_file_spec);
866  }
867  if (resolve) {
869  if (oso_dwarf)
870  oso_dwarf->ResolveSymbolContext(src_location_spec, resolve_scope,
871  sc_list);
872  }
873  }
874  return sc_list.GetSize() - initial;
875 }
876 
878  ConstString name, const CompilerDeclContext &parent_decl_ctx,
879  const std::vector<uint32_t>
880  &indexes, // Indexes into the symbol table that match "name"
881  uint32_t max_matches, VariableList &variables) {
882  const size_t match_count = indexes.size();
883  for (size_t i = 0; i < match_count; ++i) {
884  uint32_t oso_idx;
885  CompileUnitInfo *comp_unit_info =
886  GetCompileUnitInfoForSymbolWithIndex(indexes[i], &oso_idx);
887  if (comp_unit_info) {
888  SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx);
889  if (oso_dwarf) {
890  oso_dwarf->FindGlobalVariables(name, parent_decl_ctx, max_matches,
891  variables);
892  if (variables.GetSize() > max_matches)
893  break;
894  }
895  }
896  }
897 }
898 
900  ConstString name, const CompilerDeclContext &parent_decl_ctx,
901  uint32_t max_matches, VariableList &variables) {
902  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
903  uint32_t total_matches = 0;
904 
905  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
906  const uint32_t old_size = variables.GetSize();
907  oso_dwarf->FindGlobalVariables(name, parent_decl_ctx, max_matches,
908  variables);
909  const uint32_t oso_matches = variables.GetSize() - old_size;
910  if (oso_matches > 0) {
911  total_matches += oso_matches;
912 
913  // Are we getting all matches?
914  if (max_matches == UINT32_MAX)
915  return false; // Yep, continue getting everything
916 
917  // If we have found enough matches, lets get out
918  if (max_matches >= total_matches)
919  return true;
920 
921  // Update the max matches for any subsequent calls to find globals in any
922  // other object files with DWARF
923  max_matches -= oso_matches;
924  }
925 
926  return false;
927  });
928 }
929 
931  const RegularExpression &regex, uint32_t max_matches,
932  VariableList &variables) {
933  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
934  uint32_t total_matches = 0;
935  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
936  const uint32_t old_size = variables.GetSize();
937  oso_dwarf->FindGlobalVariables(regex, max_matches, variables);
938 
939  const uint32_t oso_matches = variables.GetSize() - old_size;
940  if (oso_matches > 0) {
941  total_matches += oso_matches;
942 
943  // Are we getting all matches?
944  if (max_matches == UINT32_MAX)
945  return false; // Yep, continue getting everything
946 
947  // If we have found enough matches, lets get out
948  if (max_matches >= total_matches)
949  return true;
950 
951  // Update the max matches for any subsequent calls to find globals in any
952  // other object files with DWARF
953  max_matches -= oso_matches;
954  }
955 
956  return false;
957  });
958 }
959 
961  uint32_t *symbol_idx_ptr, const CompileUnitInfo *comp_unit_info) {
962  const uint32_t symbol_idx = *symbol_idx_ptr;
963 
964  if (symbol_idx < comp_unit_info->first_symbol_index)
965  return -1;
966 
967  if (symbol_idx <= comp_unit_info->last_symbol_index)
968  return 0;
969 
970  return 1;
971 }
972 
974  user_id_t *symbol_idx_ptr, const CompileUnitInfo *comp_unit_info) {
975  const user_id_t symbol_id = *symbol_idx_ptr;
976 
977  if (symbol_id < comp_unit_info->first_symbol_id)
978  return -1;
979 
980  if (symbol_id <= comp_unit_info->last_symbol_id)
981  return 0;
982 
983  return 1;
984 }
985 
988  uint32_t symbol_idx, uint32_t *oso_idx_ptr) {
989  const uint32_t oso_index_count = m_compile_unit_infos.size();
990  CompileUnitInfo *comp_unit_info = nullptr;
991  if (oso_index_count) {
992  comp_unit_info = (CompileUnitInfo *)bsearch(
993  &symbol_idx, &m_compile_unit_infos[0], m_compile_unit_infos.size(),
994  sizeof(CompileUnitInfo),
995  (ComparisonFunction)SymbolContainsSymbolWithIndex);
996  }
997 
998  if (oso_idx_ptr) {
999  if (comp_unit_info != nullptr)
1000  *oso_idx_ptr = comp_unit_info - &m_compile_unit_infos[0];
1001  else
1002  *oso_idx_ptr = UINT32_MAX;
1003  }
1004  return comp_unit_info;
1005 }
1006 
1009  user_id_t symbol_id, uint32_t *oso_idx_ptr) {
1010  const uint32_t oso_index_count = m_compile_unit_infos.size();
1011  CompileUnitInfo *comp_unit_info = nullptr;
1012  if (oso_index_count) {
1013  comp_unit_info = (CompileUnitInfo *)::bsearch(
1014  &symbol_id, &m_compile_unit_infos[0], m_compile_unit_infos.size(),
1015  sizeof(CompileUnitInfo),
1016  (ComparisonFunction)SymbolContainsSymbolWithID);
1017  }
1018 
1019  if (oso_idx_ptr) {
1020  if (comp_unit_info != nullptr)
1021  *oso_idx_ptr = comp_unit_info - &m_compile_unit_infos[0];
1022  else
1023  *oso_idx_ptr = UINT32_MAX;
1024  }
1025  return comp_unit_info;
1026 }
1027 
1028 static void RemoveFunctionsWithModuleNotEqualTo(const ModuleSP &module_sp,
1029  SymbolContextList &sc_list,
1030  uint32_t start_idx) {
1031  // We found functions in .o files. Not all functions in the .o files will
1032  // have made it into the final output file. The ones that did make it into
1033  // the final output file will have a section whose module matches the module
1034  // from the ObjectFile for this SymbolFile. When the modules don't match,
1035  // then we have something that was in a .o file, but doesn't map to anything
1036  // in the final executable.
1037  uint32_t i = start_idx;
1038  while (i < sc_list.GetSize()) {
1039  SymbolContext sc;
1040  sc_list.GetContextAtIndex(i, sc);
1041  if (sc.function) {
1042  const SectionSP section_sp(
1044  if (section_sp->GetModule() != module_sp) {
1045  sc_list.RemoveContextAtIndex(i);
1046  continue;
1047  }
1048  }
1049  ++i;
1050  }
1051 }
1052 
1054  const Module::LookupInfo &lookup_info,
1055  const CompilerDeclContext &parent_decl_ctx, bool include_inlines,
1056  SymbolContextList &sc_list) {
1057  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
1058  LLDB_SCOPED_TIMERF("SymbolFileDWARFDebugMap::FindFunctions (name = %s)",
1059  lookup_info.GetLookupName().GetCString());
1060 
1061  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1062  uint32_t sc_idx = sc_list.GetSize();
1063  oso_dwarf->FindFunctions(lookup_info, parent_decl_ctx, include_inlines,
1064  sc_list);
1065  if (!sc_list.IsEmpty()) {
1066  RemoveFunctionsWithModuleNotEqualTo(m_objfile_sp->GetModule(), sc_list,
1067  sc_idx);
1068  }
1069  return false;
1070  });
1071 }
1072 
1074  bool include_inlines,
1075  SymbolContextList &sc_list) {
1076  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
1077  LLDB_SCOPED_TIMERF("SymbolFileDWARFDebugMap::FindFunctions (regex = '%s')",
1078  regex.GetText().str().c_str());
1079 
1080  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1081  uint32_t sc_idx = sc_list.GetSize();
1082 
1083  oso_dwarf->FindFunctions(regex, include_inlines, sc_list);
1084  if (!sc_list.IsEmpty()) {
1085  RemoveFunctionsWithModuleNotEqualTo(m_objfile_sp->GetModule(), sc_list,
1086  sc_idx);
1087  }
1088  return false;
1089  });
1090 }
1091 
1093  lldb::TypeClass type_mask,
1094  TypeList &type_list) {
1095  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
1096  LLDB_SCOPED_TIMERF("SymbolFileDWARFDebugMap::GetTypes (type_mask = 0x%8.8x)",
1097  type_mask);
1098 
1099  SymbolFileDWARF *oso_dwarf = nullptr;
1100  if (sc_scope) {
1101  SymbolContext sc;
1102  sc_scope->CalculateSymbolContext(&sc);
1103 
1104  CompileUnitInfo *cu_info = GetCompUnitInfo(sc);
1105  if (cu_info) {
1106  oso_dwarf = GetSymbolFileByCompUnitInfo(cu_info);
1107  if (oso_dwarf)
1108  oso_dwarf->GetTypes(sc_scope, type_mask, type_list);
1109  }
1110  } else {
1111  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1112  oso_dwarf->GetTypes(sc_scope, type_mask, type_list);
1113  return false;
1114  });
1115  }
1116 }
1117 
1118 std::vector<std::unique_ptr<lldb_private::CallEdge>>
1120  uint32_t oso_idx = GetOSOIndexFromUserID(func_id.GetID());
1121  SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx);
1122  if (oso_dwarf)
1123  return oso_dwarf->ParseCallEdgesInFunction(func_id);
1124  return {};
1125 }
1126 
1128  const DWARFDIE &die) {
1129  TypeSP type_sp;
1130  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1131  type_sp = oso_dwarf->FindDefinitionTypeForDWARFDeclContext(die);
1132  return ((bool)type_sp);
1133  });
1134  return type_sp;
1135 }
1136 
1138  SymbolFileDWARF *skip_dwarf_oso) {
1141  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1142  if (skip_dwarf_oso != oso_dwarf &&
1143  oso_dwarf->Supports_DW_AT_APPLE_objc_complete_type(nullptr)) {
1144  m_supports_DW_AT_APPLE_objc_complete_type = eLazyBoolYes;
1145  return true;
1146  }
1147  return false;
1148  });
1149  }
1151 }
1152 
1154  const DWARFDIE &die, ConstString type_name,
1155  bool must_be_implementation) {
1156  // If we have a debug map, we will have an Objective-C symbol whose name is
1157  // the type name and whose type is eSymbolTypeObjCClass. If we can find that
1158  // symbol and find its containing parent, we can locate the .o file that will
1159  // contain the implementation definition since it will be scoped inside the
1160  // N_SO and we can then locate the SymbolFileDWARF that corresponds to that
1161  // N_SO.
1162  SymbolFileDWARF *oso_dwarf = nullptr;
1163  TypeSP type_sp;
1164  ObjectFile *module_objfile = m_objfile_sp->GetModule()->GetObjectFile();
1165  if (module_objfile) {
1166  Symtab *symtab = module_objfile->GetSymtab();
1167  if (symtab) {
1168  Symbol *objc_class_symbol = symtab->FindFirstSymbolWithNameAndType(
1169  type_name, eSymbolTypeObjCClass, Symtab::eDebugAny,
1170  Symtab::eVisibilityAny);
1171  if (objc_class_symbol) {
1172  // Get the N_SO symbol that contains the objective C class symbol as
1173  // this should be the .o file that contains the real definition...
1174  const Symbol *source_file_symbol = symtab->GetParent(objc_class_symbol);
1175 
1176  if (source_file_symbol &&
1177  source_file_symbol->GetType() == eSymbolTypeSourceFile) {
1178  const uint32_t source_file_symbol_idx =
1179  symtab->GetIndexForSymbol(source_file_symbol);
1180  if (source_file_symbol_idx != UINT32_MAX) {
1181  CompileUnitInfo *compile_unit_info =
1182  GetCompileUnitInfoForSymbolWithIndex(source_file_symbol_idx,
1183  nullptr);
1184  if (compile_unit_info) {
1185  oso_dwarf = GetSymbolFileByCompUnitInfo(compile_unit_info);
1186  if (oso_dwarf) {
1187  TypeSP type_sp(oso_dwarf->FindCompleteObjCDefinitionTypeForDIE(
1188  die, type_name, must_be_implementation));
1189  if (type_sp) {
1190  return type_sp;
1191  }
1192  }
1193  }
1194  }
1195  }
1196  }
1197  }
1198  }
1199 
1200  // Only search all .o files for the definition if we don't need the
1201  // implementation because otherwise, with a valid debug map we should have
1202  // the ObjC class symbol and the code above should have found it.
1203  if (!must_be_implementation) {
1204  TypeSP type_sp;
1205 
1206  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1207  type_sp = oso_dwarf->FindCompleteObjCDefinitionTypeForDIE(
1208  die, type_name, must_be_implementation);
1209  return (bool)type_sp;
1210  });
1211 
1212  return type_sp;
1213  }
1214  return TypeSP();
1215 }
1216 
1218  ConstString name, const CompilerDeclContext &parent_decl_ctx,
1219  uint32_t max_matches,
1220  llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
1221  TypeMap &types) {
1222  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
1223  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1224  oso_dwarf->FindTypes(name, parent_decl_ctx, max_matches,
1225  searched_symbol_files, types);
1226  return types.GetSize() >= max_matches;
1227  });
1228 }
1229 
1231  llvm::ArrayRef<CompilerContext> context, LanguageSet languages,
1232  llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
1233  TypeMap &types) {
1235  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1236  oso_dwarf->FindTypes(context, languages, searched_symbol_files, types);
1237  return false;
1238  });
1239 }
1240 
1243  const CompilerDeclContext &parent_decl_ctx) {
1244  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
1245  CompilerDeclContext matching_namespace;
1246 
1247  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1248  matching_namespace = oso_dwarf->FindNamespace(name, parent_decl_ctx);
1249 
1250  return (bool)matching_namespace;
1251  });
1252 
1253  return matching_namespace;
1254 }
1255 
1257  ForEachSymbolFile([&s](SymbolFileDWARF *oso_dwarf) -> bool {
1258  oso_dwarf->DumpClangAST(s);
1259  // The underlying assumption is that DumpClangAST(...) will obtain the
1260  // AST from the underlying TypeSystem and therefore we only need to do
1261  // this once and can stop after the first iteration hence we return true.
1262  return true;
1263  });
1264 }
1265 
1266 lldb::CompUnitSP
1268  if (oso_dwarf) {
1269  const uint32_t cu_count = GetNumCompileUnits();
1270  for (uint32_t cu_idx = 0; cu_idx < cu_count; ++cu_idx) {
1271  SymbolFileDWARF *oso_symfile =
1273  if (oso_symfile == oso_dwarf) {
1274  if (m_compile_unit_infos[cu_idx].compile_units_sps.empty())
1275  ParseCompileUnitAtIndex(cu_idx);
1276 
1277  auto &id_to_index_map = m_compile_unit_infos[cu_idx].id_to_index_map;
1278  auto it = id_to_index_map.find(dwarf_cu.GetID());
1279  if (it != id_to_index_map.end())
1280  return m_compile_unit_infos[cu_idx]
1281  .compile_units_sps[it->getSecond()];
1282  }
1283  }
1284  }
1285  llvm_unreachable("this shouldn't happen");
1286 }
1287 
1290  if (oso_dwarf) {
1291  const uint32_t cu_count = GetNumCompileUnits();
1292  for (uint32_t cu_idx = 0; cu_idx < cu_count; ++cu_idx) {
1293  SymbolFileDWARF *oso_symfile =
1295  if (oso_symfile == oso_dwarf) {
1296  return &m_compile_unit_infos[cu_idx];
1297  }
1298  }
1299  }
1300  return nullptr;
1301 }
1302 
1304  const CompUnitSP &cu_sp) {
1305  if (oso_dwarf) {
1306  const uint32_t cu_count = GetNumCompileUnits();
1307  for (uint32_t cu_idx = 0; cu_idx < cu_count; ++cu_idx) {
1308  SymbolFileDWARF *oso_symfile =
1310  if (oso_symfile == oso_dwarf) {
1311  if (!m_compile_unit_infos[cu_idx].compile_units_sps.empty()) {
1312  assert(m_compile_unit_infos[cu_idx].compile_units_sps[0].get() ==
1313  cu_sp.get());
1314  } else {
1315  assert(cu_sp->GetID() == 0 &&
1316  "Setting first compile unit but with id different than 0!");
1317  auto &compile_units_sps = m_compile_unit_infos[cu_idx].compile_units_sps;
1318  compile_units_sps.push_back(cu_sp);
1319  m_compile_unit_infos[cu_idx].id_to_index_map.insert(
1320  {cu_sp->GetID(), compile_units_sps.size() - 1});
1321 
1322  SetCompileUnitAtIndex(cu_idx, cu_sp);
1323  }
1324  }
1325  }
1326  }
1327 }
1328 
1331  const uint64_t oso_idx = GetOSOIndexFromUserID(type_uid);
1332  SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx);
1333  if (oso_dwarf)
1334  return oso_dwarf->GetDeclContextForUID(type_uid);
1335  return CompilerDeclContext();
1336 }
1337 
1340  const uint64_t oso_idx = GetOSOIndexFromUserID(type_uid);
1341  SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx);
1342  if (oso_dwarf)
1343  return oso_dwarf->GetDeclContextContainingUID(type_uid);
1344  return CompilerDeclContext();
1345 }
1346 
1349  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1350  oso_dwarf->ParseDeclsForContext(decl_ctx);
1351  return true; // Keep iterating
1352  });
1353 }
1354 
1356  lldb::addr_t exe_file_addr,
1357  lldb::addr_t exe_byte_size,
1358  lldb::addr_t oso_file_addr,
1359  lldb::addr_t oso_byte_size) {
1360  const uint32_t debug_map_idx =
1361  m_debug_map.FindEntryIndexThatContains(exe_file_addr);
1362  if (debug_map_idx != UINT32_MAX) {
1363  DebugMap::Entry *debug_map_entry =
1364  m_debug_map.FindEntryThatContains(exe_file_addr);
1365  debug_map_entry->data.SetOSOFileAddress(oso_file_addr);
1366  addr_t range_size = std::min<addr_t>(exe_byte_size, oso_byte_size);
1367  if (range_size == 0) {
1368  range_size = std::max<addr_t>(exe_byte_size, oso_byte_size);
1369  if (range_size == 0)
1370  range_size = 1;
1371  }
1372  cu_info->file_range_map.Append(
1373  FileRangeMap::Entry(oso_file_addr, range_size, exe_file_addr));
1374  return true;
1375  }
1376  return false;
1377 }
1378 
1380  cu_info->file_range_map.Sort();
1381 #if defined(DEBUG_OSO_DMAP)
1382  const FileRangeMap &oso_file_range_map = cu_info->GetFileRangeMap(this);
1383  const size_t n = oso_file_range_map.GetSize();
1384  printf("SymbolFileDWARFDebugMap::FinalizeOSOFileRanges (cu_info = %p) %s\n",
1385  cu_info, cu_info->oso_sp->module_sp->GetFileSpec().GetPath().c_str());
1386  for (size_t i = 0; i < n; ++i) {
1387  const FileRangeMap::Entry &entry = oso_file_range_map.GetEntryRef(i);
1388  printf("oso [0x%16.16" PRIx64 " - 0x%16.16" PRIx64
1389  ") ==> exe [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n",
1390  entry.GetRangeBase(), entry.GetRangeEnd(), entry.data,
1391  entry.data + entry.GetByteSize());
1392  }
1393 #endif
1394 }
1395 
1398  lldb::addr_t oso_file_addr) {
1399  CompileUnitInfo *cu_info = GetCompileUnitInfo(oso_symfile);
1400  if (cu_info) {
1401  const FileRangeMap::Entry *oso_range_entry =
1402  cu_info->GetFileRangeMap(this).FindEntryThatContains(oso_file_addr);
1403  if (oso_range_entry) {
1404  const DebugMap::Entry *debug_map_entry =
1405  m_debug_map.FindEntryThatContains(oso_range_entry->data);
1406  if (debug_map_entry) {
1407  const lldb::addr_t offset =
1408  oso_file_addr - oso_range_entry->GetRangeBase();
1409  const lldb::addr_t exe_file_addr =
1410  debug_map_entry->GetRangeBase() + offset;
1411  return exe_file_addr;
1412  }
1413  }
1414  }
1415  return LLDB_INVALID_ADDRESS;
1416 }
1417 
1419  // Make sure this address hasn't been fixed already
1420  Module *exe_module = GetObjectFile()->GetModule().get();
1421  Module *addr_module = addr.GetModule().get();
1422  if (addr_module == exe_module)
1423  return true; // Address is already in terms of the main executable module
1424 
1427  if (cu_info) {
1428  const lldb::addr_t oso_file_addr = addr.GetFileAddress();
1429  const FileRangeMap::Entry *oso_range_entry =
1430  cu_info->GetFileRangeMap(this).FindEntryThatContains(oso_file_addr);
1431  if (oso_range_entry) {
1432  const DebugMap::Entry *debug_map_entry =
1433  m_debug_map.FindEntryThatContains(oso_range_entry->data);
1434  if (debug_map_entry) {
1435  const lldb::addr_t offset =
1436  oso_file_addr - oso_range_entry->GetRangeBase();
1437  const lldb::addr_t exe_file_addr =
1438  debug_map_entry->GetRangeBase() + offset;
1439  return exe_module->ResolveFileAddress(exe_file_addr, addr);
1440  }
1441  }
1442  }
1443  return true;
1444 }
1445 
1447  LineTable *line_table) {
1448  CompileUnitInfo *cu_info = GetCompileUnitInfo(oso_dwarf);
1449  if (cu_info)
1450  return line_table->LinkLineTable(cu_info->GetFileRangeMap(this));
1451  return nullptr;
1452 }
1453 
1454 size_t
1456  DWARFDebugAranges *debug_aranges) {
1457  size_t num_line_entries_added = 0;
1458  if (debug_aranges && dwarf2Data) {
1459  CompileUnitInfo *compile_unit_info = GetCompileUnitInfo(dwarf2Data);
1460  if (compile_unit_info) {
1461  const FileRangeMap &file_range_map =
1462  compile_unit_info->GetFileRangeMap(this);
1463  for (size_t idx = 0; idx < file_range_map.GetSize(); idx++) {
1464  const FileRangeMap::Entry *entry = file_range_map.GetEntryAtIndex(idx);
1465  if (entry) {
1466  debug_aranges->AppendRange(dwarf2Data->GetID(), entry->GetRangeBase(),
1467  entry->GetRangeEnd());
1468  num_line_entries_added++;
1469  }
1470  }
1471  }
1472  }
1473  return num_line_entries_added;
1474 }
1475 
1477  ModuleList oso_modules;
1478  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
1479  ObjectFile *oso_objfile = oso_dwarf->GetObjectFile();
1480  if (oso_objfile) {
1481  ModuleSP module_sp = oso_objfile->GetModule();
1482  if (module_sp)
1483  oso_modules.Append(module_sp);
1484  }
1485  return false; // Keep iterating
1486  });
1487  return oso_modules;
1488 }
1489 
1491  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
1492 
1493  // We need to make sure that our PC value from the frame matches the module
1494  // for this object file since we will lookup the PC file address in the debug
1495  // map below.
1496  Address pc_addr = frame.GetFrameCodeAddress();
1497  if (pc_addr.GetModule() == m_objfile_sp->GetModule()) {
1498  Symtab *symtab = m_objfile_sp->GetSymtab();
1499  if (symtab) {
1500  const DebugMap::Entry *debug_map_entry =
1502  if (debug_map_entry) {
1503  Symbol *symbol =
1504  symtab->SymbolAtIndex(debug_map_entry->data.GetExeSymbolIndex());
1505  if (symbol) {
1506  uint32_t oso_idx = 0;
1507  CompileUnitInfo *comp_unit_info =
1508  GetCompileUnitInfoForSymbolWithID(symbol->GetID(), &oso_idx);
1509  if (comp_unit_info) {
1510  Module *oso_module = GetModuleByCompUnitInfo(comp_unit_info);
1511  if (oso_module) {
1512  // Check the .o file's DWARF in case it has an error to display.
1513  SymbolFile *oso_sym_file = oso_module->GetSymbolFile();
1514  if (oso_sym_file)
1515  return oso_sym_file->GetFrameVariableError(frame);
1516  }
1517  // If we don't have a valid OSO module here, then something went
1518  // wrong as we have a symbol for the address in the debug map, but
1519  // we weren't able to open the .o file. Display an appropriate
1520  // error
1521  if (comp_unit_info->oso_load_error.Fail())
1522  return comp_unit_info->oso_load_error;
1523  else
1524  return Status("unable to load debug map object file \"%s\" "
1525  "exist, debug info will not be loaded",
1526  comp_unit_info->oso_path.GetCString());
1527  }
1528  }
1529  }
1530  }
1531  }
1532  return Status();
1533 }
SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override
This function actually returns the first compile unit the object file at the given index contains.
Definition: SymbolFileDWARFDebugMap.cpp:587
lldb_private::SourceLocationSpec::GetFileSpec
FileSpec GetFileSpec() const
Definition: SourceLocationSpec.h:166
RegularExpression.h
SymbolFileDWARFDebugMap::GetObjectFileByOSOIndex
lldb_private::ObjectFile * GetObjectFileByOSOIndex(uint32_t oso_idx)
Definition: SymbolFileDWARFDebugMap.cpp:500
SymbolFileDWARFDebugMap::GetSymbolFile
SymbolFileDWARF * GetSymbolFile(const lldb_private::SymbolContext &sc)
Definition: SymbolFileDWARFDebugMap.cpp:508
lldb_private::AddressRange::GetBaseAddress
Address & GetBaseAddress()
Get accessor for the base address of the range.
Definition: AddressRange.h:209
SymbolFileDWARFDebugMap::CompileUnitInfo::file_range_map
FileRangeMap file_range_map
Definition: SymbolFileDWARFDebugMap.h:186
SymbolFileDWARFDebugMap::m_glob_indexes
std::vector< uint32_t > m_glob_indexes
Definition: SymbolFileDWARFDebugMap.h:329
SymbolFileDWARFDebugMap.h
lldb_private::Module::GetObjectFile
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
Definition: Module.cpp:1268
lldb_private::SymbolFile
Provides public interface for all SymbolFiles.
Definition: SymbolFile.h:46
SymbolFileDWARFDebugMap::GetObjectFileByCompUnitInfo
lldb_private::ObjectFile * GetObjectFileByCompUnitInfo(CompileUnitInfo *comp_unit_info)
Definition: SymbolFileDWARFDebugMap.cpp:520
lldb_private::Range::GetRangeBase
BaseType GetRangeBase() const
Definition: RangeMap.h:46
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
SymbolFileDWARFDebugMap::GetCompUnitInfo
CompileUnitInfo * GetCompUnitInfo(const lldb_private::SymbolContext &sc)
Definition: SymbolFileDWARFDebugMap.cpp:634
lldb_private::SymbolContext::comp_unit
CompileUnit * comp_unit
The CompileUnit for a given query.
Definition: SymbolContext.h:319
SymbolFileDWARFDebugMap::ParseXcodeSDK
lldb_private::XcodeSDK ParseXcodeSDK(lldb_private::CompileUnit &comp_unit) override
Return the Xcode SDK comp_unit was compiled against.
Definition: SymbolFileDWARFDebugMap.cpp:673
SymbolFileDWARFDebugMap::SetCompileUnit
void SetCompileUnit(SymbolFileDWARF *oso_dwarf, const lldb::CompUnitSP &cu_sp)
Definition: SymbolFileDWARFDebugMap.cpp:1303
LLDB_SCOPED_TIMERF
#define LLDB_SCOPED_TIMERF(...)
Definition: Timer.h:86
DWARFCompileUnit.h
lldb_private::ArchSpec
Definition: ArchSpec.h:32
SymbolFileDWARFDebugMap::m_flags
std::bitset< kNumFlags > m_flags
Definition: SymbolFileDWARFDebugMap.h:326
lldb_private::RegularExpression
Definition: RegularExpression.h:18
FileSystem.h
SymbolFileDWARFDebugMap::FindNamespace
lldb_private::CompilerDeclContext FindNamespace(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx) override
Definition: SymbolFileDWARFDebugMap.cpp:1241
lldb::eSymbolTypeCode
@ eSymbolTypeCode
Definition: lldb-enumerations.h:623
lldb_private::Symtab::AppendSymbolIndexesWithTypeAndFlagsValue
uint32_t AppendSymbolIndexesWithTypeAndFlagsValue(lldb::SymbolType symbol_type, uint32_t flags_value, std::vector< uint32_t > &indexes, uint32_t start_idx=0, uint32_t end_index=UINT32_MAX) const
Definition: Symtab.cpp:505
lldb_private::RangeDataVector::GetEntryRef
Entry & GetEntryRef(size_t i)
Definition: RangeMap.h:538
CompileUnit.h
SymbolFileDWARF::ParseLineTable
bool ParseLineTable(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARF.cpp:1142
lldb_private::Function::GetAddressRange
const AddressRange & GetAddressRange()
Definition: Function.h:457
SymbolFileDWARF::ResolveTypeUID
lldb_private::Type * ResolveTypeUID(lldb::user_id_t type_uid) override
Definition: SymbolFileDWARF.cpp:1492
TypeMap.h
SymbolFileDWARF::ParseFunctions
size_t ParseFunctions(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARF.cpp:946
lldb_private::Symbol
Definition: Symbol.h:20
lldb_private::Symbol::ValueIsAddress
bool ValueIsAddress() const
Definition: Symbol.cpp:117
SymbolFileDWARFDebugMap::GetSymbolFileAsSymbolFileDWARF
static SymbolFileDWARF * GetSymbolFileAsSymbolFileDWARF(SymbolFile *sym_file)
Definition: SymbolFileDWARFDebugMap.cpp:549
DWARFDebugAranges
Definition: DWARFDebugAranges.h:16
lldb_private::SourceLocationSpec
Definition: SourceLocationSpec.h:27
lldb_private::Symtab::GetParent
const Symbol * GetParent(Symbol *symbol) const
Get the parent symbol for the given symbol.
Definition: Symtab.cpp:1152
SymbolFileDWARFDebugMap::FindDefinitionTypeForDWARFDeclContext
lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(const DWARFDIE &die)
Definition: SymbolFileDWARFDebugMap.cpp:1127
SymbolFileDWARF::GetPluginNameStatic
static llvm::StringRef GetPluginNameStatic()
Definition: SymbolFileDWARF.h:88
SymbolFileDWARFDebugMap::GetTypes
void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) override
Definition: SymbolFileDWARFDebugMap.cpp:1092
SymbolFileDWARFDebugMap::CompleteType
bool CompleteType(lldb_private::CompilerType &compiler_type) override
Definition: SymbolFileDWARFDebugMap.cpp:790
SymbolFileDWARF::ParseLanguage
lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARF.cpp:909
lldb_private::StackFrame::GetFrameCodeAddress
const Address & GetFrameCodeAddress()
Get an Address for the current pc value in this StackFrame.
Definition: StackFrame.cpp:190
lldb_private::UserID
Definition: UserID.h:31
SymbolFileDWARFDebugMap::SymbolContainsSymbolWithID
static int SymbolContainsSymbolWithID(lldb::user_id_t *symbol_idx_ptr, const CompileUnitInfo *comp_unit_info)
Definition: SymbolFileDWARFDebugMap.cpp:973
SymbolFileDWARFDebugMap::ParseBlocksRecursive
size_t ParseBlocksRecursive(lldb_private::Function &func) override
Definition: SymbolFileDWARFDebugMap.cpp:742
SymbolFileDWARF::FindFunctions
void FindFunctions(const lldb_private::Module::LookupInfo &lookup_info, const lldb_private::CompilerDeclContext &parent_decl_ctx, bool include_inlines, lldb_private::SymbolContextList &sc_list) override
Definition: SymbolFileDWARF.cpp:2356
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:344
lldb_private::SymbolFile::GetModuleMutex
virtual std::recursive_mutex & GetModuleMutex() const
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
Definition: SymbolFile.cpp:35
Module.h
SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE
lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, lldb_private::ConstString type_name, bool must_be_implementation)
Definition: SymbolFileDWARFDebugMap.cpp:1153
SymbolFileDWARFDebugMap::GetOSOIndexFromUserID
static uint32_t GetOSOIndexFromUserID(lldb::user_id_t uid)
Definition: SymbolFileDWARFDebugMap.h:210
lldb_private::XcodeSDK
An abstraction for Xcode-style SDKs that works like ArchSpec.
Definition: XcodeSDK.h:24
SymbolFileDWARF::ParseImportedModules
bool ParseImportedModules(const lldb_private::SymbolContext &sc, std::vector< lldb_private::SourceModule > &imported_modules) override
Definition: SymbolFileDWARF.cpp:1087
SymbolFileDWARF
Definition: SymbolFileDWARF.h:60
lldb_private::RangeDataVector::Sort
void Sort()
Definition: RangeMap.h:460
lldb_private::VariableList::GetSize
size_t GetSize() const
Definition: VariableList.cpp:165
SymbolFileDWARFDebugMap::ParseLineTable
bool ParseLineTable(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARFDebugMap.cpp:689
SymbolFileDWARF.h
lldb::eSymbolTypeData
@ eSymbolTypeData
Definition: lldb-enumerations.h:625
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
SymbolFileDWARFDebugMap::InitializeObject
void InitializeObject() override
Initialize the SymbolFile object.
Definition: SymbolFileDWARFDebugMap.cpp:251
lldb_private::Module::GetSymbolFile
virtual SymbolFile * GetSymbolFile(bool can_create=true, Stream *feedback_strm=nullptr)
Get the module's symbol file.
Definition: Module.cpp:1053
lldb_private::SymbolContextList::GetContextAtIndex
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
Definition: SymbolContext.cpp:1258
lldb_private::Module
Definition: Module.h:86
SymbolFileDWARFDebugMap::Supports_DW_AT_APPLE_objc_complete_type
bool Supports_DW_AT_APPLE_objc_complete_type(SymbolFileDWARF *skip_dwarf_oso)
Definition: SymbolFileDWARFDebugMap.cpp:1137
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:192
SymbolFileDWARFDebugMap::m_oso_map
std::map< std::pair< lldb_private::ConstString, llvm::sys::TimePoint<> >, OSOInfoSP > m_oso_map
Definition: SymbolFileDWARFDebugMap.h:332
SymbolFileDWARFDebugMap::GetDynamicArrayInfoForUID
llvm::Optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) override
If type_uid points to an array type, return its characteristics.
Definition: SymbolFileDWARFDebugMap.cpp:781
SymbolFileDWARFDebugMap::CreateInstance
static lldb_private::SymbolFile * CreateInstance(lldb::ObjectFileSP objfile_sp)
Definition: SymbolFileDWARFDebugMap.cpp:240
SymbolFileDWARFDebugMap::CompileUnitInfo
Definition: SymbolFileDWARFDebugMap.h:172
SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext
virtual lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(const DWARFDIE &die)
Definition: SymbolFileDWARF.cpp:2950
StackFrame.h
lldb_private::RangeDataVector::GetEntryAtIndex
const Entry * GetEntryAtIndex(size_t i) const
Definition: RangeMap.h:528
SymbolFileDWARF::SetDebugMapModule
void SetDebugMapModule(const lldb::ModuleSP &module_sp)
Definition: SymbolFileDWARF.h:459
lldb_private::UserID::SetID
void SetID(lldb::user_id_t uid)
Set accessor for the user ID.
Definition: UserID.h:53
lldb_private::Stream
Definition: Stream.h:28
lldb_private::RangeData
Definition: RangeMap.h:415
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
SymbolFileDWARF::FindNamespace
lldb_private::CompilerDeclContext FindNamespace(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx) override
Definition: SymbolFileDWARF.cpp:2634
SymbolFileDWARFDebugMap::ParseCallEdgesInFunction
std::vector< std::unique_ptr< lldb_private::CallEdge > > ParseCallEdgesInFunction(lldb_private::UserID func_id) override
Definition: SymbolFileDWARFDebugMap.cpp:1119
RangeMap.h
SymbolFileDWARF::Supports_DW_AT_APPLE_objc_complete_type
bool Supports_DW_AT_APPLE_objc_complete_type(DWARFUnit *cu)
Definition: SymbolFileDWARF.cpp:2781
SymbolFileDWARFDebugMap::ParseImportedModules
bool ParseImportedModules(const lldb_private::SymbolContext &sc, std::vector< lldb_private::SourceModule > &imported_modules) override
Definition: SymbolFileDWARFDebugMap.cpp:733
lldb_private::SymbolFileCommon
Containing protected virtual methods for child classes to override.
Definition: SymbolFile.h:424
SymbolFileDWARFDebugMap::ForEachExternalModule
bool ForEachExternalModule(lldb_private::CompileUnit &, llvm::DenseSet< lldb_private::SymbolFile * > &, llvm::function_ref< bool(lldb_private::Module &)>) override
Definition: SymbolFileDWARFDebugMap.cpp:705
lldb_private::SymbolContext
Definition: SymbolContext.h:33
Section.h
lldb_private::TypeMap::GetSize
uint32_t GetSize() const
Definition: TypeMap.cpp:75
SymbolFileDWARFDebugMap::FindFunctions
void FindFunctions(const lldb_private::Module::LookupInfo &lookup_info, const lldb_private::CompilerDeclContext &parent_decl_ctx, bool include_inlines, lldb_private::SymbolContextList &sc_list) override
Definition: SymbolFileDWARFDebugMap.cpp:1053
SymbolFileDWARFDebugMap::AddOSOARanges
size_t AddOSOARanges(SymbolFileDWARF *dwarf2Data, DWARFDebugAranges *debug_aranges)
Definition: SymbolFileDWARFDebugMap.cpp:1455
lldb_private::PluginInterface::GetPluginName
virtual llvm::StringRef GetPluginName()=0
SymbolFileDWARF::GetDynamicArrayInfoForUID
llvm::Optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) override
If type_uid points to an array type, return its characteristics.
Definition: SymbolFileDWARF.cpp:1504
SymbolFileDWARFDebugMap::GetCompileUnitInfoForSymbolWithIndex
CompileUnitInfo * GetCompileUnitInfoForSymbolWithIndex(uint32_t symbol_idx, uint32_t *oso_idx_ptr)
Definition: SymbolFileDWARFDebugMap.cpp:987
lldb_private::VariableList
Definition: VariableList.h:18
DebugMapModule::m_cu_idx
const uint32_t m_cu_idx
Definition: SymbolFileDWARFDebugMap.cpp:224
SymbolFileDWARF::FindGlobalVariables
void FindGlobalVariables(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, lldb_private::VariableList &variables) override
Definition: SymbolFileDWARF.cpp:2171
RemoveFunctionsWithModuleNotEqualTo
static void RemoveFunctionsWithModuleNotEqualTo(const ModuleSP &module_sp, SymbolContextList &sc_list, uint32_t start_idx)
Definition: SymbolFileDWARFDebugMap.cpp:1028
lldb_private::RangeDataVector< lldb::addr_t, lldb::addr_t, OSOEntry >::Entry
RangeData< lldb::addr_t, lldb::addr_t, OSOEntry > Entry
Definition: RangeMap.h:443
SymbolFileDWARFDebugMap::GetDeclContextForUID
lldb_private::CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
Definition: SymbolFileDWARFDebugMap.cpp:1330
lldb_private::CompileUnit
Definition: CompileUnit.h:38
DWARFDIE
Definition: DWARFDIE.h:16
SymbolFileDWARFDebugMap::ParseDeclsForContext
void ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override
Definition: SymbolFileDWARFDebugMap.cpp:1347
SymbolFileDWARFDebugMap::ParseIsOptimized
bool ParseIsOptimized(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARFDebugMap.cpp:725
SymbolFileDWARFDebugMap::GetCompUnitInfoIndex
uint32_t GetCompUnitInfoIndex(const CompileUnitInfo *comp_unit_info)
Definition: SymbolFileDWARFDebugMap.cpp:528
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::Symtab::FindFirstSymbolWithNameAndType
Symbol * FindFirstSymbolWithNameAndType(ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
Definition: Symtab.cpp:861
lldb_private::Module::LookupInfo
Definition: Module.h:936
lldb_private::RangeDataVector::FindEntryThatContains
Entry * FindEntryThatContains(B addr)
Definition: RangeMap.h:563
lldb_private::FileSpec
Definition: FileSpec.h:55
SymbolFileDWARFDebugMap::CompileUnitInfo::oso_sp
OSOInfoSP oso_sp
Definition: SymbolFileDWARFDebugMap.h:177
DWARFCompileUnit
Definition: DWARFCompileUnit.h:15
SymbolFileDWARF::ResolveSymbolContext
uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr, lldb::SymbolContextItem resolve_scope, lldb_private::SymbolContext &sc) override
lldb_private::SymbolContext::symbol
Symbol * symbol
The Symbol for a given query.
Definition: SymbolContext.h:323
SymbolFileDWARFDebugMap::Terminate
static void Terminate()
Definition: SymbolFileDWARFDebugMap.cpp:232
lldb_private::SymbolFileCommon::m_objfile_sp
lldb::ObjectFileSP m_objfile_sp
Definition: SymbolFile.h:500
lldb_private::LineTable
Definition: LineTable.h:40
SymbolFileDWARFDebugMap::FindGlobalVariables
void FindGlobalVariables(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, lldb_private::VariableList &variables) override
Definition: SymbolFileDWARFDebugMap.cpp:899
lldb_private::Function
Definition: Function.h:409
lldb_private::RangeDataVector::Append
void Append(const Entry &entry)
Definition: RangeMap.h:451
SymbolFileDWARF::ForEachExternalModule
bool ForEachExternalModule(lldb_private::CompileUnit &, llvm::DenseSet< lldb_private::SymbolFile * > &, llvm::function_ref< bool(lldb_private::Module &)>) override
Definition: SymbolFileDWARF.cpp:969
SymbolFileDWARFDebugMap::CalculateFrameVariableError
lldb_private::Status CalculateFrameVariableError(lldb_private::StackFrame &frame) override
Subclasses will override this function to for GetFrameVariableError().
Definition: SymbolFileDWARFDebugMap.cpp:1490
ModuleList.h
lldb_private::Function::GetCompileUnit
CompileUnit * GetCompileUnit()
Get accessor for the compile unit that owns this function.
Definition: Function.cpp:360
lldb::eSymbolTypeSourceFile
@ eSymbolTypeSourceFile
Definition: lldb-enumerations.h:629
lldb_private::ModuleList
Definition: ModuleList.h:82
lldb::eSymbolTypeObjectFile
@ eSymbolTypeObjectFile
Definition: lldb-enumerations.h:631
SymbolFileDWARFDebugMap::ResolveSymbolContext
uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr, lldb::SymbolContextItem resolve_scope, lldb_private::SymbolContext &sc) override
SymbolFileDWARFDebugMap::GetCompileUnitInfo
CompileUnitInfo * GetCompileUnitInfo(SymbolFileDWARF *oso_dwarf)
Definition: SymbolFileDWARFDebugMap.cpp:1289
DebugMapModule::GetSymbolFile
SymbolFile * GetSymbolFile(bool can_create=true, lldb_private::Stream *feedback_strm=nullptr) override
Get the module's symbol file.
Definition: SymbolFileDWARFDebugMap.cpp:182
SymbolFileDWARFDebugMap::CompileUnitInfo::oso_path
lldb_private::ConstString oso_path
Definition: SymbolFileDWARFDebugMap.h:174
SymbolFileDWARFDebugMap::CalculateAbilities
uint32_t CalculateAbilities() override
Definition: SymbolFileDWARFDebugMap.cpp:563
lldb_private::ArchSpec::SetTriple
bool SetTriple(const llvm::Triple &triple)
Architecture triple setter.
Definition: ArchSpec.cpp:750
DebugMapModule
Definition: SymbolFileDWARFDebugMap.cpp:170
lldb_private::Status::Fail
bool Fail() const
Test for error condition.
Definition: Status.cpp:181
SymbolFileDWARFDebugMap::GetPluginDescriptionStatic
static llvm::StringRef GetPluginDescriptionStatic()
Definition: SymbolFileDWARFDebugMap.cpp:236
SymbolFileDWARFDebugMap::m_func_indexes
std::vector< uint32_t > m_func_indexes
Definition: SymbolFileDWARFDebugMap.h:328
lldb_private::Status::SetErrorStringWithFormat
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
Definition: Status.cpp:255
lldb_private::SymbolContextScope::CalculateSymbolContext
virtual void CalculateSymbolContext(SymbolContext *sc)=0
Reconstruct the object's symbol context into sc.
lldb_private::SymbolContext::function
Function * function
The Function for a given query.
Definition: SymbolContext.h:320
StreamString.h
lldb_private::Address::GetFileAddress
lldb::addr_t GetFileAddress() const
Get the file address.
Definition: Address.cpp:291
SymbolFileDWARFDebugMap::GetDeclContextContainingUID
lldb_private::CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
Definition: SymbolFileDWARFDebugMap.cpp:1339
lldb_private::Symbol::GetAddressRef
Address & GetAddressRef()
Definition: Symbol.h:57
SymbolFileDWARFDebugMap::ParseTypes
size_t ParseTypes(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARFDebugMap.cpp:754
lldb_private::Module::ResolveFileAddress
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr)
Definition: Module.cpp:441
lldb_private::SymbolContextList::GetSize
uint32_t GetSize() const
Get accessor for a symbol context list size.
Definition: SymbolContext.cpp:1274
SymbolFileDWARFDebugMap::GetCompileUnit
lldb::CompUnitSP GetCompileUnit(SymbolFileDWARF *oso_dwarf, DWARFCompileUnit &dwarf_cu)
Returns the compile unit associated with the dwarf compile unit.
Definition: SymbolFileDWARFDebugMap.cpp:1267
DWARFDebugAranges::AppendRange
void AppendRange(dw_offset_t cu_offset, dw_addr_t low_pc, dw_addr_t high_pc)
Definition: DWARFDebugAranges.cpp:84
lldb_private::ConstString
Definition: ConstString.h:39
SymbolFileDWARFDebugMap
Definition: SymbolFileDWARFDebugMap.h:26
Timer.h
DWARFDebugAranges.h
SymbolFileDWARFDebugMap::GetFileSpecForSO
bool GetFileSpecForSO(uint32_t oso_idx, lldb_private::FileSpec &file_spec)
Definition: SymbolFileDWARFDebugMap.cpp:489
SymbolFileDWARFDebugMap::GetDebugInfoModules
lldb_private::ModuleList GetDebugInfoModules() override
Get the additional modules that this symbol file uses to parse debug info.
Definition: SymbolFileDWARFDebugMap.cpp:1476
SymbolFileDWARF::ParseTypes
size_t ParseTypes(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARF.cpp:3155
LLDB_SCOPED_TIMER
#define LLDB_SCOPED_TIMER()
Definition: Timer.h:83
SymbolFileDWARFDebugMap::GetSymbolFileByOSOIndex
SymbolFileDWARF * GetSymbolFileByOSOIndex(uint32_t oso_idx)
Definition: SymbolFileDWARFDebugMap.cpp:541
SymbolFileDWARFDebugMap::m_debug_map
DebugMap m_debug_map
Definition: SymbolFileDWARFDebugMap.h:335
LogChannelDWARF.h
lldb::eSymbolTypeObjCClass
@ eSymbolTypeObjCClass
Definition: lldb-enumerations.h:647
SymbolFileDWARFDebugMap::GetCompileUnitInfoForSymbolWithID
CompileUnitInfo * GetCompileUnitInfoForSymbolWithID(lldb::user_id_t symbol_id, uint32_t *oso_idx_ptr)
Definition: SymbolFileDWARFDebugMap.cpp:1008
lldb_private::Symtab::GetIndexForSymbol
uint32_t GetIndexForSymbol(const Symbol *symbol) const
Definition: Symtab.cpp:548
SymbolFileDWARF::GetDeclContextForUID
lldb_private::CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
Definition: SymbolFileDWARF.cpp:1469
lldb_private::SymbolFileCommon::GetNumCompileUnits
uint32_t GetNumCompileUnits() override
Definition: SymbolFile.cpp:193
lldb_private::LineTable::LinkLineTable
LineTable * LinkLineTable(const FileRangeMap &file_range_map)
Definition: LineTable.cpp:406
DWARFDebugInfo.h
SymbolFileDWARFDebugMap::AddOSOFileRange
bool AddOSOFileRange(CompileUnitInfo *cu_info, lldb::addr_t exe_file_addr, lldb::addr_t exe_byte_size, lldb::addr_t oso_file_addr, lldb::addr_t oso_byte_size)
Definition: SymbolFileDWARFDebugMap.cpp:1355
lldb_private::Address::GetSection
lldb::SectionSP GetSection() const
Get const accessor for the section.
Definition: Address.h:429
SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo
lldb_private::Module * GetModuleByCompUnitInfo(CompileUnitInfo *comp_unit_info)
Definition: SymbolFileDWARFDebugMap.cpp:401
SymbolFileDWARFDebugMap::CompileUnitInfo::oso_mod_time
llvm::sys::TimePoint oso_mod_time
Definition: SymbolFileDWARFDebugMap.h:175
SymbolFileDWARFDebugMap::Initialize
static void Initialize()
Definition: SymbolFileDWARFDebugMap.cpp:227
SymbolFileDWARFDebugMap::ParseFunctions
size_t ParseFunctions(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARFDebugMap.cpp:681
lldb_private::Symbol::GetMangled
Mangled & GetMangled()
Definition: Symbol.h:131
SymbolFileDWARF::ParseXcodeSDK
lldb_private::XcodeSDK ParseXcodeSDK(lldb_private::CompileUnit &comp_unit) override
Return the Xcode SDK comp_unit was compiled against.
Definition: SymbolFileDWARF.cpp:918
VariableList.h
lldb_private::TypeMap
Definition: TypeMap.h:20
lldb_private::RangeDataVector::FindEntryIndexThatContains
uint32_t FindEntryIndexThatContains(B addr) const
Definition: RangeMap.h:545
lldb_private::Symbol::GetIntegerValue
uint64_t GetIntegerValue(uint64_t fail_value=0) const
Definition: Symbol.h:102
lldb_private::CompilerDeclContext
Represents a generic declaration context in a program.
Definition: CompilerDeclContext.h:30
lldb_private::SymbolContextScope
Definition: SymbolContextScope.h:64
ObjectFile.h
SymbolFileDWARF::ParseVariablesForContext
size_t ParseVariablesForContext(const lldb_private::SymbolContext &sc) override
Definition: SymbolFileDWARF.cpp:3171
lldb_private::UserID::GetID
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47
SymbolFileDWARFDebugMap::GetCompUnitInfosForModule
size_t GetCompUnitInfosForModule(const lldb_private::Module *oso_module, std::vector< CompileUnitInfo * > &cu_infos)
Definition: SymbolFileDWARFDebugMap.cpp:653
SymbolFileDWARF::ParseIsOptimized
bool ParseIsOptimized(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARF.cpp:1079
SymbolFileDWARFDebugMap::CompileUnitInfo::oso_load_error
lldb_private::Status oso_load_error
Definition: SymbolFileDWARFDebugMap.h:176
lldb_private::SymbolFile::GetFrameVariableError
Status GetFrameVariableError(StackFrame &frame)
Get an error that describes why variables might be missing for a given symbol context.
Definition: SymbolFile.h:254
lldb_private::Symbol::GetName
ConstString GetName() const
Definition: Symbol.cpp:500
StreamFile.h
lldb_private::Symbol::IsDebug
bool IsDebug() const
Definition: Symbol.h:176
lldb_private::Status
Definition: Status.h:44
lldb_private::Module::LookupInfo::GetLookupName
ConstString GetLookupName() const
Definition: Module.h:947
lldb_private::Module::GetSpecificationDescription
std::string GetSpecificationDescription() const
Get the module path and object name.
Definition: Module.cpp:1086
SymbolFileDWARFDebugMap::FinalizeOSOFileRanges
void FinalizeOSOFileRanges(CompileUnitInfo *cu_info)
Definition: SymbolFileDWARFDebugMap.cpp:1379
lldb_private::Symtab::AppendSymbolIndexesWithType
uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type, std::vector< uint32_t > &indexes, uint32_t start_idx=0, uint32_t end_index=UINT32_MAX) const
Definition: Symtab.cpp:487
SymbolFileDWARFDebugMap::SymbolContainsSymbolWithIndex
static int SymbolContainsSymbolWithIndex(uint32_t *symbol_idx_ptr, const CompileUnitInfo *comp_unit_info)
Definition: SymbolFileDWARFDebugMap.cpp:960
SymbolFileDWARF::ParseDebugMacros
bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARF.cpp:1227
SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo
SymbolFileDWARF * GetSymbolFileByCompUnitInfo(CompileUnitInfo *comp_unit_info)
Definition: SymbolFileDWARFDebugMap.cpp:556
lldb_private::Symtab
Definition: Symtab.h:22
uint32_t
SymbolFileDWARFDebugMap::LinkOSOAddress
bool LinkOSOAddress(lldb_private::Address &addr)
Convert addr from a .o file address, to an executable address.
Definition: SymbolFileDWARFDebugMap.cpp:1418
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb_private::RangeDataVector::GetSize
size_t GetSize() const
Definition: RangeMap.h:526
lldb_private::Address
Definition: Address.h:59
SymbolFileDWARFDebugMap::ID
static char ID
LLVM RTTI support.
Definition: SymbolFileDWARFDebugMap.h:28
DebugMapModule::m_exe_module_wp
ModuleWP m_exe_module_wp
Definition: SymbolFileDWARFDebugMap.cpp:223
lldb_private::RangeDataVector< lldb::addr_t, lldb::addr_t, lldb::addr_t >
SymbolFileDWARFDebugMap::DumpClangAST
void DumpClangAST(lldb_private::Stream &s) override
Definition: SymbolFileDWARFDebugMap.cpp:1256
SymbolFileDWARFDebugMap::SymbolFileDWARFDebugMap
SymbolFileDWARFDebugMap(lldb::ObjectFileSP objfile_sp)
Definition: SymbolFileDWARFDebugMap.cpp:244
SymbolFileDWARFDebugMap::m_supports_DW_AT_APPLE_objc_complete_type
lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type
Definition: SymbolFileDWARFDebugMap.h:334
lldb_private::Type
Definition: Type.h:66
LineTable.h
lldb_private::ObjectFile::ClearSymtab
virtual void ClearSymtab()
Frees the symbol table.
Definition: ObjectFile.cpp:574
DebugMapModule::DebugMapModule
DebugMapModule(const ModuleSP &exe_module_sp, uint32_t cu_idx, const FileSpec &file_spec, const ArchSpec &arch, const ConstString *object_name, off_t object_offset, const llvm::sys::TimePoint<> object_mod_time)
Definition: SymbolFileDWARFDebugMap.cpp:172
lldb_private::Symbol::GetByteSize
lldb::addr_t GetByteSize() const
Definition: Symbol.cpp:414
lldb_private::Range::GetByteSize
SizeType GetByteSize() const
Definition: RangeMap.h:87
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::ModuleChild::GetModule
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Definition: ModuleChild.cpp:24
SymbolFileDWARFDebugMap::ResolveTypeUID
lldb_private::Type * ResolveTypeUID(lldb::user_id_t type_uid) override
Definition: SymbolFileDWARFDebugMap.cpp:771
SymbolFileDWARF::ParseDeclsForContext
void ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override
Definition: SymbolFileDWARF.cpp:1392
PluginManager.h
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:215
SymbolFileDWARFDebugMap::ForEachSymbolFile
void ForEachSymbolFile(std::function< bool(SymbolFileDWARF *)> closure)
Definition: SymbolFileDWARFDebugMap.h:245
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:35
SymbolFileDWARFDebugMap::InitOSO
void InitOSO()
Definition: SymbolFileDWARFDebugMap.cpp:253
SymbolFileDWARFDebugMap::ParseSupportFiles
bool ParseSupportFiles(lldb_private::CompileUnit &comp_unit, lldb_private::FileSpecList &support_files) override
Definition: SymbolFileDWARFDebugMap.cpp:716
lldb_private::SymbolContextList::IsEmpty
bool IsEmpty() const
Definition: SymbolContext.cpp:1276
lldb_private::SymbolFileCommon::GetObjectFile
ObjectFile * GetObjectFile() override
Definition: SymbolFile.h:453
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
SymbolFileDWARF::FindTypes
void FindTypes(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, llvm::DenseSet< lldb_private::SymbolFile * > &searched_symbol_files, lldb_private::TypeMap &types) override
SymbolFileDWARFDebugMap::ParseLanguage
lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARFDebugMap.cpp:665
SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE
virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, lldb_private::ConstString type_name, bool must_be_implementation)
Definition: SymbolFileDWARF.cpp:2807
SymbolFileDWARFDebugMap::GetModuleByOSOIndex
lldb_private::Module * GetModuleByOSOIndex(uint32_t oso_idx)
Definition: SymbolFileDWARFDebugMap.cpp:394
SymbolFileDWARF::ParseBlocksRecursive
size_t ParseBlocksRecursive(lldb_private::Function &func) override
Definition: SymbolFileDWARF.cpp:3134
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::SymbolFile::ResolveSymbolContext
virtual uint32_t ResolveSymbolContext(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc)=0
lldb_private::eLazyBoolCalculate
@ eLazyBoolCalculate
Definition: lldb-private-enumerations.h:115
SymbolFileDWARFDebugMap::CalculateNumCompileUnits
uint32_t CalculateNumCompileUnits() override
This function actually returns the number of object files, which may be less than the actual number o...
Definition: SymbolFileDWARFDebugMap.cpp:582
lldb_private::TypeList
Definition: TypeList.h:20
SymbolFileDWARFDebugMap::LinkOSOLineTable
lldb_private::LineTable * LinkOSOLineTable(SymbolFileDWARF *oso_symfile, lldb_private::LineTable *line_table)
Given a line table full of lines with "file addresses" that are for a .o file represented by oso_symf...
Definition: SymbolFileDWARFDebugMap.cpp:1446
lldb_private::Symtab::SortSymbolIndexesByValue
void SortSymbolIndexesByValue(std::vector< uint32_t > &indexes, bool remove_duplicates) const
Definition: Symtab.cpp:613
SymbolFileDWARFDebugMap::LinkOSOFileAddress
lldb::addr_t LinkOSOFileAddress(SymbolFileDWARF *oso_symfile, lldb::addr_t oso_file_addr)
Convert a .o file "file address" to an executable "file address".
Definition: SymbolFileDWARFDebugMap.cpp:1397
SymbolFileDWARFDebugMap::OSOEntry
Definition: SymbolFileDWARFDebugMap.h:298
SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap
const FileRangeMap & GetFileRangeMap(SymbolFileDWARFDebugMap *exe_symfile)
Definition: SymbolFileDWARFDebugMap.cpp:54
lldb_private::LanguageSet
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: TypeSystem.h:44
lldb_private::Address::GetModule
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
Definition: Address.cpp:283
SymbolFileDWARF::GetDeclContextContainingUID
lldb_private::CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
Definition: SymbolFileDWARF.cpp:1482
SymbolFileDWARF::ParseSupportFiles
bool ParseSupportFiles(lldb_private::CompileUnit &comp_unit, lldb_private::FileSpecList &support_files) override
lldb_private::Log
Definition: Log.h:115
lldb_private::SourceLocationSpec::GetCheckInlines
bool GetCheckInlines() const
Definition: SourceLocationSpec.h:172
SymbolFileDWARFDebugMap::ParseDebugMacros
bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override
Definition: SymbolFileDWARFDebugMap.cpp:697
lldb_private::RegularExpression::GetText
llvm::StringRef GetText() const
Access the regular expression text.
Definition: RegularExpression.cpp:33
lldb_private::RangeData::data
DataType data
Definition: RangeMap.h:418
SymbolFileDWARFDebugMap::kHaveInitializedOSOs
@ kHaveInitializedOSOs
Definition: SymbolFileDWARFDebugMap.h:153
SymbolVendor.h
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
lldb_private::FileSpec::GetPath
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:364
lldb::eLanguageTypeUnknown
@ eLanguageTypeUnknown
Unknown or invalid language value.
Definition: lldb-enumerations.h:438
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb_private::Symbol::GetType
lldb::SymbolType GetType() const
Definition: Symbol.h:153
SymbolFileDWARFDebugMap::ParseVariablesForContext
size_t ParseVariablesForContext(const lldb_private::SymbolContext &sc) override
Definition: SymbolFileDWARFDebugMap.cpp:763
lldb
Definition: SBAddress.h:15
SymbolFileDWARFDebugMap::m_compile_unit_infos
std::vector< CompileUnitInfo > m_compile_unit_infos
Definition: SymbolFileDWARFDebugMap.h:327
SymbolFileDWARFDebugMap::FindTypes
void FindTypes(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, llvm::DenseSet< lldb_private::SymbolFile * > &searched_symbol_files, lldb_private::TypeMap &types) override
SymbolFileDWARF::HasForwardDeclForClangType
bool HasForwardDeclForClangType(const lldb_private::CompilerType &compiler_type)
Definition: SymbolFileDWARF.cpp:1559
SymbolFileDWARF::ParseCallEdgesInFunction
std::vector< std::unique_ptr< lldb_private::CallEdge > > ParseCallEdgesInFunction(UserID func_id) override
Definition: SymbolFileDWARF.cpp:4062
SymbolFileDWARF::GetTypes
void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) override
lldb_private::ObjectFile
Definition: ObjectFile.h:60
lldb_private::SymbolFileCommon::SetCompileUnitAtIndex
void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp)
Definition: SymbolFile.cpp:214
lldb_private::ModuleList::Append
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
SymbolFileDWARF::DumpClangAST
void DumpClangAST(lldb_private::Stream &s) override
Definition: SymbolFileDWARF.cpp:4079
SymbolFileDWARFDebugMap::~SymbolFileDWARFDebugMap
~SymbolFileDWARFDebugMap() override
SymbolFileDWARFDebugMap::PrivateFindGlobalVariables
void PrivateFindGlobalVariables(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, const std::vector< uint32_t > &name_symbol_indexes, uint32_t max_matches, lldb_private::VariableList &variables)
Definition: SymbolFileDWARFDebugMap.cpp:877
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:437
lldb_private::Status::AsCString
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:130
lldb_private::SymbolContextList::RemoveContextAtIndex
bool RemoveContextAtIndex(size_t idx)
Definition: SymbolContext.cpp:1266
lldb_private::Symbol::GetSiblingIndex
uint32_t GetSiblingIndex() const
Definition: Symbol.cpp:169
lldb_private::Symbol::GetID
uint32_t GetID() const
Definition: Symbol.h:121
lldb_private::Range::GetRangeEnd
BaseType GetRangeEnd() const
Definition: RangeMap.h:78