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);
444 const DbiModuleList &modules =
m_index->dbi().modules();
445 uint32_t count = modules.getModuleCount();
452 DbiModuleDescriptor last = modules.getModuleDescriptor(count - 1);
453 if (last.getModuleName() ==
"* Linker *")
464 if (
auto err = ts_or_err.takeError())
466 auto ts = *ts_or_err;
471 switch (sym.kind()) {
477 return &func->GetBlock(
false);
484 BlockSym block(
static_cast<SymbolRecordKind
>(sym.kind()));
485 if (
auto err = SymbolDeserializer::deserializeAs<BlockSym>(sym, block)) {
487 "Failed to deserialize BlockSym record: {0}");
490 if (block.Parent == 0) {
506 m_index->MakeVirtualAddress(block.Segment, block.CodeOffset);
509 if (block_base >= func_base)
510 child_block->AddRange(
Block::Range(block_base - func_base, block.CodeSize));
513 "S_BLOCK32 at modi: {0:d} offset: {1:d}: adding range "
514 "[{2:x16}-{3:x16}) which has a base that is less than the "
516 "low PC 0x%" PRIx64
". Please file a bug and attach the file at the "
517 "start of this error message",
519 block_base + block.CodeSize, func_base);
523 m_blocks.insert({opaque_block_uid, child_block});
528 comp_unit->GetLineTable();
530 std::shared_ptr<InlineSite> inline_site =
m_inline_sites[opaque_block_uid];
538 for (
size_t i = 0; i < inline_site->ranges.GetSize(); ++i) {
539 auto *entry = inline_site->ranges.GetEntryAtIndex(i);
540 child_block->AddRange(
541 Block::Range(entry->GetRangeBase(), entry->GetByteSize()));
543 child_block->FinalizeRanges();
546 Declaration &decl = inline_site->inline_function_info->GetDeclaration();
547 Declaration &callsite = inline_site->inline_function_info->GetCallSite();
548 child_block->SetInlinedFunctionInfo(
549 inline_site->inline_function_info->GetName().GetCString(),
nullptr,
551 m_blocks.insert({opaque_block_uid, child_block});
572 if (sym_record.kind() != S_LPROC32 && sym_record.kind() != S_GPROC32) {
588 ProcSym proc(
static_cast<SymbolRecordKind
>(sym_record.kind()));
589 if (
auto err = SymbolDeserializer::deserializeAs<ProcSym>(sym_record, proc)) {
591 "Failed to deserialize ProcSym record: {0}");
594 if (proc.FunctionType == TypeIndex::None())
603 SegmentOffset(proc.Segment, proc.CodeOffset), proc.FunctionType);
604 Mangled mangled(mangled_opt.value_or(proc.Name));
606 FunctionSP func_sp = std::make_shared<Function>(
608 func_type.get(), func_addr,
614 if (
auto err = ts_or_err.takeError())
616 auto ts = *ts_or_err;
619 ast_builder->EnsureFunction(func_id);
635 llvm::SmallString<64> source_file_name;
636 if (
auto main_file_or_err =
m_index->compilands().GetMainSourceFile(cci)) {
637 source_file_name = std::move(*main_file_or_err);
640 "Failed to determine main source file: {0}");
642 FileSpec fs(llvm::sys::path::convert_to_slash(
643 source_file_name, llvm::sys::path::Style::windows_backslash));
645 CompUnitSP cu_sp = std::make_shared<CompileUnit>(
646 m_objfile_sp->GetModule(),
nullptr, std::make_shared<SupportFile>(fs),
654 const ModifierRecord &mr,
656 TpiStream &stream =
m_index->tpi();
660 if ((mr.Modifiers & ModifierOptions::Const) != ModifierOptions::None)
662 if ((mr.Modifiers & ModifierOptions::Volatile) != ModifierOptions::None)
664 if ((mr.Modifiers & ModifierOptions::Unaligned) != ModifierOptions::None)
665 name +=
"__unaligned ";
667 if (mr.ModifiedType.isSimple())
670 name += computeTypeName(stream.typeCollection(), mr.ModifiedType);
675 llvm::expectedToOptional(modified_type->GetByteSize(
nullptr)),
682 const llvm::codeview::PointerRecord &pr,
688 if (pr.isPointerToMember()) {
689 MemberPointerInfo mpi = pr.getMemberInfo();
702 if (ti == TypeIndex::NullptrT()) {
709 if (ti.getSimpleMode() != SimpleTypeMode::Direct) {
711 uint32_t pointer_size = 0;
712 switch (ti.getSimpleMode()) {
713 case SimpleTypeMode::FarPointer32:
714 case SimpleTypeMode::NearPointer32:
717 case SimpleTypeMode::NearPointer64:
729 if (ti.getSimpleKind() == SimpleTypeKind::NotTranslated)
741 if (!record.hasUniqueName())
744 llvm::ms_demangle::Demangler demangler;
745 std::string_view sv(record.UniqueName.begin(), record.UniqueName.size());
746 llvm::ms_demangle::TagTypeNode *ttn = demangler.parseTagUniqueName(sv);
750 llvm::ms_demangle::IdentifierNode *idn =
751 ttn->QualifiedName->getUnqualifiedIdentifier();
752 return idn->toString();
757 const TagRecord &record,
765 decl = std::move(*maybeDecl);
768 "Failed to resolve declaration for '{1}': {0}", uname);
776 const ClassRecord &cr,
782 const UnionRecord &ur,
788 const EnumRecord &er,
795 decl = std::move(*maybeDecl);
798 "Failed to resolve declaration for '{1}': {0}", uname);
804 llvm::expectedToOptional(underlying_type->GetByteSize(
nullptr)),
nullptr,
810 const ArrayRecord &ar,
819 array_sp->SetEncodingType(element_type.get());
824 const MemberFunctionRecord &mfr,
826 if (mfr.ReturnType.isSimple())
837 const ProcedureRecord &pr,
839 if (pr.ReturnType.isSimple())
850 llvm::codeview::TypeIndex arglist_ti) {
851 if (arglist_ti.isNoneType())
854 CVType arglist_cvt =
m_index->tpi().getType(arglist_ti);
855 if (arglist_cvt.kind() != LF_ARGLIST)
860 TypeDeserializer::deserializeAs<ArgListRecord>(arglist_cvt, alr)) {
862 "Failed to deserialize ArgListRecord record ({1}): {0}",
866 for (TypeIndex
id : alr.getIndices())
867 if (!
id.isNoneType() &&
id.isSimple())
872 if (type_id.
index.isSimple())
876 CVType cvt = stream.getType(type_id.
index);
878 if (cvt.kind() == LF_MODIFIER) {
879 ModifierRecord modifier;
881 TypeDeserializer::deserializeAs<ModifierRecord>(cvt, modifier)) {
883 "Failed to deserialize ModifierRecord record ({1}): {0}",
890 if (cvt.kind() == LF_POINTER) {
891 PointerRecord pointer;
893 TypeDeserializer::deserializeAs<PointerRecord>(cvt, pointer)) {
895 "Failed to deserialize PointerRecord record ({1}): {0}",
904 if (
auto err = TypeDeserializer::deserializeAs<ClassRecord>(cvt, cr)) {
906 "Failed to deserialize ClassRecord record ({1}): {0}",
913 if (cvt.kind() == LF_ENUM) {
915 if (
auto err = TypeDeserializer::deserializeAs<EnumRecord>(cvt, er)) {
917 "Failed to deserialize EnumRecord record ({1}): {0}",
924 if (cvt.kind() == LF_UNION) {
926 if (
auto err = TypeDeserializer::deserializeAs<UnionRecord>(cvt, ur)) {
928 "Failed to deserialize UnionRecord record ({1}): {0}",
935 if (cvt.kind() == LF_ARRAY) {
937 if (
auto err = TypeDeserializer::deserializeAs<ArrayRecord>(cvt, ar)) {
939 "Failed to deserialize ArrayRecord record ({1}): {0}",
946 if (cvt.kind() == LF_PROCEDURE) {
948 if (
auto err = TypeDeserializer::deserializeAs<ProcedureRecord>(cvt, pr)) {
950 "Failed to deserialize ProcedureRecord record ({1}): {0}",
956 if (cvt.kind() == LF_MFUNCTION) {
957 MemberFunctionRecord mfr;
959 TypeDeserializer::deserializeAs<MemberFunctionRecord>(cvt, mfr)) {
962 "Failed to deserialize MemberFunctionRecord record ({1}): {0}",
975 std::optional<PdbTypeSymId> full_decl_uid;
977 auto expected_full_ti =
978 m_index->tpi().findFullDeclForForwardRef(type_id.
index);
979 if (!expected_full_ti)
980 llvm::consumeError(expected_full_ti.takeError());
981 else if (*expected_full_ti != type_id.
index) {
989 if (full_iter !=
m_types.end()) {
990 TypeSP result = full_iter->second;
999 PdbTypeSymId best_decl_id = full_decl_uid ? *full_decl_uid : type_id;
1001 if (
auto err = ts_or_err.takeError())
1003 auto ts = *ts_or_err;
1033 return iter->second;
1042 CVSymbol sym =
m_index->symrecords().readRecord(var_id.
offset);
1043 if (sym.kind() == S_CONSTANT)
1048 llvm::StringRef name;
1050 uint16_t section = 0;
1051 uint32_t offset = 0;
1052 bool is_external =
false;
1053 switch (sym.kind()) {
1058 DataSym ds(sym.kind());
1059 if (
auto err = SymbolDeserializer::deserializeAs<DataSym>(sym, ds)) {
1061 "Failed to deserialize DataSym record: {0}");
1068 section = ds.Segment;
1069 offset = ds.DataOffset;
1070 addr =
m_index->MakeVirtualAddress(ds.Segment, ds.DataOffset);
1077 ThreadLocalDataSym tlds(sym.kind());
1079 SymbolDeserializer::deserializeAs<ThreadLocalDataSym>(sym, tlds)) {
1081 "Failed to deserialize ThreadLocalDataSym record: {0}");
1086 section = tlds.Segment;
1087 offset = tlds.DataOffset;
1088 addr =
m_index->MakeVirtualAddress(tlds.Segment, tlds.DataOffset);
1093 llvm_unreachable(
"unreachable!");
1097 std::optional<uint16_t> modi =
m_index->GetModuleIndexForVa(addr);
1108 std::make_shared<SymbolFileType>(*
this,
toOpaqueUid(tid));
1111 if (
auto err = ts_or_err.takeError())
1113 auto ts = *ts_or_err;
1116 ast_builder->EnsureVariable(var_id);
1124 std::string global_name(
"::");
1125 global_name += name;
1126 bool artificial =
false;
1127 bool location_is_constant_data =
false;
1128 bool static_member =
false;
1129 VariableSP var_sp = std::make_shared<Variable>(
1130 toOpaqueUid(var_id), name.str().c_str(), global_name.c_str(), type_sp,
1131 scope, comp_unit.get(), ranges, &decl, location, is_external, artificial,
1132 location_is_constant_data, static_member);
1139 const CVSymbol &cvs) {
1140 TpiStream &tpi =
m_index->tpi();
1141 ConstantSym constant(cvs.kind());
1143 if (cvs.kind() != S_CONSTANT)
1147 SymbolDeserializer::deserializeAs<ConstantSym>(cvs, constant)) {
1149 "Failed to deserialize ConstantSym record: {0}");
1152 std::string global_name(
"::");
1153 global_name += constant.Name;
1156 std::make_shared<SymbolFileType>(*
this,
toOpaqueUid(tid));
1162 constant.Value, module);
1163 if (!location_or_err) {
1165 "Failed to make constant location expression for {1}: {0}",
1171 bool external =
false;
1172 bool artificial =
false;
1173 bool location_is_constant_data =
true;
1174 bool static_member =
false;
1175 VariableSP var_sp = std::make_shared<Variable>(
1176 toOpaqueUid(var_id), constant.Name.str().c_str(), global_name.c_str(),
1178 external, artificial, location_is_constant_data, static_member);
1185 if (emplace_result.second) {
1187 emplace_result.first->second = var_sp;
1192 return emplace_result.first->second;
1202 if (emplace_result.second)
1203 emplace_result.first->second =
CreateFunction(func_id, comp_unit);
1205 return emplace_result.first->second;
1211 auto emplace_result =
1213 if (emplace_result.second) {
1219 return emplace_result.first->second;
1225 return iter->second.get();
1244 assert(index < UINT16_MAX &&
"Invalid compile unit index");
1245 if (index >= UINT16_MAX)
1257 assert(
false &&
"uid of compile unit not a compiland");
1271 auto *section_list =
1272 m_objfile_sp->GetModule()->GetObjectFile()->GetSectionList();
1276 PublicSym32 last_sym;
1277 size_t last_sym_idx = 0;
1285 auto finish_last_symbol = [&](
const PublicSym32 *next) {
1292 if (next && last_sym.Segment == next->Segment) {
1293 assert(last_sym.Offset <= next->Offset);
1294 last->
SetByteSize(next->Offset - last_sym.Offset);
1297 assert(section_sp->GetByteSize() >= last_sym.Offset);
1298 assert(!next || next->Segment > last_sym.Segment);
1299 last->
SetByteSize(section_sp->GetByteSize() - last_sym.Offset);
1304 for (
auto pid :
m_index->publics().getAddressMap()) {
1306 CVSymbol sym =
m_index->ReadSymbolRecord(global);
1307 auto kind = sym.kind();
1308 if (kind != S_PUB32)
1310 auto pub_or_err = SymbolDeserializer::deserializeAs<PublicSym32>(sym);
1313 "Failed to deserialize PublicSym32 record: {0}");
1316 PublicSym32 pub = std::move(*pub_or_err);
1317 finish_last_symbol(&pub);
1319 if (!section_sp || last_sym.Segment != pub.Segment)
1320 section_sp = section_list->FindSectionByID(pub.Segment);
1326 if ((pub.Flags & PublicSymFlags::Function) != PublicSymFlags::None ||
1327 (pub.Flags & PublicSymFlags::Code) != PublicSymFlags::None)
1347 finish_last_symbol(
nullptr);
1354 assert(
false &&
"uid of compile unit not a compiland");
1362 for (
auto iter = syms.begin(); iter != syms.end(); ++iter) {
1363 if (iter->kind() != S_LPROC32 && iter->kind() != S_GPROC32)
1372 if (new_count < count) {
1373 assert(
false &&
"less functions after parsing than before");
1376 return new_count - count;
1381 uint32_t flags = eSymbolContextCompUnit;
1382 flags |= eSymbolContextVariable;
1383 flags |= eSymbolContextFunction;
1384 flags |= eSymbolContextBlock;
1385 flags |= eSymbolContextLineEntry;
1386 return (resolve_scope & flags) != 0;
1390 const Address &addr, SymbolContextItem resolve_scope, SymbolContext &sc) {
1392 uint32_t resolved_flags = 0;
1396 std::optional<uint16_t> modi =
m_index->GetModuleIndexForVa(file_addr);
1404 resolved_flags |= eSymbolContextCompUnit;
1407 if (resolve_scope & eSymbolContextFunction ||
1408 resolve_scope & eSymbolContextBlock) {
1411 "missing compile unit for symbol at address {0:x}", file_addr);
1414 std::vector<SymbolAndUid> matches =
m_index->FindSymbolsByVa(file_addr);
1418 for (
const auto &match : llvm::reverse(matches)) {
1422 PdbCompilandSymId csid = match.uid.asCompilandSym();
1423 CVSymbol cvs =
m_index->ReadSymbolRecord(csid);
1425 if (type != PDB_SymType::Function && type != PDB_SymType::Block)
1427 if (type == PDB_SymType::Function) {
1432 addr_t offset = file_addr - func_base;
1437 if (type == PDB_SymType::Block) {
1445 addr_t offset = file_addr - func_base;
1450 resolved_flags |= eSymbolContextFunction;
1452 resolved_flags |= eSymbolContextBlock;
1457 if (resolve_scope & eSymbolContextLineEntry) {
1460 "missing compile unit for symbol at address {0:x}", file_addr);
1464 if (line_table->FindLineEntryByAddress(addr, sc.
line_entry))
1465 resolved_flags |= eSymbolContextLineEntry;
1469 return resolved_flags;
1476 const uint32_t prev_size = sc_list.
GetSize();
1477 if (resolve_scope & eSymbolContextCompUnit) {
1486 if (file_spec_matches_cu_file_spec) {
1492 return sc_list.
GetSize() - prev_size;
1503 assert(
false &&
"uid of compile unit not a compiland");
1517 std::set<LineTable::Entry, LineTableEntryComparator> line_set;
1522 for (
const DebugSubsectionRecord &dssr :
1524 if (dssr.kind() != DebugSubsectionKind::Lines)
1527 DebugLinesSubsectionRef lines;
1528 llvm::BinaryStreamReader reader(dssr.getRecordData());
1529 if (
auto EC = lines.initialize(reader)) {
1530 llvm::consumeError(std::move(EC));
1534 const LineFragmentHeader *lfh = lines.header();
1535 uint64_t virtual_addr =
1536 m_index->MakeVirtualAddress(lfh->RelocSegment, lfh->RelocOffset);
1540 for (
const LineColumnEntry &group : lines) {
1541 llvm::Expected<uint32_t> file_index_or_err =
1543 if (!file_index_or_err) {
1545 "failed to get file index for line entry: {0}");
1548 uint32_t file_index = file_index_or_err.get();
1549 if (group.LineNumbers.empty()) {
1551 "no line numbers for {0} in modi={1}", group.NameIndex, modi);
1556 for (
const LineNumberEntry &entry : group.LineNumbers) {
1557 LineInfo cur_info(entry.Flags);
1559 if (cur_info.isAlwaysStepInto() || cur_info.isNeverStepInto())
1562 uint64_t addr = virtual_addr + entry.Offset;
1564 bool is_statement = cur_info.isStatement();
1568 uint32_t lno = cur_info.getStartLine();
1571 is_prologue, is_epilogue,
false);
1573 auto iter = line_set.find(new_entry);
1574 if (iter != line_set.end() && iter->is_terminal_entry)
1575 line_set.erase(iter);
1576 line_set.insert(new_entry);
1583 line_entry.
data = {file_index, lno};
1585 LineInfo last_line(group.LineNumbers.back().Flags);
1586 line_set.emplace(virtual_addr + lfh->CodeSize, last_line.getEndLine(), 0,
1587 file_index,
false,
false,
false,
false,
true);
1590 line_entry.
SetRangeEnd(virtual_addr + lfh->CodeSize);
1599 const CVSymbolArray &syms = cii->
m_debug_stream.getSymbolArray();
1600 for (
auto iter = syms.begin(); iter != syms.end();) {
1601 if (iter->kind() != S_LPROC32 && iter->kind() != S_GPROC32) {
1606 uint32_t record_offset = iter.offset();
1607 CVSymbol func_record =
1620 if (kind != S_INLINESITE)
1625 for (
const auto &line_entry :
1630 if (!line_entry.is_terminal_entry)
1631 line_set.erase(line_entry);
1632 line_set.insert(line_entry);
1640 iter = syms.at(getScopeEndOffset(func_record));
1646 std::vector<LineTable::Sequence> sequence(1);
1647 for (
const auto &line_entry : line_set) {
1649 sequence.back(), line_entry.file_addr, line_entry.line,
1650 line_entry.column, line_entry.file_idx,
1651 line_entry.is_start_of_statement, line_entry.is_start_of_basic_block,
1652 line_entry.is_prologue_end, line_entry.is_epilogue_begin,
1653 line_entry.is_terminal_entry);
1656 std::make_unique<LineTable>(&comp_unit, std::move(sequence));
1658 if (line_table->GetSize() == 0)
1670llvm::Expected<uint32_t>
1674 return llvm::make_error<RawError>(raw_error_code::no_entry);
1676 const auto &checksums = cii.
m_strings.checksums().getArray();
1677 const auto &strings = cii.
m_strings.strings();
1681 auto iter = checksums.at(file_id);
1682 if (iter == checksums.end())
1683 return llvm::make_error<RawError>(raw_error_code::no_entry);
1685 llvm::Expected<llvm::StringRef> efn = strings.getString(iter->FileNameOffset);
1687 return efn.takeError();
1693 return std::distance(cii.
m_file_list.begin(), fn_iter);
1694 return llvm::make_error<RawError>(raw_error_code::no_entry);
1702 assert(
false &&
"uid of compile unit not a compiland");
1715 f.starts_with(
"/") ? FileSpec::Style::posix : FileSpec::Style::windows;
1717 support_files.
Append(spec);
1723 const SymbolContext &sc, std::vector<SourceModule> &imported_modules) {
1736 CVSymbol sym = cii->
m_debug_stream.readSymbolAtOffset(
id.offset);
1738 if (sym.kind() != S_INLINESITE)
1741 InlineSiteSym inline_site(
static_cast<SymbolRecordKind
>(sym.kind()));
1743 SymbolDeserializer::deserializeAs<InlineSiteSym>(sym, inline_site)) {
1745 "Failed to deserialize InlineSiteSym record: {0}");
1750 std::shared_ptr<InlineSite> inline_site_sp =
1751 std::make_shared<InlineSite>(parent_id);
1754 auto iter = cii->
m_inline_map.find(inline_site.Inlinee);
1757 InlineeSourceLine inlinee_line = iter->second;
1761 llvm::Expected<uint32_t> file_index_or_err =
1763 if (!file_index_or_err) {
1765 "failed to get file index for inline site: {0}");
1768 uint32_t file_offset = file_index_or_err.get();
1770 uint32_t decl_line = inlinee_line.Header->SourceLineNum;
1771 std::unique_ptr<Declaration> decl_up =
1772 std::make_unique<Declaration>(decl_file, decl_line);
1775 uint32_t code_offset = 0;
1776 int32_t line_offset = 0;
1777 std::optional<uint32_t> code_offset_base;
1778 std::optional<uint32_t> code_offset_end;
1779 std::optional<int32_t> cur_line_offset;
1780 std::optional<int32_t> next_line_offset;
1781 std::optional<uint32_t> next_file_offset;
1783 bool is_terminal_entry =
false;
1784 bool is_start_of_statement =
true;
1786 bool is_prologue_end =
true;
1788 auto update_code_offset = [&](uint32_t code_delta) {
1789 if (!code_offset_base)
1790 code_offset_base = code_offset;
1791 else if (!code_offset_end)
1792 code_offset_end = *code_offset_base + code_delta;
1794 auto update_line_offset = [&](int32_t line_delta) {
1795 line_offset += line_delta;
1796 if (!code_offset_base || !cur_line_offset)
1797 cur_line_offset = line_offset;
1799 next_line_offset = line_offset;
1802 auto update_file_offset = [&](uint32_t offset) {
1803 if (!code_offset_base)
1804 file_offset = offset;
1806 next_file_offset = offset;
1809 for (
auto &annot : inline_site.annotations()) {
1810 switch (annot.OpCode) {
1811 case BinaryAnnotationsOpCode::CodeOffset:
1812 case BinaryAnnotationsOpCode::ChangeCodeOffset:
1813 case BinaryAnnotationsOpCode::ChangeCodeOffsetBase:
1814 code_offset += annot.U1;
1815 update_code_offset(annot.U1);
1817 case BinaryAnnotationsOpCode::ChangeLineOffset:
1818 update_line_offset(annot.S1);
1820 case BinaryAnnotationsOpCode::ChangeCodeLength:
1821 update_code_offset(annot.U1);
1822 code_offset += annot.U1;
1823 is_terminal_entry =
true;
1825 case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
1826 code_offset += annot.U1;
1827 update_code_offset(annot.U1);
1828 update_line_offset(annot.S1);
1830 case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
1831 code_offset += annot.U2;
1832 update_code_offset(annot.U2);
1833 update_code_offset(annot.U1);
1834 code_offset += annot.U1;
1835 is_terminal_entry =
true;
1837 case BinaryAnnotationsOpCode::ChangeFile:
1838 update_file_offset(annot.U1);
1845 if (code_offset_base && code_offset_end && cur_line_offset) {
1847 *code_offset_base, *code_offset_end - *code_offset_base,
1848 decl_line + *cur_line_offset));
1850 if (next_file_offset)
1851 file_offset = *next_file_offset;
1852 if (next_line_offset) {
1853 cur_line_offset = next_line_offset;
1854 next_line_offset = std::nullopt;
1856 code_offset_base = is_terminal_entry ? std::nullopt : code_offset_end;
1857 code_offset_end = next_file_offset = std::nullopt;
1859 if (code_offset_base && cur_line_offset) {
1860 if (is_terminal_entry) {
1862 func_base + *code_offset_base, decl_line + *cur_line_offset, 0,
1863 file_offset,
false,
false,
false,
false,
true);
1864 inline_site_sp->line_entries.push_back(line_entry);
1867 decl_line + *cur_line_offset, 0,
1868 file_offset, is_start_of_statement,
false,
1869 is_prologue_end,
false,
false);
1870 inline_site_sp->line_entries.push_back(line_entry);
1871 is_prologue_end =
false;
1872 is_start_of_statement =
false;
1875 if (is_terminal_entry)
1876 is_start_of_statement =
true;
1877 is_terminal_entry =
false;
1880 inline_site_sp->ranges.Sort();
1883 std::unique_ptr<Declaration> callsite_up;
1884 if (!inline_site_sp->ranges.IsEmpty()) {
1885 auto *entry = inline_site_sp->ranges.GetEntryAtIndex(0);
1886 addr_t base_offset = entry->GetRangeBase();
1892 std::shared_ptr<InlineSite> parent_site =
1895 parent_site->inline_function_info->GetDeclaration().GetFile();
1896 if (
auto *parent_entry =
1897 parent_site->ranges.FindEntryThatContains(base_offset)) {
1899 std::make_unique<Declaration>(parent_decl_file, parent_entry->data);
1904 func_base + base_offset)) {
1908 std::make_unique<Declaration>(callsite_file, entry->data.second);
1914 std::string inlinee_name;
1915 llvm::Expected<CVType> inlinee_cvt =
1916 m_index->ipi().typeCollection().getTypeOrError(inline_site.Inlinee);
1918 inlinee_name =
"[error reading function name: " +
1919 llvm::toString(inlinee_cvt.takeError()) +
"]";
1920 }
else if (inlinee_cvt->kind() == LF_MFUNC_ID) {
1921 MemberFuncIdRecord mfr;
1922 if (
auto err = TypeDeserializer::deserializeAs<MemberFuncIdRecord>(
1923 *inlinee_cvt, mfr)) {
1925 "[error reading function name: " + llvm::toString(std::move(err)) +
1928 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
1929 inlinee_name.append(std::string(types.getTypeName(mfr.ClassType)));
1930 inlinee_name.append(
"::");
1931 inlinee_name.append(mfr.getName().str());
1933 }
else if (inlinee_cvt->kind() == LF_FUNC_ID) {
1936 TypeDeserializer::deserializeAs<FuncIdRecord>(*inlinee_cvt, fir)) {
1938 "[error reading function name: " + llvm::toString(std::move(err)) +
1941 TypeIndex parent_idx = fir.getParentScope();
1942 if (!parent_idx.isNoneType()) {
1943 LazyRandomTypeCollection &ids =
m_index->ipi().typeCollection();
1944 inlinee_name.append(std::string(ids.getTypeName(parent_idx)));
1945 inlinee_name.append(
"::");
1947 inlinee_name.append(fir.getName().str());
1950 inline_site_sp->inline_function_info = std::make_shared<InlineFunctionInfo>(
1951 inlinee_name.c_str(), llvm::StringRef(), decl_up.get(),
1962 std::set<uint64_t> remove_uids;
1964 if (kind == S_GPROC32 || kind == S_LPROC32 || kind == S_BLOCK32 ||
1965 kind == S_INLINESITE) {
1967 if (kind == S_INLINESITE)
1974 for (uint64_t uid : remove_uids) {
1986 CVSymbolArray syms =
1990 for (
auto iter = syms.begin(); iter != syms.end(); ++iter) {
1992 if (fn(iter->kind(), child_id))
2004 "failed to get C++ type system: {0}");
2007 auto ts = *ts_or_err;
2014 ast_builder->
Dump(s, filter, show_color);
2022 std::map<std::pair<uint16_t, uint32_t>, uint32_t> func_addr_ids;
2025 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
2026 CVSymbol sym =
m_index->symrecords().readRecord(gid);
2027 auto kind = sym.kind();
2030 llvm::StringRef name;
2032 case SymbolKind::S_GDATA32:
2033 case SymbolKind::S_LDATA32: {
2034 auto data_or_err = SymbolDeserializer::deserializeAs<DataSym>(sym);
2037 "Failed to deserialize DataSym record: {0}");
2040 name = data_or_err->Name;
2043 case SymbolKind::S_GTHREAD32:
2044 case SymbolKind::S_LTHREAD32: {
2046 SymbolDeserializer::deserializeAs<ThreadLocalDataSym>(sym);
2049 "Failed to deserialize ThreadLocalDataSym record: {0}");
2052 name = data_or_err->Name;
2055 case SymbolKind::S_CONSTANT: {
2056 auto data_or_err = SymbolDeserializer::deserializeAs<ConstantSym>(sym);
2059 "Failed to deserialize ConstantSym record: {0}");
2062 name = data_or_err->Name;
2069 if (!name.empty()) {
2078 if (kind != S_PROCREF && kind != S_LPROCREF)
2084 auto ref_or_err = SymbolDeserializer::deserializeAs<ProcRefSym>(sym);
2087 "Failed to deserialize ProcRefSym record: {0}");
2090 ProcRefSym ref = std::move(*ref_or_err);
2091 if (ref.Name.empty())
2096 m_index->compilands().GetOrCreateCompiland(ref.modi());
2097 auto iter = cci.
m_debug_stream.getSymbolArray().at(ref.SymOffset);
2100 kind = iter->kind();
2101 if (kind != S_GPROC32 && kind != S_LPROC32)
2104 auto proc_or_err = SymbolDeserializer::deserializeAs<ProcSym>(*iter);
2107 "Failed to deserialize ProcSym record: {0}");
2110 ProcSym proc = std::move(*proc_or_err);
2111 if ((proc.Flags & ProcSymFlags::IsUnreachable) != ProcSymFlags::None)
2113 if (proc.Name.empty() || proc.FunctionType.isSimple())
2119 func_addr_ids.emplace(std::make_pair(proc.Segment, proc.CodeOffset), gid);
2122 if (basename.empty())
2123 basename = proc.Name;
2129 auto type =
m_index->tpi().getType(proc.FunctionType);
2130 if (type.kind() == LF_MFUNCTION) {
2131 MemberFunctionRecord mfr;
2132 if (
auto err = TypeDeserializer::deserializeAs<MemberFunctionRecord>(
2136 "Failed to deserialize MemberFunctionRecord record ({1}): {0}",
2138 }
else if (!mfr.getThisType().isNoneType())
2144 for (
auto pid :
m_index->publics().getPublicsTable()) {
2146 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2147 auto kind = sym.kind();
2148 if (kind != S_PUB32)
2150 auto pub_or_err = SymbolDeserializer::deserializeAs<PublicSym32>(sym);
2153 "Failed to deserialize PublicSym32 record: {0}");
2156 PublicSym32 pub = std::move(*pub_or_err);
2163 auto it = func_addr_ids.find({pub.Segment, pub.Offset});
2164 if (it != func_addr_ids.end())
2186 std::vector<uint32_t> results;
2189 size_t n_matches = 0;
2190 for (uint32_t gid : results) {
2193 if (parent_decl_ctx.
IsValid() &&
2202 if (++n_matches >= max_matches)
2214 if (name_type_mask & eFunctionNameTypeFull)
2217 if (!(name_type_mask & eFunctionNameTypeFull ||
2218 name_type_mask & eFunctionNameTypeBase ||
2219 name_type_mask & eFunctionNameTypeMethod))
2223 std::set<uint32_t> resolved_ids;
2225 std::vector<uint32_t> ids;
2226 if (!Names.GetValues(name, ids))
2229 for (uint32_t
id : ids) {
2230 if (!resolved_ids.insert(
id).second)
2234 if (parent_decl_ctx.
IsValid() &&
2238 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2239 auto kind = sym.kind();
2240 if (kind != S_PROCREF && kind != S_LPROCREF) {
2246 auto proc_or_err = SymbolDeserializer::deserializeAs<ProcRefSym>(sym);
2249 "Failed to deserialize ProcRefSym record: {0}");
2252 ProcRefSym proc = std::move(*proc_or_err);
2258 m_index->compilands().GetOrCreateCompiland(proc.modi());
2274 if (name_type_mask & eFunctionNameTypeFull)
2276 if (name_type_mask & eFunctionNameTypeBase)
2278 if (name_type_mask & eFunctionNameTypeMethod)
2283 bool include_inlines,
2300 std::vector<uint32_t> matches;
2303 for (uint32_t match_idx : matches) {
2305 if (context.empty())
2314 if (results.
Done(query))
2321 uint32_t max_matches,
2324 std::vector<TypeIndex> matches =
m_index->tpi().findRecordsByName(name);
2325 if (max_matches > 0 && max_matches < matches.size())
2326 matches.resize(max_matches);
2328 for (TypeIndex ti : matches) {
2344 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
2347 for (
auto ti = types.getFirst(); ti; ti = types.getNext(*ti)) {
2350 (void)type->GetFullCompilerType();
2354 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
2356 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2357 if (sym.kind() != S_UDT)
2360 auto udt_or_err = SymbolDeserializer::deserializeAs<UDTSym>(sym);
2363 "Failed to deserialize UDTSym record: {0}");
2366 UDTSym udt = std::move(*udt_or_err);
2367 bool is_typedef =
true;
2369 CVType cvt =
m_index->tpi().getType(udt.Type);
2371 if (name == udt.Name)
2383 return new_count - old_count;
2389 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
2391 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2396 switch (sym.kind()) {
2397 case SymbolKind::S_GDATA32:
2398 case SymbolKind::S_LDATA32:
2399 case SymbolKind::S_GTHREAD32:
2400 case SymbolKind::S_LTHREAD32: {
2427 bool location_is_constant_data = is_constant;
2431 if (sym.kind() != S_CONSTANT)
2433 ConstantSym constant(sym.kind());
2435 SymbolDeserializer::deserializeAs<ConstantSym>(sym, constant)) {
2437 "Failed to deserialize ConstantSym record: {0}");
2441 var_info.
name = constant.Name;
2442 var_info.
type = constant.Type;
2444 constant.Type,
m_index->tpi(), constant.Value, module);
2445 if (!location_or_err) {
2447 "Failed to make constant location expression for {1}: {0}",
2455 Block *func_block = block;
2476 std::string name = var_info.
name.str();
2479 std::make_shared<SymbolFileType>(*
this, type_sp->GetID());
2484 bool external =
false;
2485 bool artificial =
false;
2486 bool static_member =
false;
2488 VariableSP var_sp = std::make_shared<Variable>(
2489 toOpaqueUid(var_id), name.c_str(), name.c_str(), sftype, var_scope, block,
2490 scope_ranges, &decl, var_info.
location, external, artificial,
2491 location_is_constant_data, static_member);
2494 if (
auto err = ts_or_err.takeError())
2496 auto ts = *ts_or_err;
2499 ast_builder->EnsureVariable(scope_id, var_id);
2509 bool is_param,
bool is_constant) {
2512 return iter->second;
2518 CVSymbol sym =
m_index->ReadSymbolRecord(
id);
2519 if (sym.kind() != S_UDT) {
2524 auto udt_or_err = SymbolDeserializer::deserializeAs<UDTSym>(sym);
2527 "Failed to deserialize UDTSym record: {0}");
2530 UDTSym udt = std::move(*udt_or_err);
2535 if (
auto err = ts_or_err.takeError())
2537 auto ts = *ts_or_err;
2545 ct = target_type->GetForwardCompilerType();
2549 llvm::expectedToOptional(target_type->GetByteSize(
nullptr)),
2550 nullptr, target_type->GetID(),
2558 return iter->second;
2572 uint32_t params_remaining = 0;
2573 switch (sym.kind()) {
2576 ProcSym proc(
static_cast<SymbolRecordKind
>(sym.kind()));
2577 if (
auto err = SymbolDeserializer::deserializeAs<ProcSym>(sym, proc)) {
2579 "Failed to deserialize ProcSym record: {0}");
2582 CVType signature =
m_index->tpi().getType(proc.FunctionType);
2583 if (signature.kind() == LF_PROCEDURE) {
2584 ProcedureRecord sig;
2585 if (llvm::Error e = TypeDeserializer::deserializeAs<ProcedureRecord>(
2587 llvm::consumeError(std::move(e));
2590 params_remaining = sig.getParameterCount();
2591 }
else if (signature.kind() == LF_MFUNCTION) {
2592 MemberFunctionRecord sig;
2593 if (llvm::Error e = TypeDeserializer::deserializeAs<MemberFunctionRecord>(
2595 llvm::consumeError(std::move(e));
2598 params_remaining = sig.getParameterCount();
2614 variables = std::make_shared<VariableList>();
2618 CVSymbolArray syms = limitSymbolArrayToScope(
2624 auto iter = syms.begin();
2625 auto end = syms.end();
2627 while (iter != end) {
2628 uint32_t record_offset = iter.offset();
2629 CVSymbol variable_cvs = *iter;
2635 if (variable_cvs.kind() == S_BLOCK32 ||
2636 variable_cvs.kind() == S_INLINESITE) {
2637 uint32_t block_end = getScopeEndOffset(variable_cvs);
2639 iter = syms.at(block_end);
2643 bool is_param = params_remaining > 0;
2645 switch (variable_cvs.kind()) {
2647 case S_REGREL32_INDIR:
2654 variables->AddVariableIfUnique(variable);
2661 variables->AddVariableIfUnique(variable);
2695 variables = std::make_shared<VariableList>();
2702 "missing missing block, function, or module for symbol context");
2708 if (
auto err = ts_or_err.takeError())
2710 auto ts = *ts_or_err;
2722 if (
auto err = ts_or_err.takeError())
2724 auto ts = *ts_or_err;
2736 if (
auto err = ts_or_err.takeError())
2738 auto ts = *ts_or_err;
2749 auto iter =
m_types.find(type_uid);
2756 return &*iter->second;
2760 assert(
false &&
"uid is not a type index");
2764 if (type_id.
index.isNoneType())
2773std::optional<SymbolFile::ArrayInfo>
2776 return std::nullopt;
2792 TypeClass type_mask,
2801 if (
auto err = ts_or_err.takeError())
2803 auto ts = *ts_or_err;
2806 auto *
clang = llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
2817llvm::Expected<lldb::TypeSystemSP>
2819 auto type_system_or_err =
2820 m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
2821 if (type_system_or_err)
2822 if (
auto ts = *type_system_or_err)
2823 ts->SetSymbolFile(
this);
2824 return type_system_or_err;
2829 return m_index->pdb().getFileSize();
2837 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
2839 llvm::DenseMap<TypeIndex, TypeIndex> forward_to_full;
2840 llvm::DenseMap<TypeIndex, TypeIndex> full_to_forward;
2842 struct RecordIndices {
2847 llvm::StringMap<RecordIndices> record_indices;
2849 for (
auto ti = types.getFirst(); ti; ti = types.getNext(*ti)) {
2850 CVType type = types.getType(*ti);
2856 RecordIndices &indices = record_indices[tag.
asTag().getUniqueName()];
2857 if (tag.
asTag().isForwardRef()) {
2858 indices.forward = *ti;
2866 if (indices.full != TypeIndex::None() &&
2867 indices.forward != TypeIndex::None()) {
2868 forward_to_full[indices.forward] = indices.full;
2869 full_to_forward[indices.full] = indices.forward;
2875 if (tag.
asTag().isForwardRef() || !tag.
asTag().containsNestedClass())
2879 ProcessTpiStream(
PdbIndex &index, TypeIndex parent,
2881 llvm::DenseMap<TypeIndex, TypeIndex> &parents)
2882 : index(index), parents(parents), parent(parent),
2883 parent_cvt(parent_cvt) {}
2886 llvm::DenseMap<TypeIndex, TypeIndex> &parents;
2888 unsigned unnamed_type_index = 1;
2892 llvm::Error visitKnownMember(CVMemberRecord &CVR,
2893 NestedTypeRecord &Record)
override {
2894 std::string unnamed_type_name;
2895 if (Record.Name.empty()) {
2897 llvm::formatv(
"<unnamed-type-$S{0}>", unnamed_type_index).str();
2898 Record.Name = unnamed_type_name;
2899 ++unnamed_type_index;
2901 std::optional<CVTagRecord> tag =
2904 return llvm::ErrorSuccess();
2906 parents[Record.Type] = parent;
2907 return llvm::ErrorSuccess();
2911 CVType field_list_cvt =
m_index->tpi().getType(tag.
asTag().FieldList);
2912 if (field_list_cvt.kind() != LF_FIELDLIST)
2916 FieldListRecord field_list;
2917 if (llvm::Error
error = TypeDeserializer::deserializeAs<FieldListRecord>(
2918 field_list_cvt, field_list))
2919 llvm::consumeError(std::move(
error));
2920 if (llvm::Error
error = visitMemberRecordStream(field_list.Data, process))
2921 llvm::consumeError(std::move(
error));
2933 std::vector<TypeIndex> full_keys;
2934 std::vector<TypeIndex> fwd_keys;
2936 TypeIndex key = entry.first;
2937 TypeIndex value = entry.second;
2939 auto iter = forward_to_full.find(value);
2940 if (iter != forward_to_full.end())
2941 entry.second = iter->second;
2943 iter = forward_to_full.find(key);
2944 if (iter != forward_to_full.end())
2945 fwd_keys.push_back(key);
2947 full_keys.push_back(key);
2949 for (TypeIndex fwd : fwd_keys) {
2950 TypeIndex full = forward_to_full[fwd];
2954 for (TypeIndex full : full_keys) {
2955 TypeIndex fwd = full_to_forward[full];
2960std::optional<PdbCompilandSymId>
2962 CVSymbol sym =
m_index->ReadSymbolRecord(
id);
2963 if (symbolOpensScope(sym.kind())) {
2966 id.offset = getScopeParentOffset(sym);
2970 return std::nullopt;
2979 auto begin = syms.begin();
2980 auto end = syms.at(
id.offset);
2981 std::vector<PdbCompilandSymId> scope_stack;
2983 while (begin != end) {
2984 if (begin.offset() >
id.offset) {
2988 return std::nullopt;
2993 if (symbolOpensScope(begin->kind())) {
2996 uint32_t scope_end = getScopeEndOffset(*begin);
2997 if (scope_end <
id.offset) {
2998 begin = syms.at(scope_end);
3001 scope_stack.emplace_back(
id.modi, begin.offset());
3003 }
else if (symbolEndsScope(begin->kind())) {
3004 scope_stack.pop_back();
3008 if (scope_stack.empty())
3009 return std::nullopt;
3011 return scope_stack.back();
3014std::optional<llvm::codeview::TypeIndex>
3019 return std::nullopt;
3020 return parent_iter->second;
3023std::vector<CompilerContext>
3025 CVType type =
m_index->tpi().getType(ti);
3031 std::optional<Type::ParsedName> parsed_name =
3036 std::vector<CompilerContext> ctx;
3038 for (llvm::StringRef scope : parsed_name->scope) {
3045 for (
auto &el : llvm::reverse(llvm::drop_end(ctx))) {
3051 type =
m_index->tpi().getType(ti);
3052 switch (type.kind()) {
3072std::optional<llvm::StringRef>
3077 return std::nullopt;
3080 if (sym_record.kind() != S_LPROC32 && sym_record.kind() != S_GPROC32)
3081 return std::nullopt;
3083 ProcSym proc(
static_cast<SymbolRecordKind
>(sym_record.kind()));
3084 if (
auto err = SymbolDeserializer::deserializeAs<ProcSym>(sym_record, proc)) {
3086 "Failed to deserialize ProcSym record: {0}");
3087 return std::nullopt;
3094std::optional<llvm::StringRef>
3096 TypeIndex function_type) {
3097 auto symbol =
m_index->publics().findByAddress(
m_index->symrecords(),
3100 return std::nullopt;
3102 llvm::StringRef name = symbol->first.Name;
3105 if (!function_type.isNoneType() &&
3106 (symbol->first.Flags & PublicSymFlags::Function) != PublicSymFlags::None)
3123 if (!mangled.starts_with(
'_') ||
3124 m_index->dbi().getMachineType() != PDB_Machine::x86)
3128 PDB_CallingConv cc = PDB_CallingConv::NearC;
3129 if (cvt.kind() == LF_PROCEDURE) {
3130 ProcedureRecord proc;
3131 if (llvm::Error
error =
3132 TypeDeserializer::deserializeAs<ProcedureRecord>(cvt, proc))
3133 llvm::consumeError(std::move(
error));
3135 }
else if (cvt.kind() == LF_MFUNCTION) {
3136 MemberFunctionRecord mfunc;
3137 if (llvm::Error
error =
3138 TypeDeserializer::deserializeAs<MemberFunctionRecord>(cvt, mfunc))
3139 llvm::consumeError(std::move(
error));
3140 cc = mfunc.CallConv;
3147 if (cc == PDB_CallingConv::NearC || cc == PDB_CallingConv::FarC)
3148 return mangled.drop_front();
3154 for (CVType cvt :
m_index->ipi().typeArray()) {
3155 switch (cvt.kind()) {
3156 case LF_UDT_SRC_LINE: {
3157 UdtSourceLineRecord udt_src;
3158 if (
auto err = TypeDeserializer::deserializeAs(cvt, udt_src)) {
3160 "Failed to deserialize UdtSourceLineRecord record: {0}");
3166 udt_src.LineNumber});
3168 case LF_UDT_MOD_SRC_LINE: {
3169 UdtModSourceLineRecord udt_mod_src;
3170 if (
auto err = TypeDeserializer::deserializeAs(cvt, udt_mod_src)) {
3173 "Failed to deserialize UdtModSourceLineRecord record: {0}");
3183 udt_mod_src.LineNumber});
3191llvm::Expected<Declaration>
3197 return llvm::createStringError(
"no UDT declaration found");
3199 llvm::StringRef file_name;
3200 if (it->second.IsIpiIndex) {
3201 CVType cvt =
m_index->ipi().getType(it->second.FileNameIndex);
3202 if (cvt.kind() != LF_STRING_ID)
3203 return llvm::createStringError(
"file name was not a LF_STRING_ID");
3206 if (
auto err = TypeDeserializer::deserializeAs(cvt, sid))
3207 return std::move(err);
3208 file_name = sid.String;
3211 auto string_table =
m_index->pdb().getStringTable();
3213 return string_table.takeError();
3215 llvm::Expected<llvm::StringRef>
string =
3216 string_table->getStringTable().getString(
3217 it->second.FileNameIndex.getIndex());
3219 return string.takeError();
3220 file_name = *string;
3224 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