28#include "llvm/DebugInfo/CodeView/CVRecord.h"
29#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
30#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
31#include "llvm/DebugInfo/CodeView/Formatters.h"
32#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
33#include "llvm/DebugInfo/CodeView/RecordName.h"
34#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
35#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
36#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
37#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
38#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
39#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
40#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
41#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
42#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
43#include "llvm/DebugInfo/PDB/Native/PublicsStream.h"
44#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
45#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
46#include "llvm/DebugInfo/PDB/PDB.h"
47#include "llvm/DebugInfo/PDB/PDBTypes.h"
48#include "llvm/Demangle/MicrosoftDemangle.h"
49#include "llvm/Object/COFF.h"
50#include "llvm/Support/Allocator.h"
51#include "llvm/Support/BinaryStreamReader.h"
52#include "llvm/Support/Error.h"
53#include "llvm/Support/ErrorOr.h"
54#include "llvm/Support/MemoryBuffer.h"
83 case PDB_Lang::ObjCpp:
90static std::optional<std::string>
92 llvm::StringRef exe_path) {
95 if (fs.
Exists(original_pdb_path))
96 return std::string(original_pdb_path);
101 const FileSpec original_pdb_spec(original_pdb_path,
103 .value_or(FileSpec::Style::native));
104 const llvm::StringRef pdb_filename = original_pdb_spec.
GetFilename();
115 for (
const FileSpec &search_dir : search_paths) {
124static std::unique_ptr<PDBFile>
127 using namespace llvm::object;
128 auto expected_binary = createBinary(exe_path);
131 if (!expected_binary) {
132 llvm::consumeError(expected_binary.takeError());
135 OwningBinary<Binary> binary = std::move(*expected_binary);
139 auto *obj = llvm::dyn_cast<llvm::object::COFFObjectFile>(binary.getBinary());
142 const llvm::codeview::DebugInfo *pdb_info =
nullptr;
145 llvm::StringRef pdb_file;
146 if (llvm::Error e = obj->getDebugPDBInfo(pdb_info, pdb_file)) {
147 consumeError(std::move(e));
151 std::optional<std::string> resolved_pdb_path =
153 if (!resolved_pdb_path)
162 auto expected_info =
pdb->getPDBInfoStream();
163 if (!expected_info) {
164 llvm::consumeError(expected_info.takeError());
167 llvm::codeview::GUID guid;
168 memcpy(&guid, pdb_info->PDB70.Signature, 16);
170 if (expected_info->getGuid() != guid)
195 case SimpleTypeKind::Boolean128:
197 case SimpleTypeKind::Boolean64:
199 case SimpleTypeKind::Boolean32:
201 case SimpleTypeKind::Boolean16:
203 case SimpleTypeKind::Boolean8:
206 case SimpleTypeKind::Byte:
207 case SimpleTypeKind::UnsignedCharacter:
208 return "unsigned char";
209 case SimpleTypeKind::NarrowCharacter:
211 case SimpleTypeKind::SignedCharacter:
212 case SimpleTypeKind::SByte:
213 return "signed char";
214 case SimpleTypeKind::Character32:
216 case SimpleTypeKind::Character16:
218 case SimpleTypeKind::Character8:
221 case SimpleTypeKind::Complex128:
222 return "_Complex __float128";
223 case SimpleTypeKind::Complex80:
224 return "_Complex long double";
225 case SimpleTypeKind::Complex64:
226 return "_Complex double";
227 case SimpleTypeKind::Complex48:
228 return "_Complex __float48";
229 case SimpleTypeKind::Complex32:
230 case SimpleTypeKind::Complex32PartialPrecision:
231 return "_Complex float";
232 case SimpleTypeKind::Complex16:
233 return "_Complex _Float16";
235 case SimpleTypeKind::Float128:
237 case SimpleTypeKind::Float80:
238 return "long double";
239 case SimpleTypeKind::Float64:
241 case SimpleTypeKind::Float48:
243 case SimpleTypeKind::Float32:
244 case SimpleTypeKind::Float32PartialPrecision:
246 case SimpleTypeKind::Float16:
249 case SimpleTypeKind::Int128Oct:
250 case SimpleTypeKind::Int128:
252 case SimpleTypeKind::Int64:
253 case SimpleTypeKind::Int64Quad:
255 case SimpleTypeKind::Int32Long:
257 case SimpleTypeKind::Int32:
259 case SimpleTypeKind::Int16:
260 case SimpleTypeKind::Int16Short:
263 case SimpleTypeKind::UInt128Oct:
264 case SimpleTypeKind::UInt128:
265 return "unsigned __int128";
266 case SimpleTypeKind::UInt64:
267 case SimpleTypeKind::UInt64Quad:
268 return "unsigned long long";
269 case SimpleTypeKind::UInt32:
271 case SimpleTypeKind::UInt16:
272 case SimpleTypeKind::UInt16Short:
273 return "unsigned short";
274 case SimpleTypeKind::UInt32Long:
275 return "unsigned long";
277 case SimpleTypeKind::HResult:
279 case SimpleTypeKind::Void:
281 case SimpleTypeKind::WideCharacter:
284 case SimpleTypeKind::None:
285 case SimpleTypeKind::NotTranslated:
302static std::optional<CVTagRecord>
321 if (Record.Type.isSimple())
324 CVType cvt = tpi.getType(Record.Type);
333 std::string qname = std::string(parent.
asTag().getUniqueName());
334 if (qname.size() < 4 || child.
asTag().getUniqueName().size() < 4)
340 qname[3] = child.
asTag().getUniqueName()[3];
344 piece += Record.Name;
345 piece.push_back(
'@');
346 qname.insert(4, std::move(piece));
347 if (qname != child.
asTag().UniqueName)
350 return std::move(child);
366 return "Microsoft PDB debug symbol cross-platform file reader.";
382 uint32_t abilities = 0;
390 pdb_file = &
pdb->GetPDBFile();
402 pdb_file->getFilePath(),
403 m_objfile_sp->GetModule()->GetObjectFile()->GetFileSpec().GetPath());
406 if (!expected_index) {
407 llvm::consumeError(expected_index.takeError());
410 m_index = std::move(*expected_index);
419 if (
m_index->dbi().isStripped())
430 m_index->ParseSectionContribs();
432 auto ts_or_err =
m_objfile_sp->GetModule()->GetTypeSystemForLanguage(
434 if (
auto err = ts_or_err.takeError()) {
436 "Failed to initialize: {0}");
438 if (
auto ts = *ts_or_err)
439 ts->SetSymbolFile(
this);
445 const DbiModuleList &modules =
m_index->dbi().modules();
446 uint32_t count = modules.getModuleCount();
453 DbiModuleDescriptor last = modules.getModuleDescriptor(count - 1);
454 if (last.getModuleName() ==
"* Linker *")
465 if (
auto err = ts_or_err.takeError())
467 auto ts = *ts_or_err;
472 switch (sym.kind()) {
478 return &func->GetBlock(
false);
485 BlockSym block(
static_cast<SymbolRecordKind
>(sym.kind()));
486 if (
auto err = SymbolDeserializer::deserializeAs<BlockSym>(sym, block)) {
488 "Failed to deserialize BlockSym record: {0}");
491 if (block.Parent == 0) {
507 m_index->MakeVirtualAddress(block.Segment, block.CodeOffset);
510 if (block_base >= func_base)
511 child_block->AddRange(
Block::Range(block_base - func_base, block.CodeSize));
514 "S_BLOCK32 at modi: {0:d} offset: {1:d}: adding range "
515 "[{2:x16}-{3:x16}) which has a base that is less than the "
517 "low PC 0x%" PRIx64
". Please file a bug and attach the file at the "
518 "start of this error message",
520 block_base + block.CodeSize, func_base);
524 m_blocks.insert({opaque_block_uid, child_block});
529 comp_unit->GetLineTable();
531 std::shared_ptr<InlineSite> inline_site =
m_inline_sites[opaque_block_uid];
539 for (
size_t i = 0; i < inline_site->ranges.GetSize(); ++i) {
540 auto *entry = inline_site->ranges.GetEntryAtIndex(i);
541 child_block->AddRange(
542 Block::Range(entry->GetRangeBase(), entry->GetByteSize()));
544 child_block->FinalizeRanges();
547 Declaration &decl = inline_site->inline_function_info->GetDeclaration();
548 Declaration &callsite = inline_site->inline_function_info->GetCallSite();
549 child_block->SetInlinedFunctionInfo(
550 inline_site->inline_function_info->GetName().GetCString(),
nullptr,
552 m_blocks.insert({opaque_block_uid, child_block});
573 if (sym_record.kind() != S_LPROC32 && sym_record.kind() != S_GPROC32) {
589 ProcSym proc(
static_cast<SymbolRecordKind
>(sym_record.kind()));
590 if (
auto err = SymbolDeserializer::deserializeAs<ProcSym>(sym_record, proc)) {
592 "Failed to deserialize ProcSym record: {0}");
595 if (proc.FunctionType == TypeIndex::None())
604 SegmentOffset(proc.Segment, proc.CodeOffset), proc.FunctionType);
605 Mangled mangled(mangled_opt.value_or(proc.Name));
607 FunctionSP func_sp = std::make_shared<Function>(
609 func_type.get(), func_addr,
615 if (
auto err = ts_or_err.takeError())
617 auto ts = *ts_or_err;
620 ast_builder->EnsureFunction(func_id);
636 llvm::SmallString<64> source_file_name;
637 if (
auto main_file_or_err =
m_index->compilands().GetMainSourceFile(cci)) {
638 source_file_name = std::move(*main_file_or_err);
641 "Failed to determine main source file: {0}");
643 FileSpec fs(llvm::sys::path::convert_to_slash(
644 source_file_name, llvm::sys::path::Style::windows_backslash));
646 CompUnitSP cu_sp = std::make_shared<CompileUnit>(
647 m_objfile_sp->GetModule(),
nullptr, std::make_shared<SupportFile>(fs),
655 const ModifierRecord &mr,
657 TpiStream &stream =
m_index->tpi();
661 if ((mr.Modifiers & ModifierOptions::Const) != ModifierOptions::None)
663 if ((mr.Modifiers & ModifierOptions::Volatile) != ModifierOptions::None)
665 if ((mr.Modifiers & ModifierOptions::Unaligned) != ModifierOptions::None)
666 name +=
"__unaligned ";
668 if (mr.ModifiedType.isSimple())
671 name += computeTypeName(stream.typeCollection(), mr.ModifiedType);
676 llvm::expectedToOptional(modified_type->GetByteSize(
nullptr)),
683 const llvm::codeview::PointerRecord &pr,
689 if (pr.isPointerToMember()) {
690 MemberPointerInfo mpi = pr.getMemberInfo();
703 if (ti == TypeIndex::NullptrT()) {
710 if (ti.getSimpleMode() != SimpleTypeMode::Direct) {
712 uint32_t pointer_size = 0;
713 switch (ti.getSimpleMode()) {
714 case SimpleTypeMode::FarPointer32:
715 case SimpleTypeMode::NearPointer32:
718 case SimpleTypeMode::NearPointer64:
730 if (ti.getSimpleKind() == SimpleTypeKind::NotTranslated)
742 if (!record.hasUniqueName())
745 llvm::ms_demangle::Demangler demangler;
746 std::string_view sv(record.UniqueName.begin(), record.UniqueName.size());
747 llvm::ms_demangle::TagTypeNode *ttn = demangler.parseTagUniqueName(sv);
751 llvm::ms_demangle::IdentifierNode *idn =
752 ttn->QualifiedName->getUnqualifiedIdentifier();
753 return idn->toString();
758 const TagRecord &record,
766 decl = std::move(*maybeDecl);
769 "Failed to resolve declaration for '{1}': {0}", uname);
777 const ClassRecord &cr,
783 const UnionRecord &ur,
789 const EnumRecord &er,
796 decl = std::move(*maybeDecl);
799 "Failed to resolve declaration for '{1}': {0}", uname);
805 llvm::expectedToOptional(underlying_type->GetByteSize(
nullptr)),
nullptr,
811 const ArrayRecord &ar,
820 array_sp->SetEncodingType(element_type.get());
825 const MemberFunctionRecord &mfr,
827 if (mfr.ReturnType.isSimple())
838 const ProcedureRecord &pr,
840 if (pr.ReturnType.isSimple())
851 llvm::codeview::TypeIndex arglist_ti) {
852 if (arglist_ti.isNoneType())
855 CVType arglist_cvt =
m_index->tpi().getType(arglist_ti);
856 if (arglist_cvt.kind() != LF_ARGLIST)
861 TypeDeserializer::deserializeAs<ArgListRecord>(arglist_cvt, alr)) {
863 "Failed to deserialize ArgListRecord record ({1}): {0}",
867 for (TypeIndex
id : alr.getIndices())
868 if (!
id.isNoneType() &&
id.isSimple())
873 if (type_id.
index.isSimple())
877 CVType cvt = stream.getType(type_id.
index);
879 if (cvt.kind() == LF_MODIFIER) {
880 ModifierRecord modifier;
882 TypeDeserializer::deserializeAs<ModifierRecord>(cvt, modifier)) {
884 "Failed to deserialize ModifierRecord record ({1}): {0}",
891 if (cvt.kind() == LF_POINTER) {
892 PointerRecord pointer;
894 TypeDeserializer::deserializeAs<PointerRecord>(cvt, pointer)) {
896 "Failed to deserialize PointerRecord record ({1}): {0}",
905 if (
auto err = TypeDeserializer::deserializeAs<ClassRecord>(cvt, cr)) {
907 "Failed to deserialize ClassRecord record ({1}): {0}",
914 if (cvt.kind() == LF_ENUM) {
916 if (
auto err = TypeDeserializer::deserializeAs<EnumRecord>(cvt, er)) {
918 "Failed to deserialize EnumRecord record ({1}): {0}",
925 if (cvt.kind() == LF_UNION) {
927 if (
auto err = TypeDeserializer::deserializeAs<UnionRecord>(cvt, ur)) {
929 "Failed to deserialize UnionRecord record ({1}): {0}",
936 if (cvt.kind() == LF_ARRAY) {
938 if (
auto err = TypeDeserializer::deserializeAs<ArrayRecord>(cvt, ar)) {
940 "Failed to deserialize ArrayRecord record ({1}): {0}",
947 if (cvt.kind() == LF_PROCEDURE) {
949 if (
auto err = TypeDeserializer::deserializeAs<ProcedureRecord>(cvt, pr)) {
951 "Failed to deserialize ProcedureRecord record ({1}): {0}",
957 if (cvt.kind() == LF_MFUNCTION) {
958 MemberFunctionRecord mfr;
960 TypeDeserializer::deserializeAs<MemberFunctionRecord>(cvt, mfr)) {
963 "Failed to deserialize MemberFunctionRecord record ({1}): {0}",
976 std::optional<PdbTypeSymId> full_decl_uid;
978 auto expected_full_ti =
979 m_index->tpi().findFullDeclForForwardRef(type_id.
index);
980 if (!expected_full_ti)
981 llvm::consumeError(expected_full_ti.takeError());
982 else if (*expected_full_ti != type_id.
index) {
990 if (full_iter !=
m_types.end()) {
991 TypeSP result = full_iter->second;
1000 PdbTypeSymId best_decl_id = full_decl_uid ? *full_decl_uid : type_id;
1002 if (
auto err = ts_or_err.takeError())
1004 auto ts = *ts_or_err;
1034 return iter->second;
1043 CVSymbol sym =
m_index->symrecords().readRecord(var_id.
offset);
1044 if (sym.kind() == S_CONSTANT)
1049 llvm::StringRef name;
1051 uint16_t section = 0;
1052 uint32_t offset = 0;
1053 bool is_external =
false;
1054 switch (sym.kind()) {
1059 DataSym ds(sym.kind());
1060 if (
auto err = SymbolDeserializer::deserializeAs<DataSym>(sym, ds)) {
1062 "Failed to deserialize DataSym record: {0}");
1069 section = ds.Segment;
1070 offset = ds.DataOffset;
1071 addr =
m_index->MakeVirtualAddress(ds.Segment, ds.DataOffset);
1078 ThreadLocalDataSym tlds(sym.kind());
1080 SymbolDeserializer::deserializeAs<ThreadLocalDataSym>(sym, tlds)) {
1082 "Failed to deserialize ThreadLocalDataSym record: {0}");
1087 section = tlds.Segment;
1088 offset = tlds.DataOffset;
1089 addr =
m_index->MakeVirtualAddress(tlds.Segment, tlds.DataOffset);
1094 llvm_unreachable(
"unreachable!");
1098 std::optional<uint16_t> modi =
m_index->GetModuleIndexForVa(addr);
1109 std::make_shared<SymbolFileType>(*
this,
toOpaqueUid(tid));
1112 if (
auto err = ts_or_err.takeError())
1114 auto ts = *ts_or_err;
1117 ast_builder->EnsureVariable(var_id);
1125 std::string global_name(
"::");
1126 global_name += name;
1127 bool artificial =
false;
1128 bool location_is_constant_data =
false;
1129 bool static_member =
false;
1130 VariableSP var_sp = std::make_shared<Variable>(
1131 toOpaqueUid(var_id), name.str().c_str(), global_name.c_str(), type_sp,
1132 scope, comp_unit.get(), ranges, &decl, location, is_external, artificial,
1133 location_is_constant_data, static_member);
1140 const CVSymbol &cvs) {
1141 TpiStream &tpi =
m_index->tpi();
1142 ConstantSym constant(cvs.kind());
1144 if (cvs.kind() != S_CONSTANT)
1148 SymbolDeserializer::deserializeAs<ConstantSym>(cvs, constant)) {
1150 "Failed to deserialize ConstantSym record: {0}");
1153 std::string global_name(
"::");
1154 global_name += constant.Name;
1157 std::make_shared<SymbolFileType>(*
this,
toOpaqueUid(tid));
1163 constant.Value, module);
1164 if (!location_or_err) {
1166 "Failed to make constant location expression for {1}: {0}",
1172 bool external =
false;
1173 bool artificial =
false;
1174 bool location_is_constant_data =
true;
1175 bool static_member =
false;
1176 VariableSP var_sp = std::make_shared<Variable>(
1177 toOpaqueUid(var_id), constant.Name.str().c_str(), global_name.c_str(),
1179 external, artificial, location_is_constant_data, static_member);
1186 if (emplace_result.second) {
1188 emplace_result.first->second = var_sp;
1193 return emplace_result.first->second;
1203 if (emplace_result.second)
1204 emplace_result.first->second =
CreateFunction(func_id, comp_unit);
1206 return emplace_result.first->second;
1212 auto emplace_result =
1214 if (emplace_result.second) {
1220 return emplace_result.first->second;
1226 return iter->second.get();
1245 assert(index < UINT16_MAX &&
"Invalid compile unit index");
1246 if (index >= UINT16_MAX)
1258 assert(
false &&
"uid of compile unit not a compiland");
1272 auto *section_list =
1273 m_objfile_sp->GetModule()->GetObjectFile()->GetSectionList();
1277 PublicSym32 last_sym;
1278 size_t last_sym_idx = 0;
1286 auto finish_last_symbol = [&](
const PublicSym32 *next) {
1293 if (next && last_sym.Segment == next->Segment) {
1294 assert(last_sym.Offset <= next->Offset);
1295 last->
SetByteSize(next->Offset - last_sym.Offset);
1298 assert(section_sp->GetByteSize() >= last_sym.Offset);
1299 assert(!next || next->Segment > last_sym.Segment);
1300 last->
SetByteSize(section_sp->GetByteSize() - last_sym.Offset);
1305 for (
auto pid :
m_index->publics().getAddressMap()) {
1307 CVSymbol sym =
m_index->ReadSymbolRecord(global);
1308 auto kind = sym.kind();
1309 if (kind != S_PUB32)
1311 auto pub_or_err = SymbolDeserializer::deserializeAs<PublicSym32>(sym);
1314 "Failed to deserialize PublicSym32 record: {0}");
1317 PublicSym32 pub = std::move(*pub_or_err);
1318 finish_last_symbol(&pub);
1320 if (!section_sp || last_sym.Segment != pub.Segment)
1321 section_sp = section_list->FindSectionByID(pub.Segment);
1327 if ((pub.Flags & PublicSymFlags::Function) != PublicSymFlags::None ||
1328 (pub.Flags & PublicSymFlags::Code) != PublicSymFlags::None)
1348 finish_last_symbol(
nullptr);
1355 assert(
false &&
"uid of compile unit not a compiland");
1363 for (
auto iter = syms.begin(); iter != syms.end(); ++iter) {
1364 if (iter->kind() != S_LPROC32 && iter->kind() != S_GPROC32)
1373 if (new_count < count) {
1374 assert(
false &&
"less functions after parsing than before");
1377 return new_count - count;
1382 uint32_t flags = eSymbolContextCompUnit;
1383 flags |= eSymbolContextVariable;
1384 flags |= eSymbolContextFunction;
1385 flags |= eSymbolContextBlock;
1386 flags |= eSymbolContextLineEntry;
1387 return (resolve_scope & flags) != 0;
1391 const Address &addr, SymbolContextItem resolve_scope, SymbolContext &sc) {
1393 uint32_t resolved_flags = 0;
1397 std::optional<uint16_t> modi =
m_index->GetModuleIndexForVa(file_addr);
1405 resolved_flags |= eSymbolContextCompUnit;
1408 if (resolve_scope & eSymbolContextFunction ||
1409 resolve_scope & eSymbolContextBlock) {
1412 "missing compile unit for symbol at address {0:x}", file_addr);
1415 std::vector<SymbolAndUid> matches =
m_index->FindSymbolsByVa(file_addr);
1419 for (
const auto &match : llvm::reverse(matches)) {
1423 PdbCompilandSymId csid = match.uid.asCompilandSym();
1424 CVSymbol cvs =
m_index->ReadSymbolRecord(csid);
1426 if (type != PDB_SymType::Function && type != PDB_SymType::Block)
1428 if (type == PDB_SymType::Function) {
1433 addr_t offset = file_addr - func_base;
1438 if (type == PDB_SymType::Block) {
1446 addr_t offset = file_addr - func_base;
1451 resolved_flags |= eSymbolContextFunction;
1453 resolved_flags |= eSymbolContextBlock;
1458 if (resolve_scope & eSymbolContextLineEntry) {
1461 "missing compile unit for symbol at address {0:x}", file_addr);
1465 if (line_table->FindLineEntryByAddress(addr, sc.
line_entry))
1466 resolved_flags |= eSymbolContextLineEntry;
1470 return resolved_flags;
1477 const uint32_t prev_size = sc_list.
GetSize();
1478 if (resolve_scope & eSymbolContextCompUnit) {
1487 if (file_spec_matches_cu_file_spec) {
1493 return sc_list.
GetSize() - prev_size;
1504 assert(
false &&
"uid of compile unit not a compiland");
1518 std::set<LineTable::Entry, LineTableEntryComparator> line_set;
1523 for (
const DebugSubsectionRecord &dssr :
1525 if (dssr.kind() != DebugSubsectionKind::Lines)
1528 DebugLinesSubsectionRef lines;
1529 llvm::BinaryStreamReader reader(dssr.getRecordData());
1530 if (
auto EC = lines.initialize(reader)) {
1531 llvm::consumeError(std::move(EC));
1535 const LineFragmentHeader *lfh = lines.header();
1536 uint64_t virtual_addr =
1537 m_index->MakeVirtualAddress(lfh->RelocSegment, lfh->RelocOffset);
1541 for (
const LineColumnEntry &group : lines) {
1542 llvm::Expected<uint32_t> file_index_or_err =
1544 if (!file_index_or_err) {
1546 "failed to get file index for line entry: {0}");
1549 uint32_t file_index = file_index_or_err.get();
1550 if (group.LineNumbers.empty()) {
1552 "no line numbers for {0} in modi={1}", group.NameIndex, modi);
1557 for (
const LineNumberEntry &entry : group.LineNumbers) {
1558 LineInfo cur_info(entry.Flags);
1560 if (cur_info.isAlwaysStepInto() || cur_info.isNeverStepInto())
1563 uint64_t addr = virtual_addr + entry.Offset;
1565 bool is_statement = cur_info.isStatement();
1569 uint32_t lno = cur_info.getStartLine();
1572 is_prologue, is_epilogue,
false);
1574 auto iter = line_set.find(new_entry);
1575 if (iter != line_set.end() && iter->is_terminal_entry)
1576 line_set.erase(iter);
1577 line_set.insert(new_entry);
1584 line_entry.
data = {file_index, lno};
1586 LineInfo last_line(group.LineNumbers.back().Flags);
1587 line_set.emplace(virtual_addr + lfh->CodeSize, last_line.getEndLine(), 0,
1588 file_index,
false,
false,
false,
false,
true);
1591 line_entry.
SetRangeEnd(virtual_addr + lfh->CodeSize);
1600 const CVSymbolArray &syms = cii->
m_debug_stream.getSymbolArray();
1601 for (
auto iter = syms.begin(); iter != syms.end();) {
1602 if (iter->kind() != S_LPROC32 && iter->kind() != S_GPROC32) {
1607 uint32_t record_offset = iter.offset();
1608 CVSymbol func_record =
1621 if (kind != S_INLINESITE)
1626 for (
const auto &line_entry :
1631 if (!line_entry.is_terminal_entry)
1632 line_set.erase(line_entry);
1633 line_set.insert(line_entry);
1641 iter = syms.at(getScopeEndOffset(func_record));
1647 std::vector<LineTable::Sequence> sequence(1);
1648 for (
const auto &line_entry : line_set) {
1650 sequence.back(), line_entry.file_addr, line_entry.line,
1651 line_entry.column, line_entry.file_idx,
1652 line_entry.is_start_of_statement, line_entry.is_start_of_basic_block,
1653 line_entry.is_prologue_end, line_entry.is_epilogue_begin,
1654 line_entry.is_terminal_entry);
1657 std::make_unique<LineTable>(&comp_unit, std::move(sequence));
1659 if (line_table->GetSize() == 0)
1671llvm::Expected<uint32_t>
1675 return llvm::make_error<RawError>(raw_error_code::no_entry);
1677 const auto &checksums = cii.
m_strings.checksums().getArray();
1678 const auto &strings = cii.
m_strings.strings();
1682 auto iter = checksums.at(file_id);
1683 if (iter == checksums.end())
1684 return llvm::make_error<RawError>(raw_error_code::no_entry);
1686 llvm::Expected<llvm::StringRef> efn = strings.getString(iter->FileNameOffset);
1688 return efn.takeError();
1694 return std::distance(cii.
m_file_list.begin(), fn_iter);
1695 return llvm::make_error<RawError>(raw_error_code::no_entry);
1703 assert(
false &&
"uid of compile unit not a compiland");
1716 f.starts_with(
"/") ? FileSpec::Style::posix : FileSpec::Style::windows;
1718 support_files.
Append(spec);
1724 const SymbolContext &sc, std::vector<SourceModule> &imported_modules) {
1737 CVSymbol sym = cii->
m_debug_stream.readSymbolAtOffset(
id.offset);
1739 if (sym.kind() != S_INLINESITE)
1742 InlineSiteSym inline_site(
static_cast<SymbolRecordKind
>(sym.kind()));
1744 SymbolDeserializer::deserializeAs<InlineSiteSym>(sym, inline_site)) {
1746 "Failed to deserialize InlineSiteSym record: {0}");
1751 std::shared_ptr<InlineSite> inline_site_sp =
1752 std::make_shared<InlineSite>(parent_id);
1755 auto iter = cii->
m_inline_map.find(inline_site.Inlinee);
1758 InlineeSourceLine inlinee_line = iter->second;
1762 llvm::Expected<uint32_t> file_index_or_err =
1764 if (!file_index_or_err) {
1766 "failed to get file index for inline site: {0}");
1769 uint32_t file_offset = file_index_or_err.get();
1771 uint32_t decl_line = inlinee_line.Header->SourceLineNum;
1772 std::unique_ptr<Declaration> decl_up =
1773 std::make_unique<Declaration>(decl_file, decl_line);
1776 uint32_t code_offset = 0;
1777 int32_t line_offset = 0;
1778 std::optional<uint32_t> code_offset_base;
1779 std::optional<uint32_t> code_offset_end;
1780 std::optional<int32_t> cur_line_offset;
1781 std::optional<int32_t> next_line_offset;
1782 std::optional<uint32_t> next_file_offset;
1784 bool is_terminal_entry =
false;
1785 bool is_start_of_statement =
true;
1787 bool is_prologue_end =
true;
1789 auto update_code_offset = [&](uint32_t code_delta) {
1790 if (!code_offset_base)
1791 code_offset_base = code_offset;
1792 else if (!code_offset_end)
1793 code_offset_end = *code_offset_base + code_delta;
1795 auto update_line_offset = [&](int32_t line_delta) {
1796 line_offset += line_delta;
1797 if (!code_offset_base || !cur_line_offset)
1798 cur_line_offset = line_offset;
1800 next_line_offset = line_offset;
1803 auto update_file_offset = [&](uint32_t offset) {
1804 if (!code_offset_base)
1805 file_offset = offset;
1807 next_file_offset = offset;
1810 for (
auto &annot : inline_site.annotations()) {
1811 switch (annot.OpCode) {
1812 case BinaryAnnotationsOpCode::CodeOffset:
1813 case BinaryAnnotationsOpCode::ChangeCodeOffset:
1814 case BinaryAnnotationsOpCode::ChangeCodeOffsetBase:
1815 code_offset += annot.U1;
1816 update_code_offset(annot.U1);
1818 case BinaryAnnotationsOpCode::ChangeLineOffset:
1819 update_line_offset(annot.S1);
1821 case BinaryAnnotationsOpCode::ChangeCodeLength:
1822 update_code_offset(annot.U1);
1823 code_offset += annot.U1;
1824 is_terminal_entry =
true;
1826 case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
1827 code_offset += annot.U1;
1828 update_code_offset(annot.U1);
1829 update_line_offset(annot.S1);
1831 case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
1832 code_offset += annot.U2;
1833 update_code_offset(annot.U2);
1834 update_code_offset(annot.U1);
1835 code_offset += annot.U1;
1836 is_terminal_entry =
true;
1838 case BinaryAnnotationsOpCode::ChangeFile:
1839 update_file_offset(annot.U1);
1846 if (code_offset_base && code_offset_end && cur_line_offset) {
1848 *code_offset_base, *code_offset_end - *code_offset_base,
1849 decl_line + *cur_line_offset));
1851 if (next_file_offset)
1852 file_offset = *next_file_offset;
1853 if (next_line_offset) {
1854 cur_line_offset = next_line_offset;
1855 next_line_offset = std::nullopt;
1857 code_offset_base = is_terminal_entry ? std::nullopt : code_offset_end;
1858 code_offset_end = next_file_offset = std::nullopt;
1860 if (code_offset_base && cur_line_offset) {
1861 if (is_terminal_entry) {
1863 func_base + *code_offset_base, decl_line + *cur_line_offset, 0,
1864 file_offset,
false,
false,
false,
false,
true);
1865 inline_site_sp->line_entries.push_back(line_entry);
1868 decl_line + *cur_line_offset, 0,
1869 file_offset, is_start_of_statement,
false,
1870 is_prologue_end,
false,
false);
1871 inline_site_sp->line_entries.push_back(line_entry);
1872 is_prologue_end =
false;
1873 is_start_of_statement =
false;
1876 if (is_terminal_entry)
1877 is_start_of_statement =
true;
1878 is_terminal_entry =
false;
1881 inline_site_sp->ranges.Sort();
1884 std::unique_ptr<Declaration> callsite_up;
1885 if (!inline_site_sp->ranges.IsEmpty()) {
1886 auto *entry = inline_site_sp->ranges.GetEntryAtIndex(0);
1887 addr_t base_offset = entry->GetRangeBase();
1893 std::shared_ptr<InlineSite> parent_site =
1896 parent_site->inline_function_info->GetDeclaration().GetFile();
1897 if (
auto *parent_entry =
1898 parent_site->ranges.FindEntryThatContains(base_offset)) {
1900 std::make_unique<Declaration>(parent_decl_file, parent_entry->data);
1905 func_base + base_offset)) {
1909 std::make_unique<Declaration>(callsite_file, entry->data.second);
1915 std::string inlinee_name;
1916 llvm::Expected<CVType> inlinee_cvt =
1917 m_index->ipi().typeCollection().getTypeOrError(inline_site.Inlinee);
1919 inlinee_name =
"[error reading function name: " +
1920 llvm::toString(inlinee_cvt.takeError()) +
"]";
1921 }
else if (inlinee_cvt->kind() == LF_MFUNC_ID) {
1922 MemberFuncIdRecord mfr;
1923 if (
auto err = TypeDeserializer::deserializeAs<MemberFuncIdRecord>(
1924 *inlinee_cvt, mfr)) {
1926 "[error reading function name: " + llvm::toString(std::move(err)) +
1929 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
1930 inlinee_name.append(std::string(types.getTypeName(mfr.ClassType)));
1931 inlinee_name.append(
"::");
1932 inlinee_name.append(mfr.getName().str());
1934 }
else if (inlinee_cvt->kind() == LF_FUNC_ID) {
1937 TypeDeserializer::deserializeAs<FuncIdRecord>(*inlinee_cvt, fir)) {
1939 "[error reading function name: " + llvm::toString(std::move(err)) +
1942 TypeIndex parent_idx = fir.getParentScope();
1943 if (!parent_idx.isNoneType()) {
1944 LazyRandomTypeCollection &ids =
m_index->ipi().typeCollection();
1945 inlinee_name.append(std::string(ids.getTypeName(parent_idx)));
1946 inlinee_name.append(
"::");
1948 inlinee_name.append(fir.getName().str());
1951 inline_site_sp->inline_function_info = std::make_shared<InlineFunctionInfo>(
1952 inlinee_name.c_str(), llvm::StringRef(), decl_up.get(),
1963 std::set<uint64_t> remove_uids;
1965 if (kind == S_GPROC32 || kind == S_LPROC32 || kind == S_BLOCK32 ||
1966 kind == S_INLINESITE) {
1968 if (kind == S_INLINESITE)
1975 for (uint64_t uid : remove_uids) {
1987 CVSymbolArray syms =
1991 for (
auto iter = syms.begin(); iter != syms.end(); ++iter) {
1993 if (fn(iter->kind(), child_id))
2005 "failed to get C++ type system: {0}");
2008 auto ts = *ts_or_err;
2015 ast_builder->
Dump(s, filter, show_color);
2023 std::map<std::pair<uint16_t, uint32_t>, uint32_t> func_addr_ids;
2026 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
2027 CVSymbol sym =
m_index->symrecords().readRecord(gid);
2028 auto kind = sym.kind();
2031 llvm::StringRef name;
2033 case SymbolKind::S_GDATA32:
2034 case SymbolKind::S_LDATA32: {
2035 auto data_or_err = SymbolDeserializer::deserializeAs<DataSym>(sym);
2038 "Failed to deserialize DataSym record: {0}");
2041 name = data_or_err->Name;
2044 case SymbolKind::S_GTHREAD32:
2045 case SymbolKind::S_LTHREAD32: {
2047 SymbolDeserializer::deserializeAs<ThreadLocalDataSym>(sym);
2050 "Failed to deserialize ThreadLocalDataSym record: {0}");
2053 name = data_or_err->Name;
2056 case SymbolKind::S_CONSTANT: {
2057 auto data_or_err = SymbolDeserializer::deserializeAs<ConstantSym>(sym);
2060 "Failed to deserialize ConstantSym record: {0}");
2063 name = data_or_err->Name;
2070 if (!name.empty()) {
2079 if (kind != S_PROCREF && kind != S_LPROCREF)
2085 auto ref_or_err = SymbolDeserializer::deserializeAs<ProcRefSym>(sym);
2088 "Failed to deserialize ProcRefSym record: {0}");
2091 ProcRefSym ref = std::move(*ref_or_err);
2092 if (ref.Name.empty())
2097 m_index->compilands().GetOrCreateCompiland(ref.modi());
2098 auto iter = cci.
m_debug_stream.getSymbolArray().at(ref.SymOffset);
2101 kind = iter->kind();
2102 if (kind != S_GPROC32 && kind != S_LPROC32)
2105 auto proc_or_err = SymbolDeserializer::deserializeAs<ProcSym>(*iter);
2108 "Failed to deserialize ProcSym record: {0}");
2111 ProcSym proc = std::move(*proc_or_err);
2112 if ((proc.Flags & ProcSymFlags::IsUnreachable) != ProcSymFlags::None)
2114 if (proc.Name.empty() || proc.FunctionType.isSimple())
2120 func_addr_ids.emplace(std::make_pair(proc.Segment, proc.CodeOffset), gid);
2123 if (basename.empty())
2124 basename = proc.Name;
2130 auto type =
m_index->tpi().getType(proc.FunctionType);
2131 if (type.kind() == LF_MFUNCTION) {
2132 MemberFunctionRecord mfr;
2133 if (
auto err = TypeDeserializer::deserializeAs<MemberFunctionRecord>(
2137 "Failed to deserialize MemberFunctionRecord record ({1}): {0}",
2139 }
else if (!mfr.getThisType().isNoneType())
2145 for (
auto pid :
m_index->publics().getPublicsTable()) {
2147 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2148 auto kind = sym.kind();
2149 if (kind != S_PUB32)
2151 auto pub_or_err = SymbolDeserializer::deserializeAs<PublicSym32>(sym);
2154 "Failed to deserialize PublicSym32 record: {0}");
2157 PublicSym32 pub = std::move(*pub_or_err);
2164 auto it = func_addr_ids.find({pub.Segment, pub.Offset});
2165 if (it != func_addr_ids.end())
2187 std::vector<uint32_t> results;
2190 size_t n_matches = 0;
2191 for (uint32_t gid : results) {
2194 if (parent_decl_ctx.
IsValid() &&
2203 if (++n_matches >= max_matches)
2215 if (name_type_mask & eFunctionNameTypeFull)
2218 if (!(name_type_mask & eFunctionNameTypeFull ||
2219 name_type_mask & eFunctionNameTypeBase ||
2220 name_type_mask & eFunctionNameTypeMethod))
2224 std::set<uint32_t> resolved_ids;
2226 std::vector<uint32_t> ids;
2227 if (!Names.GetValues(name, ids))
2230 for (uint32_t
id : ids) {
2231 if (!resolved_ids.insert(
id).second)
2235 if (parent_decl_ctx.
IsValid() &&
2239 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2240 auto kind = sym.kind();
2241 if (kind != S_PROCREF && kind != S_LPROCREF) {
2247 auto proc_or_err = SymbolDeserializer::deserializeAs<ProcRefSym>(sym);
2250 "Failed to deserialize ProcRefSym record: {0}");
2253 ProcRefSym proc = std::move(*proc_or_err);
2259 m_index->compilands().GetOrCreateCompiland(proc.modi());
2275 if (name_type_mask & eFunctionNameTypeFull)
2277 if (name_type_mask & eFunctionNameTypeBase)
2279 if (name_type_mask & eFunctionNameTypeMethod)
2284 bool include_inlines,
2299 std::vector<uint32_t> matches;
2302 for (uint32_t match_idx : matches) {
2304 if (context.empty())
2313 if (results.
Done(query))
2320 uint32_t max_matches,
2323 std::vector<TypeIndex> matches =
m_index->tpi().findRecordsByName(name);
2324 if (max_matches > 0 && max_matches < matches.size())
2325 matches.resize(max_matches);
2327 for (TypeIndex ti : matches) {
2343 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
2346 for (
auto ti = types.getFirst(); ti; ti = types.getNext(*ti)) {
2349 (void)type->GetFullCompilerType();
2353 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
2355 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2356 if (sym.kind() != S_UDT)
2359 auto udt_or_err = SymbolDeserializer::deserializeAs<UDTSym>(sym);
2362 "Failed to deserialize UDTSym record: {0}");
2365 UDTSym udt = std::move(*udt_or_err);
2366 bool is_typedef =
true;
2368 CVType cvt =
m_index->tpi().getType(udt.Type);
2370 if (name == udt.Name)
2382 return new_count - old_count;
2388 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
2390 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2395 switch (sym.kind()) {
2396 case SymbolKind::S_GDATA32:
2397 case SymbolKind::S_LDATA32:
2398 case SymbolKind::S_GTHREAD32:
2399 case SymbolKind::S_LTHREAD32: {
2426 bool location_is_constant_data = is_constant;
2430 if (sym.kind() != S_CONSTANT)
2432 ConstantSym constant(sym.kind());
2434 SymbolDeserializer::deserializeAs<ConstantSym>(sym, constant)) {
2436 "Failed to deserialize ConstantSym record: {0}");
2440 var_info.
name = constant.Name;
2441 var_info.
type = constant.Type;
2443 constant.Type,
m_index->tpi(), constant.Value, module);
2444 if (!location_or_err) {
2446 "Failed to make constant location expression for {1}: {0}",
2454 Block *func_block = block;
2475 std::string name = var_info.
name.str();
2478 std::make_shared<SymbolFileType>(*
this, type_sp->GetID());
2483 bool external =
false;
2484 bool artificial =
false;
2485 bool static_member =
false;
2487 VariableSP var_sp = std::make_shared<Variable>(
2488 toOpaqueUid(var_id), name.c_str(), name.c_str(), sftype, var_scope, block,
2489 scope_ranges, &decl, var_info.
location, external, artificial,
2490 location_is_constant_data, static_member);
2493 if (
auto err = ts_or_err.takeError())
2495 auto ts = *ts_or_err;
2498 ast_builder->EnsureVariable(scope_id, var_id);
2508 bool is_param,
bool is_constant) {
2511 return iter->second;
2517 CVSymbol sym =
m_index->ReadSymbolRecord(
id);
2518 if (sym.kind() != S_UDT) {
2523 auto udt_or_err = SymbolDeserializer::deserializeAs<UDTSym>(sym);
2526 "Failed to deserialize UDTSym record: {0}");
2529 UDTSym udt = std::move(*udt_or_err);
2534 if (
auto err = ts_or_err.takeError())
2536 auto ts = *ts_or_err;
2544 ct = target_type->GetForwardCompilerType();
2548 llvm::expectedToOptional(target_type->GetByteSize(
nullptr)),
2549 nullptr, target_type->GetID(),
2557 return iter->second;
2571 uint32_t params_remaining = 0;
2572 switch (sym.kind()) {
2575 ProcSym proc(
static_cast<SymbolRecordKind
>(sym.kind()));
2576 if (
auto err = SymbolDeserializer::deserializeAs<ProcSym>(sym, proc)) {
2578 "Failed to deserialize ProcSym record: {0}");
2581 CVType signature =
m_index->tpi().getType(proc.FunctionType);
2582 if (signature.kind() == LF_PROCEDURE) {
2583 ProcedureRecord sig;
2584 if (llvm::Error e = TypeDeserializer::deserializeAs<ProcedureRecord>(
2586 llvm::consumeError(std::move(e));
2589 params_remaining = sig.getParameterCount();
2590 }
else if (signature.kind() == LF_MFUNCTION) {
2591 MemberFunctionRecord sig;
2592 if (llvm::Error e = TypeDeserializer::deserializeAs<MemberFunctionRecord>(
2594 llvm::consumeError(std::move(e));
2597 params_remaining = sig.getParameterCount();
2613 variables = std::make_shared<VariableList>();
2617 CVSymbolArray syms = limitSymbolArrayToScope(
2623 auto iter = syms.begin();
2624 auto end = syms.end();
2626 while (iter != end) {
2627 uint32_t record_offset = iter.offset();
2628 CVSymbol variable_cvs = *iter;
2634 if (variable_cvs.kind() == S_BLOCK32 ||
2635 variable_cvs.kind() == S_INLINESITE) {
2636 uint32_t block_end = getScopeEndOffset(variable_cvs);
2638 iter = syms.at(block_end);
2642 bool is_param = params_remaining > 0;
2644 switch (variable_cvs.kind()) {
2646 case S_REGREL32_INDIR:
2653 variables->AddVariableIfUnique(variable);
2660 variables->AddVariableIfUnique(variable);
2694 variables = std::make_shared<VariableList>();
2701 "missing missing block, function, or module for symbol context");
2707 if (
auto err = ts_or_err.takeError())
2709 auto ts = *ts_or_err;
2721 if (
auto err = ts_or_err.takeError())
2723 auto ts = *ts_or_err;
2735 if (
auto err = ts_or_err.takeError())
2737 auto ts = *ts_or_err;
2748 auto iter =
m_types.find(type_uid);
2755 return &*iter->second;
2759 assert(
false &&
"uid is not a type index");
2763 if (type_id.
index.isNoneType())
2772std::optional<SymbolFile::ArrayInfo>
2775 return std::nullopt;
2791 TypeClass type_mask,
2800 if (
auto err = ts_or_err.takeError())
2802 auto ts = *ts_or_err;
2805 auto *
clang = llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
2816llvm::Expected<lldb::TypeSystemSP>
2818 auto type_system_or_err =
2819 m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
2820 if (type_system_or_err)
2821 if (
auto ts = *type_system_or_err)
2822 ts->SetSymbolFile(
this);
2823 return type_system_or_err;
2828 return m_index->pdb().getFileSize();
2832 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
2834 llvm::DenseMap<TypeIndex, TypeIndex> forward_to_full;
2835 llvm::DenseMap<TypeIndex, TypeIndex> full_to_forward;
2837 struct RecordIndices {
2842 llvm::StringMap<RecordIndices> record_indices;
2844 for (
auto ti = types.getFirst(); ti; ti = types.getNext(*ti)) {
2845 CVType type = types.getType(*ti);
2851 RecordIndices &indices = record_indices[tag.
asTag().getUniqueName()];
2852 if (tag.
asTag().isForwardRef()) {
2853 indices.forward = *ti;
2861 if (indices.full != TypeIndex::None() &&
2862 indices.forward != TypeIndex::None()) {
2863 forward_to_full[indices.forward] = indices.full;
2864 full_to_forward[indices.full] = indices.forward;
2870 if (tag.
asTag().isForwardRef() || !tag.
asTag().containsNestedClass())
2874 ProcessTpiStream(
PdbIndex &index, TypeIndex parent,
2876 llvm::DenseMap<TypeIndex, TypeIndex> &parents)
2877 : index(index), parents(parents), parent(parent),
2878 parent_cvt(parent_cvt) {}
2881 llvm::DenseMap<TypeIndex, TypeIndex> &parents;
2883 unsigned unnamed_type_index = 1;
2887 llvm::Error visitKnownMember(CVMemberRecord &CVR,
2888 NestedTypeRecord &Record)
override {
2889 std::string unnamed_type_name;
2890 if (Record.Name.empty()) {
2892 llvm::formatv(
"<unnamed-type-$S{0}>", unnamed_type_index).str();
2893 Record.Name = unnamed_type_name;
2894 ++unnamed_type_index;
2896 std::optional<CVTagRecord> tag =
2899 return llvm::ErrorSuccess();
2901 parents[Record.Type] = parent;
2902 return llvm::ErrorSuccess();
2906 CVType field_list_cvt =
m_index->tpi().getType(tag.
asTag().FieldList);
2907 if (field_list_cvt.kind() != LF_FIELDLIST)
2911 FieldListRecord field_list;
2912 if (llvm::Error
error = TypeDeserializer::deserializeAs<FieldListRecord>(
2913 field_list_cvt, field_list))
2914 llvm::consumeError(std::move(
error));
2915 if (llvm::Error
error = visitMemberRecordStream(field_list.Data, process))
2916 llvm::consumeError(std::move(
error));
2928 std::vector<TypeIndex> full_keys;
2929 std::vector<TypeIndex> fwd_keys;
2931 TypeIndex key = entry.first;
2932 TypeIndex value = entry.second;
2934 auto iter = forward_to_full.find(value);
2935 if (iter != forward_to_full.end())
2936 entry.second = iter->second;
2938 iter = forward_to_full.find(key);
2939 if (iter != forward_to_full.end())
2940 fwd_keys.push_back(key);
2942 full_keys.push_back(key);
2944 for (TypeIndex fwd : fwd_keys) {
2945 TypeIndex full = forward_to_full[fwd];
2949 for (TypeIndex full : full_keys) {
2950 TypeIndex fwd = full_to_forward[full];
2955std::optional<PdbCompilandSymId>
2957 CVSymbol sym =
m_index->ReadSymbolRecord(
id);
2958 if (symbolOpensScope(sym.kind())) {
2961 id.offset = getScopeParentOffset(sym);
2965 return std::nullopt;
2974 auto begin = syms.begin();
2975 auto end = syms.at(
id.offset);
2976 std::vector<PdbCompilandSymId> scope_stack;
2978 while (begin != end) {
2979 if (begin.offset() >
id.offset) {
2983 return std::nullopt;
2988 if (symbolOpensScope(begin->kind())) {
2991 uint32_t scope_end = getScopeEndOffset(*begin);
2992 if (scope_end <
id.offset) {
2993 begin = syms.at(scope_end);
2996 scope_stack.emplace_back(
id.modi, begin.offset());
2998 }
else if (symbolEndsScope(begin->kind())) {
2999 scope_stack.pop_back();
3003 if (scope_stack.empty())
3004 return std::nullopt;
3006 return scope_stack.back();
3009std::optional<llvm::codeview::TypeIndex>
3013 return std::nullopt;
3014 return parent_iter->second;
3017std::vector<CompilerContext>
3019 CVType type =
m_index->tpi().getType(ti);
3025 std::optional<Type::ParsedName> parsed_name =
3030 std::vector<CompilerContext> ctx;
3032 for (llvm::StringRef scope : parsed_name->scope) {
3039 for (
auto &el : llvm::reverse(llvm::drop_end(ctx))) {
3045 type =
m_index->tpi().getType(ti);
3046 switch (type.kind()) {
3066std::optional<llvm::StringRef>
3071 return std::nullopt;
3074 if (sym_record.kind() != S_LPROC32 && sym_record.kind() != S_GPROC32)
3075 return std::nullopt;
3077 ProcSym proc(
static_cast<SymbolRecordKind
>(sym_record.kind()));
3078 if (
auto err = SymbolDeserializer::deserializeAs<ProcSym>(sym_record, proc)) {
3080 "Failed to deserialize ProcSym record: {0}");
3081 return std::nullopt;
3088std::optional<llvm::StringRef>
3090 TypeIndex function_type) {
3091 auto symbol =
m_index->publics().findByAddress(
m_index->symrecords(),
3094 return std::nullopt;
3096 llvm::StringRef name = symbol->first.Name;
3099 if (!function_type.isNoneType() &&
3100 (symbol->first.Flags & PublicSymFlags::Function) != PublicSymFlags::None)
3117 if (!mangled.starts_with(
'_') ||
3118 m_index->dbi().getMachineType() != PDB_Machine::x86)
3122 PDB_CallingConv cc = PDB_CallingConv::NearC;
3123 if (cvt.kind() == LF_PROCEDURE) {
3124 ProcedureRecord proc;
3125 if (llvm::Error
error =
3126 TypeDeserializer::deserializeAs<ProcedureRecord>(cvt, proc))
3127 llvm::consumeError(std::move(
error));
3129 }
else if (cvt.kind() == LF_MFUNCTION) {
3130 MemberFunctionRecord mfunc;
3131 if (llvm::Error
error =
3132 TypeDeserializer::deserializeAs<MemberFunctionRecord>(cvt, mfunc))
3133 llvm::consumeError(std::move(
error));
3134 cc = mfunc.CallConv;
3141 if (cc == PDB_CallingConv::NearC || cc == PDB_CallingConv::FarC)
3142 return mangled.drop_front();
3148 for (CVType cvt :
m_index->ipi().typeArray()) {
3149 switch (cvt.kind()) {
3150 case LF_UDT_SRC_LINE: {
3151 UdtSourceLineRecord udt_src;
3152 if (
auto err = TypeDeserializer::deserializeAs(cvt, udt_src)) {
3154 "Failed to deserialize UdtSourceLineRecord record: {0}");
3160 udt_src.LineNumber});
3162 case LF_UDT_MOD_SRC_LINE: {
3163 UdtModSourceLineRecord udt_mod_src;
3164 if (
auto err = TypeDeserializer::deserializeAs(cvt, udt_mod_src)) {
3167 "Failed to deserialize UdtModSourceLineRecord record: {0}");
3177 udt_mod_src.LineNumber});
3185llvm::Expected<Declaration>
3191 return llvm::createStringError(
"no UDT declaration found");
3193 llvm::StringRef file_name;
3194 if (it->second.IsIpiIndex) {
3195 CVType cvt =
m_index->ipi().getType(it->second.FileNameIndex);
3196 if (cvt.kind() != LF_STRING_ID)
3197 return llvm::createStringError(
"file name was not a LF_STRING_ID");
3200 if (
auto err = TypeDeserializer::deserializeAs(cvt, sid))
3201 return std::move(err);
3202 file_name = sid.String;
3205 auto string_table =
m_index->pdb().getStringTable();
3207 return string_table.takeError();
3209 llvm::Expected<llvm::StringRef>
string =
3210 string_table->getStringTable().getString(
3211 it->second.FileNameIndex.getIndex());
3213 return string.takeError();
3214 file_name = *string;
3218 if (file_name ==
"\\<unknown>")
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOG_ERROR(log, error,...)
static std::unique_ptr< PDBFile > loadMatchingPDBFile(std::string exe_path, llvm::BumpPtrAllocator &allocator)
static std::optional< CVTagRecord > GetNestedTagDefinition(const NestedTypeRecord &Record, const CVTagRecord &parent, TpiStream &tpi)
static lldb::LanguageType TranslateLanguage(PDB_Lang lang)
static std::string GetUnqualifiedTypeName(const TagRecord &record)
static llvm::StringRef GetSimpleTypeName(SimpleTypeKind kind)
static bool IsClassRecord(TypeLeafKind kind)
static bool IsFunctionEpilogue(const CompilandIndexItem &cci, lldb::addr_t addr)
static bool NeedsResolvedCompileUnit(uint32_t resolve_scope)
static std::optional< std::string > findMatchingPDBFilePath(llvm::StringRef original_pdb_path, llvm::StringRef exe_path)
static bool IsFunctionPrologue(const CompilandIndexItem &cci, lldb::addr_t addr)
static llvm::StringRef DropScope(llvm::StringRef name)
static bool UseNativePDB()
A section + offset based address class.
lldb::addr_t GetFileAddress() const
Get the file address.
bool IsValid() const
Check if the object state is valid.
A class that describes a single lexical block.
lldb::VariableListSP GetBlockVariableList(bool can_create)
Get the variable list for this block only.
Block * FindInnermostBlockByOffset(const lldb::addr_t offset)
void SetBlockInfoHasBeenParsed(bool b, bool set_children)
lldb::BlockSP CreateChild(lldb::user_id_t uid)
Creates a block with the specified UID uid.
Function * CalculateSymbolContextFunction() override
void SetVariableList(lldb::VariableListSP &variable_list_sp)
Set accessor for the variable list.
Block * GetParent() const
Get the parent block.
bool GetStartAddress(Address &addr)
void SetDidParseVariables(bool b, bool set_children)
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.
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.
void AddFunction(lldb::FunctionSP &function_sp)
Add a function to this compile unit.
size_t GetNumFunctions() const
Returns the number of functions in this compile unit.
lldb::LanguageType GetLanguage()
LineTable * GetLineTable()
Get the line table for the compile unit.
Represents a generic declaration context in a program.
TypeSystem * GetTypeSystem() const
Represents a generic declaration such as a function declaration.
Generic representation of a type in a programming language.
TypeSystemSPWrapper GetTypeSystem() const
Accessors.
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
bool IsValid() const
Return true if the location expression contains data.
void SetFuncFileAddress(lldb::addr_t func_file_addr)
"lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location expression and interprets it.
A class to manage flag bits.
A class that describes the declaration location of a lldb object.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const
static std::optional< Style > GuessPathStyle(llvm::StringRef absolute_path)
Attempt to guess path style for a given path string.
static bool Match(const FileSpec &pattern, const FileSpec &file)
Match FileSpec pattern against FileSpec file.
llvm::StringRef GetFilename() const
Filename string const get accessor.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
FileSpec CopyByRemovingLastPathComponent() const
llvm::sys::path::Style Style
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
A class that describes a function.
const Address & GetAddress() const
Return the address of the function (its entry point).
Block & GetBlock(bool can_create)
Get accessor for the block list.
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)
A class that handles mangled names.
static bool IsMangledName(llvm::StringRef name)
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
A class that encapsulates name lookup information.
lldb::FunctionNameType GetNameTypeMask() const
ConstString GetLookupName() const
ConstString GetName() const
static std::unique_ptr< llvm::pdb::PDBFile > loadPDBFile(std::string PdbPath, llvm::BumpPtrAllocator &Allocator)
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
RangeData< lldb::addr_t, uint32_t, std::pair< uint32_t, uint32_t > > Entry
void Append(const Entry &entry)
Entry * FindEntryThatContains(B addr)
"lldb/Core/SourceLocationSpec.h" A source location specifier class.
FileSpec GetFileSpec() const
A stream class that can stream formatted output to a file.
A list of support files for a CompileUnit.
const FileSpec & GetFileSpecAtIndex(size_t idx) const
void Append(const FileSpec &file)
Defines a list of symbol context objects.
uint32_t GetSize() const
Get accessor for a symbol context list size.
void Append(const SymbolContext &sc)
Append a new symbol context to the list.
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
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.
CompileUnit * comp_unit
The CompileUnit for a 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
void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp)
SymbolFileCommon(lldb::ObjectFileSP objfile_sp)
uint32_t GetNumCompileUnits() override
lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional< uint64_t > byte_size, SymbolContextScope *context, lldb::user_id_t encoding_uid, Type::EncodingDataType encoding_uid_type, const Declaration &decl, const CompilerType &compiler_qual_type, Type::ResolveState compiler_type_resolve_state, uint32_t opaque_payload=0) override
This function is used to create types that belong to a SymbolFile.
virtual std::recursive_mutex & GetModuleMutex() const
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
void SetByteSize(lldb::addr_t size)
Symbol * SymbolAtIndex(size_t idx)
uint32_t AddSymbol(const Symbol &symbol)
static FileSpecList GetDefaultDebugFileSearchPaths()
void Insert(const lldb::TypeSP &type)
void Insert(const lldb::TypeSP &type)
A class that contains all state required for type lookups.
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.
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 npdb::PdbAstBuilder * GetNativePDBParser()
@ eEncodingIsTypedefUID
This type is alias to a type whose UID is m_encoding_uid.
@ eEncodingIsUID
This type is the type whose UID is m_encoding_uid.
static std::optional< ParsedName > GetTypeScopeAndBasename(llvm::StringRef name)
void AddVariable(const lldb::VariableSP &var_sp)
RangeVector< lldb::addr_t, lldb::addr_t > RangeList
virtual CompilerType GetOrCreateTypedefType(PdbGlobalSymId id)=0
virtual void Dump(Stream &stream, llvm::StringRef filter, bool show_color)=0
virtual CompilerDeclContext FindNamespaceDecl(CompilerDeclContext parent_ctx, llvm::StringRef name)=0
virtual bool CompleteType(CompilerType ct)=0
virtual void EnsureBlock(PdbCompilandSymId block_id)=0
virtual CompilerDeclContext GetParentDeclContext(PdbSymUid uid)=0
virtual CompilerType GetOrCreateType(PdbTypeSymId type)=0
virtual CompilerDecl GetOrCreateDeclForUid(PdbSymUid uid)=0
virtual void EnsureInlinedFunction(PdbCompilandSymId inlinesite_id)=0
virtual void ParseDeclsForContext(CompilerDeclContext context)=0
virtual CompilerDeclContext GetOrCreateDeclContextForUid(PdbSymUid uid)=0
PdbIndex - Lazy access to the important parts of a PDB file.
static llvm::Expected< std::unique_ptr< PdbIndex > > create(llvm::pdb::PDBFile *)
llvm::pdb::TpiStream & tpi()
PdbCompilandId asCompiland() const
PdbCompilandSymId asCompilandSym() const
PdbTypeSymId asTypeSym() const
PdbSymUidKind kind() const
void CreateSimpleArgumentListTypes(llvm::codeview::TypeIndex arglist_ti)
lldb::VariableSP GetOrCreateGlobalVariable(PdbGlobalSymId var_id)
bool ParseLineTable(lldb_private::CompileUnit &comp_unit) override
lldb::TypeSP CreateArrayType(PdbTypeSymId type_id, const llvm::codeview::ArrayRecord &ar, CompilerType ct)
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.
void CacheGlobalBaseNames()
Caches the basenames of symbols found in the globals stream.
llvm::Expected< Declaration > ResolveUdtDeclaration(PdbTypeSymId type_id)
lldb::VariableSP CreateGlobalVariable(PdbGlobalSymId var_id)
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language) override
void InitializeObject() override
Initialize the SymbolFile object.
lldb_private::UniqueCStringMap< uint32_t > m_func_base_names
basename -> Global ID(s)
static SymbolFile * CreateInstance(lldb::ObjectFileSP objfile_sp)
uint32_t CalculateNumCompileUnits() override
llvm::DenseMap< lldb::user_id_t, lldb::TypeSP > m_types
bool CompleteType(CompilerType &compiler_type) override
lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override
CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
void DumpClangAST(Stream &s, llvm::StringRef filter, bool show_color) override
size_t ParseVariablesForContext(const SymbolContext &sc) override
size_t ParseFunctions(lldb_private::CompileUnit &comp_unit) override
lldb::TypeSP CreatePointerType(PdbTypeSymId type_id, const llvm::codeview::PointerRecord &pr, CompilerType ct)
lldb::FunctionSP CreateFunction(PdbCompilandSymId func_id, CompileUnit &comp_unit)
llvm::DenseMap< lldb::user_id_t, lldb::BlockSP > m_blocks
bool ParseSupportFiles(lldb_private::CompileUnit &comp_unit, SupportFileList &support_files) override
CompilerDecl GetDeclForUID(lldb::user_id_t uid) override
std::optional< llvm::StringRef > FindMangledFunctionName(PdbCompilandSymId id)
Find the mangled name for a function.
SymbolFileNativePDB(lldb::ObjectFileSP objfile_sp)
lldb::TypeSP GetOrCreateTypedef(PdbGlobalSymId id)
void FindTypesByName(llvm::StringRef name, uint32_t max_matches, TypeMap &types)
lldb::TypeSP CreateTagType(PdbTypeSymId type_id, const llvm::codeview::ClassRecord &cr, CompilerType ct)
lldb::TypeSP GetOrCreateType(PdbTypeSymId type_id)
llvm::BumpPtrAllocator m_allocator
void GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask, TypeList &type_list) override
llvm::DenseMap< lldb::user_id_t, lldb::VariableSP > m_local_variables
~SymbolFileNativePDB() override
lldb::VariableSP CreateConstantSymbol(PdbGlobalSymId var_id, const llvm::codeview::CVSymbol &cvs)
lldb::TypeSP CreateType(PdbTypeSymId type_id, CompilerType ct)
lldb_private::UniqueCStringMap< uint32_t > m_func_method_names
method basename -> Global ID(s)
void AddSymbols(Symtab &symtab) override
std::optional< llvm::codeview::TypeIndex > GetParentType(llvm::codeview::TypeIndex ti)
lldb_private::UniqueCStringMap< uint32_t > m_global_variable_base_names
global variable basename -> Global ID(s)
void FindFunctions(const Module::LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, bool include_inlines, SymbolContextList &sc_list) override
static llvm::StringRef GetPluginDescriptionStatic()
std::unique_ptr< llvm::pdb::PDBFile > m_file_up
lldb::TypeSP CreateProcedureType(PdbTypeSymId type_id, const llvm::codeview::ProcedureRecord &pr, CompilerType ct)
lldb::TypeSP CreateModifierType(PdbTypeSymId type_id, const llvm::codeview::ModifierRecord &mr, CompilerType ct)
uint64_t GetDebugInfoSize(bool load_all_debug_info=false) override
Metrics gathering functions.
std::optional< llvm::StringRef > FindMangledSymbol(SegmentOffset so, llvm::codeview::TypeIndex function_type=llvm::codeview::TypeIndex())
Find a symbol name at a specific address (so).
size_t ParseTypes(lldb_private::CompileUnit &comp_unit) override
Block * GetOrCreateBlock(PdbCompilandSymId block_id)
lldb::VariableSP GetOrCreateLocalVariable(PdbCompilandSymId scope_id, PdbCompilandSymId var_id, bool is_param, bool is_constant=false)
lldb::addr_t m_obj_load_address
size_t ParseBlocksRecursive(Function &func) override
std::once_flag m_cached_udt_declarations
void CacheUdtDeclarations()
lldb::CompUnitSP CreateCompileUnit(const CompilandIndexItem &cci)
std::optional< PdbCompilandSymId > FindSymbolScope(PdbCompilandSymId id)
size_t ParseSymbolArrayInScope(PdbCompilandSymId parent, llvm::function_ref< bool(llvm::codeview::SymbolKind, PdbCompilandSymId)> fn)
size_t ParseVariablesForCompileUnit(CompileUnit &comp_unit, VariableList &variables)
uint32_t CalculateAbilities() override
llvm::DenseMap< lldb::user_id_t, lldb::CompUnitSP > m_compilands
Block * CreateBlock(PdbCompilandSymId block_id)
std::vector< CompilerContext > GetContextForType(llvm::codeview::TypeIndex ti)
llvm::Expected< uint32_t > GetFileIndex(const CompilandIndexItem &cii, uint32_t file_id)
lldb::CompUnitSP GetOrCreateCompileUnit(const CompilandIndexItem &cci)
Type * ResolveTypeUID(lldb::user_id_t type_uid) override
llvm::DenseMap< lldb::user_id_t, lldb::FunctionSP > m_functions
bool ParseImportedModules(const SymbolContext &sc, std::vector< lldb_private::SourceModule > &imported_modules) override
llvm::StringRef StripMangledFunctionName(llvm::StringRef mangled, PdbTypeSymId func_ty)
static void DebuggerInitialize(Debugger &debugger)
lldb::VariableSP CreateLocalVariable(PdbCompilandSymId scope_id, PdbCompilandSymId var_id, bool is_param, bool is_constant=false)
llvm::DenseMap< lldb::user_id_t, std::shared_ptr< InlineSite > > m_inline_sites
void ParseInlineSite(PdbCompilandSymId inline_site_id, Address func_addr)
lldb::TypeSP CreateClassStructUnion(PdbTypeSymId type_id, const llvm::codeview::TagRecord &record, size_t size, CompilerType ct)
void FindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, VariableList &variables) override
static llvm::StringRef GetPluginNameStatic()
size_t ParseVariablesForBlock(PdbCompilandSymId block_id)
void ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override
lldb::FunctionSP GetOrCreateFunction(PdbCompilandSymId func_id, CompileUnit &comp_unit)
llvm::DenseMap< llvm::codeview::TypeIndex, llvm::codeview::TypeIndex > m_parent_types
lldb_private::UniqueCStringMap< uint32_t > m_func_full_names
mangled name/full function name -> Global ID(s)
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override
lldb::TypeSP CreateFunctionType(PdbTypeSymId type_id, const llvm::codeview::MemberFunctionRecord &pr, CompilerType ct)
lldb_private::UniqueCStringMap< uint32_t > m_type_base_names
lldb::TypeSP CreateAndCacheType(PdbTypeSymId type_id)
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.
CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override
lldb::TypeSP CreateTypedef(PdbGlobalSymId id)
bool m_done_full_type_scan
llvm::DenseMap< llvm::codeview::TypeIndex, UdtDeclaration > m_udt_declarations
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 char ID
LLVM RTTI support.
uint32_t ResolveSymbolContext(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) override
std::unique_ptr< PdbIndex > m_index
llvm::DenseMap< lldb::user_id_t, lldb::VariableSP > m_global_vars
lldb::TypeSP CreateSimpleType(llvm::codeview::TypeIndex ti, CompilerType ct)
#define LLDB_INVALID_ADDRESS
uint64_t toOpaqueUid(const T &cid)
size_t GetTypeSizeForSimpleKind(llvm::codeview::SimpleTypeKind kind)
SegmentOffsetLength GetSegmentOffsetAndLength(const llvm::codeview::CVSymbol &sym)
bool IsTagRecord(llvm::codeview::CVType cvt)
bool IsValidRecord(const RecordT &sym)
llvm::Expected< DWARFExpression > MakeConstantLocationExpression(llvm::codeview::TypeIndex underlying_ti, llvm::pdb::TpiStream &tpi, const llvm::APSInt &constant, lldb::ModuleSP module)
DWARFExpression MakeGlobalLocationExpression(uint16_t section, uint32_t offset, lldb::ModuleSP module)
VariableInfo GetVariableLocationInfo(PdbIndex &index, PdbCompilandSymId var_id, Block &func_block, lldb::ModuleSP module)
bool IsForwardRefUdt(llvm::codeview::CVType cvt)
llvm::pdb::PDB_SymType CVSymToPDBSym(llvm::codeview::SymbolKind kind)
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.
std::shared_ptr< lldb_private::Function > FunctionSP
std::shared_ptr< lldb_private::Block > BlockSP
std::shared_ptr< lldb_private::ObjectFile > ObjectFileSP
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeObjC_plus_plus
Objective-C++.
@ eLanguageTypeSwift
Swift.
@ eLanguageTypeC
Non-standardized C, such as K&R.
@ eLanguageTypeObjC
Objective-C.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::VariableList > VariableListSP
std::shared_ptr< lldb_private::SymbolFileType > SymbolFileTypeSP
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
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::CompileUnit > CompUnitSP
BaseType GetRangeBase() const
void SetRangeEnd(BaseType end)
void SetRangeBase(BaseType b)
Set the start value for the range, and keep the same size.
lldb::user_id_t GetID() const
Get accessor for the user ID.
CompilerContextKind contextKind() const
static CVTagRecord create(llvm::codeview::CVType type)
const llvm::codeview::TagRecord & asTag() const
llvm::StringRef name() const
Represents a single compile unit.
std::map< llvm::codeview::TypeIndex, llvm::codeview::InlineeSourceLine > m_inline_map
std::optional< llvm::codeview::Compile3Sym > m_compile_opts
llvm::pdb::ModuleDebugStreamRef m_debug_stream
GlobalLineTable m_global_line_table
llvm::codeview::StringsAndChecksumsRef m_strings
std::vector< llvm::StringRef > m_file_list
llvm::codeview::TypeIndex index
DWARFExpressionList location
llvm::codeview::TypeIndex type