10#include "clang/Basic/ABI.h"
11#include "llvm/ADT/STLExtras.h"
12#include "llvm/ADT/StringExtras.h"
13#include "llvm/ADT/StringRef.h"
14#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
15#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
16#include "llvm/Support/Casting.h"
17#include "llvm/Support/Error.h"
18#include "llvm/Support/ErrorExtras.h"
19#include "llvm/Support/FileUtilities.h"
20#include "llvm/Support/FormatAdapters.h"
21#include "llvm/Support/Threading.h"
85#include "llvm/DebugInfo/DWARF/DWARFContext.h"
86#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
87#include "llvm/Demangle/Demangle.h"
88#include "llvm/Support/FileSystem.h"
89#include "llvm/Support/FormatVariadic.h"
101#ifdef ENABLE_DEBUG_PRINTF
103#define DEBUG_PRINTF(fmt, ...) printf(fmt, __VA_ARGS__)
105#define DEBUG_PRINTF(fmt, ...)
111using namespace llvm::dwarf;
119#define LLDB_PROPERTIES_symbolfiledwarf
120#include "SymbolFileDWARFProperties.inc"
123#define LLDB_PROPERTIES_symbolfiledwarf
124#include "SymbolFileDWARFPropertiesEnum.inc"
129 static llvm::StringRef GetSettingName() {
134 m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
135 m_collection_sp->Initialize(g_symbolfiledwarf_properties_def);
138 bool IgnoreFileIndexes()
const {
139 return GetPropertyAtIndexAs<bool>(ePropertyIgnoreIndexes,
false);
146 return Tag == llvm::dwarf::Tag::DW_TAG_class_type ||
147 Tag == llvm::dwarf::Tag::DW_TAG_structure_type;
151 static PluginProperties g_settings;
155static const llvm::DWARFDebugLine::LineTable *
161 llvm::DWARFContext &ctx = context.
GetAsLLVM();
162 llvm::Expected<const llvm::DWARFDebugLine::LineTable *> line_table =
163 line.getOrParseLineTable(
164 data, line_offset, ctx,
nullptr, [&](llvm::Error e) {
167 "SymbolFileDWARF::ParseLineTable failed to parse: {0}");
172 "SymbolFileDWARF::ParseLineTable failed to parse: {0}");
179 llvm::DWARFDebugLine::Prologue &prologue,
185 llvm::DWARFContext &ctx = context.
GetAsLLVM();
186 uint64_t offset = line_offset;
187 llvm::Error
error = prologue.parse(
192 "SymbolFileDWARF::ParseSupportFiles failed to parse "
193 "line table prologue: {0}");
198 "SymbolFileDWARF::ParseSupportFiles failed to parse line "
199 "table prologue: {0}");
205static std::optional<std::string>
209 std::string abs_path;
210 auto absolute = llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath;
211 if (prologue.getFileNameByIndex(idx, compile_dir, absolute, abs_path, style))
212 return std::move(abs_path);
215 std::string rel_path;
216 auto relative = llvm::DILineInfoSpecifier::FileLineInfoKind::RawValue;
217 if (!prologue.getFileNameByIndex(idx, compile_dir, relative, rel_path, style))
219 return std::move(rel_path);
225 llvm::StringRef compile_dir = {}) {
228 if (prologue.FileNames.empty())
232 const bool is_one_based = prologue.getVersion() < 5;
233 const size_t file_names = prologue.FileNames.size();
234 const size_t first_file_idx = is_one_based ? 1 : 0;
235 const size_t last_file_idx = is_one_based ? file_names : file_names - 1;
242 for (
size_t idx = first_file_idx; idx <= last_file_idx; ++idx) {
243 std::string remapped_file;
244 if (
auto file_path =
GetFileByIndex(prologue, idx, compile_dir, style)) {
245 auto entry = prologue.getFileNameEntry(idx);
246 auto source = entry.Source.getAsCString();
248 consumeError(source.takeError());
250 llvm::StringRef source_ref(*source);
251 if (!source_ref.empty()) {
255 LazyDWARFSourceFile(
const FileSpec &fs, llvm::StringRef source,
256 FileSpec::Style style)
257 : SupportFile(fs), source(source), style(style) {}
260 llvm::StringRef source;
262 std::unique_ptr<llvm::FileRemover> remover;
263 FileSpec::Style style;
269 llvm::SmallString<0> name;
272 auto ec = llvm::sys::fs::createTemporaryFile(
273 "", llvm::sys::path::filename(orig_name, style), fd, name);
276 "Could not create temporary file");
279 remover = std::make_unique<llvm::FileRemover>(name);
281 size_t num_bytes = source.size();
282 file.Write(source.data(), num_bytes);
287 support_files.
Append(std::make_unique<LazyDWARFSourceFile>(
288 FileSpec(*file_path), *source, style));
292 if (
auto remapped = module->RemapSourceFile(llvm::StringRef(*file_path)))
293 remapped_file = *remapped;
295 remapped_file = std::move(*file_path);
299 if (prologue.ContentTypes.HasMD5) {
300 const llvm::DWARFDebugLine::FileNameEntry &file_name_entry =
301 prologue.getFileNameEntry(idx);
302 checksum = file_name_entry.
Checksum;
320 debugger, PluginProperties::GetSettingName())) {
321 const bool is_global_setting =
true;
324 "Properties for the dwarf symbol-file plug-in.", is_global_setting);
335 return "DWARF and DWARF3 debug symbol file reader.";
339 if (objfile_sp->GetArchitecture().GetTriple().isWasm())
349 return debug_map_symfile->GetTypeList();
358 if (die_offset >= max_die_offset)
361 if (die_offset >= min_die_offset) {
364 bool add_type =
false;
367 case DW_TAG_array_type:
368 add_type = (type_mask & eTypeClassArray) != 0;
370 case DW_TAG_unspecified_type:
371 case DW_TAG_base_type:
372 add_type = (type_mask & eTypeClassBuiltin) != 0;
374 case DW_TAG_class_type:
375 add_type = (type_mask & eTypeClassClass) != 0;
377 case DW_TAG_structure_type:
378 add_type = (type_mask & eTypeClassStruct) != 0;
380 case DW_TAG_union_type:
381 add_type = (type_mask & eTypeClassUnion) != 0;
383 case DW_TAG_enumeration_type:
384 add_type = (type_mask & eTypeClassEnumeration) != 0;
386 case DW_TAG_subroutine_type:
387 case DW_TAG_subprogram:
388 case DW_TAG_inlined_subroutine:
389 add_type = (type_mask & eTypeClassFunction) != 0;
391 case DW_TAG_pointer_type:
392 add_type = (type_mask & eTypeClassPointer) != 0;
394 case DW_TAG_rvalue_reference_type:
395 case DW_TAG_reference_type:
396 add_type = (type_mask & eTypeClassReference) != 0;
399 add_type = (type_mask & eTypeClassTypedef) != 0;
401 case DW_TAG_ptr_to_member_type:
402 add_type = (type_mask & eTypeClassMemberPointer) != 0;
409 const bool assert_not_being_parsed =
true;
412 type_set.insert(type);
417 GetTypes(child_die, min_die_offset, max_die_offset, type_mask, type_set);
423 TypeClass type_mask,
TypeList &type_list)
436 unit = &unit->GetNonSkeletonUnit();
437 GetTypes(unit->DIE(), unit->GetOffset(), unit->GetNextUnitOffset(),
438 type_mask, type_set);
445 for (
size_t cu_idx = 0; cu_idx < num_cus; ++cu_idx)
449 std::set<CompilerType> compiler_type_set;
450 for (
Type *type : type_set) {
451 CompilerType compiler_type = type->GetForwardCompilerType();
452 if (compiler_type_set.find(compiler_type) == compiler_type_set.end()) {
453 compiler_type_set.insert(compiler_type);
454 type_list.
Insert(type->shared_from_this());
468 case DW_TAG_compile_unit:
469 case DW_TAG_partial_unit:
470 case DW_TAG_subprogram:
471 case DW_TAG_inlined_subroutine:
472 case DW_TAG_lexical_block:
491 static ConstString g_dwarf_section_name(
"__DWARF");
492 return g_dwarf_section_name;
495llvm::DenseMap<const DWARFDebugInfoEntry *, Type *> &
498 return debug_map_symfile->GetDIEToType();
502llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> &
505 return debug_map_symfile->GetForwardDeclCompilerTypeToDIE();
511 if (debug_map_symfile)
517llvm::Expected<lldb::TypeSystemSP>
520 return debug_map_symfile->GetTypeSystemForLanguage(language);
543 *
GetObjectFile()->GetModule(), apple_names, apple_namespaces,
544 apple_types, apple_objc,
m_context.getOrLoadStrData());
554 llvm::Expected<std::unique_ptr<DebugNamesDWARFIndex>> index_or =
559 m_index = std::move(*index_or);
563 "Unable to read .debug_names data: {0}");
568 std::make_unique<ManualDWARFIndex>(*
GetObjectFile()->GetModule(), *
this);
580 for (
SectionSP section_sp : section_list) {
581 if (section_sp->GetChildren().GetSize() > 0) {
591 return version >= 2 && version <= 5;
594static std::set<dw_form_t>
599 std::set<dw_form_t> unsupported_forms;
600 for (
const auto &[_, decl_set] : *debug_abbrev)
601 for (
const auto &decl : decl_set)
602 for (
const auto &attr : decl.attributes())
604 unsupported_forms.insert(attr.Form);
606 return unsupported_forms;
610 uint32_t abilities = 0;
612 const Section *section =
nullptr;
614 if (section_list ==
nullptr)
617 uint64_t debug_abbrev_file_size = 0;
618 uint64_t debug_info_file_size = 0;
619 uint64_t debug_line_file_size = 0;
628 if (section !=
nullptr) {
639 if (!unsupported_forms.empty()) {
641 error.Printf(
"unsupported DW_FORM value%s:",
642 unsupported_forms.size() > 1 ?
"s" :
"");
643 for (
auto form : unsupported_forms)
644 error.Printf(
" %#x", form);
655 llvm::StringRef symfile_dir =
656 m_objfile_sp->GetFileSpec().GetDirectory().GetStringRef();
657 if (symfile_dir.contains_insensitive(
".dsym")) {
668 "empty dSYM file detected, dSYM was created with an "
669 "executable with no debug info");
676 if (debug_info_file_size >= MaxDebugInfoSize) {
678 "SymbolFileDWARF can't load this DWARF. It's larger then {0:x+16}",
683 if (debug_abbrev_file_size > 0 && debug_info_file_size > 0)
687 if (debug_line_file_size > 0)
696 const SectionList *section_list = module_sp->GetSectionList();
718 std::make_unique<llvm::DWARFDebugAbbrev>(debug_abbrev_data.
GetAsLLVM());
719 llvm::Error
error = abbr->parse();
723 "Unable to read .debug_abbrev section: {0}");
750 return llvm::cast_or_null<DWARFCompileUnit>(dwarf_cu);
764 if (
auto remapped_file = module_sp->RemapSourceFile(file_spec.
GetPath()))
765 file_spec.
SetFile(*remapped_file, FileSpec::Style::native);
771 const char *dwo_name =
784 cu_sp = comp_unit->shared_from_this();
797 cu_sp = std::make_shared<CompileUnit>(
798 module_sp, &dwarf_cu, support_file_nsp,
807 auto lazy_initialize_cu = [&]() {
829 if (support_files.
GetSize() == 0)
836 if (!lazy_initialize_cu()) {
850 initialize_cu(std::make_shared<SupportFile>(cu_file_spec),
869 for (uint32_t i = 0, num = info.
GetNumUnits(); i < num; ++i) {
870 if (
auto *cu = llvm::dyn_cast<DWARFCompileUnit>(info.
GetUnitAtIndex(i))) {
895 if (
auto *dwarf_cu = llvm::cast_or_null<DWARFCompileUnit>(
910 if (
auto err = type_system_or_err.takeError()) {
911 LLDB_LOG_ERROR(log, std::move(err),
"Unable to parse function: {0}");
914 auto ts = *type_system_or_err;
923 if (llvm::Expected<llvm::DWARFAddressRangesVector> die_ranges =
924 die.
GetDIE()->GetAttributeAddressRanges(die.
GetCU(),
926 for (
const auto &range : *die_ranges) {
929 if (
Address base_addr(range.LowPC, module_sp->GetSectionList());
931 ranges.emplace_back(std::move(base_addr), range.HighPC - range.LowPC);
950 if (
auto err = type_system_or_err.takeError()) {
952 "Unable to construct demangled name for function: {0}");
956 auto ts = *type_system_or_err;
970 if (debug_map_symfile)
977 if (debug_map_symfile) {
1003 llvm::StringRef sysroot =
1008 if (!sysroot.starts_with(
"/Library/Developer/CommandLineTools/SDKs")) {
1015 module_sp->RegisterXcodeSDK(sdk, sysroot);
1018 if (local_module_sp && local_module_sp != module_sp)
1019 local_module_sp->RegisterXcodeSDK(sdk, sysroot);
1032 size_t functions_added = 0;
1035 if (entry.Tag() != DW_TAG_subprogram)
1045 return functions_added;
1050 llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files,
1051 llvm::function_ref<
bool(
Module &)> lambda) {
1053 if (!visited_symbol_files.insert(
this).second)
1063 if (lambda(*module))
1066 for (std::size_t i = 0; i < module->GetNumCompileUnits(); ++i) {
1067 auto cu =
module->GetCompileUnitAtIndex(i);
1068 bool early_exit = cu->ForEachExternalModule(visited_symbol_files, lambda);
1098 llvm::DWARFDebugLine::Prologue prologue;
1110 if (
auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(&unit)) {
1112 return lldb_cu->GetSupportFiles().GetFileSpecAtIndex(file_idx);
1116 auto &tu = llvm::cast<DWARFTypeUnit>(unit);
1128 offset == llvm::DenseMapInfo<dw_offset_t>::getEmptyKey())
1134 std::unique_ptr<SupportFileList> &list = iter_bool.first->second;
1135 if (iter_bool.second) {
1136 list = std::make_unique<SupportFileList>();
1137 uint64_t line_table_offset = offset;
1138 llvm::DWARFDataExtractor data =
1139 m_context.getOrLoadLineData().GetAsLLVMDWARF();
1140 llvm::DWARFContext &ctx =
m_context.GetAsLLVM();
1141 llvm::DWARFDebugLine::Prologue prologue;
1142 auto report = [](llvm::Error
error) {
1145 "SymbolFileDWARF::GetTypeUnitSupportFiles failed to parse "
1146 "the line table prologue: {0}");
1149 llvm::Error
error = prologue.parse(data, &line_table_offset, report, ctx);
1151 report(std::move(
error));
1169 std::vector<SourceModule> &imported_modules) {
1185 if (child_die.Tag() != DW_TAG_imported_declaration)
1188 DWARFDIE module_die = child_die.GetReferencedDIE(DW_AT_import);
1189 if (module_die.
Tag() != DW_TAG_module)
1192 if (
const char *name =
1195 module.path.push_back(ConstString(name));
1198 DW_AT_LLVM_include_path,
nullptr);
1200 while ((parent_die = parent_die.
GetParent())) {
1201 if (parent_die.
Tag() != DW_TAG_module)
1203 if (
const char *name =
1205 module.path.push_back(ConstString(name));
1212 DW_AT_LLVM_include_path,
nullptr);
1214 std::reverse(module.
path.begin(), module.
path.end());
1219 module.search_path = ConstString(include_spec.GetPath());
1222 DW_AT_LLVM_sysroot,
nullptr))
1223 module.sysroot = ConstString(sysroot);
1224 imported_modules.push_back(module);
1244 llvm::DWARFDebugLine line;
1245 const llvm::DWARFDebugLine::LineTable *line_table =
1254 std::vector<LineTable::Sequence> sequences;
1257 for (
const llvm::DWARFDebugLine::Sequence &seq : line_table->Sequences) {
1265 for (
unsigned idx = seq.FirstRowIndex; idx < seq.LastRowIndex; ++idx) {
1266 const llvm::DWARFDebugLine::Row &row = line_table->Rows[idx];
1268 sequence, row.Address.Address, row.Line, row.Column, row.File,
1269 row.IsStmt, row.BasicBlock, row.PrologueEnd, row.EpilogueBegin,
1272 sequences.push_back(std::move(sequence));
1275 std::unique_ptr<LineTable> line_table_up =
1276 std::make_unique<LineTable>(&comp_unit, std::move(sequences));
1283 debug_map_symfile->LinkOSOLineTable(
this, line_table_up.get()));
1295 return iter->second;
1309 offset,
this, debug_macros_sp);
1311 return debug_macros_sp;
1318 if (dwarf_cu ==
nullptr)
1340 addr_t function_file_addr) {
1341 size_t blocks_added = 0;
1345 if (tag != DW_TAG_inlined_subroutine && tag != DW_TAG_lexical_block)
1349 llvm::DWARFAddressRangesVector ranges;
1350 const char *name =
nullptr;
1351 const char *mangled_name =
nullptr;
1353 std::optional<int> decl_file;
1354 std::optional<int> decl_line;
1355 std::optional<int> decl_column;
1356 std::optional<int> call_file;
1357 std::optional<int> call_line;
1358 std::optional<int> call_column;
1360 decl_line, decl_column, call_file, call_line,
1361 call_column,
nullptr)) {
1362 for (
const llvm::DWARFAddressRange &range : ranges) {
1365 range.HighPC - range.LowPC));
1369 if (tag != DW_TAG_subprogram &&
1370 (name !=
nullptr || mangled_name !=
nullptr)) {
1371 std::unique_ptr<Declaration> decl_up;
1372 if (decl_file || decl_line || decl_column)
1373 decl_up = std::make_unique<Declaration>(
1375 decl_file.value_or(0)),
1376 decl_line.value_or(0), decl_column.value_or(0));
1378 std::unique_ptr<Declaration> call_up;
1379 if (call_file || call_line || call_column)
1380 call_up = std::make_unique<Declaration>(
1382 call_file.value_or(0)),
1383 call_line.value_or(0), call_column.value_or(0));
1397 return blocks_added;
1404 bool check_virtuality =
false;
1406 case DW_TAG_inheritance:
1407 case DW_TAG_subprogram:
1408 check_virtuality =
true;
1413 if (check_virtuality) {
1414 if (die.GetAttributeValueAsUnsigned(DW_AT_virtuality, 0) != 0)
1424 if (type_system !=
nullptr)
1468std::vector<CompilerContext>
1475 return die.GetDeclContext();
1485 return type_die.ResolveType();
1496 return std::nullopt;
1504 bool assert_not_being_parsed) {
1510 "SymbolFileDWARF::ResolveTypeUID (die = {0:x16}) {1} ({2}) '{3}'",
1520 switch (decl_ctx_die.
Tag()) {
1521 case DW_TAG_structure_type:
1522 case DW_TAG_union_type:
1523 case DW_TAG_class_type: {
1528 "SymbolFileDWARF::ResolveTypeUID (die = {0:x16}) {1} ({2}) "
1529 "'{3}' resolve parent forward type for {4:x16})",
1556 if (!clang_type_system)
1559 llvm::cast<DWARFASTParserClang>(clang_type_system->GetDWARFParser());
1560 return ast_parser->GetClangASTImporter().CanImport(compiler_type);
1566 if (clang_type_system) {
1568 llvm::cast<DWARFASTParserClang>(clang_type_system->GetDWARFParser());
1570 ast_parser->GetClangASTImporter().CanImport(compiler_type))
1571 return ast_parser->GetClangASTImporter().CompleteType(compiler_type);
1592 if (debug_map_symfile) {
1610 if (decl_die != def_die) {
1612 auto *ast_parser = llvm::cast<DWARFASTParserClang>(dwarf_ast);
1613 ast_parser->MapDeclDIEToDefDIE(decl_die, def_die);
1619 log,
"{0:x8}: {1} ({2}) '{3}' resolving forward declaration...",
1622 assert(compiler_type);
1627 bool assert_not_being_parsed,
1628 bool resolve_function_context) {
1632 if (assert_not_being_parsed) {
1637 "Parsing a die that is being parsed die: {0:x16}: {1} ({2}) {3}",
1668 m_index->GetObjCMethods(class_name, callback);
1674 if (die && llvm::isa<DWARFCompileUnit>(die.
GetCU())) {
1709 std::optional<uint32_t> file_index = die_ref.
file_index();
1720 return debug_map->GetSymbolFileByOSOIndex(*file_index);
1751 std::optional<uint64_t> dwo_id =
1763 return ::GetDWOId(*cu, *cu_die);
1772std::shared_ptr<SymbolFileDWARFDwo>
1786 if (!dwarf_cu || !dwarf_cu->
GetDWOId().has_value())
1789 const char *dwo_name =
GetDWOName(*dwarf_cu, cu_die);
1792 "missing DWO name in skeleton DIE {0:x16}", cu_die.
GetOffset()));
1805 size_t num_search_paths = debug_file_search_paths.
GetSize();
1811 const char *comp_dir =
1816 dwo_file.
SetFile(comp_dir, FileSpec::Style::native);
1827 FileSpec relative_to_binary = dwo_file;
1829 m_objfile_sp->GetFileSpec().GetDirectory().GetStringRef());
1832 dwo_paths.
Append(relative_to_binary);
1835 for (
size_t idx = 0; idx < num_search_paths; ++idx) {
1843 dwo_paths.
Append(dirspec);
1846 size_t num_possible = dwo_paths.
GetSize();
1847 for (
size_t idx = 0; idx < num_possible && !found; ++idx) {
1850 dwo_file = dwo_spec;
1858 "unable to locate relative .dwo debug file \"%s\" for "
1859 "skeleton DIE 0x%016" PRIx64
" without valid DW_AT_comp_dir "
1870 llvm::StringRef filename_only = dwo_name_spec.
GetFilename();
1873 m_objfile_sp->GetFileSpec().GetDirectory().GetStringRef());
1877 FileSpec dwo_name_binary_directory(binary_directory);
1879 dwo_paths.
Append(dwo_name_binary_directory);
1882 FileSpec filename_binary_directory(binary_directory);
1884 dwo_paths.
Append(filename_binary_directory);
1886 for (
size_t idx = 0; idx < num_search_paths; ++idx) {
1892 FileSpec dwo_name_dirspec(dirspec);
1894 dwo_paths.
Append(dwo_name_dirspec);
1896 FileSpec filename_dirspec(dirspec);
1898 dwo_paths.
Append(filename_dirspec);
1901 size_t num_possible = dwo_paths.
GetSize();
1902 for (
size_t idx = 0; idx < num_possible && !found; ++idx) {
1905 dwo_file = dwo_spec;
1914 if (error_dwo_path.
IsRelative() && comp_dir !=
nullptr) {
1919 "unable to locate .dwo debug file \"{0}\" for skeleton DIE "
1925 "unable to locate separate debug file (dwo, dwp). Debugging will be "
1937 dwo_file_data_offset);
1938 if (dwo_obj_file ==
nullptr) {
1940 "unable to load object file for .dwo debug file \"{0}\" for "
1946 return std::make_shared<SymbolFileDWARFDwo>(*
this, dwo_obj_file,
1958 for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
1960 llvm::dyn_cast<DWARFCompileUnit>(debug_info.
GetUnitAtIndex(cu_idx));
1984 const char *comp_dir =
1988 FileSpec::Style::native);
2008 if (
m_objfile_sp->GetFileSpec().GetFileNameExtension() ==
".dwo" &&
2021 "{0}",
error.AsCString(
"unknown error"));
2023 "unable to locate module needed for external types.\n"
2024 "Debugging will be degraded due to missing types. Rebuilding the "
2025 "project will regenerate the needed module files");
2036 llvm::dyn_cast_or_null<SymbolFileDWARF>(module_sp->GetSymbolFile());
2039 std::optional<uint64_t> dwo_dwo_id = dwo_symfile->GetDWOId();
2043 if (dwo_id != dwo_dwo_id) {
2045 "module {0} is out-of-date (hash mismatch).\n"
2046 "Type information from this module may be incomplete or inconsistent "
2047 "with the rest of the program. Rebuilding the project will "
2048 "regenerate the needed module files",
2060 const size_t num_cus = module_sp->GetNumCompileUnits();
2061 for (
size_t i = 0; i < num_cus; ++i) {
2062 CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(i);
2066 const size_t num_globals = globals_sp->GetSize();
2067 for (
size_t g = 0; g < num_globals; ++g) {
2068 VariableSP var_sp = globals_sp->GetVariableAtIndex(g);
2069 if (var_sp && !var_sp->GetLocationIsConstantValueData()) {
2071 var_sp->LocationExpressionList();
2073 llvm::Expected<Value> location_result = location.
Evaluate(
2075 if (location_result) {
2076 if (location_result->GetValueType() ==
2079 location_result->GetScalar().ULongLong();
2081 if (var_sp->GetType())
2082 byte_size = llvm::expectedToOptional(
2083 var_sp->GetType()->GetByteSize(
nullptr))
2086 file_addr, byte_size, var_sp.get()));
2090 location_result.takeError(),
2091 "location expression failed to execute: {0}");
2132 SymbolContextItem resolve_scope,
2136 "ResolveSymbolContext (so_addr = { "
2137 "section = %p, offset = 0x%" PRIx64
2138 " }, resolve_scope = 0x%8.8x)",
2139 static_cast<void *
>(so_addr.
GetSection().get()),
2141 uint32_t resolved = 0;
2143 (eSymbolContextCompUnit | eSymbolContextFunction | eSymbolContextBlock |
2144 eSymbolContextLineEntry | eSymbolContextVariable)) {
2156 if (resolve_scope & eSymbolContextVariable) {
2159 map.FindEntryThatContains(file_vm_addr);
2160 if (entry && entry->data) {
2172 if (
auto *dwarf_cu = llvm::dyn_cast_or_null<DWARFCompileUnit>(
2177 resolved |= eSymbolContextCompUnit;
2179 bool force_check_line_table =
false;
2180 if (resolve_scope & (eSymbolContextFunction | eSymbolContextBlock)) {
2182 resolve_scope & eSymbolContextBlock, sc);
2184 resolved |= eSymbolContextFunction;
2192 force_check_line_table =
true;
2195 resolved |= eSymbolContextBlock;
2198 if ((resolve_scope & eSymbolContextLineEntry) ||
2199 force_check_line_table) {
2201 if (line_table !=
nullptr) {
2207 Address exe_so_addr(so_addr);
2211 resolved |= eSymbolContextLineEntry;
2217 if (force_check_line_table && !(resolved & eSymbolContextLineEntry)) {
2224 resolved &= ~eSymbolContextCompUnit;
2228 "{0:x16}: compile unit {1} failed to create a valid "
2229 "lldb_private::CompileUnit class",
2239 const SourceLocationSpec &src_location_spec,
2240 SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
2243 const uint32_t prev_size = sc_list.
GetSize();
2244 if (resolve_scope & eSymbolContextCompUnit) {
2253 if (check_inlines || file_spec_matches_cu_file_spec) {
2260 return sc_list.
GetSize() - prev_size;
2278 return module_sp->GetMutex();
2294 if (
auto err = type_system_or_err.takeError()) {
2296 "Unable to match namespace decl using TypeSystem: {0}");
2300 if (decl_ctx_type_system == type_system_or_err->get())
2308 log,
"Valid namespace does not match symbol file");
2322 "SymbolFileDWARF::FindGlobalVariables (name=\"{0}\", "
2323 "parent_decl_ctx={1:p}, max_matches={2}, variables)",
2324 name.
GetCString(),
static_cast<const void *
>(&parent_decl_ctx),
2331 const uint32_t original_size = variables.
GetSize();
2333 llvm::StringRef basename;
2334 llvm::StringRef context;
2344 uint32_t pruned_idx = original_size;
2352 if (die.
Tag() != DW_TAG_variable && die.
Tag() != DW_TAG_member)
2355 auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(die.
GetCU());
2360 if (parent_decl_ctx) {
2363 dwarf_ast->GetDeclContextContainingUIDFromDWARF(die);
2369 if (!actual_parent_decl_ctx ||
2370 (actual_parent_decl_ctx != parent_decl_ctx &&
2377 while (pruned_idx < variables.
GetSize()) {
2379 if (name_is_mangled ||
2380 var_sp->GetName().GetStringRef().contains(name.
GetStringRef()))
2386 if (variables.
GetSize() - original_size < max_matches)
2393 const uint32_t num_matches = variables.
GetSize() - original_size;
2394 if (log && num_matches > 0) {
2397 "SymbolFileDWARF::FindGlobalVariables (name=\"{0}\", "
2398 "parent_decl_ctx={1:p}, max_matches={2}, variables) => {3}",
2399 name.
GetCString(),
static_cast<const void *
>(&parent_decl_ctx),
2400 max_matches, num_matches);
2405 uint32_t max_matches,
2413 "SymbolFileDWARF::FindGlobalVariables (regex=\"{0}\", "
2414 "max_matches={1}, variables)",
2415 regex.
GetText().str().c_str(), max_matches);
2419 const uint32_t original_size = variables.
GetSize();
2434 if (variables.
GetSize() - original_size < max_matches)
2442 bool include_inlines,
2450 if (!(orig_die.
Tag() == DW_TAG_subprogram ||
2451 (include_inlines && orig_die.
Tag() == DW_TAG_inlined_subroutine)))
2456 if (die.
Tag() == DW_TAG_inlined_subroutine) {
2463 if (die.
Tag() == DW_TAG_subprogram)
2469 assert(die && die.
Tag() == DW_TAG_subprogram);
2475 if (sc.
block ==
nullptr)
2488 case clang::CXXCtorType::Ctor_Complete:
2490 case clang::CXXCtorType::Ctor_Base:
2492 case clang::CXXCtorType::Ctor_Unified:
2494 case clang::CXXCtorType::Ctor_CopyingClosure:
2495 case clang::CXXCtorType::Ctor_DefaultClosure:
2496 case clang::CXXCtorType::Ctor_Comdat:
2497 llvm_unreachable(
"Unexpected constructor kind.");
2499 llvm_unreachable(
"Fully covered switch above");
2504 case clang::CXXDtorType::Dtor_Deleting:
2506 case clang::CXXDtorType::Dtor_Complete:
2508 case clang::CXXDtorType::Dtor_Base:
2510 case clang::CXXDtorType::Dtor_Unified:
2512 case clang::CXXDtorType::Dtor_Comdat:
2513 case clang::CXXDtorType::Dtor_VectorDeleting:
2514 llvm_unreachable(
"Unexpected destructor kind.");
2516 llvm_unreachable(
"Fully covered switch above");
2519static llvm::StringRef
2521 const bool is_ctor = discriminator.consume_front(
"C");
2522 if (!is_ctor && !discriminator.consume_front(
"D"))
2525 uint64_t structor_kind;
2526 if (!llvm::to_integer(discriminator, structor_kind))
2530 if (structor_kind > clang::CXXCtorType::Ctor_Unified)
2534 static_cast<clang::CXXCtorType
>(structor_kind));
2537 if (structor_kind > clang::CXXDtorType::Dtor_Unified)
2543llvm::Expected<DWARFDIE>
2546 auto do_lookup = [
this](llvm::StringRef lookup_name) ->
DWARFDIE {
2549 ConstString(lookup_name), lldb::eFunctionNameTypeFull,
2553 if (entry.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_declaration, 0))
2569 return llvm::createStringError(
2570 "no definition DIE found in this SymbolFile");
2583 return subst_or_err.takeError();
2585 definition = do_lookup(*subst_or_err);
2588 return llvm::createStringError(
2589 "failed to find definition DIE for structor alias in fallback lookup");
2594llvm::Expected<SymbolContext>
2599 llvm::StringRef from = label.
discriminator[0] ==
'C' ?
"C4" :
"D4";
2602 if (variant.empty())
2603 return llvm::createStringError(
2604 "failed to get Itanium variant for discriminator");
2606 if (from == variant)
2607 return llvm::createStringError(
2608 "tried substituting unified structor variant into label");
2616 return llvm::joinErrors(
2617 llvm::createStringErrorV(
2618 "failed to substitute {0} for {1} in mangled name {2}:", from,
2620 subst_or_err.takeError());
2623 return llvm::createStringErrorV(
2624 "got invalid substituted mangled named (substituted "
2625 "{0} for {1} in mangled name {2})",
2633 return llvm::createStringErrorV(
"invalid DIE ID in {0}", label);
2640 return llvm::joinErrors(
2641 llvm::createStringError(
"failed to find definition DIE:"),
2642 die_or_err.takeError());
2644 die = std::move(*die_or_err);
2649 return llvm::createStringError(
"failed to resolve function");
2652 return llvm::createStringError(
"failed to find function");
2654 assert(sc_list.
GetSize() == 1);
2661 bool only_root_namespaces) {
2668 if (only_root_namespaces)
2669 return die.
GetParent().
Tag() == llvm::dwarf::DW_TAG_compile_unit;
2677 dwarf_ast->GetDeclContextContainingUIDFromDWARF(die))
2686 bool include_inlines,
2694 assert((name_type_mask & eFunctionNameTypeAuto) == 0);
2701 "SymbolFileDWARF::FindFunctions (name=\"{0}\", name_type_mask={1:x}, "
2716 const uint32_t original_size = sc_list.
GetSize();
2718 llvm::DenseSet<const DWARFDebugInfoEntry *> resolved_dies;
2720 m_index->GetFunctions(lookup_info, *
this, parent_decl_ctx, [&](
DWARFDIE die) {
2721 if (resolved_dies.insert(die.
GetDIE()).second)
2730 auto it = name_ref.find(
'<');
2731 if (it != llvm::StringRef::npos) {
2732 const llvm::StringRef name_no_template_params = name_ref.slice(0, it);
2735 lookup_info,
ConstString(name_no_template_params));
2736 m_index->GetFunctions(no_tp_lookup_info, *
this, parent_decl_ctx,
2738 if (resolved_dies.insert(die.
GetDIE()).second)
2746 const uint32_t num_matches = sc_list.
GetSize() - original_size;
2748 if (log && num_matches > 0) {
2751 "SymbolFileDWARF::FindFunctions (name=\"{0}\", "
2752 "name_type_mask={1:x}, include_inlines={2:d}, sc_list) => {3}",
2753 name.
GetCString(), name_type_mask, include_inlines, num_matches);
2758 bool include_inlines,
2762 regex.
GetText().str().c_str());
2768 log,
"SymbolFileDWARF::FindFunctions (regex=\"{0}\", sc_list)",
2769 regex.
GetText().str().c_str());
2772 llvm::DenseSet<const DWARFDebugInfoEntry *> resolved_dies;
2774 if (resolved_dies.insert(die.
GetDIE()).second)
2781 const std::string &scope_qualified_name,
2782 std::vector<ConstString> &mangled_names) {
2785 for (uint32_t i = 0; i < num_comp_units; i++) {
2804 llvm::StringRef &basename,
2805 llvm::StringRef &template_params) {
2806 auto it = fullname.find(
'<');
2807 if (it == llvm::StringRef::npos) {
2808 basename = fullname;
2809 template_params = llvm::StringRef();
2812 basename = fullname.slice(0, it);
2813 template_params = fullname.slice(it, fullname.size());
2821 bool any_context_updated =
false;
2823 llvm::StringRef basename, params;
2826 any_context_updated =
true;
2829 return any_context_updated;
2839 return debug_info_size + dwp_sp->GetDebugInfoSize();
2842 for (uint32_t i = 0; i < num_comp_units; i++) {
2851 return debug_info_size;
2865 log,
"SymbolFileDWARF::FindTypes(type_basename=\"{0}\")",
2872 bool have_index_match =
false;
2884 auto CompilerTypeBasename =
2885 matching_type->GetForwardCompilerType().GetTypeName(
true);
2889 have_index_match =
true;
2890 results.
InsertUnique(matching_type->shared_from_this());
2892 if (!results.
Done(query))
2898 if (results.
Done(query)) {
2901 log,
"SymbolFileDWARF::FindTypes(type_basename=\"{0}\") => {1}",
2924 std::vector<CompilerContext> qualified_context =
2930 results.
InsertUnique(matching_type->shared_from_this());
2931 if (!results.
Done(query))
2936 if (results.
Done(query)) {
2940 "SymbolFileDWARF::FindTypes(type_basename=\"{0}\") => {1} "
2941 "(simplified as \"{2}\")",
2943 type_basename_simple);
2956 if (
ModuleSP external_module_sp = pair.second) {
2957 external_module_sp->FindTypes(query, results);
2958 if (results.
Done(query)) {
2970 bool only_root_namespaces) {
2976 log,
"SymbolFileDWARF::FindNamespace (sc, name=\"{0}\")",
2983 return namespace_decl_ctx;
2985 m_index->GetNamespacesWithParents(name, parent_decl_ctx, [&](
DWARFDIE die) {
2994 if (namespace_decl_ctx.
IsValid())
3000 if (log && namespace_decl_ctx) {
3003 "SymbolFileDWARF::FindNamespace (sc, name=\"{0}\") => "
3004 "CompilerDeclContext({1:p}/{2:p}) \"{3}\"",
3006 static_cast<const void *
>(namespace_decl_ctx.
GetTypeSystem()),
3011 return namespace_decl_ctx;
3015 bool resolve_function_context) {
3019 if (type_ptr ==
nullptr) {
3021 if (
auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(die.
GetCU()))
3028 while (parent_die !=
nullptr) {
3029 if (parent_die->
Tag() == DW_TAG_subprogram)
3034 if (resolve_function_context && parent_die !=
nullptr &&
3041 type_sp = type_ptr->shared_from_this();
3056 if (orig_die != die) {
3057 switch (die.
Tag()) {
3058 case DW_TAG_compile_unit:
3059 case DW_TAG_partial_unit:
3060 case DW_TAG_namespace:
3061 case DW_TAG_structure_type:
3062 case DW_TAG_union_type:
3063 case DW_TAG_class_type:
3064 case DW_TAG_lexical_block:
3065 case DW_TAG_subprogram:
3067 case DW_TAG_inlined_subroutine: {
3083 return decl_ctx_die;
3090 return decl_ctx_die;
3100 Symbol *objc_class_symbol =
nullptr;
3109 return objc_class_symbol;
3122 m_index->GetCompleteObjCClass(
3123 type_name, must_be_implementation, [&](
DWARFDIE type_die) {
3129 if (must_be_implementation) {
3131 DW_AT_APPLE_objc_complete_type, 0);
3132 if (!try_resolving_type)
3141 "resolved 0x%8.8" PRIx64
" from %s to 0x%8.8" PRIx64
3142 " (cu 0x%8.8" PRIx64
")\n",
3144 m_objfile_sp->GetFileSpec().GetFilename().AsCString(
"<Unknown>"),
3145 type_die.
GetID(), type_cu->GetID());
3149 type_sp = resolved_type->shared_from_this();
3157 const char *name = die.
GetName();
3164 "Searching definition DIE in {0}: '{1}'",
3165 GetObjectFile()->GetFileSpec().GetFilename().GetString(), name));
3173 "SymbolFileDWARF::FindDefinitionDIE(tag={0} "
3174 "({1}), name='{2}')",
3185 if (
auto err = type_system_or_err.takeError()) {
3187 "Cannot get TypeSystem for language {1}: {0}",
3190 type_system = *type_system_or_err;
3196 std::vector<std::string> template_params;
3199 type_system ? type_system->GetDWARFParser() :
nullptr;
3200 for (
DWARFDIE ctx_die = die; ctx_die && !isUnitType(ctx_die.Tag());
3201 ctx_die = ctx_die.GetParentDeclContextDIE()) {
3203 template_params.push_back(
3204 (ctx_die.IsStructUnionOrClass() && dwarf_ast)
3208 const bool any_template_params = llvm::any_of(
3209 template_params, [](llvm::StringRef p) {
return !p.empty(); });
3211 auto die_matches = [&](
DWARFDIE type_die) {
3213 const bool tag_matches =
3214 type_die.Tag() == tag ||
3218 if (any_template_params) {
3220 for (
DWARFDIE ctx_die = type_die; ctx_die && !isUnitType(ctx_die.Tag()) &&
3221 pos < template_params.size();
3222 ctx_die = ctx_die.GetParentDeclContextDIE(), ++pos) {
3223 if (template_params[pos].empty())
3225 if (template_params[pos] !=
3229 if (pos != template_params.size())
3235 m_index->GetFullyQualifiedType(die_dwarf_decl_ctx, [&](
DWARFDIE type_die) {
3243 if (!die_matches(type_die)) {
3247 "SymbolFileDWARF::FindDefinitionDIE(tag={0} ({1}), "
3248 "name='{2}') ignoring die={3:x16} ({4})",
3259 "SymbolFileDWARF::FindDefinitionTypeDIE(tag={0} ({1}), name='{2}') "
3260 "trying die={3:x16} ({4})",
3272 bool *type_is_new_ptr) {
3277 if (
auto err = type_system_or_err.takeError()) {
3279 "Unable to parse type: {0}");
3282 auto ts = *type_system_or_err;
3292 if (die.
Tag() == DW_TAG_subprogram) {
3296 if (scope_qualified_name.size()) {
3308 bool parse_siblings,
bool parse_children) {
3309 size_t types_added = 0;
3314 bool type_is_new =
false;
3316 Tag dwarf_tag =
static_cast<Tag
>(tag);
3321 if (isType(dwarf_tag) && tag != DW_TAG_subrange_type)
3328 if (die.
Tag() == DW_TAG_subprogram) {
3353 size_t functions_added = 0;
3360 if (llvm::Expected<llvm::DWARFAddressRangesVector> ranges =
3361 function_die.
GetDIE()->GetAttributeAddressRanges(
3362 function_die.
GetCU(),
3364 if (ranges->empty())
3366 dw_addr_t function_file_addr = ranges->begin()->LowPC;
3376 return functions_added;
3381 size_t types_added = 0;
3402 if (llvm::Expected<llvm::DWARFAddressRangesVector> ranges =
3403 function_die.
GetDIE()->GetAttributeAddressRanges(
3404 function_die.
GetCU(),
true)) {
3405 if (!ranges->empty())
3406 func_lo_pc = ranges->begin()->LowPC;
3409 "DIE({1:x}): {0}", function_die.
GetID());
3412 const size_t num_variables =
3417 return num_variables;
3422 if (dwarf_cu ==
nullptr)
3425 uint32_t vars_added = 0;
3428 if (variables.get() ==
nullptr) {
3429 variables = std::make_shared<VariableList>();
3435 variables->AddVariableIfUnique(var_sp);
3460 die_to_variable[die.
GetDIE()] = var_sp;
3462 die_to_variable[spec_die.GetDIE()] = var_sp;
3470 unsigned max_depth = 64) {
3472 if (!die || !max_depth)
3473 return std::nullopt;
3475 if (std::optional<uint64_t> byte_size =
3479 switch (die.
Tag()) {
3480 case DW_TAG_const_type:
3481 case DW_TAG_volatile_type:
3482 case DW_TAG_restrict_type:
3483 case DW_TAG_atomic_type:
3484 case DW_TAG_typedef:
3491 return std::nullopt;
3498 const addr_t func_low_pc) {
3503 uint64_t block_length = form_value.
Unsigned();
3511 if (form_value.
Form() == DW_FORM_loclistx)
3520 return location_list;
3526static DWARFExpressionList
3532 uint64_t block_offset =
3534 uint64_t block_length = form_value.
Unsigned();
3536 module,
DataExtractor(debug_info_data, block_offset, block_length),
3539 if (
const char *str = form_value.
AsCString())
3559 if (!debug_map_objfile)
3563 if (!debug_map_symtab)
3592 if (tag != DW_TAG_variable && tag != DW_TAG_constant &&
3593 tag != DW_TAG_member && (tag != DW_TAG_formal_parameter || !sc.
function))
3597 const char *name =
nullptr;
3598 const char *mangled =
nullptr;
3601 bool is_external =
false;
3602 bool is_artificial =
false;
3603 std::optional<uint64_t> tag_offset = std::nullopt;
3607 for (
size_t i = 0; i < attributes.
Size(); ++i) {
3614 case DW_AT_LLVM_tag_offset:
3615 tag_offset = form_value.
Unsigned();
3617 case DW_AT_decl_file:
3621 case DW_AT_decl_line:
3624 case DW_AT_decl_column:
3630 case DW_AT_linkage_name:
3631 case DW_AT_MIPS_linkage_name:
3638 type_die_form = form_value;
3640 case DW_AT_external:
3641 is_external = form_value.
Boolean();
3643 case DW_AT_const_value:
3644 const_value_form = form_value;
3646 case DW_AT_location:
3647 location_form = form_value;
3649 case DW_AT_start_scope:
3652 case DW_AT_artificial:
3653 is_artificial = form_value.
Boolean();
3655 case DW_AT_declaration:
3656 case DW_AT_description:
3657 case DW_AT_endianity:
3659 case DW_AT_specification:
3660 case DW_AT_visibility:
3662 case DW_AT_abstract_origin:
3671 bool location_is_const_value_data =
3677 if (const_value_form.
IsValid())
3685 bool is_static_member = (parent_tag == DW_TAG_compile_unit ||
3686 parent_tag == DW_TAG_partial_unit) &&
3687 (parent_context_die.
Tag() == DW_TAG_class_type ||
3688 parent_context_die.
Tag() == DW_TAG_structure_type);
3693 bool has_explicit_mangled = mangled !=
nullptr;
3705 if ((parent_tag == DW_TAG_compile_unit ||
3706 parent_tag == DW_TAG_partial_unit) &&
3713 if (tag == DW_TAG_formal_parameter)
3724 bool has_explicit_location = location_form.
IsValid();
3725 bool is_static_lifetime =
3726 has_explicit_mangled ||
3727 (has_explicit_location && !location_list.
IsValid());
3730 if (!location_is_const_value_data) {
3733 if (
auto maybe_location_DW_OP_addr =
3734 location->GetLocation_DW_OP_addr(location_form.
GetUnit())) {
3735 location_DW_OP_addr = *maybe_location_DW_OP_addr;
3740 "{0:x16}: {1} ({2}) has an invalid location: {3}: {4}",
3742 llvm::fmt_consume(maybe_location_DW_OP_addr.takeError()),
3747 is_static_lifetime =
true;
3750 if (debug_map_symfile)
3756 if (is_static_lifetime) {
3762 if (debug_map_symfile) {
3763 bool linked_oso_file_addr =
false;
3765 if (is_external && location_DW_OP_addr == 0) {
3767 *debug_map_symfile, mangled ? mangled : name, location_list,
3769 linked_oso_file_addr =
true;
3770 symbol_context_scope = exe_symbol;
3774 if (!linked_oso_file_addr) {
3791 if (location_is_const_value_data &&
3792 die.
GetDIE()->IsGlobalOrStaticScopeVariable())
3796 if (debug_map_symfile) {
3801 [
this, debug_map_symfile](
3803 return debug_map_symfile->LinkOSOFileAddress(
3804 this, unlinked_file_addr);
3813 if (symbol_context_scope ==
nullptr) {
3814 switch (parent_tag) {
3815 case DW_TAG_subprogram:
3816 case DW_TAG_inlined_subroutine:
3817 case DW_TAG_lexical_block:
3819 symbol_context_scope =
3821 if (symbol_context_scope ==
nullptr)
3822 symbol_context_scope = sc.
function;
3832 if (!symbol_context_scope) {
3839 auto type_sp = std::make_shared<SymbolFileType>(
3842 bool use_type_size_for_value =
3843 location_is_const_value_data &&
3845 if (use_type_size_for_value) {
3846 std::optional<uint64_t> byte_size;
3847 if (
Type *t = type_sp->GetType())
3848 byte_size = llvm::expectedToOptional(t->GetByteSize(
nullptr));
3865 return std::make_shared<Variable>(
3866 die.
GetID(), name, mangled, type_sp, scope, symbol_context_scope,
3867 scope_ranges, &decl, location_list, is_external, is_artificial,
3868 location_is_const_value_data, is_static_member, tag_offset);
3878 spec_block_die_offset);
3885 switch (die.
Tag()) {
3886 case DW_TAG_subprogram:
3887 case DW_TAG_inlined_subroutine:
3888 case DW_TAG_lexical_block: {
3890 spec_block_die_offset)
3894 spec_block_die_offset)
3922 if (tag != DW_TAG_variable && tag != DW_TAG_constant && tag != DW_TAG_member)
3938 switch (parent_tag) {
3939 case DW_TAG_compile_unit:
3940 case DW_TAG_partial_unit:
3945 "parent {0:x8} {1} ({2}) with no valid compile unit in "
3946 "symbol context for {3:x8} {4} ({5}).\n",
3956 "{0} '{1}' ({2:x8}) is not a global variable - ignoring", tag,
3966 if (variable_list_sp)
3967 variable_list_sp->AddVariableIfUnique(var_sp);
3983 if (block_die.
Tag() != DW_TAG_inlined_subroutine) {
3984 return std::move(variable_dies);
3989 if (!abs_die || abs_die.
Tag() != DW_TAG_subprogram ||
3991 return std::move(variable_dies);
3996 DIEArray::iterator concrete_it = variable_dies.
begin();
3999 bool did_merge_abstract =
false;
4000 for (; abstract_child; abstract_child = abstract_child.
GetSibling()) {
4001 if (abstract_child.
Tag() == DW_TAG_formal_parameter) {
4002 if (concrete_it == variable_dies.end() ||
4003 GetDIE(*concrete_it).Tag() != DW_TAG_formal_parameter) {
4007 merged.push_back(*abstract_child.
GetDIERef());
4008 did_merge_abstract =
true;
4014 if (origin_of_concrete == abstract_child) {
4017 merged.push_back(*concrete_it);
4022 merged.push_back(*abstract_child.
GetDIERef());
4023 did_merge_abstract =
true;
4029 if (!did_merge_abstract)
4030 return std::move(variable_dies);
4037 for (; concrete_it != variable_dies.end(); ++concrete_it) {
4038 if (
GetDIE(*concrete_it).
Tag() == DW_TAG_formal_parameter) {
4039 return std::move(variable_dies);
4041 merged.push_back(*concrete_it);
4057 dummy_block_variables);
4067 size_t vars_added = 0;
4070 if ((tag == DW_TAG_variable) || (tag == DW_TAG_constant) ||
4071 (tag == DW_TAG_formal_parameter)) {
4072 accumulator.push_back(*die.
GetDIERef());
4076 case DW_TAG_subprogram:
4077 case DW_TAG_inlined_subroutine:
4078 case DW_TAG_lexical_block: {
4082 if (block ==
nullptr) {
4089 if (concrete_block_die)
4094 if (block ==
nullptr)
4097 const bool can_create =
false;
4100 if (block_variable_list_sp.get() ==
nullptr) {
4101 block_variable_list_sp = std::make_shared<VariableList>();
4109 sc, child, func_low_pc, block_variables);
4114 block_variables, func_low_pc);
4123 sc, child, func_low_pc, accumulator);
4133 llvm::ArrayRef<DIERef> variable_dies,
lldb::addr_t func_low_pc) {
4135 for (
auto &die : variable_dies) {
4140 return variable_dies.size();
4148 if (child.Tag() != DW_TAG_call_site_parameter &&
4149 child.Tag() != DW_TAG_GNU_call_site_parameter)
4152 std::optional<DWARFExpressionList> LocationInCallee;
4153 std::optional<DWARFExpressionList> LocationInCaller;
4159 auto parse_simple_location =
4160 [&](
int attr_index) -> std::optional<DWARFExpressionList> {
4166 auto data = child.GetData();
4167 uint64_t block_offset = form_value.
BlockData() - data.GetDataStart();
4168 uint64_t block_length = form_value.
Unsigned();
4174 for (
size_t i = 0; i < attributes.
Size(); ++i) {
4176 if (attr == DW_AT_location)
4177 LocationInCallee = parse_simple_location(i);
4178 if (attr == DW_AT_call_value || attr == DW_AT_GNU_call_site_value)
4179 LocationInCaller = parse_simple_location(i);
4182 if (LocationInCallee && LocationInCaller) {
4184 parameters.push_back(param);
4191std::vector<std::unique_ptr<lldb_private::CallEdge>>
4195 bool has_call_edges =
4198 if (!has_call_edges)
4202 LLDB_LOG(log,
"CollectCallEdges: Found call site info in {0}",
4210 std::vector<std::unique_ptr<CallEdge>> call_edges;
4212 if (child.Tag() != DW_TAG_call_site && child.Tag() != DW_TAG_GNU_call_site)
4215 std::optional<DWARFDIE> call_origin;
4216 std::optional<DWARFExpressionList> call_target;
4220 bool tail_call =
false;
4226 for (
size_t i = 0; i < attributes.
Size(); ++i) {
4229 LLDB_LOG(log,
"CollectCallEdges: Could not extract TAG_call_site form");
4235 if (attr == DW_AT_call_tail_call || attr == DW_AT_GNU_tail_call)
4236 tail_call = form_value.
Boolean();
4239 if (attr == DW_AT_call_origin || attr == DW_AT_abstract_origin) {
4241 if (!call_origin->IsValid()) {
4242 LLDB_LOG(log,
"CollectCallEdges: Invalid call origin in {0}",
4248 if (attr == DW_AT_low_pc)
4249 low_pc = form_value.
Address();
4254 if (attr == DW_AT_call_return_pc)
4255 return_pc = form_value.
Address();
4260 if (attr == DW_AT_call_pc)
4261 call_inst_pc = form_value.
Address();
4265 if (attr == DW_AT_call_target || attr == DW_AT_GNU_call_site_target) {
4268 "CollectCallEdges: AT_call_target does not have block form");
4272 auto data = child.GetData();
4273 uint64_t block_offset = form_value.
BlockData() - data.GetDataStart();
4274 uint64_t block_length = form_value.
Unsigned();
4280 if (!call_origin && !call_target) {
4281 LLDB_LOG(log,
"CollectCallEdges: call site without any call target");
4288 caller_address = return_pc;
4291 caller_address = low_pc;
4294 caller_address = call_inst_pc;
4297 LLDB_LOG(log,
"CollectCallEdges: No caller address");
4309 std::unique_ptr<CallEdge> edge;
4312 "CollectCallEdges: Found call origin: {0} (retn-PC: {1:x}) "
4314 call_origin->GetPubname(), return_pc, call_inst_pc);
4315 edge = std::make_unique<DirectCallEdge>(
4316 call_origin->GetMangledName(), caller_address_type, caller_address,
4317 tail_call, std::move(parameters));
4323 LLDB_LOG(log,
"CollectCallEdges: Found indirect call target: {0}",
4326 edge = std::make_unique<IndirectCallEdge>(
4327 *call_target, caller_address_type, caller_address, tail_call,
4328 std::move(parameters));
4331 if (log && parameters.size()) {
4334 param.LocationInCallee.GetDescription(&callee_loc_desc,
4336 param.LocationInCaller.GetDescription(&caller_loc_desc,
4338 LLDB_LOG(log,
"CollectCallEdges: \tparam: {0} => {1}",
4343 call_edges.push_back(std::move(edge));
4348std::vector<std::unique_ptr<lldb_private::CallEdge>>
4371 auto ts = *ts_or_err;
4380 bool load_all_debug_info) {
4384 for (
size_t cu_idx = 0; cu_idx < num_cus; cu_idx++) {
4387 if (dwarf_cu ==
nullptr)
4392 if (!dwarf_cu->
GetDWOId().has_value())
4396 std::make_shared<StructuredData::Dictionary>();
4397 const uint64_t dwo_id = dwarf_cu->
GetDWOId().value();
4398 dwo_data->AddIntegerItem(
"dwo_id", dwo_id);
4403 dwo_data->AddStringItem(
"dwo_name", dwo_name);
4405 dwo_data->AddStringItem(
"error",
"missing dwo name");
4408 const char *comp_dir = die.GetDIE()->GetAttributeValueAsString(
4409 dwarf_cu, DW_AT_comp_dir,
nullptr);
4411 dwo_data->AddStringItem(
"comp_dir", comp_dir);
4414 dwo_data->AddStringItem(
4416 llvm::formatv(
"unable to get unit DIE for DWARFUnit at {0:x}",
4425 dwo_data->AddStringItem(
4426 "resolved_dwo_path",
4429 dwo_data->AddStringItem(
"error",
4432 dwo_data->AddBooleanItem(
"loaded", dwo_symfile !=
nullptr);
4433 if (!errors_only || dwo_data->HasKey(
"error"))
4434 separate_debug_info_files.
AddItem(dwo_data);
4439 d.
AddItem(
"separate-debug-info-files",
4440 std::make_shared<StructuredData::Array>(
4441 std::move(separate_debug_info_files)));
4450 module_sp->GetSymbolFile()->GetBackingSymbolFile());
4458 if (
m_objfile_sp->GetArchitecture().GetTriple().isAppleMachO())
4465 symfiles.
Append(module_fspec);
4471 if (symfile_fspec != module_fspec) {
4472 symfiles.
Append(symfile_fspec);
4479 if (filename_no_ext != module_fspec.
GetFilename()) {
4480 FileSpec module_spec_no_ext(module_fspec);
4482 symfiles.
Append(module_spec_no_ext);
4490 for (
const auto &symfile : symfiles.
files()) {
4492 FileSpec(symfile.GetPath() +
".dwp", symfile.GetPathStyle());
4493 LLDB_LOG(log,
"Searching for DWP using: \"{0}\"",
4496 module_spec, search_paths,
4497 m_objfile_sp->GetModule()->GetSymbolLocatorStatistics());
4503 LLDB_LOG(log,
"No DWP file found locally");
4509 module_spec, search_paths,
4510 m_objfile_sp->GetModule()->GetSymbolLocatorStatistics());
4513 LLDB_LOG(log,
"Found DWP file: \"{0}\"", dwp_filespec);
4519 dwp_file_extractor_sp, dwp_file_data_offset);
4526 LLDB_LOG(log,
"Unable to locate for DWP file for: \"{0}\"",
4533llvm::Expected<lldb::TypeSystemSP>
4540 if (
auto err = type_system_or_err.takeError()) {
4542 "Unable to get DWARFASTParser: {0}");
4545 if (
auto ts = *type_system_or_err)
4546 return ts->GetDWARFParser();
4552 return dwarf_ast->GetDeclForUIDFromDWARF(die);
4558 return dwarf_ast->GetDeclContextForUIDFromDWARF(die);
4565 return dwarf_ast->GetDeclContextContainingUIDFromDWARF(die);
4576 case DW_LANG_Mips_Assembler:
4589 if (llvm::dwarf::isCPlusPlus(lang))
4590 lang = DW_LANG_C_plus_plus;
4596 return m_index->GetIndexTime();
4603 return m_index->ResetStatistics();
4621 if (dwo_error.
Fail())
4622 return dwo_error.
Clone();
4631 if (dwarf_cu->
HasAny({DW_TAG_variable, DW_TAG_formal_parameter}))
4635 "no variable information is available in debug info for this "
4640 std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) {
4644 for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
4661 args.insert({comp_unit,
Args(flags)});
4670 for (
size_t cu_idx = 0; cu_idx < num_cus; cu_idx++) {
4672 if (dwarf_cu ==
nullptr)
4676 if (!dwarf_cu->
GetDWOId().has_value())
4691 if (dwo_error.
Fail())
static llvm::raw_ostream & error(Stream &strm)
#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 bool UpdateCompilerContextForSimpleTemplateNames(TypeQuery &match)
static ConstString GetDWARFMachOSegmentName()
static DWARFExpressionList GetExprListFromAtConstValue(DWARFFormValue form_value, ModuleSP module, const DWARFDIE &die)
Creates a DWARFExpressionList from an DW_AT_const_value.
static llvm::StringRef ClangToItaniumCtorKind(clang::CXXCtorType kind)
static void ParseSupportFilesFromPrologue(SupportFileList &support_files, const lldb::ModuleSP &module, const llvm::DWARFDebugLine::Prologue &prologue, FileSpec::Style style, llvm::StringRef compile_dir={})
static std::optional< uint64_t > GetByteSizeFromTypeDIE(DWARFDIE die, unsigned max_depth=64)
Walks transparent type wrappers following DW_AT_type and returns the first DW_AT_byte_size encountere...
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 llvm::StringRef GetItaniumCtorDtorVariant(llvm::StringRef discriminator)
static const llvm::DWARFDebugLine::LineTable * ParseLLVMLineTable(DWARFContext &context, llvm::DWARFDebugLine &line, dw_offset_t line_offset, dw_offset_t unit_offset)
bool IsStructOrClassTag(llvm::dwarf::Tag Tag)
static bool SplitTemplateParams(llvm::StringRef fullname, llvm::StringRef &basename, llvm::StringRef &template_params)
Split a name up into a basename and template parameters.
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::set< dw_form_t > GetUnsupportedForms(llvm::DWARFDebugAbbrev *debug_abbrev)
static std::optional< std::string > GetFileByIndex(const llvm::DWARFDebugLine::Prologue &prologue, size_t idx, llvm::StringRef compile_dir, FileSpec::Style style)
static llvm::StringRef ClangToItaniumDtorKind(clang::CXXDtorType kind)
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 bool ParseLLVMLineTablePrologue(DWARFContext &context, llvm::DWARFDebugLine::Prologue &prologue, dw_offset_t line_offset, dw_offset_t unit_offset)
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(...)
A section + offset based address class.
lldb::SectionSP GetSection() const
Get const accessor for the section.
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.
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.
lldb::BlockSP CreateChild(lldb::user_id_t uid)
Creates a block with the specified UID uid.
Block * FindBlockByID(lldb::user_id_t block_id)
void SetVariableList(lldb::VariableListSP &variable_list_sp)
Set accessor for the variable list.
void SetDidParseVariables(bool b, bool set_children)
void AddRange(const Range &range)
Add a new offset range to this block.
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(llvm::StringRef name, llvm::StringRef &context, llvm::StringRef &identifier)
static llvm::Expected< ConstString > SubstituteStructor_ItaniumMangle(llvm::StringRef mangled_name, llvm::StringRef subst_from, llvm::StringRef subst_to)
Substitutes Itanium structor encoding substrings given by subst_from in mangled_name with subst_to.
static llvm::Expected< ConstString > SubstituteStructorAliases_ItaniumMangle(llvm::StringRef mangled_name)
Tries replacing Itanium structor encoding substrings in mangled_name with potential aliases....
Checksum(llvm::MD5::MD5Result md5=g_sentinel)
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.
const SupportFileList & GetSupportFiles()
Get the compile unit's support file list.
lldb::VariableListSP GetVariableList(bool can_create)
Get the variable list for a compile unit.
void SetDebugMacros(const DebugMacrosSP &debug_macros)
const FileSpec & GetPrimaryFile() const
Return the primary source spec associated with this compile unit.
void ResolveSymbolContext(const SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list, RealpathPrefixes *realpath_prefixes=nullptr)
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.
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.
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.
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 char * AsCString(const char *value_if_empty) const
Get the string value as a C string.
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
llvm::Expected< Value > Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::addr_t func_load_addr, const Value *initial_value_ptr, const Value *object_address_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.
void UpdateValue(uint64_t const_value, lldb::offset_t const_value_byte_size, uint8_t addr_byte_size)
bool Update_DW_OP_addr(const Delegate *dwarf_cu, lldb::addr_t file_addr)
A class to manage flag bits.
A class that describes the declaration location of a lldb object.
void SetLine(uint32_t line)
Set accessor for the declaration line number.
void SetColumn(uint16_t column)
Set accessor for the declaration column number.
void SetFile(const FileSpec &file_spec)
Set accessor for the declaration file specification.
A class that measures elapsed time in an exception safe way.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
llvm::iterator_range< const_iterator > files() const
const FileSpec & GetFileSpecAtIndex(size_t idx) const
Get file at index.
void Append(const FileSpec &file)
Append a FileSpec object to the list.
size_t GetSize() const
Get the number of files in the file list.
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
void AppendPathComponent(llvm::StringRef component)
static bool Match(const FileSpec &pattern, const FileSpec &file)
Match FileSpec pattern against FileSpec file.
bool IsRelative() const
Returns true if the filespec represents a relative path.
const ConstString & GetFilename() const
Filename string const get accessor.
void MakeAbsolute(const FileSpec &dir)
Make the FileSpec absolute by treating it relative to dir.
void SetPath(llvm::StringRef p)
Temporary helper for FileSystem change.
ConstString GetFileNameStrippingExtension() const
Return the filename without the extension part.
void PrependPathComponent(llvm::StringRef component)
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
llvm::sys::path::Style Style
void SetFilename(ConstString filename)
Filename string set accessor.
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
A class that describes a function.
lldb::ModuleSP CalculateSymbolContextModule() override
CompileUnit * GetCompileUnit()
Get accessor for the compile unit that owns this function.
Block & GetBlock(bool can_create)
Get accessor for the block list.
static const char * GetNameForLanguageType(lldb::LanguageType language)
Returns the internal LLDB name for the specified language.
static bool LanguageIsCPlusPlus(lldb::LanguageType language)
static void AppendLineEntryToSequence(Sequence &sequence, lldb::addr_t file_addr, uint32_t line, uint16_t column, uint16_t file_idx, bool is_start_of_statement, bool is_start_of_basic_block, bool is_prologue_end, bool is_epilogue_begin, bool is_terminal_entry)
bool FindLineEntryByAddress(const Address &so_addr, LineEntry &line_entry, uint32_t *index_ptr=nullptr)
Find a line entry that contains the section offset address so_addr.
static Mangled::ManglingScheme GetManglingScheme(llvm::StringRef name)
Try to identify the mangling scheme used.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool invoke_locate_callback=true)
ArchSpec & GetArchitecture()
FileSpec & GetSymbolFileSpec()
A class that encapsulates name lookup information.
lldb::FunctionNameType GetNameTypeMask() const
ConstString GetLookupName() const
static std::vector< LookupInfo > MakeLookupInfos(ConstString name, lldb::FunctionNameType name_type_mask, lldb::LanguageType lang_type, ConstString lookup_name_override={})
Creates a vector of lookup infos for function name resolution.
A class that describes an executable image and its associated object and symbol files.
A plug-in interface definition class for object file parsers.
static lldb::ObjectFileSP FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file_spec, lldb::offset_t file_offset, lldb::offset_t file_size, lldb::DataExtractorSP extractor_sp, lldb::offset_t &data_offset)
Find a ObjectFile plug-in that can parse file_spec.
Symtab * GetSymtab(bool can_create=true)
Gets the symbol table for the currently selected architecture (and object for archives).
@ eTypeDebugInfo
An object file that contains only debug information.
virtual FileSpec & GetFileSpec()
Get accessor to the object file specification.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static FileSpec LocateExecutableSymbolFile(const ModuleSpec &module_spec, const FileSpecList &default_search_paths, StatisticsMap &map)
static bool CreateSettingForSymbolFilePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static lldb::OptionValuePropertiesSP GetSettingForSymbolFilePlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A Progress indicator helper class.
RangeData< lldb::addr_t, lldb::addr_t, Variable * > Entry
llvm::StringRef GetText() const
Access the regular expression text.
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
lldb::SectionSP FindSectionByType(lldb::SectionType sect_type, bool check_children, size_t start_idx=0) const
SectionList & GetChildren()
lldb::offset_t GetFileSize() const
bool GetCheckInlines() const
FileSpec GetFileSpec() const
This base class provides an interface to stack frames.
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
std::chrono::duration< double > Duration
Status Clone() const
Don't call this function in new code.
static Status FromErrorString(const char *str)
bool Fail() const
Test for error condition.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
const char * GetData() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
void AddItem(const ObjectSP &item)
void AddStringItem(llvm::StringRef key, llvm::StringRef value)
void AddItem(llvm::StringRef key, ObjectSP value_sp)
std::shared_ptr< Dictionary > DictionarySP
A list of support files for a CompileUnit.
const FileSpec & GetFileSpecAtIndex(size_t idx) const
void Append(const FileSpec &file)
SupportFileNSP GetSupportFileAtIndex(size_t idx) const
void EmplaceBack(Args &&...args)
Wraps a FileSpec and an optional Checksum.
virtual const FileSpec & Materialize()
Materialize the file to disk and return the path to that temporary file.
Defines a list of symbol context objects.
uint32_t GetSize() const
Get accessor for a symbol context list size.
bool AppendIfUnique(const SymbolContext &sc, bool merge_symbol_into_function)
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
virtual CompileUnit * CalculateSymbolContextCompileUnit()
virtual void CalculateSymbolContext(SymbolContext *sc)=0
Reconstruct the object's symbol context into sc.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Block * block
The Block for a given query.
lldb::ModuleSP module_sp
The Module for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
uint32_t GetResolvedMask() const
void Clear(bool clear_target)
Clear the object's state.
Variable * variable
The global variable matching the given query.
LineEntry line_entry
The LineEntry for a given query.
lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx) override
ObjectFile * GetObjectFile() override
virtual TypeList & GetTypeList()
lldb::ObjectFileSP m_objfile_sp
ObjectFile * GetMainObjectFile() override
void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp)
SymbolFileCommon(lldb::ObjectFileSP objfile_sp)
Symtab * GetSymtab(bool can_create=true) override
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language) override
uint32_t GetNumCompileUnits() override
void Dump(Stream &s) override
uint64_t GetDebugInfoSize(bool load_all_debug_info=false) override
Metrics gathering functions.
std::unordered_map< lldb::CompUnitSP, Args > GetCompileOptions()
Returns a map of compilation unit to the compile option arguments associated with that compilation un...
virtual ObjectFile * GetObjectFile()=0
bool ValueIsAddress() const
Address & GetAddressRef()
Symbol * FindFirstSymbolWithNameAndType(ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
static FileSpecList GetDefaultDebugFileSearchPaths()
void Insert(const lldb::TypeSP &type)
A class that contains all state required for type lookups.
bool GetModuleSearch() const
The m_context can be used in two ways: normal types searching with the context containing a stanadard...
std::vector< lldb_private::CompilerContext > & GetContextRef()
Access the internal compiler context array.
ConstString GetTypeBasename() const
Get the type basename to use when searching the type indexes in each SymbolFile object.
bool ContextMatches(llvm::ArrayRef< lldb_private::CompilerContext > context) const
Check of a CompilerContext array from matching type from a symbol file matches the m_context.
bool GetSearchByMangledName() const
Returns true if the type query is supposed to treat the name to be searched as a mangled name.
This class tracks the state and results of a TypeQuery.
bool InsertUnique(const lldb::TypeSP &type_sp)
When types that match a TypeQuery are found, this API is used to insert the matching types.
bool Done(const TypeQuery &query) const
Check if the type matching has found all of the matches that it needs.
bool AlreadySearched(lldb_private::SymbolFile *sym_file)
Check if a SymbolFile object has already been searched by this type match object.
A TypeSystem implementation based on Clang.
Interface for representing a type system.
virtual lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type)=0
virtual plugin::dwarf::DWARFASTParser * GetDWARFParser()
@ FileAddress
A file address value.
bool AddVariableIfUnique(const lldb::VariableSP &var_sp)
lldb::VariableSP GetVariableAtIndex(size_t idx) const
lldb::VariableSP RemoveVariableAtIndex(size_t idx)
SymbolContextScope * GetSymbolContextScope() const
RangeVector< lldb::addr_t, lldb::addr_t > RangeList
An abstraction for Xcode-style SDKs that works like ArchSpec.
static std::unique_ptr< AppleDWARFIndex > Create(Module &module, DWARFDataExtractor apple_names, DWARFDataExtractor apple_namespaces, DWARFDataExtractor apple_types, DWARFDataExtractor apple_objc, DWARFDataExtractor debug_str)
Identifies a DWARF debug info entry within a given Module.
std::optional< uint32_t > file_index() const
static constexpr uint64_t k_file_index_mask
dw_offset_t die_offset() const
virtual void EnsureAllDIEsInDeclContextHaveBeenParsed(CompilerDeclContext decl_context)=0
virtual bool CompleteTypeFromDWARF(const DWARFDIE &die, Type *type, const CompilerType &compiler_type)=0
virtual std::string GetDIEClassTemplateParams(DWARFDIE die)=0
virtual Function * ParseFunctionFromDWARF(CompileUnit &comp_unit, const DWARFDIE &die, AddressRanges ranges)=0
virtual ConstString ConstructDemangledNameFromDWARF(const DWARFDIE &die)=0
virtual lldb::TypeSP ParseTypeFromDWARF(const SymbolContext &sc, const DWARFDIE &die, bool *type_is_new_ptr)=0
static std::optional< SymbolFile::ArrayInfo > ParseChildArrayInfo(const DWARFDIE &parent_die, const ExecutionContext *exe_ctx=nullptr)
virtual CompilerDeclContext GetDeclContextForUIDFromDWARF(const DWARFDIE &die)=0
DWARFUnit * CompileUnitAtIndex(uint32_t i) const
dw_attr_t AttributeAtIndex(uint32_t i) const
bool ExtractFormValueAtIndex(uint32_t i, DWARFFormValue &form_value) const
DWARFAttributes GetAttributes(Recurse recurse=Recurse::yes) const
std::optional< uint64_t > GetAttributeValueAsOptionalUnsigned(const dw_attr_t attr) const
const DWARFDataExtractor & GetData() const
const char * GetAttributeValueAsString(const dw_attr_t attr, const char *fail_value) const
std::optional< DIERef > GetDIERef() const
lldb::ModuleSP GetModule() const
SymbolFileDWARF * GetDWARF() const
DWARFDebugInfoEntry * GetDIE() const
DWARFUnit * GetCU() 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()
const DWARFDataExtractor & getOrLoadLineData()
llvm::DWARFContext & GetAsLLVM()
void GetName(Stream &s) const
const char * GetMangledName(bool substitute_name_allowed=true) const
DWARFDIE GetFirstChild() const
DWARFDIE GetParent() const
bool GetDIENamesAndRanges(const char *&name, const char *&mangled, llvm::DWARFAddressRangesVector &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, DWARFExpressionList *frame_base) 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.
std::vector< CompilerContext > GetDeclContext(bool derive_template_names=false) const
Return this DIE's decl context as it is needed to look up types in Clang modules.
DWARFDIE LookupDeepestBlock(lldb::addr_t file_addr) const
DWARFDIE GetAttributeValueAsReferenceDIE(const dw_attr_t attr) const
DWARFDeclContext GetDWARFDeclContext() const
child_iterator begin() const
DWARFDIE GetReferencedDIE(const dw_attr_t attr) const
std::vector< CompilerContext > GetTypeLookupContext(bool derive_template_names=false) const
Get a context to a type so it can be looked up.
const char * GetPubname() const
DWARFDIE GetSibling() 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...
dw_offset_t GetOffset() const
std::optional< uint64_t > GetAttributeValueAsOptionalUnsigned(const DWARFUnit *cu, const dw_attr_t attr, bool check_elaborating_dies=false) const
DWARFDebugInfoEntry * GetParent()
const char * GetAttributeValueAsString(const DWARFUnit *cu, const dw_attr_t attr, const char *fail_value, bool check_elaborating_dies=false) const
DWARFUnit * GetSkeletonUnit(DWARFUnit *dwo_unit)
DWARFUnit * GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset, uint32_t *idx_ptr=nullptr)
const DWARFDebugAranges & GetCompileUnitAranges()
DWARFDIE GetDIE(DIERef::Section section, dw_offset_t die_offset)
DWARFUnit * GetUnitAtIndex(size_t idx)
static void ReadMacroEntries(const DWARFDataExtractor &debug_macro_data, const DWARFDataExtractor &debug_str_data, const bool offset_is_64_bit, lldb::offset_t *sect_offset, SymbolFileDWARF *sym_file_dwarf, DebugMacrosSP &debug_macros_sp)
const char * GetQualifiedName() const
ConstString GetQualifiedNameAsConstString() const
void AppendDeclContext(dw_tag_t tag, const char *name)
FileSpec::Style GetPathStyle()
DWARFBaseDIE GetUnitDIEOnly()
void ExtractUnitDIEIfNeeded()
SymbolFileDWARF & GetSymbolFileDWARF() const
dw_offset_t GetLineTableOffset()
DWARFCompileUnit * GetSkeletonUnit()
Get the skeleton compile unit for a DWO file.
const Status & GetDwoError() const
Get the fission .dwo file specific error for this compile unit.
void SetLLDBCompUnit(lldb_private::CompileUnit *cu)
lldb_private::CompileUnit * GetLLDBCompUnit() const
dw_offset_t GetOffset() const
uint8_t GetAddressByteSize() const override
DWARFDataExtractor GetLocationData() const
die_iterator_range dies()
std::optional< uint64_t > GetLoclistOffset(uint32_t Index)
bool ParseDWARFLocationList(const DataExtractor &data, DWARFExpressionList &loc_list) const
void SetDwoError(Status &&error)
Set the fission .dwo file specific error for this compile unit.
uint64_t GetDWARFLanguageType()
DWARFUnit & GetNonSkeletonUnit()
DWARFDIE GetDIE(dw_offset_t die_offset)
lldb::ByteOrder GetByteOrder() const
SymbolFileDWARFDwo * GetDwoSymbolFile(bool load_all_debug_info=true)
uint16_t GetVersion() const override
const FileSpec & GetCompilationDirectory()
std::optional< uint64_t > GetDWOId()
Get the DWO ID from the DWARFUnitHeader for DWARF5, or from the unit DIE's DW_AT_dwo_id or DW_AT_GNU_...
bool HasAny(llvm::ArrayRef< dw_tag_t > tags)
Returns true if any DIEs in the unit match any DW_TAG values in tags.
FileSpec GetFile(size_t file_idx)
static llvm::Expected< std::unique_ptr< DebugNamesDWARFIndex > > Create(Module &module, DWARFDataExtractor debug_names, DWARFDataExtractor debug_str, SymbolFileDWARF &dwarf)
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(Address &addr)
Convert addr from a .o file address, to an executable address.
UniqueDWARFASTTypeMap & GetUniqueDWARFASTTypeMap()
DWARFDIE FindDefinitionDIE(const DWARFDIE &die)
uint64_t GetDebugInfoSize(bool load_all_debug_info=false) override
Metrics gathering functions.
CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
static CompilerDeclContext GetContainingDeclContext(const DWARFDIE &die)
static bool SupportedVersion(uint16_t version)
std::optional< uint32_t > GetDWARFUnitIndex(uint32_t cu_idx)
CompileUnit * GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu)
lldb::ModuleSP GetExternalModule(ConstString name)
void BuildCuTranslationTable()
friend class DWARFASTParser
void FindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, VariableList &variables) override
virtual DWARFDIE FindDefinitionDIE(const DWARFDIE &die)
DWARFDIE FindBlockContainingSpecification(const DIERef &func_die_ref, dw_offset_t spec_block_die_offset)
lldb::VariableSP ParseVariableDIE(const SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
void UpdateExternalModuleListIfNeeded()
static DWARFASTParser * GetDWARFParser(DWARFUnit &unit)
static lldb::LanguageType GetLanguageFamily(DWARFUnit &unit)
Same as GetLanguage() but reports all C++ versions as C++ (no version).
bool ForEachExternalModule(CompileUnit &, llvm::DenseSet< SymbolFile * > &, llvm::function_ref< bool(Module &)>) override
static char ID
LLVM RTTI support.
std::unique_ptr< DWARFDebugInfo > m_info
bool DeclContextMatchesThisSymbolFile(const CompilerDeclContext &decl_ctx)
void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector< ConstString > &mangled_names) override
size_t PopulateBlockVariableList(VariableList &variable_list, const SymbolContext &sc, llvm::ArrayRef< DIERef > variable_dies, lldb::addr_t func_low_pc)
Type * ResolveType(const DWARFDIE &die, bool assert_not_being_parsed=true, bool resolve_function_context=false)
DWOStats GetDwoStats() override
Gets statistics about dwo files associated with this symbol file.
virtual llvm::DenseMap< lldb::opaque_compiler_type_t, DIERef > & GetForwardDeclCompilerTypeToDIE()
llvm::DenseMap< const DWARFDebugInfoEntry *, lldb::VariableSP > DIEToVariableSP
friend class SymbolFileDWARFDwo
size_t ParseVariablesInFunctionContextRecursive(const SymbolContext &sc, const DWARFDIE &die, lldb::addr_t func_low_pc, DIEArray &accumulator)
virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, ConstString type_name, bool must_be_implementation)
const std::shared_ptr< SymbolFileDWARFDwo > & GetDwpSymbolFile()
std::recursive_mutex & GetModuleMutex() const override
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
bool GetSeparateDebugInfo(StructuredData::Dictionary &d, bool errors_only, bool load_all_debug_info=false) override
List separate dwo files.
UniqueDWARFASTTypeMap m_unique_ast_type_map
llvm::Expected< DWARFDIE > FindFunctionDefinition(const FunctionCallLabel &label, const DWARFDIE &declaration)
Find the definition DIE for the specified label in this SymbolFile.
bool m_fetched_external_modules
virtual llvm::DenseMap< const DWARFDebugInfoEntry *, Type * > & GetDIEToType()
GlobalVariableMap & GetGlobalAranges()
virtual DWARFCompileUnit * GetDWARFCompileUnit(CompileUnit *comp_unit)
llvm::SetVector< Type * > TypeSet
Function * ParseFunction(CompileUnit &comp_unit, const DWARFDIE &die)
friend class SymbolFileDWARFDebugMap
lldb::TypeSP GetTypeForDIE(const DWARFDIE &die, bool resolve_function_context=false)
friend class DWARFCompileUnit
llvm::Expected< SymbolContext > ResolveFunctionCallLabel(FunctionCallLabel &label) override
Resolves the function corresponding to the specified LLDB function call label.
lldb::addr_t m_first_code_address
DWARF does not provide a good way for traditional (concatenating) linkers to invalidate debug info de...
ConstString ConstructFunctionDemangledName(const DWARFDIE &die)
lldb::ModuleWP m_debug_map_module_wp
DWARFUnit * GetSkeletonUnit(DWARFUnit *dwo_unit)
Given a DWO DWARFUnit, find the corresponding skeleton DWARFUnit in the main symbol file.
FileSpec GetFile(DWARFUnit &unit, size_t file_idx)
std::shared_ptr< SymbolFileDWARFDwo > m_dwp_symfile
void DumpClangAST(Stream &s, llvm::StringRef filter, bool show_colors) override
void InitializeFirstCodeAddressRecursive(const SectionList §ion_list)
std::unique_ptr< llvm::DWARFDebugAbbrev > m_abbr
llvm::DenseMap< lldb::opaque_compiler_type_t, DIERef > m_forward_decl_compiler_type_to_die
std::vector< CompilerContext > GetCompilerContextForUID(lldb::user_id_t uid) override
virtual DWARFDIE GetDIE(const DIERef &die_ref)
static llvm::StringRef GetPluginNameStatic()
void InitializeFirstCodeAddress()
std::unique_ptr< GlobalVariableMap > m_global_aranges_up
llvm::once_flag m_info_once_flag
uint64_t GetDebugInfoSize(bool load_all_debug_info=false) override
Metrics gathering functions.
void FindTypes(const lldb_private::TypeQuery &match, lldb_private::TypeResults &results) override
Find types using a type-matching object that contains all search parameters.
static CompilerDecl GetDecl(const DWARFDIE &die)
void ResolveFunctionAndBlock(lldb::addr_t file_vm_addr, bool lookup_block, SymbolContext &sc)
Resolve functions and (possibly) blocks for the given file address and a compile unit.
void ResetStatistics() override
Reset the statistics for the symbol file.
size_t ParseVariablesForContext(const SymbolContext &sc) override
uint32_t CalculateNumCompileUnits() override
std::optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const ExecutionContext *exe_ctx) override
If type_uid points to an array type, return its characteristics.
size_t ParseBlocksRecursive(Function &func) override
ExternalTypeModuleMap m_external_type_modules
Type * ResolveTypeUID(lldb::user_id_t type_uid) override
static lldb::LanguageType GetLanguage(DWARFUnit &unit)
bool ClassOrStructIsVirtual(const DWARFDIE &die)
llvm::DenseMap< dw_offset_t, std::unique_ptr< SupportFileList > > m_type_unit_support_files
size_t ParseFunctions(CompileUnit &comp_unit) override
bool ParseDebugMacros(CompileUnit &comp_unit) override
NameToOffsetMap m_function_scope_qualified_name_map
static SymbolFile * CreateInstance(lldb::ObjectFileSP objfile_sp)
std::atomic_flag m_dwo_warning_issued
bool ParseSupportFiles(CompileUnit &comp_unit, SupportFileList &support_files) override
XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit) override
Return the Xcode SDK comp_unit was compiled against.
bool ParseImportedModules(const SymbolContext &sc, std::vector< SourceModule > &imported_modules) override
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
void GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask, TypeList &type_list) override
SymbolFileDWARFDebugMap * GetDebugMapSymfile()
void ParseDeclsForContext(CompilerDeclContext decl_ctx) override
size_t ParseTypes(CompileUnit &comp_unit) override
std::shared_ptr< SymbolFileDWARFDwo > GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die)
SymbolFileDWARF(lldb::ObjectFileSP objfile_sp, SectionList *dwo_section_list)
~SymbolFileDWARF() override
lldb::VariableSP ParseVariableDIECached(const SymbolContext &sc, const DWARFDIE &die)
StatsDuration::Duration GetDebugInfoIndexTime() override
Return the time it took to index the debug information in the object file.
bool CompleteType(CompilerType &compiler_type) override
DWARFDebugInfo & DebugInfo()
bool ParseLineTable(CompileUnit &comp_unit) override
bool ResolveFunction(const DWARFDIE &die, bool include_inlines, SymbolContextList &sc_list)
bool ParseIsOptimized(CompileUnit &comp_unit) override
static llvm::StringRef GetPluginDescriptionStatic()
std::vector< std::unique_ptr< 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...
void Dump(Stream &s) override
DIEArray MergeBlockAbstractParameters(const DWARFDIE &block_die, DIEArray &&variable_dies)
DWARFDIE GetDeclContextDIEContainingDIE(const DWARFDIE &die)
SymbolFileDWARFDebugMap * m_debug_map_symfile
void InitializeObject() override
Initialize the SymbolFile object.
void ParseAndAppendGlobalVariable(const SymbolContext &sc, const DWARFDIE &die, VariableList &cc_variable_list)
static llvm::Expected< lldb::TypeSystemSP > GetTypeSystem(DWARFUnit &unit)
std::vector< uint32_t > m_lldb_cu_to_dwarf_unit
void FindFunctions(const Module::LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, bool include_inlines, SymbolContextList &sc_list) override
static bool DIEInDeclContext(const CompilerDeclContext &parent_decl_ctx, const DWARFDIE &die, bool only_root_namespaces=false)
uint32_t ResolveSymbolContext(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) override
std::unique_ptr< DWARFIndex > m_index
bool HasForwardDeclForCompilerType(const CompilerType &compiler_type)
void PreloadSymbols() override
TypeList & GetTypeList() override
lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit &dwarf_cu)
CompilerDeclContext FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx, bool only_root_namespaces) override
Finds a namespace of name name and whose parent context is parent_decl_ctx.
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override
static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val)
lldb::TypeSP ParseType(const SymbolContext &sc, const DWARFDIE &die, bool *type_is_new)
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die)
std::vector< std::unique_ptr< CallEdge > > ParseCallEdgesInFunction(UserID func_id) override
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...
virtual void GetObjCMethods(ConstString class_name, llvm::function_ref< IterationAction(DWARFDIE die)> callback)
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language) override
CompilerDecl GetDeclForUID(lldb::user_id_t uid) override
virtual SymbolFileDWARF * GetDIERefSymbolFile(const DIERef &die_ref)
Given a DIERef, find the correct SymbolFileDWARF.
lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) override
StatsDuration m_parse_time
llvm::once_flag m_dwp_symfile_once_flag
CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
static void DebuggerInitialize(Debugger &debugger)
RangeDataVector< lldb::addr_t, lldb::addr_t, Variable * > GlobalVariableMap
size_t ParseVariablesInFunctionContext(const SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
DebugMacrosMap m_debug_macros_map
llvm::DWARFDebugAbbrev * DebugAbbrev()
llvm::DenseMap< const DWARFDebugInfoEntry *, Type * > m_die_to_type
bool GetFunction(const DWARFDIE &die, SymbolContext &sc)
const SupportFileList * GetTypeUnitSupportFiles(DWARFTypeUnit &tu)
virtual DIEToVariableSP & GetDIEToVariable()
std::optional< uint64_t > GetFileIndex() const
Symbol * GetObjCClassSymbol(ConstString objc_class_name)
static CompilerDeclContext GetDeclContext(const DWARFDIE &die)
virtual UniqueDWARFASTTypeMap & GetUniqueDWARFASTTypeMap()
virtual void LoadSectionData(lldb::SectionType sect_type, DWARFDataExtractor &data)
Status CalculateFrameVariableError(StackFrame &frame) override
Subclasses will override this function to for GetFrameVariableError().
#define DW_INVALID_OFFSET
llvm::dwarf::Tag dw_tag_t
#define DW_DIE_OFFSET_MAX_BITSIZE
llvm::dwarf::Attribute dw_attr_t
#define LLDB_INVALID_ADDRESS
llvm::StringRef DW_TAG_value_to_name(dw_tag_t tag)
std::vector< DIERef > DIEArray
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
NonNullSharedPtr< lldb_private::SupportFile > SupportFileNSP
NativeFilePosix NativeFile
std::shared_ptr< DebugMacros > DebugMacrosSP
llvm::SmallVector< CallSiteParameter, 0 > CallSiteParameterArray
A vector of CallSiteParameter.
IterationAction
Useful for callbacks whose return type indicates whether to continue iteration or short-circuit.
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
std::shared_ptr< lldb_private::ObjectFile > ObjectFileSP
LanguageType
Programming language type.
@ eLanguageTypeMipsAssembler
Mips_Assembler.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
@ eLanguageTypeLastStandardLanguage
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::VariableList > VariableListSP
std::shared_ptr< lldb_private::Variable > VariableSP
@ eValueTypeVariableGlobal
globals variable
@ eValueTypeVariableLocal
function local variables
@ eValueTypeVariableArgument
function argument variables
@ eValueTypeVariableStatic
static variable
@ eValueTypeVariableThreadLocal
thread local storage variable
std::shared_ptr< lldb_private::Section > SectionSP
@ eSectionTypeDWARFAppleNamespaces
@ eSectionTypeDWARFDebugNames
DWARF v5 .debug_names.
@ eSectionTypeDWARFAppleTypes
@ eSectionTypeDWARFDebugInfo
@ eSectionTypeDWARFDebugLine
@ eSectionTypeDWARFDebugStr
@ eSectionTypeDWARFAppleNames
@ eSectionTypeDWARFAppleObjC
@ eSectionTypeDWARFDebugAbbrev
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::CompileUnit > CompUnitSP
Represent the locations of a parameter at a call site, both in the caller and in the callee.
static CompilerType RemoveFastQualifiers(const CompilerType &ct)
Holds statistics about DWO (Debug With Object) files.
uint32_t loaded_dwo_file_count
Holds parsed information about a function call label that LLDB attaches as an AsmLabel to function AS...
lldb::user_id_t symbol_id
Unique identifier of the function symbol on which to perform the function call.
llvm::StringRef discriminator
Arbitrary string which language plugins can interpret for their own needs.
llvm::StringRef lookup_name
Name to use when searching for the function symbol in module_id.
Information needed to import a source-language module.
std::vector< ConstString > path
Something like "Module.Submodule".
A mix in class that contains a generic user ID.
lldb::user_id_t GetID() const
Get accessor for the user ID.