11#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
12#include "llvm/Support/Casting.h"
13#include "llvm/Support/Threading.h"
76#include "llvm/DebugInfo/DWARF/DWARFContext.h"
77#include "llvm/Support/FileSystem.h"
78#include "llvm/Support/FormatVariadic.h"
90#ifdef ENABLE_DEBUG_PRINTF
92#define DEBUG_PRINTF(fmt, ...) printf(fmt, __VA_ARGS__)
94#define DEBUG_PRINTF(fmt, ...)
107#define LLDB_PROPERTIES_symbolfiledwarf
108#include "SymbolFileDWARFProperties.inc"
111#define LLDB_PROPERTIES_symbolfiledwarf
112#include "SymbolFileDWARFPropertiesEnum.inc"
117 static llvm::StringRef GetSettingName() {
122 m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
123 m_collection_sp->Initialize(g_symbolfiledwarf_properties);
126 bool IgnoreFileIndexes()
const {
127 return GetPropertyAtIndexAs<bool>(ePropertyIgnoreIndexes,
false);
134 static PluginProperties g_settings;
138static const llvm::DWARFDebugLine::LineTable *
140 llvm::DWARFDebugLine &line,
dw_offset_t line_offset,
145 llvm::DWARFContext &ctx = context.
GetAsLLVM();
146 llvm::Expected<const llvm::DWARFDebugLine::LineTable *> line_table =
147 line.getOrParseLineTable(
148 data, line_offset, ctx,
nullptr, [&](llvm::Error e) {
151 "SymbolFileDWARF::ParseLineTable failed to parse: {0}");
156 "SymbolFileDWARF::ParseLineTable failed to parse: {0}");
163 llvm::DWARFDebugLine::Prologue &prologue,
169 llvm::DWARFContext &ctx = context.
GetAsLLVM();
170 uint64_t offset = line_offset;
171 llvm::Error
error = prologue.parse(
176 "SymbolFileDWARF::ParseSupportFiles failed to parse "
177 "line table prologue: {0}");
182 "SymbolFileDWARF::ParseSupportFiles failed to parse line "
183 "table prologue: {0}");
189static std::optional<std::string>
193 std::string abs_path;
194 auto absolute = llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath;
195 if (prologue.getFileNameByIndex(idx, compile_dir, absolute, abs_path, style))
196 return std::move(abs_path);
199 std::string rel_path;
200 auto relative = llvm::DILineInfoSpecifier::FileLineInfoKind::RawValue;
201 if (!prologue.getFileNameByIndex(idx, compile_dir, relative, rel_path, style))
203 return std::move(rel_path);
208 const llvm::DWARFDebugLine::Prologue &prologue,
210 llvm::StringRef compile_dir = {}) {
212 size_t first_file = 0;
213 if (prologue.getVersion() <= 4) {
221 const size_t number_of_files = prologue.FileNames.size();
222 for (
size_t idx = first_file; idx <= number_of_files; ++idx) {
223 std::string remapped_file;
224 if (
auto file_path =
GetFileByIndex(prologue, idx, compile_dir, style)) {
225 if (
auto remapped = module->RemapSourceFile(llvm::StringRef(*file_path)))
226 remapped_file = *remapped;
228 remapped_file = std::move(*file_path);
235 return support_files;
248 debugger, PluginProperties::GetSettingName())) {
249 const bool is_global_setting =
true;
252 "Properties for the dwarf symbol-file plug-in.", is_global_setting);
263 return "DWARF and DWARF3 debug symbol file reader.";
274 return debug_map_symfile->GetTypeList();
283 if (die_offset >= max_die_offset)
286 if (die_offset >= min_die_offset) {
289 bool add_type =
false;
292 case DW_TAG_array_type:
293 add_type = (type_mask & eTypeClassArray) != 0;
295 case DW_TAG_unspecified_type:
296 case DW_TAG_base_type:
297 add_type = (type_mask & eTypeClassBuiltin) != 0;
299 case DW_TAG_class_type:
300 add_type = (type_mask & eTypeClassClass) != 0;
302 case DW_TAG_structure_type:
303 add_type = (type_mask & eTypeClassStruct) != 0;
305 case DW_TAG_union_type:
306 add_type = (type_mask & eTypeClassUnion) != 0;
308 case DW_TAG_enumeration_type:
309 add_type = (type_mask & eTypeClassEnumeration) != 0;
311 case DW_TAG_subroutine_type:
312 case DW_TAG_subprogram:
313 case DW_TAG_inlined_subroutine:
314 add_type = (type_mask & eTypeClassFunction) != 0;
316 case DW_TAG_pointer_type:
317 add_type = (type_mask & eTypeClassPointer) != 0;
319 case DW_TAG_rvalue_reference_type:
320 case DW_TAG_reference_type:
321 add_type = (type_mask & eTypeClassReference) != 0;
324 add_type = (type_mask & eTypeClassTypedef) != 0;
326 case DW_TAG_ptr_to_member_type:
327 add_type = (type_mask & eTypeClassMemberPointer) != 0;
334 const bool assert_not_being_parsed =
true;
337 type_set.insert(type);
342 GetTypes(child_die, min_die_offset, max_die_offset, type_mask, type_set);
348 TypeClass type_mask,
TypeList &type_list)
361 unit = &unit->GetNonSkeletonUnit();
362 GetTypes(unit->DIE(), unit->GetOffset(), unit->GetNextUnitOffset(),
363 type_mask, type_set);
370 for (
size_t cu_idx = 0; cu_idx < num_cus; ++cu_idx)
374 std::set<CompilerType> compiler_type_set;
375 for (
Type *type : type_set) {
376 CompilerType compiler_type = type->GetForwardCompilerType();
377 if (compiler_type_set.find(compiler_type) == compiler_type_set.end()) {
378 compiler_type_set.insert(compiler_type);
379 type_list.
Insert(type->shared_from_this());
393 case DW_TAG_compile_unit:
394 case DW_TAG_partial_unit:
395 case DW_TAG_subprogram:
396 case DW_TAG_inlined_subroutine:
397 case DW_TAG_lexical_block:
409 m_debug_map_symfile(nullptr),
410 m_context(m_objfile_sp->GetModule()->GetSectionList(), dwo_section_list),
411 m_fetched_external_modules(false),
417 static ConstString g_dwarf_section_name(
"__DWARF");
418 return g_dwarf_section_name;
423 if (debug_map_symfile)
429llvm::Expected<lldb::TypeSystemSP>
432 return debug_map_symfile->GetTypeSystemForLanguage(language);
434 auto type_system_or_err =
435 m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
436 if (type_system_or_err)
437 if (
auto ts = *type_system_or_err)
438 ts->SetSymbolFile(
this);
439 return type_system_or_err;
459 Progress progress(llvm::formatv(
"Loading Apple DWARF index for {0}",
462 *
GetObjectFile()->GetModule(), apple_names, apple_namespaces,
473 llvm::formatv(
"Loading DWARF5 index for {0}", module_desc.
GetData()));
474 llvm::Expected<std::unique_ptr<DebugNamesDWARFIndex>> index_or =
479 m_index = std::move(*index_or);
483 "Unable to read .debug_names data: {0}");
488 std::make_unique<ManualDWARFIndex>(*
GetObjectFile()->GetModule(), *
this);
500 for (
SectionSP section_sp : section_list) {
501 if (section_sp->GetChildren().GetSize() > 0) {
511 return version >= 2 && version <= 5;
515 uint32_t abilities = 0;
517 const Section *section =
nullptr;
519 if (section_list ==
nullptr)
522 uint64_t debug_abbrev_file_size = 0;
523 uint64_t debug_info_file_size = 0;
524 uint64_t debug_line_file_size = 0;
533 if (section !=
nullptr) {
544 std::set<dw_form_t> invalid_forms;
546 if (!invalid_forms.empty()) {
548 error.Printf(
"unsupported DW_FORM value%s:",
549 invalid_forms.size() > 1 ?
"s" :
"");
550 for (
auto form : invalid_forms)
551 error.Printf(
" %#x", form);
553 "{0}",
error.GetString().str().c_str());
564 llvm::StringRef symfile_dir =
565 m_objfile_sp->GetFileSpec().GetDirectory().GetStringRef();
566 if (symfile_dir.contains_insensitive(
".dsym")) {
577 "empty dSYM file detected, dSYM was created with an "
578 "executable with no debug info.");
585 if (debug_info_file_size >= MaxDebugInfoSize) {
587 "SymbolFileDWARF can't load this DWARF. It's larger then {0:x+16}",
592 if (debug_abbrev_file_size > 0 && debug_info_file_size > 0)
596 if (debug_line_file_size > 0)
605 const SectionList *section_list = module_sp->GetSectionList();
625 auto abbr = std::make_unique<DWARFDebugAbbrev>();
626 llvm::Error
error = abbr->parse(debug_abbrev_data);
630 "Unable to read .debug_abbrev section: {0}");
641 static_cast<void *
>(
this));
653 if (dwarf_cu && dwarf_cu->
GetUserData() ==
nullptr)
657 return llvm::cast_or_null<DWARFCompileUnit>(dwarf_cu);
663 static_cast<void *
>(
this));
666 m_ranges = std::make_unique<DWARFDebugRanges>();
685 if (
auto remapped_file = module_sp->RemapSourceFile(file_spec.
GetPath()))
686 file_spec.
SetFile(*remapped_file, FileSpec::Style::native);
692 const char *dwo_name =
705 cu_sp = comp_unit->shared_from_this();
714 auto initialize_cu = [&](
const FileSpec &file_spec,
717 cu_sp = std::make_shared<CompileUnit>(
718 module_sp, &dwarf_cu, file_spec,
727 auto lazy_initialize_cu = [&]() {
749 if (support_files.
GetSize() == 0)
754 cu_sp->SetSupportFiles(std::move(support_files));
758 if (!lazy_initialize_cu()) {
772 initialize_cu(cu_file_spec, cu_language);
790 for (uint32_t i = 0, num = info.
GetNumUnits(); i < num; ++i) {
791 if (
auto *cu = llvm::dyn_cast<DWARFCompileUnit>(info.
GetUnitAtIndex(i))) {
816 if (
auto *dwarf_cu = llvm::cast_or_null<DWARFCompileUnit>(
830 if (
auto err = type_system_or_err.takeError()) {
832 "Unable to parse function: {0}");
835 auto ts = *type_system_or_err;
852 lowest_func_addr >= highest_func_addr ||
859 lowest_func_addr, module_sp->GetSectionList());
863 func_range.
SetByteSize(highest_func_addr - lowest_func_addr);
878 if (
auto err = type_system_or_err.takeError()) {
880 "Unable to construct demangled name for function: {0}");
884 auto ts = *type_system_or_err;
898 if (debug_map_symfile)
905 if (debug_map_symfile) {
931 const char *sysroot =
939 module_sp->RegisterXcodeSDK(sdk, sysroot);
942 if (local_module_sp && local_module_sp != module_sp)
943 local_module_sp->RegisterXcodeSDK(sdk, sysroot);
955 size_t functions_added = 0;
958 if (entry.Tag() != DW_TAG_subprogram)
968 return functions_added;
973 llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files,
974 llvm::function_ref<
bool(
Module &)> lambda) {
976 if (!visited_symbol_files.insert(
this).second)
989 for (std::size_t i = 0; i < module->GetNumCompileUnits(); ++i) {
990 auto cu = module->GetCompileUnitAtIndex(i);
991 bool early_exit = cu->ForEachExternalModule(visited_symbol_files, lambda);
1022 llvm::DWARFDebugLine::Prologue prologue;
1034 if (
auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(&unit)) {
1036 return lldb_cu->GetSupportFiles().GetFileSpecAtIndex(file_idx);
1040 auto &tu = llvm::cast<DWARFTypeUnit>(unit);
1050 offset == llvm::DenseMapInfo<dw_offset_t>::getEmptyKey() ||
1051 offset == llvm::DenseMapInfo<dw_offset_t>::getTombstoneKey())
1058 if (iter_bool.second) {
1059 uint64_t line_table_offset = offset;
1060 llvm::DWARFDataExtractor data =
1063 llvm::DWARFDebugLine::Prologue prologue;
1064 auto report = [](llvm::Error
error) {
1067 "SymbolFileDWARF::GetTypeUnitSupportFiles failed to parse "
1068 "the line table prologue: {0}");
1071 llvm::Error
error = prologue.parse(data, &line_table_offset, report, ctx);
1073 report(std::move(
error));
1092 std::vector<SourceModule> &imported_modules) {
1108 if (child_die.Tag() != DW_TAG_imported_declaration)
1112 if (module_die.
Tag() != DW_TAG_module)
1115 if (
const char *name =
1121 while ((parent_die = parent_die.
GetParent())) {
1122 if (parent_die.
Tag() != DW_TAG_module)
1124 if (
const char *name =
1128 std::reverse(module.
path.begin(), module.
path.end());
1130 DW_AT_LLVM_include_path,
nullptr)) {
1137 DW_AT_LLVM_sysroot,
nullptr))
1139 imported_modules.push_back(module);
1159 llvm::DWARFDebugLine line;
1160 const llvm::DWARFDebugLine::LineTable *line_table =
1169 std::vector<std::unique_ptr<LineSequence>> sequences;
1172 for (
const llvm::DWARFDebugLine::Sequence &seq : line_table->Sequences) {
1179 std::unique_ptr<LineSequence> sequence =
1181 for (
unsigned idx = seq.FirstRowIndex; idx < seq.LastRowIndex; ++idx) {
1182 const llvm::DWARFDebugLine::Row &row = line_table->Rows[idx];
1184 sequence.get(), row.Address.Address, row.Line, row.Column, row.File,
1185 row.IsStmt, row.BasicBlock, row.PrologueEnd, row.EpilogueBegin,
1188 sequences.push_back(std::move(sequence));
1191 std::unique_ptr<LineTable> line_table_up =
1192 std::make_unique<LineTable>(&comp_unit, std::move(sequences));
1199 debug_map_symfile->LinkOSOLineTable(
this, line_table_up.get()));
1211 return iter->second;
1225 offset,
this, debug_macros_sp);
1227 return debug_macros_sp;
1234 if (dwarf_cu ==
nullptr)
1256 const DWARFDIE &orig_die,
addr_t subprogram_low_pc, uint32_t depth) {
1257 size_t blocks_added = 0;
1263 case DW_TAG_inlined_subroutine:
1264 case DW_TAG_subprogram:
1265 case DW_TAG_lexical_block: {
1266 Block *block =
nullptr;
1267 if (tag == DW_TAG_subprogram) {
1275 block = parent_block;
1279 block = block_sp.get();
1282 const char *name =
nullptr;
1283 const char *mangled_name =
nullptr;
1285 std::optional<int> decl_file;
1286 std::optional<int> decl_line;
1287 std::optional<int> decl_column;
1288 std::optional<int> call_file;
1289 std::optional<int> call_line;
1290 std::optional<int> call_column;
1292 decl_line, decl_column, call_file, call_line,
1293 call_column,
nullptr)) {
1294 if (tag == DW_TAG_subprogram) {
1297 }
else if (tag == DW_TAG_inlined_subroutine) {
1311 const size_t num_ranges = ranges.
GetSize();
1312 for (
size_t i = 0; i < num_ranges; ++i) {
1315 if (range_base >= subprogram_low_pc)
1320 "{0:x8}: adding range [{1:x16}-{2:x16}) which has a base "
1321 "that is less than the function's low PC {3:x16}. Please file "
1322 "a bug and attach the file at the "
1323 "start of this error message",
1330 if (tag != DW_TAG_subprogram &&
1331 (name !=
nullptr || mangled_name !=
nullptr)) {
1332 std::unique_ptr<Declaration> decl_up;
1333 if (decl_file || decl_line || decl_column)
1334 decl_up = std::make_unique<Declaration>(
1336 decl_file ? *decl_file : 0),
1337 decl_line ? *decl_line : 0, decl_column ? *decl_column : 0);
1339 std::unique_ptr<Declaration> call_up;
1340 if (call_file || call_line || call_column)
1341 call_up = std::make_unique<Declaration>(
1343 call_file ? *call_file : 0),
1344 call_line ? *call_line : 0, call_column ? *call_column : 0);
1355 subprogram_low_pc, depth + 1);
1372 return blocks_added;
1379 bool check_virtuality =
false;
1381 case DW_TAG_inheritance:
1382 case DW_TAG_subprogram:
1383 check_virtuality =
true;
1388 if (check_virtuality) {
1389 if (die.GetAttributeValueAsUnsigned(DW_AT_virtuality, 0) != 0)
1399 if (type_system !=
nullptr)
1449 return type_die.ResolveType();
1460 return std::nullopt;
1468 bool assert_not_being_parsed) {
1473 log,
"SymbolFileDWARF::ResolveTypeUID (die = {0:x16}) {1} '{2}'",
1482 switch (decl_ctx_die.
Tag()) {
1483 case DW_TAG_structure_type:
1484 case DW_TAG_union_type:
1485 case DW_TAG_class_type: {
1490 "SymbolFileDWARF::ResolveTypeUID (die = {0:x16}) "
1492 "resolve parent forward type for {3:x16})",
1520 if (!clang_type_system)
1529 auto clang_type_system =
1531 if (clang_type_system) {
1559 Log *log =
GetLog(DWARFLog::DebugInfo | DWARFLog::TypeCompletion);
1562 log,
"{0:x8}: {1} '{2}' resolving forward declaration...",
1565 assert(compiler_type);
1567 return dwarf_ast->CompleteTypeFromDWARF(dwarf_die, type, compiler_type);
1573 bool assert_not_being_parsed,
1574 bool resolve_function_context) {
1578 if (assert_not_being_parsed) {
1583 "Parsing a die that is being parsed die: {0:x16}: {1} {2}",
1612 m_index->GetObjCMethods(class_name, callback);
1618 if (die && llvm::isa<DWARFCompileUnit>(die.
GetCU())) {
1659 std::optional<uint32_t> file_index = die_ref.
file_index();
1662 symbol_file = debug_map->GetSymbolFileByOSOIndex(*file_index);
1679 return symbol_file->
GetDIE(die_ref);
1687 std::optional<uint64_t> dwo_id =
1699 return ::GetDWOId(*cu, *cu_die);
1704std::shared_ptr<SymbolFileDWARFDwo>
1718 if (!dwarf_cu || !dwarf_cu->
GetDWOId().has_value())
1721 const char *dwo_name =
GetDWOName(*dwarf_cu, cu_die);
1724 "missing DWO name in skeleton DIE {0:x16}", cu_die.
GetOffset()));
1737 size_t num_search_paths = debug_file_search_paths.
GetSize();
1745 const char *comp_dir =
1749 dwo_file.
SetFile(comp_dir, FileSpec::Style::native);
1760 FileSpec relative_to_binary = dwo_file;
1762 m_objfile_sp->GetFileSpec().GetDirectory().GetStringRef());
1765 dwo_paths.
Append(relative_to_binary);
1768 for (
size_t idx = 0; idx < num_search_paths; ++idx) {
1776 dwo_paths.
Append(dirspec);
1779 size_t num_possible = dwo_paths.
GetSize();
1780 for (
size_t idx = 0; idx < num_possible && !found; ++idx) {
1783 dwo_file = dwo_spec;
1791 "unable to locate relative .dwo debug file \"%s\" for "
1792 "skeleton DIE 0x%016" PRIx64
" without valid DW_AT_comp_dir "
1803 llvm::StringRef filename_only = dwo_name_spec.
GetFilename();
1806 m_objfile_sp->GetFileSpec().GetDirectory().GetStringRef());
1810 FileSpec dwo_name_binary_directory(binary_directory);
1812 dwo_paths.
Append(dwo_name_binary_directory);
1815 FileSpec filename_binary_directory(binary_directory);
1817 dwo_paths.
Append(filename_binary_directory);
1819 for (
size_t idx = 0; idx < num_search_paths; ++idx) {
1825 FileSpec dwo_name_dirspec(dirspec);
1827 dwo_paths.
Append(dwo_name_dirspec);
1829 FileSpec filename_dirspec(dirspec);
1831 dwo_paths.
Append(filename_dirspec);
1834 size_t num_possible = dwo_paths.
GetSize();
1835 for (
size_t idx = 0; idx < num_possible && !found; ++idx) {
1838 dwo_file = dwo_spec;
1846 "unable to locate .dwo debug file \"{0}\" for skeleton DIE "
1852 "unable to locate separate debug file (dwo, dwp). Debugging will be "
1864 dwo_file_data_offset);
1865 if (dwo_obj_file ==
nullptr) {
1867 "unable to load object file for .dwo debug file \"{0}\" for "
1873 return std::make_shared<SymbolFileDWARFDwo>(*
this, dwo_obj_file,
1885 for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
1887 llvm::dyn_cast<DWARFCompileUnit>(debug_info.
GetUnitAtIndex(cu_idx));
1911 const char *comp_dir =
1915 FileSpec::Style::native);
1935 if (
m_objfile_sp->GetFileSpec().GetFileNameExtension() ==
".dwo" &&
1942 nullptr,
nullptr,
nullptr);
1945 "{0:x16}: unable to locate module needed for external types: "
1946 "{1}\nerror: {2}\nDebugging will be degraded due to missing "
1947 "types. Rebuilding the project will regenerate the needed "
1950 error.AsCString(
"unknown error"));
1961 llvm::dyn_cast_or_null<SymbolFileDWARF>(module_sp->GetSymbolFile());
1964 std::optional<uint64_t> dwo_dwo_id = dwo_symfile->GetDWOId();
1968 if (dwo_id != dwo_dwo_id) {
1970 "{0:x16}: Module {1} is out-of-date (hash mismatch). Type "
1972 "from this module may be incomplete or inconsistent with the rest of "
1973 "the program. Rebuilding the project will regenerate the needed "
1986 const size_t num_cus = module_sp->GetNumCompileUnits();
1987 for (
size_t i = 0; i < num_cus; ++i) {
1988 CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(i);
1992 const size_t num_globals = globals_sp->GetSize();
1993 for (
size_t g = 0; g < num_globals; ++g) {
1994 VariableSP var_sp = globals_sp->GetVariableAtIndex(g);
1995 if (var_sp && !var_sp->GetLocationIsConstantValueData()) {
1997 var_sp->LocationExpressionList();
1998 Value location_result;
2002 nullptr,
nullptr, location_result,
2005 Value::ValueType::FileAddress) {
2009 if (var_sp->GetType())
2011 var_sp->GetType()->GetByteSize(
nullptr).value_or(0);
2013 file_addr, byte_size, var_sp.get()));
2055 SymbolContextItem resolve_scope,
2059 "ResolveSymbolContext (so_addr = { "
2060 "section = %p, offset = 0x%" PRIx64
2061 " }, resolve_scope = 0x%8.8x)",
2062 static_cast<void *
>(so_addr.
GetSection().get()),
2064 uint32_t resolved = 0;
2066 (eSymbolContextCompUnit | eSymbolContextFunction | eSymbolContextBlock |
2067 eSymbolContextLineEntry | eSymbolContextVariable)) {
2079 if (resolve_scope & eSymbolContextVariable) {
2082 map.FindEntryThatContains(file_vm_addr);
2083 if (entry && entry->data) {
2095 if (
auto *dwarf_cu = llvm::dyn_cast_or_null<DWARFCompileUnit>(
2100 resolved |= eSymbolContextCompUnit;
2102 bool force_check_line_table =
false;
2103 if (resolve_scope & (eSymbolContextFunction | eSymbolContextBlock)) {
2105 resolve_scope & eSymbolContextBlock, sc);
2107 resolved |= eSymbolContextFunction;
2115 force_check_line_table =
true;
2118 resolved |= eSymbolContextBlock;
2121 if ((resolve_scope & eSymbolContextLineEntry) ||
2122 force_check_line_table) {
2124 if (line_table !=
nullptr) {
2134 resolved |= eSymbolContextLineEntry;
2140 if (force_check_line_table && !(resolved & eSymbolContextLineEntry)) {
2147 resolved &= ~eSymbolContextCompUnit;
2151 "{0:x16}: compile unit {1} failed to create a valid "
2152 "lldb_private::CompileUnit class.",
2166 const uint32_t prev_size = sc_list.
GetSize();
2167 if (resolve_scope & eSymbolContextCompUnit) {
2176 if (check_inlines || file_spec_matches_cu_file_spec) {
2183 return sc_list.
GetSize() - prev_size;
2201 return module_sp->GetMutex();
2217 if (
auto err = type_system_or_err.takeError()) {
2219 "Unable to match namespace decl using TypeSystem: {0}");
2223 if (decl_ctx_type_system == type_system_or_err->get())
2231 log,
"Valid namespace does not match symbol file");
2245 "SymbolFileDWARF::FindGlobalVariables (name=\"{0}\", "
2246 "parent_decl_ctx={1:p}, max_matches={2}, variables)",
2247 name.
GetCString(),
static_cast<const void *
>(&parent_decl_ctx),
2254 const uint32_t original_size = variables.
GetSize();
2256 llvm::StringRef basename;
2257 llvm::StringRef context;
2267 uint32_t pruned_idx = original_size;
2275 if (die.
Tag() != DW_TAG_variable)
2278 auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(die.
GetCU());
2283 if (parent_decl_ctx) {
2286 dwarf_ast->GetDeclContextContainingUIDFromDWARF(die);
2292 if (!actual_parent_decl_ctx ||
2293 (actual_parent_decl_ctx != parent_decl_ctx &&
2300 while (pruned_idx < variables.
GetSize()) {
2302 if (name_is_mangled ||
2303 var_sp->GetName().GetStringRef().contains(name.
GetStringRef()))
2309 return variables.
GetSize() - original_size < max_matches;
2313 const uint32_t num_matches = variables.
GetSize() - original_size;
2314 if (log && num_matches > 0) {
2317 "SymbolFileDWARF::FindGlobalVariables (name=\"{0}\", "
2318 "parent_decl_ctx={1:p}, max_matches={2}, variables) => {3}",
2319 name.
GetCString(),
static_cast<const void *
>(&parent_decl_ctx),
2320 max_matches, num_matches);
2325 uint32_t max_matches,
2333 "SymbolFileDWARF::FindGlobalVariables (regex=\"{0}\", "
2334 "max_matches={1}, variables)",
2335 regex.
GetText().str().c_str(), max_matches);
2339 const uint32_t original_size = variables.
GetSize();
2354 return variables.
GetSize() - original_size < max_matches;
2359 bool include_inlines,
2367 if (!(orig_die.
Tag() == DW_TAG_subprogram ||
2368 (include_inlines && orig_die.
Tag() == DW_TAG_inlined_subroutine)))
2373 if (die.
Tag() == DW_TAG_inlined_subroutine) {
2380 if (die.
Tag() == DW_TAG_subprogram)
2386 assert(die && die.
Tag() == DW_TAG_subprogram);
2393 if (sc.
block ==
nullptr)
2411 bool only_root_namespaces) {
2418 if (only_root_namespaces)
2419 return die.
GetParent().
Tag() == dwarf::DW_TAG_compile_unit;
2427 dwarf_ast->GetDeclContextContainingUIDFromDWARF(die))
2436 bool include_inlines,
2444 assert((name_type_mask & eFunctionNameTypeAuto) == 0);
2451 "SymbolFileDWARF::FindFunctions (name=\"{0}\", name_type_mask={1:x}, "
2466 const uint32_t original_size = sc_list.
GetSize();
2468 llvm::DenseSet<const DWARFDebugInfoEntry *> resolved_dies;
2470 m_index->GetFunctions(lookup_info, *
this, parent_decl_ctx, [&](
DWARFDIE die) {
2471 if (resolved_dies.insert(die.
GetDIE()).second)
2480 auto it = name_ref.find(
'<');
2481 if (it != llvm::StringRef::npos) {
2482 const llvm::StringRef name_no_template_params = name_ref.slice(0, it);
2486 m_index->GetFunctions(no_tp_lookup_info, *
this, parent_decl_ctx, [&](
DWARFDIE die) {
2487 if (resolved_dies.insert(die.
GetDIE()).second)
2495 const uint32_t num_matches = sc_list.
GetSize() - original_size;
2497 if (log && num_matches > 0) {
2500 "SymbolFileDWARF::FindFunctions (name=\"{0}\", "
2501 "name_type_mask={1:x}, include_inlines={2:d}, sc_list) => {3}",
2502 name.
GetCString(), name_type_mask, include_inlines, num_matches);
2507 bool include_inlines,
2511 regex.
GetText().str().c_str());
2517 log,
"SymbolFileDWARF::FindFunctions (regex=\"{0}\", sc_list)",
2518 regex.
GetText().str().c_str());
2521 llvm::DenseSet<const DWARFDebugInfoEntry *> resolved_dies;
2523 if (resolved_dies.insert(die.
GetDIE()).second)
2530 const std::string &scope_qualified_name,
2531 std::vector<ConstString> &mangled_names) {
2534 for (uint32_t i = 0; i < num_comp_units; i++) {
2553 uint32_t max_matches,
2554 llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
2558 if (!searched_symbol_files.insert(
this).second)
2564 if (parent_decl_ctx)
2567 "SymbolFileDWARF::FindTypes (sc, name=\"{0}\", parent_decl_ctx = "
2568 "{1:p} (\"{2}\"), max_matches={3}, type_list)",
2569 name.
GetCString(),
static_cast<const void *
>(&parent_decl_ctx),
2574 "SymbolFileDWARF::FindTypes (sc, name=\"{0}\", parent_decl_ctx = "
2575 "NULL, max_matches={1}, type_list)",
2586 auto name_bracket_index = name_ref.find(
'<');
2598 if (name_bracket_index == llvm::StringRef::npos &&
2605 return types.
GetSize() < max_matches;
2611 if (types.
GetSize() < max_matches) {
2612 if (name_bracket_index != llvm::StringRef::npos) {
2613 const llvm::StringRef name_no_template_params =
2614 name_ref.slice(0, name_bracket_index);
2615 const llvm::StringRef template_params =
2616 name_ref.slice(name_bracket_index, name_ref.size());
2621 const llvm::StringRef base_name =
GetTypeForDIE(die)->GetBaseName().AsCString();
2622 auto it = base_name.find(
'<');
2625 if (it == llvm::StringRef::npos)
2629 const llvm::StringRef base_name_template_params =
2630 base_name.slice(it, base_name.size());
2632 if (template_params != base_name_template_params)
2642 return types.
GetSize() < max_matches;
2650 if (types.
GetSize() < max_matches) {
2654 if (
ModuleSP external_module_sp = pair.second)
2655 if (
SymbolFile *sym_file = external_module_sp->GetSymbolFile())
2656 sym_file->FindTypes(name, parent_decl_ctx, max_matches,
2657 searched_symbol_files, types);
2661 if (parent_decl_ctx) {
2664 "SymbolFileDWARF::FindTypes (sc, name=\"{0}\", parent_decl_ctx "
2665 "= {1:p} (\"{2}\"), max_matches={3}, type_list) => {4}",
2666 name.
GetCString(),
static_cast<const void *
>(&parent_decl_ctx),
2672 "SymbolFileDWARF::FindTypes (sc, name=\"{0}\", parent_decl_ctx "
2673 "= NULL, max_matches={1}, type_list) => {2}",
2680 llvm::ArrayRef<CompilerContext> pattern,
LanguageSet languages,
2681 llvm::DenseSet<SymbolFile *> &searched_symbol_files,
TypeMap &types) {
2683 if (!searched_symbol_files.insert(
this).second)
2687 if (pattern.empty())
2699 llvm::SmallVector<CompilerContext, 4> die_context;
2718 if (
ModuleSP external_module_sp = pair.second)
2719 external_module_sp->FindTypes(pattern, languages, searched_symbol_files,
2726 bool only_root_namespaces) {
2732 log,
"SymbolFileDWARF::FindNamespace (sc, name=\"{0}\")",
2739 return namespace_decl_ctx;
2750 return !namespace_decl_ctx.
IsValid();
2753 if (log && namespace_decl_ctx) {
2756 "SymbolFileDWARF::FindNamespace (sc, name=\"{0}\") => "
2757 "CompilerDeclContext({1:p}/{2:p}) \"{3}\"",
2759 static_cast<const void *
>(namespace_decl_ctx.
GetTypeSystem()),
2764 return namespace_decl_ctx;
2768 bool resolve_function_context) {
2772 if (type_ptr ==
nullptr) {
2774 if (
auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(die.
GetCU()))
2781 while (parent_die !=
nullptr) {
2782 if (parent_die->
Tag() == DW_TAG_subprogram)
2787 if (resolve_function_context && parent_die !=
nullptr &&
2794 type_sp = type_ptr->shared_from_this();
2809 if (orig_die != die) {
2810 switch (die.
Tag()) {
2811 case DW_TAG_compile_unit:
2812 case DW_TAG_partial_unit:
2813 case DW_TAG_namespace:
2814 case DW_TAG_structure_type:
2815 case DW_TAG_union_type:
2816 case DW_TAG_class_type:
2817 case DW_TAG_lexical_block:
2818 case DW_TAG_subprogram:
2820 case DW_TAG_inlined_subroutine: {
2836 return decl_ctx_die;
2843 return decl_ctx_die;
2853 Symbol *objc_class_symbol =
nullptr;
2862 return objc_class_symbol;
2880 for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
2882 if (dwarf_cu != cu &&
2906 m_index->GetCompleteObjCClass(
2907 type_name, must_be_implementation, [&](
DWARFDIE type_die) {
2908 bool try_resolving_type =
false;
2912 if (type_die != die) {
2913 switch (type_die.
Tag()) {
2914 case DW_TAG_class_type:
2915 case DW_TAG_structure_type:
2916 try_resolving_type = true;
2922 if (!try_resolving_type)
2925 if (must_be_implementation &&
2928 DW_AT_APPLE_objc_complete_type, 0);
2929 if (!try_resolving_type)
2937 "resolved 0x%8.8" PRIx64
" from %s to 0x%8.8" PRIx64
2938 " (cu 0x%8.8" PRIx64
")\n",
2940 m_objfile_sp->GetFileSpec().GetFilename().AsCString(
"<Unknown>"),
2941 type_die.
GetID(), type_cu->GetID());
2945 type_sp = resolved_type->shared_from_this();
2965 std::vector<DWARFDIE> decl_ctx_1;
2966 std::vector<DWARFDIE> decl_ctx_2;
2985 const size_t count1 = decl_ctx_1.size();
2986 const size_t count2 = decl_ctx_2.size();
2987 if (count1 != count2)
2995 for (i = 0; i < count1; i++) {
2996 decl_ctx_die1 = decl_ctx_1[i];
2997 decl_ctx_die2 = decl_ctx_2[i];
2998 if (decl_ctx_die1.
Tag() != decl_ctx_die2.
Tag())
3009 assert(cu_tag == DW_TAG_compile_unit || cu_tag == DW_TAG_partial_unit);
3014 for (i = 0; i < count1 - 1; i++) {
3015 decl_ctx_die1 = decl_ctx_1[i];
3016 decl_ctx_die2 = decl_ctx_2[i];
3017 const char *name1 = decl_ctx_die1.
GetName();
3018 const char *name2 = decl_ctx_die2.
GetName();
3026 if (name1 && name2) {
3028 if (strcmp(name1, name2) != 0)
3047 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
3051 "SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(tag={0}, "
3063 if (
auto err = type_system_or_err.takeError()) {
3065 "Cannot get TypeSystem for language {1}: {0}",
3068 type_system = *type_system_or_err;
3088 bool try_resolving_type =
false;
3094 if (type_tag == tag) {
3096 try_resolving_type =
true;
3102 case DW_TAG_class_type:
3105 try_resolving_type = (tag == DW_TAG_structure_type);
3107 case DW_TAG_structure_type:
3110 try_resolving_type = (tag == DW_TAG_class_type);
3119 if (!try_resolving_type) {
3124 "FindDefinitionTypeForDWARFDeclContext(tag={0}, "
3125 "name='{1}') ignoring die={2:x16} ({3})",
3138 "FindDefinitionTypeForDWARFDeclContext(tag={0}, "
3139 "name='{1}') trying die={2:x16} ({3})",
3155 if (template_params) {
3156 llvm::StringRef test_base_name =
3158 auto i = test_base_name.find(
'<');
3163 if (i == llvm::StringRef::npos)
3166 llvm::StringRef test_template_params =
3167 test_base_name.slice(i, test_base_name.size());
3169 if (test_template_params != template_params.
GetStringRef())
3173 type_sp = resolved_type->shared_from_this();
3181 bool *type_is_new_ptr) {
3186 if (
auto err = type_system_or_err.takeError()) {
3188 "Unable to parse type: {0}");
3191 auto ts = *type_system_or_err;
3201 if (die.
Tag() == DW_TAG_subprogram) {
3205 if (scope_qualified_name.size()) {
3217 bool parse_siblings,
bool parse_children) {
3218 size_t types_added = 0;
3223 bool type_is_new =
false;
3225 Tag dwarf_tag =
static_cast<Tag
>(tag);
3230 if (isType(dwarf_tag) && tag != DW_TAG_subrange_type)
3237 if (die.
Tag() == DW_TAG_subprogram) {
3262 size_t functions_added = 0;
3271 return functions_added;
3276 size_t types_added = 0;
3298 function_die.
GetCU(),
true);
3302 const size_t num_variables =
3307 return num_variables;
3312 if (dwarf_cu ==
nullptr)
3315 uint32_t vars_added = 0;
3318 if (variables.get() ==
nullptr) {
3319 variables = std::make_shared<VariableList>();
3325 variables->AddVariableIfUnique(var_sp);
3350 die_to_variable[die.
GetDIE()] = var_sp;
3352 die_to_variable[spec_die.GetDIE()] = var_sp;
3361 const addr_t func_low_pc) {
3366 uint32_t block_length = form_value.
Unsigned();
3374 if (form_value.
Form() == DW_FORM_loclistx)
3383 return location_list;
3395 uint32_t block_offset =
3397 uint32_t block_length = form_value.
Unsigned();
3399 module,
DataExtractor(debug_info_data, block_offset, block_length),
3402 if (
const char *str = form_value.
AsCString())
3422 if (!debug_map_objfile)
3426 if (!debug_map_symtab)
3455 if (tag != DW_TAG_variable && tag != DW_TAG_constant &&
3456 (tag != DW_TAG_formal_parameter || !sc.
function))
3460 const char *name =
nullptr;
3461 const char *mangled =
nullptr;
3464 bool is_external =
false;
3465 bool is_artificial =
false;
3469 for (
size_t i = 0; i < attributes.
Size(); ++i) {
3476 case DW_AT_decl_file:
3480 case DW_AT_decl_line:
3483 case DW_AT_decl_column:
3489 case DW_AT_linkage_name:
3490 case DW_AT_MIPS_linkage_name:
3494 type_die_form = form_value;
3496 case DW_AT_external:
3497 is_external = form_value.
Boolean();
3499 case DW_AT_const_value:
3500 const_value_form = form_value;
3502 case DW_AT_location:
3503 location_form = form_value;
3505 case DW_AT_start_scope:
3508 case DW_AT_artificial:
3509 is_artificial = form_value.
Boolean();
3511 case DW_AT_declaration:
3512 case DW_AT_description:
3513 case DW_AT_endianity:
3515 case DW_AT_specification:
3516 case DW_AT_visibility:
3518 case DW_AT_abstract_origin:
3528 bool location_is_const_value_data =
3534 if (const_value_form.
IsValid())
3542 bool is_static_member = (parent_tag == DW_TAG_compile_unit ||
3543 parent_tag == DW_TAG_partial_unit) &&
3544 (parent_context_die.
Tag() == DW_TAG_class_type ||
3545 parent_context_die.
Tag() == DW_TAG_structure_type);
3550 bool has_explicit_mangled = mangled !=
nullptr;
3562 if ((parent_tag == DW_TAG_compile_unit ||
3563 parent_tag == DW_TAG_partial_unit) &&
3569 if (tag == DW_TAG_formal_parameter)
3580 bool has_explicit_location = location_form.
IsValid();
3581 bool is_static_lifetime =
3582 has_explicit_mangled ||
3583 (has_explicit_location && !location_list.
IsValid());
3586 if (!location_is_const_value_data) {
3587 bool op_error =
false;
3590 location_DW_OP_addr =
3596 "{0:x16}: {1} has an invalid location: {2}", die.
GetOffset(),
3600 is_static_lifetime =
true;
3603 if (debug_map_symfile)
3609 if (is_static_lifetime) {
3615 if (debug_map_symfile) {
3616 bool linked_oso_file_addr =
false;
3618 if (is_external && location_DW_OP_addr == 0) {
3620 *debug_map_symfile, mangled ? mangled : name, location_list,
3622 linked_oso_file_addr =
true;
3623 symbol_context_scope = exe_symbol;
3627 if (!linked_oso_file_addr) {
3644 if (location_is_const_value_data &&
3645 die.
GetDIE()->IsGlobalOrStaticScopeVariable())
3649 if (debug_map_symfile) {
3654 [
this, debug_map_symfile](
3656 return debug_map_symfile->LinkOSOFileAddress(
3657 this, unlinked_file_addr);
3666 if (symbol_context_scope ==
nullptr) {
3667 switch (parent_tag) {
3668 case DW_TAG_subprogram:
3669 case DW_TAG_inlined_subroutine:
3670 case DW_TAG_lexical_block:
3672 symbol_context_scope =
3674 if (symbol_context_scope ==
nullptr)
3675 symbol_context_scope = sc.
function;
3685 if (!symbol_context_scope) {
3692 auto type_sp = std::make_shared<SymbolFileType>(
3695 bool use_type_size_for_value =
3696 location_is_const_value_data &&
3698 if (use_type_size_for_value && type_sp->GetType()) {
3701 type_sp->GetType()->GetByteSize(
nullptr).value_or(0),
3705 return std::make_shared<Variable>(
3706 die.
GetID(), name, mangled, type_sp, scope, symbol_context_scope,
3707 scope_ranges, &decl, location_list, is_external, is_artificial,
3708 location_is_const_value_data, is_static_member);
3718 spec_block_die_offset);
3725 switch (die.
Tag()) {
3726 case DW_TAG_subprogram:
3727 case DW_TAG_inlined_subroutine:
3728 case DW_TAG_lexical_block: {
3730 spec_block_die_offset)
3734 spec_block_die_offset)
3762 if (tag != DW_TAG_variable && tag != DW_TAG_constant)
3778 switch (parent_tag) {
3779 case DW_TAG_compile_unit:
3780 case DW_TAG_partial_unit:
3785 "parent {0:x8} {1} with no valid compile unit in "
3786 "symbol context for {2:x8} {3}.\n",
3795 "didn't find appropriate parent DIE for variable list for {0:x8} "
3806 if (variable_list_sp)
3807 variable_list_sp->AddVariableIfUnique(var_sp);
3823 if (block_die.
Tag() != DW_TAG_inlined_subroutine) {
3824 return std::move(variable_dies);
3829 if (!abs_die || abs_die.
Tag() != DW_TAG_subprogram ||
3831 return std::move(variable_dies);
3836 DIEArray::iterator concrete_it = variable_dies.begin();
3839 bool did_merge_abstract =
false;
3840 for (; abstract_child; abstract_child = abstract_child.
GetSibling()) {
3841 if (abstract_child.
Tag() == DW_TAG_formal_parameter) {
3842 if (concrete_it == variable_dies.end() ||
3843 GetDIE(*concrete_it).
Tag() != DW_TAG_formal_parameter) {
3847 merged.push_back(*abstract_child.
GetDIERef());
3848 did_merge_abstract =
true;
3854 if (origin_of_concrete == abstract_child) {
3857 merged.push_back(*concrete_it);
3862 merged.push_back(*abstract_child.
GetDIERef());
3863 did_merge_abstract =
true;
3869 if (!did_merge_abstract)
3870 return std::move(variable_dies);
3877 for (; concrete_it != variable_dies.end(); ++concrete_it) {
3878 if (
GetDIE(*concrete_it).
Tag() == DW_TAG_formal_parameter) {
3879 return std::move(variable_dies);
3881 merged.push_back(*concrete_it);
3897 dummy_block_variables);
3907 size_t vars_added = 0;
3910 if ((tag == DW_TAG_variable) || (tag == DW_TAG_constant) ||
3911 (tag == DW_TAG_formal_parameter)) {
3912 accumulator.push_back(*die.
GetDIERef());
3916 case DW_TAG_subprogram:
3917 case DW_TAG_inlined_subroutine:
3918 case DW_TAG_lexical_block: {
3922 if (block ==
nullptr) {
3929 if (concrete_block_die)
3934 if (block ==
nullptr)
3937 const bool can_create =
false;
3940 if (block_variable_list_sp.get() ==
nullptr) {
3941 block_variable_list_sp = std::make_shared<VariableList>();
3949 sc, child, func_low_pc, block_variables);
3954 block_variables, func_low_pc);
3963 sc, child, func_low_pc, accumulator);
3973 llvm::ArrayRef<DIERef> variable_dies,
lldb::addr_t func_low_pc) {
3975 for (
auto &die : variable_dies) {
3980 return variable_dies.size();
3988 if (child.Tag() != DW_TAG_call_site_parameter &&
3989 child.Tag() != DW_TAG_GNU_call_site_parameter)
3992 std::optional<DWARFExpressionList> LocationInCallee;
3993 std::optional<DWARFExpressionList> LocationInCaller;
3999 auto parse_simple_location =
4000 [&](
int attr_index) -> std::optional<DWARFExpressionList> {
4006 auto data = child.GetData();
4007 uint32_t block_offset = form_value.
BlockData() - data.GetDataStart();
4008 uint32_t block_length = form_value.
Unsigned();
4014 for (
size_t i = 0; i < attributes.
Size(); ++i) {
4016 if (attr == DW_AT_location)
4017 LocationInCallee = parse_simple_location(i);
4018 if (attr == DW_AT_call_value || attr == DW_AT_GNU_call_site_value)
4019 LocationInCaller = parse_simple_location(i);
4022 if (LocationInCallee && LocationInCaller) {
4024 parameters.push_back(param);
4031std::vector<std::unique_ptr<lldb_private::CallEdge>>
4035 bool has_call_edges =
4038 if (!has_call_edges)
4042 LLDB_LOG(log,
"CollectCallEdges: Found call site info in {0}",
4050 std::vector<std::unique_ptr<CallEdge>> call_edges;
4052 if (child.Tag() != DW_TAG_call_site && child.Tag() != DW_TAG_GNU_call_site)
4055 std::optional<DWARFDIE> call_origin;
4056 std::optional<DWARFExpressionList> call_target;
4060 bool tail_call =
false;
4066 for (
size_t i = 0; i < attributes.
Size(); ++i) {
4069 LLDB_LOG(log,
"CollectCallEdges: Could not extract TAG_call_site form");
4075 if (attr == DW_AT_call_tail_call || attr == DW_AT_GNU_tail_call)
4076 tail_call = form_value.
Boolean();
4079 if (attr == DW_AT_call_origin || attr == DW_AT_abstract_origin) {
4081 if (!call_origin->IsValid()) {
4082 LLDB_LOG(log,
"CollectCallEdges: Invalid call origin in {0}",
4088 if (attr == DW_AT_low_pc)
4089 low_pc = form_value.
Address();
4094 if (attr == DW_AT_call_return_pc)
4095 return_pc = form_value.
Address();
4100 if (attr == DW_AT_call_pc)
4101 call_inst_pc = form_value.
Address();
4105 if (attr == DW_AT_call_target || attr == DW_AT_GNU_call_site_target) {
4108 "CollectCallEdges: AT_call_target does not have block form");
4112 auto data = child.GetData();
4113 uint32_t block_offset = form_value.
BlockData() - data.GetDataStart();
4114 uint32_t block_length = form_value.
Unsigned();
4120 if (!call_origin && !call_target) {
4121 LLDB_LOG(log,
"CollectCallEdges: call site without any call target");
4128 caller_address = return_pc;
4129 caller_address_type = CallEdge::AddrType::AfterCall;
4131 caller_address = low_pc;
4132 caller_address_type = CallEdge::AddrType::AfterCall;
4134 caller_address = call_inst_pc;
4135 caller_address_type = CallEdge::AddrType::Call;
4137 LLDB_LOG(log,
"CollectCallEdges: No caller address");
4149 std::unique_ptr<CallEdge> edge;
4152 "CollectCallEdges: Found call origin: {0} (retn-PC: {1:x}) "
4154 call_origin->GetPubname(), return_pc, call_inst_pc);
4155 edge = std::make_unique<DirectCallEdge>(
4156 call_origin->GetMangledName(), caller_address_type, caller_address,
4157 tail_call, std::move(parameters));
4163 LLDB_LOG(log,
"CollectCallEdges: Found indirect call target: {0}",
4166 edge = std::make_unique<IndirectCallEdge>(
4167 *call_target, caller_address_type, caller_address, tail_call,
4168 std::move(parameters));
4171 if (log && parameters.size()) {
4174 param.LocationInCallee.GetDescription(&callee_loc_desc,
4176 param.LocationInCaller.GetDescription(&caller_loc_desc,
4178 LLDB_LOG(log,
"CollectCallEdges: \tparam: {0} => {1}",
4183 call_edges.push_back(std::move(edge));
4188std::vector<std::unique_ptr<lldb_private::CallEdge>>
4210 auto ts = *ts_or_err;
4222 module_sp->GetSymbolFile()->GetBackingSymbolFile());
4244 dwp_file_data_offset);
4254llvm::Expected<lldb::TypeSystemSP>
4261 if (
auto err = type_system_or_err.takeError()) {
4263 "Unable to get DWARFASTParser: {0}");
4266 if (
auto ts = *type_system_or_err)
4267 return ts->GetDWARFParser();
4273 return dwarf_ast->GetDeclForUIDFromDWARF(die);
4279 return dwarf_ast->GetDeclContextForUIDFromDWARF(die);
4286 return dwarf_ast->GetDeclContextContainingUIDFromDWARF(die);
4295 return dwarf_decl_ctx;
4302 case DW_LANG_Mips_Assembler:
4315 if (llvm::dwarf::isCPlusPlus(lang))
4316 lang = DW_LANG_C_plus_plus;
4322 return m_index->GetIndexTime();
4341 if (dwo_error.
Fail())
4351 if (dwarf_cu->
HasAny({DW_TAG_variable, DW_TAG_formal_parameter}))
4354 return Status(
"no variable information is available in debug info for this "
4359 std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) {
4363 for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
4380 args.insert({comp_unit,
Args(flags)});
static llvm::raw_ostream & error(Stream &strm)
std::vector< DIERef > DIEArray
#define DEBUG_PRINTF(fmt,...)
static PluginProperties & GetGlobalPluginProperties()
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
#define LLDB_PLUGIN_DEFINE(PluginName)
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
static PluginProperties & GetGlobalPluginProperties()
static ConstString GetDWARFMachOSegmentName()
static DWARFExpressionList GetExprListFromAtConstValue(DWARFFormValue form_value, ModuleSP module, const DWARFDIE &die)
Creates a DWARFExpressionList from an DW_AT_const_value.
static CallSiteParameterArray CollectCallSiteParameters(ModuleSP module, DWARFDIE call_site_die)
Collect call site parameters in a DW_TAG_call_site DIE.
static void MakeAbsoluteAndRemap(FileSpec &file_spec, DWARFUnit &dwarf_cu, const ModuleSP &module_sp)
Make an absolute path out of file_spec and remap it using the module's source remapping dictionary.
static bool ParseLLVMLineTablePrologue(lldb_private::DWARFContext &context, llvm::DWARFDebugLine::Prologue &prologue, dw_offset_t line_offset, dw_offset_t unit_offset)
static Symbol * fixupExternalAddrZeroVariable(SymbolFileDWARFDebugMap &debug_map_symfile, llvm::StringRef name, DWARFExpressionList &expr_list, const DWARFDIE &die)
Global variables that are not initialized may have their address set to zero.
static std::optional< uint64_t > GetDWOId(DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die)
Return the DW_AT_(GNU_)dwo_id.
static std::optional< std::string > GetFileByIndex(const llvm::DWARFDebugLine::Prologue &prologue, size_t idx, llvm::StringRef compile_dir, FileSpec::Style style)
static FileSpecList ParseSupportFilesFromPrologue(const lldb::ModuleSP &module, const llvm::DWARFDebugLine::Prologue &prologue, FileSpec::Style style, llvm::StringRef compile_dir={})
static const llvm::DWARFDebugLine::LineTable * ParseLLVMLineTable(lldb_private::DWARFContext &context, llvm::DWARFDebugLine &line, dw_offset_t line_offset, dw_offset_t unit_offset)
static DWARFExpressionList GetExprListFromAtLocation(DWARFFormValue form_value, ModuleSP module, const DWARFDIE &die, const addr_t func_low_pc)
Creates a DWARFExpressionList from an DW_AT_location form_value.
static const char * GetDWOName(DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die)
Return the DW_AT_(GNU_)dwo_name.
#define DIE_IS_BEING_PARSED
#define ASSERT_MODULE_LOCK(expr)
#define LLDB_SCOPED_TIMER()
#define LLDB_SCOPED_TIMERF(...)
Identifies a DWARF debug info entry within a given Module.
static constexpr uint64_t k_file_index_mask
std::optional< uint32_t > file_index() const
dw_offset_t die_offset() const
lldb_private::ClangASTImporter & GetClangASTImporter()
virtual lldb_private::Function * ParseFunctionFromDWARF(lldb_private::CompileUnit &comp_unit, const DWARFDIE &die, const lldb_private::AddressRange &range)=0
virtual lldb_private::ConstString GetDIEClassTemplateParams(const DWARFDIE &die)=0
virtual void EnsureAllDIEsInDeclContextHaveBeenParsed(lldb_private::CompilerDeclContext decl_context)=0
virtual lldb_private::ConstString ConstructDemangledNameFromDWARF(const DWARFDIE &die)=0
virtual lldb::TypeSP ParseTypeFromDWARF(const lldb_private::SymbolContext &sc, const DWARFDIE &die, bool *type_is_new_ptr)=0
virtual lldb_private::CompilerDeclContext GetDeclContextForUIDFromDWARF(const DWARFDIE &die)=0
static std::optional< lldb_private::SymbolFile::ArrayInfo > ParseChildArrayInfo(const DWARFDIE &parent_die, const lldb_private::ExecutionContext *exe_ctx=nullptr)
dw_attr_t AttributeAtIndex(uint32_t i) const
DWARFUnit * CompileUnitAtIndex(uint32_t i) const
bool ExtractFormValueAtIndex(uint32_t i, DWARFFormValue &form_value) const
DWARFAttributes GetAttributes(Recurse recurse=Recurse::yes) const
const char * GetTagAsCString() const
DWARFDebugInfoEntry * GetDIE() const
const lldb_private::DWARFDataExtractor & GetData() const
const char * GetAttributeValueAsString(const dw_attr_t attr, const char *fail_value) const
DWARFUnit * GetCU() const
std::optional< DIERef > GetDIERef() const
lldb::ModuleSP GetModule() const
SymbolFileDWARF * GetDWARF() const
bool Supports_DW_AT_APPLE_objc_complete_type() const
const char * GetName() const
uint64_t GetAttributeValueAsUnsigned(const dw_attr_t attr, uint64_t fail_value) const
dw_offset_t GetOffset() const
lldb::user_id_t GetID() const
DWARFDIE LookupAddress(const dw_addr_t address)
DWARFCompileUnit & GetNonSkeletonUnit()
std::vector< DWARFDIE > GetDeclContextDIEs() const
void GetName(lldb_private::Stream &s) const
DWARFDIE GetFirstChild() const
DWARFDIE GetParent() const
void GetDeclContext(llvm::SmallVectorImpl< lldb_private::CompilerContext > &context) const
Return this DIE's decl context as it is needed to look up types in Clang's -gmodules debug info forma...
const char * GetMangledName() const
DWARFDIE GetDIE(dw_offset_t die_offset) const
llvm::iterator_range< child_iterator > children() const
The range of all the children of this DIE.
DWARFDIE LookupDeepestBlock(lldb::addr_t file_addr) const
DWARFDIE GetReferencedDIE(const dw_attr_t attr) const
bool GetDIENamesAndRanges(const char *&name, const char *&mangled, DWARFRangeList &ranges, std::optional< int > &decl_file, std::optional< int > &decl_line, std::optional< int > &decl_column, std::optional< int > &call_file, std::optional< int > &call_line, std::optional< int > &call_column, lldb_private::DWARFExpressionList *frame_base) const
const char * GetPubname() const
DWARFDIE GetSibling() const
void GetUnsupportedForms(std::set< dw_form_t > &invalid_forms) const
dw_offset_t FindAddress(dw_addr_t address) const
DWARFDebugInfoEntry objects assume that they are living in one big vector and do pointer arithmetic o...
std::optional< uint64_t > GetAttributeValueAsOptionalUnsigned(const DWARFUnit *cu, const dw_attr_t attr, bool check_specification_or_abstract_origin=false) const
dw_offset_t GetOffset() const
const char * GetAttributeValueAsString(const DWARFUnit *cu, const dw_attr_t attr, const char *fail_value, bool check_specification_or_abstract_origin=false) const
DWARFDebugInfoEntry * GetParent()
DWARFUnit * GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset, uint32_t *idx_ptr=nullptr)
const DWARFDebugAranges & GetCompileUnitAranges()
DWARFDIE GetDIE(const DIERef &die_ref)
DWARFUnit * GetUnitAtIndex(size_t idx)
static void ReadMacroEntries(const lldb_private::DWARFDataExtractor &debug_macro_data, const lldb_private::DWARFDataExtractor &debug_str_data, const bool offset_is_64_bit, lldb::offset_t *sect_offset, SymbolFileDWARF *sym_file_dwarf, lldb_private::DebugMacrosSP &debug_macros_sp)
const char * GetQualifiedName() const
lldb_private::ConstString GetQualifiedNameAsConstString() const
SymbolFileDWARFDwo * GetDwoSymbolFile()
std::optional< uint64_t > GetLoclistOffset(uint32_t Index)
void * GetUserData() const
lldb_private::FileSpec::Style GetPathStyle()
SymbolFileDWARF & GetSymbolFileDWARF() const
void ExtractUnitDIEIfNeeded()
void SetDwoError(const lldb_private::Status &error)
Set the fission .dwo file specific error for this compile unit.
dw_offset_t GetLineTableOffset()
bool Supports_DW_AT_APPLE_objc_complete_type()
DWARFBaseDIE GetUnitDIEOnly()
uint16_t GetVersion() const
const lldb_private::Status & GetDwoError() const
Get the fission .dwo file specific error for this compile unit.
void SetUserData(void *d)
lldb_private::DWARFDataExtractor GetLocationData() const
uint8_t GetAddressByteSize() const
uint64_t GetDWARFLanguageType()
DWARFUnit & GetNonSkeletonUnit()
DWARFDIE GetDIE(dw_offset_t die_offset)
die_iterator_range dies()
lldb::ByteOrder GetByteOrder() const
const lldb_private::FileSpec & GetCompilationDirectory()
std::optional< uint64_t > GetDWOId()
bool HasAny(llvm::ArrayRef< dw_tag_t > tags)
Returns true if any DIEs in the unit match any DW_TAG values in tags.
lldb_private::FileSpec GetFile(size_t file_idx)
dw_offset_t GetOffset() const
lldb::CompUnitSP GetCompileUnit(SymbolFileDWARF *oso_dwarf, DWARFCompileUnit &dwarf_cu)
Returns the compile unit associated with the dwarf compile unit.
bool Supports_DW_AT_APPLE_objc_complete_type(SymbolFileDWARF *skip_dwarf_oso)
UniqueDWARFASTTypeMap & GetUniqueDWARFASTTypeMap()
lldb::addr_t LinkOSOFileAddress(SymbolFileDWARF *oso_symfile, lldb::addr_t oso_file_addr)
Convert a .o file "file address" to an executable "file address".
bool LinkOSOAddress(lldb_private::Address &addr)
Convert addr from a .o file address, to an executable address.
lldb_private::CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
static lldb_private::CompilerDeclContext GetContainingDeclContext(const DWARFDIE &die)
virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, lldb_private::ConstString type_name, bool must_be_implementation)
static bool SupportedVersion(uint16_t version)
std::optional< uint32_t > GetDWARFUnitIndex(uint32_t cu_idx)
virtual DIEToVariableSP & GetDIEToVariable()
llvm::DenseMap< const DWARFDebugInfoEntry *, lldb::VariableSP > DIEToVariableSP
lldb_private::CompileUnit * GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu)
DWARFDebugRanges * GetDebugRanges()
void BuildCuTranslationTable()
size_t ParseVariablesForContext(const lldb_private::SymbolContext &sc) override
DWARFDIE FindBlockContainingSpecification(const DIERef &func_die_ref, dw_offset_t spec_block_die_offset)
void Dump(lldb_private::Stream &s) override
size_t ParseVariablesInFunctionContext(const lldb_private::SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
bool HasForwardDeclForClangType(const lldb_private::CompilerType &compiler_type)
void UpdateExternalModuleListIfNeeded()
DebugMacrosMap m_debug_macros_map
static DWARFASTParser * GetDWARFParser(DWARFUnit &unit)
bool Supports_DW_AT_APPLE_objc_complete_type(DWARFUnit *cu)
static lldb::LanguageType GetLanguageFamily(DWARFUnit &unit)
Same as GetLanguage() but reports all C++ versions as C++ (no version).
const lldb_private::FileSpecList & GetTypeUnitSupportFiles(DWARFTypeUnit &tu)
bool ResolveFunction(const DWARFDIE &die, bool include_inlines, lldb_private::SymbolContextList &sc_list)
static char ID
LLVM RTTI support.
size_t ParseVariablesInFunctionContextRecursive(const lldb_private::SymbolContext &sc, const DWARFDIE &die, lldb::addr_t func_low_pc, DIEArray &accumulator)
lldb_private::CompilerDeclContext FindNamespace(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, bool only_root_namespaces) override
Finds a namespace of name name and whose parent context is parent_decl_ctx.
static bool DIEInDeclContext(const lldb_private::CompilerDeclContext &parent_decl_ctx, const DWARFDIE &die, bool only_root_namespaces=false)
DWARFDebugAbbrev * DebugAbbrev()
lldb_private::Type * ResolveType(const DWARFDIE &die, bool assert_not_being_parsed=true, bool resolve_function_context=false)
ExternalTypeModuleMap m_external_type_modules
std::unique_ptr< DWARFDebugAbbrev > m_abbr
size_t PopulateBlockVariableList(lldb_private::VariableList &variable_list, const lldb_private::SymbolContext &sc, llvm::ArrayRef< DIERef > variable_dies, lldb::addr_t func_low_pc)
lldb_private::Function * ParseFunction(lldb_private::CompileUnit &comp_unit, const DWARFDIE &die)
lldb::ModuleSP GetExternalModule(lldb_private::ConstString name)
void InitializeFirstCodeAddressRecursive(const lldb_private::SectionList §ion_list)
const std::shared_ptr< SymbolFileDWARFDwo > & GetDwpSymbolFile()
size_t ParseFunctions(lldb_private::CompileUnit &comp_unit) override
std::recursive_mutex & GetModuleMutex() const override
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
virtual DWARFCompileUnit * GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit)
std::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.
lldb_private::RangeDataVector< lldb::addr_t, lldb::addr_t, lldb_private::Variable * > GlobalVariableMap
uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr, lldb::SymbolContextItem resolve_scope, lldb_private::SymbolContext &sc) override
bool CompleteType(lldb_private::CompilerType &compiler_type) override
GlobalVariableMap & GetGlobalAranges()
lldb::TypeSP GetTypeForDIE(const DWARFDIE &die, bool resolve_function_context=false)
NameToOffsetMap m_function_scope_qualified_name_map
bool ParseImportedModules(const lldb_private::SymbolContext &sc, std::vector< lldb_private::SourceModule > &imported_modules) override
size_t ParseBlocksRecursive(lldb_private::Function &func) override
lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override
lldb_private::ConstString ConstructFunctionDemangledName(const DWARFDIE &die)
std::unique_ptr< GlobalVariableMap > m_global_aranges_up
bool ForEachExternalModule(lldb_private::CompileUnit &, llvm::DenseSet< lldb_private::SymbolFile * > &, llvm::function_ref< bool(lldb_private::Module &)>) override
lldb_private::FileSpec GetFile(DWARFUnit &unit, size_t file_idx)
size_t ParseTypes(lldb_private::CompileUnit &comp_unit) override
virtual DWARFDIE GetDIE(const DIERef &die_ref)
SymbolFileDWARF(lldb::ObjectFileSP objfile_sp, lldb_private::SectionList *dwo_section_list)
void InitializeFirstCodeAddress()
bool DeclContextMatchesThisSymbolFile(const lldb_private::CompilerDeclContext &decl_ctx)
lldb::TypeSP ParseType(const lldb_private::SymbolContext &sc, const DWARFDIE &die, bool *type_is_new)
static lldb_private::CompilerDecl GetDecl(const DWARFDIE &die)
static void DebuggerInitialize(lldb_private::Debugger &debugger)
virtual void LoadSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data)
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
uint32_t CalculateNumCompileUnits() override
static llvm::StringRef GetPluginNameStatic()
llvm::DenseMap< dw_offset_t, lldb_private::FileSpecList > m_type_unit_support_files
lldb_private::Type * ResolveTypeUID(lldb::user_id_t type_uid) override
static lldb::LanguageType GetLanguage(DWARFUnit &unit)
bool ClassOrStructIsVirtual(const DWARFDIE &die)
std::shared_ptr< SymbolFileDWARFDwo > m_dwp_symfile
std::unique_ptr< DWARFDebugRanges > m_ranges
void FindGlobalVariables(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, lldb_private::VariableList &variables) override
bool GetFunction(const DWARFDIE &die, lldb_private::SymbolContext &sc)
static lldb_private::SymbolFile * CreateInstance(lldb::ObjectFileSP objfile_sp)
lldb_private::XcodeSDK ParseXcodeSDK(lldb_private::CompileUnit &comp_unit) override
Return the Xcode SDK comp_unit was compiled against.
lldb_private::StatsDuration m_parse_time
std::optional< uint64_t > GetDWOId()
If this is a DWARF object with a single CU, return its DW_AT_dwo_id.
uint32_t CalculateAbilities() override
SymbolFileDWARFDebugMap * GetDebugMapSymfile()
std::shared_ptr< SymbolFileDWARFDwo > GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die)
bool m_fetched_external_modules
lldb::addr_t m_first_code_address
DWARF does not provide a good way for traditional (concatenating) linkers to invalidate debug info de...
static DWARFDeclContext GetDWARFDeclContext(const DWARFDIE &die)
~SymbolFileDWARF() override
lldb_private::StatsDuration::Duration GetDebugInfoIndexTime() override
Return the time it took to index the debug information in the object file.
lldb_private::DWARFContext m_context
DWARFDebugInfo & DebugInfo()
lldb_private::Status CalculateFrameVariableError(lldb_private::StackFrame &frame) override
Subclasses will override this function to for GetFrameVariableError().
virtual lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(const DWARFDIE &die)
static llvm::StringRef GetPluginDescriptionStatic()
std::vector< std::unique_ptr< lldb_private::CallEdge > > CollectCallEdges(lldb::ModuleSP module, DWARFDIE function_die)
Parse call site entries (DW_TAG_call_site), including any nested call site parameters (DW_TAG_call_si...
DIEArray MergeBlockAbstractParameters(const DWARFDIE &block_die, DIEArray &&variable_dies)
DWARFDIE GetDeclContextDIEContainingDIE(const DWARFDIE &die)
void ResolveFunctionAndBlock(lldb::addr_t file_vm_addr, bool lookup_block, lldb_private::SymbolContext &sc)
Resolve functions and (possibly) blocks for the given file address and a compile unit.
llvm::once_flag m_info_once_flag
void InitializeObject() override
Initialize the SymbolFile object.
static llvm::Expected< lldb::TypeSystemSP > GetTypeSystem(DWARFUnit &unit)
std::vector< uint32_t > m_lldb_cu_to_dwarf_unit
lldb_private::Symbol * GetObjCClassSymbol(lldb_private::ConstString objc_class_name)
void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector< lldb_private::ConstString > &mangled_names) override
std::atomic_flag m_dwo_warning_issued
void PreloadSymbols() override
lldb::VariableSP ParseVariableDIE(const lldb_private::SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
lldb_private::TypeList & GetTypeList() override
std::unique_ptr< lldb_private::DWARFIndex > m_index
std::vector< std::unique_ptr< lldb_private::CallEdge > > ParseCallEdgesInFunction(lldb_private::UserID func_id) override
llvm::once_flag m_dwp_symfile_once_flag
lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit &dwarf_cu)
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override
llvm::SetVector< lldb_private::Type * > TypeSet
static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val)
void DumpClangAST(lldb_private::Stream &s) override
bool ParseSupportFiles(lldb_private::CompileUnit &comp_unit, lldb_private::FileSpecList &support_files) override
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die)
lldb::addr_t FixupAddress(lldb::addr_t file_addr)
If this symbol file is linked to by a debug map (see SymbolFileDWARFDebugMap), and file_addr is a fil...
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language) override
lldb_private::CompilerDecl GetDeclForUID(lldb::user_id_t uid) override
std::unique_ptr< DWARFDebugInfo > m_info
virtual void GetObjCMethods(lldb_private::ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback)
virtual DIEToTypePtr & GetDIEToType()
void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) override
lldb_private::CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
void ParseAndAppendGlobalVariable(const lldb_private::SymbolContext &sc, const DWARFDIE &die, lldb_private::VariableList &cc_variable_list)
virtual ClangTypeToDIE & GetForwardDeclClangTypeToDie()
lldb::ModuleWP m_debug_map_module_wp
lldb::VariableSP ParseVariableDIECached(const lldb_private::SymbolContext &sc, const DWARFDIE &die)
SymbolFileDWARFDebugMap * m_debug_map_symfile
bool ParseLineTable(lldb_private::CompileUnit &comp_unit) override
UniqueDWARFASTTypeMap m_unique_ast_type_map
void ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override
bool DIEDeclContextsMatch(const DWARFDIE &die1, const DWARFDIE &die2)
bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override
lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type
static lldb_private::CompilerDeclContext GetDeclContext(const DWARFDIE &die)
bool ParseIsOptimized(lldb_private::CompileUnit &comp_unit) override
virtual UniqueDWARFASTTypeMap & GetUniqueDWARFASTTypeMap()
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
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
void SetByteSize(lldb::addr_t byte_size)
Set accessor for the byte size of this range.
A section + offset based address class.
bool ResolveAddressUsingFileSections(lldb::addr_t addr, const SectionList *sections)
Resolve a file virtual address using a section list.
lldb::SectionSP GetSection() const
Get const accessor for the section.
void Clear()
Clear the object's state.
lldb::addr_t GetFileAddress() const
Get the file address.
lldb::addr_t GetOffset() const
Get the section relative offset value.
bool IsValid() const
Check if the object state is valid.
static std::unique_ptr< AppleDWARFIndex > Create(Module &module, DWARFDataExtractor apple_names, DWARFDataExtractor apple_namespaces, DWARFDataExtractor apple_types, DWARFDataExtractor apple_objc, DWARFDataExtractor debug_str)
A command line argument class.
A class that describes a single lexical block.
lldb::VariableListSP GetBlockVariableList(bool can_create)
Get the variable list for this block only.
Block * FindBlockByID(lldb::user_id_t block_id)
void SetVariableList(lldb::VariableListSP &variable_list_sp)
Set accessor for the variable list.
bool GetStartAddress(Address &addr)
void SetDidParseVariables(bool b, bool set_children)
void AddRange(const Range &range)
Add a new offset range to this block.
void AddChild(const lldb::BlockSP &child_block_sp)
Add a child to this object.
void SetInlinedFunctionInfo(const char *name, const char *mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr)
Set accessor for any inlined function information.
static bool ExtractContextAndIdentifier(const char *name, llvm::StringRef &context, llvm::StringRef &identifier)
bool CanImport(const CompilerType &type)
Returns true iff the given type was copied from another TypeSystemClang and the original type in this...
bool CompleteType(const CompilerType &compiler_type)
static bool LanguageSupportsClangModules(lldb::LanguageType language)
Query whether Clang supports modules for a particular language.
A class that describes a compilation unit.
void SetVariableList(lldb::VariableListSP &variable_list_sp)
Set accessor for the variable list.
lldb::VariableListSP GetVariableList(bool can_create)
Get the variable list for a compile unit.
void SetDebugMacros(const DebugMacrosSP &debug_macros)
void SetSupportFiles(const FileSpecList &support_files)
const FileSpec & GetPrimaryFile() const
Return the primary source file associated with this compile unit.
void ResolveSymbolContext(const SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list)
Resolve symbol contexts by file and line.
void SetLineTable(LineTable *line_table)
Set the line table for the compile unit.
lldb::FunctionSP FindFunctionByUID(lldb::user_id_t uid)
Finds a function by user ID.
const FileSpecList & GetSupportFiles()
Get the compile unit's support file list.
lldb::LanguageType GetLanguage()
LineTable * GetLineTable()
Get the line table for the compile unit.
Represents a generic declaration context in a program.
ConstString GetScopeQualifiedName() const
ConstString GetName() const
bool IsContainedInLookup(CompilerDeclContext other) const
Check if the given other decl context is contained in the lookup of this decl context (for example be...
TypeSystem * GetTypeSystem() const
void * GetOpaqueDeclContext() const
Represents a generic declaration such as a function declaration.
std::shared_ptr< TypeSystemType > dyn_cast_or_null()
Return a shared_ptr<TypeSystemType> if dyn_cast succeeds.
Generic representation of a type in a programming language.
TypeSystemSPWrapper GetTypeSystem() const
Accessors.
lldb::opaque_compiler_type_t GetOpaqueQualType() const
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
const DWARFDataExtractor & getOrLoadLineData()
const DWARFDataExtractor & getOrLoadStrData()
llvm::DWARFContext & GetAsLLVM()
const DWARFDataExtractor & getOrLoadRangesData()
const DWARFDataExtractor & getOrLoadAbbrevData()
const DWARFDataExtractor & getOrLoadMacroData()
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::addr_t func_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr, Value &result, Status *error_ptr) const
bool ContainsThreadLocalStorage() const
const DWARFExpression * GetAlwaysValidExpr() const
void SetModule(const lldb::ModuleSP &module)
bool IsValid() const
Return true if the location expression contains data.
void SetFuncFileAddress(lldb::addr_t func_file_addr)
bool LinkThreadLocalStorage(lldb::ModuleSP new_module_sp, std::function< lldb::addr_t(lldb::addr_t file_addr)> const &link_address_callback)
DWARFExpression * GetMutableExpressionAtAddress(lldb::addr_t func_load_addr=LLDB_INVALID_ADDRESS, lldb::addr_t load_addr=0)
"lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location expression and interprets it.
lldb::addr_t GetLocation_DW_OP_addr(const DWARFUnit *dwarf_cu, bool &error) const
Return the address specified by the first DW_OP_{addr, addrx, GNU_addr_index} in the operation stream...
void DumpLocation(Stream *s, lldb::DescriptionLevel level, ABI *abi) const