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}");
499 m_index->MakeVirtualAddress(block.Segment, block.CodeOffset);
502 if (block_base >= func_base)
503 child_block->AddRange(
Block::Range(block_base - func_base, block.CodeSize));
506 "S_BLOCK32 at modi: {0:d} offset: {1:d}: adding range "
507 "[{2:x16}-{3:x16}) which has a base that is less than the "
509 "low PC 0x%" PRIx64
". Please file a bug and attach the file at the "
510 "start of this error message",
512 block_base + block.CodeSize, func_base);
516 m_blocks.insert({opaque_block_uid, child_block});
521 comp_unit->GetLineTable();
523 std::shared_ptr<InlineSite> inline_site =
m_inline_sites[opaque_block_uid];
531 for (
size_t i = 0; i < inline_site->ranges.GetSize(); ++i) {
532 auto *entry = inline_site->ranges.GetEntryAtIndex(i);
533 child_block->AddRange(
534 Block::Range(entry->GetRangeBase(), entry->GetByteSize()));
536 child_block->FinalizeRanges();
539 Declaration &decl = inline_site->inline_function_info->GetDeclaration();
540 Declaration &callsite = inline_site->inline_function_info->GetCallSite();
541 child_block->SetInlinedFunctionInfo(
542 inline_site->inline_function_info->GetName().GetCString(),
nullptr,
544 m_blocks.insert({opaque_block_uid, child_block});
548 lldbassert(
false &&
"Symbol is not a block!");
561 lldbassert(sym_record.kind() == S_LPROC32 || sym_record.kind() == S_GPROC32);
573 ProcSym proc(
static_cast<SymbolRecordKind
>(sym_record.kind()));
574 if (
auto err = SymbolDeserializer::deserializeAs<ProcSym>(sym_record, proc)) {
576 "Failed to deserialize ProcSym record: {0}");
579 if (proc.FunctionType == TypeIndex::None())
588 SegmentOffset(proc.Segment, proc.CodeOffset), proc.FunctionType);
589 Mangled mangled(mangled_opt.value_or(proc.Name));
591 FunctionSP func_sp = std::make_shared<Function>(
593 func_type.get(), func_addr,
599 if (
auto err = ts_or_err.takeError())
601 auto ts = *ts_or_err;
604 ast_builder->EnsureFunction(func_id);
620 llvm::SmallString<64> source_file_name;
621 if (
auto main_file_or_err =
m_index->compilands().GetMainSourceFile(cci)) {
622 source_file_name = std::move(*main_file_or_err);
625 "Failed to determine main source file: {0}");
627 FileSpec fs(llvm::sys::path::convert_to_slash(
628 source_file_name, llvm::sys::path::Style::windows_backslash));
630 CompUnitSP cu_sp = std::make_shared<CompileUnit>(
631 m_objfile_sp->GetModule(),
nullptr, std::make_shared<SupportFile>(fs),
639 const ModifierRecord &mr,
641 TpiStream &stream =
m_index->tpi();
645 if ((mr.Modifiers & ModifierOptions::Const) != ModifierOptions::None)
647 if ((mr.Modifiers & ModifierOptions::Volatile) != ModifierOptions::None)
649 if ((mr.Modifiers & ModifierOptions::Unaligned) != ModifierOptions::None)
650 name +=
"__unaligned ";
652 if (mr.ModifiedType.isSimple())
655 name += computeTypeName(stream.typeCollection(), mr.ModifiedType);
660 llvm::expectedToOptional(modified_type->GetByteSize(
nullptr)),
667 const llvm::codeview::PointerRecord &pr,
673 if (pr.isPointerToMember()) {
674 MemberPointerInfo mpi = pr.getMemberInfo();
687 if (ti == TypeIndex::NullptrT()) {
694 if (ti.getSimpleMode() != SimpleTypeMode::Direct) {
696 uint32_t pointer_size = 0;
697 switch (ti.getSimpleMode()) {
698 case SimpleTypeMode::FarPointer32:
699 case SimpleTypeMode::NearPointer32:
702 case SimpleTypeMode::NearPointer64:
714 if (ti.getSimpleKind() == SimpleTypeKind::NotTranslated)
726 if (!record.hasUniqueName())
729 llvm::ms_demangle::Demangler demangler;
730 std::string_view sv(record.UniqueName.begin(), record.UniqueName.size());
731 llvm::ms_demangle::TagTypeNode *ttn = demangler.parseTagUniqueName(sv);
735 llvm::ms_demangle::IdentifierNode *idn =
736 ttn->QualifiedName->getUnqualifiedIdentifier();
737 return idn->toString();
742 const TagRecord &record,
750 decl = std::move(*maybeDecl);
753 "Failed to resolve declaration for '{1}': {0}", uname);
761 const ClassRecord &cr,
767 const UnionRecord &ur,
773 const EnumRecord &er,
780 decl = std::move(*maybeDecl);
783 "Failed to resolve declaration for '{1}': {0}", uname);
789 llvm::expectedToOptional(underlying_type->GetByteSize(
nullptr)),
nullptr,
795 const ArrayRecord &ar,
804 array_sp->SetEncodingType(element_type.get());
809 const MemberFunctionRecord &mfr,
811 if (mfr.ReturnType.isSimple())
822 const ProcedureRecord &pr,
824 if (pr.ReturnType.isSimple())
835 llvm::codeview::TypeIndex arglist_ti) {
836 if (arglist_ti.isNoneType())
839 CVType arglist_cvt =
m_index->tpi().getType(arglist_ti);
840 if (arglist_cvt.kind() != LF_ARGLIST)
845 TypeDeserializer::deserializeAs<ArgListRecord>(arglist_cvt, alr)) {
847 "Failed to deserialize ArgListRecord record ({1}): {0}",
851 for (TypeIndex
id : alr.getIndices())
852 if (!
id.isNoneType() &&
id.isSimple())
857 if (type_id.
index.isSimple())
861 CVType cvt = stream.getType(type_id.
index);
863 if (cvt.kind() == LF_MODIFIER) {
864 ModifierRecord modifier;
866 TypeDeserializer::deserializeAs<ModifierRecord>(cvt, modifier)) {
868 "Failed to deserialize ModifierRecord record ({1}): {0}",
875 if (cvt.kind() == LF_POINTER) {
876 PointerRecord pointer;
878 TypeDeserializer::deserializeAs<PointerRecord>(cvt, pointer)) {
880 "Failed to deserialize PointerRecord record ({1}): {0}",
889 if (
auto err = TypeDeserializer::deserializeAs<ClassRecord>(cvt, cr)) {
891 "Failed to deserialize ClassRecord record ({1}): {0}",
898 if (cvt.kind() == LF_ENUM) {
900 if (
auto err = TypeDeserializer::deserializeAs<EnumRecord>(cvt, er)) {
902 "Failed to deserialize EnumRecord record ({1}): {0}",
909 if (cvt.kind() == LF_UNION) {
911 if (
auto err = TypeDeserializer::deserializeAs<UnionRecord>(cvt, ur)) {
913 "Failed to deserialize UnionRecord record ({1}): {0}",
920 if (cvt.kind() == LF_ARRAY) {
922 if (
auto err = TypeDeserializer::deserializeAs<ArrayRecord>(cvt, ar)) {
924 "Failed to deserialize ArrayRecord record ({1}): {0}",
931 if (cvt.kind() == LF_PROCEDURE) {
933 if (
auto err = TypeDeserializer::deserializeAs<ProcedureRecord>(cvt, pr)) {
935 "Failed to deserialize ProcedureRecord record ({1}): {0}",
941 if (cvt.kind() == LF_MFUNCTION) {
942 MemberFunctionRecord mfr;
944 TypeDeserializer::deserializeAs<MemberFunctionRecord>(cvt, mfr)) {
947 "Failed to deserialize MemberFunctionRecord record ({1}): {0}",
960 std::optional<PdbTypeSymId> full_decl_uid;
962 auto expected_full_ti =
963 m_index->tpi().findFullDeclForForwardRef(type_id.
index);
964 if (!expected_full_ti)
965 llvm::consumeError(expected_full_ti.takeError());
966 else if (*expected_full_ti != type_id.
index) {
974 if (full_iter !=
m_types.end()) {
975 TypeSP result = full_iter->second;
984 PdbTypeSymId best_decl_id = full_decl_uid ? *full_decl_uid : type_id;
986 if (
auto err = ts_or_err.takeError())
988 auto ts = *ts_or_err;
1018 return iter->second;
1027 CVSymbol sym =
m_index->symrecords().readRecord(var_id.
offset);
1028 if (sym.kind() == S_CONSTANT)
1033 llvm::StringRef name;
1035 uint16_t section = 0;
1036 uint32_t offset = 0;
1037 bool is_external =
false;
1038 switch (sym.kind()) {
1043 DataSym ds(sym.kind());
1044 if (
auto err = SymbolDeserializer::deserializeAs<DataSym>(sym, ds)) {
1046 "Failed to deserialize DataSym record: {0}");
1053 section = ds.Segment;
1054 offset = ds.DataOffset;
1055 addr =
m_index->MakeVirtualAddress(ds.Segment, ds.DataOffset);
1062 ThreadLocalDataSym tlds(sym.kind());
1064 SymbolDeserializer::deserializeAs<ThreadLocalDataSym>(sym, tlds)) {
1066 "Failed to deserialize ThreadLocalDataSym record: {0}");
1071 section = tlds.Segment;
1072 offset = tlds.DataOffset;
1073 addr =
m_index->MakeVirtualAddress(tlds.Segment, tlds.DataOffset);
1078 llvm_unreachable(
"unreachable!");
1082 std::optional<uint16_t> modi =
m_index->GetModuleIndexForVa(addr);
1093 std::make_shared<SymbolFileType>(*
this,
toOpaqueUid(tid));
1096 if (
auto err = ts_or_err.takeError())
1098 auto ts = *ts_or_err;
1101 ast_builder->EnsureVariable(var_id);
1109 std::string global_name(
"::");
1110 global_name += name;
1111 bool artificial =
false;
1112 bool location_is_constant_data =
false;
1113 bool static_member =
false;
1114 VariableSP var_sp = std::make_shared<Variable>(
1115 toOpaqueUid(var_id), name.str().c_str(), global_name.c_str(), type_sp,
1116 scope, comp_unit.get(), ranges, &decl, location, is_external, artificial,
1117 location_is_constant_data, static_member);
1124 const CVSymbol &cvs) {
1125 TpiStream &tpi =
m_index->tpi();
1126 ConstantSym constant(cvs.kind());
1129 SymbolDeserializer::deserializeAs<ConstantSym>(cvs, constant)) {
1131 "Failed to deserialize ConstantSym record: {0}");
1134 std::string global_name(
"::");
1135 global_name += constant.Name;
1138 std::make_shared<SymbolFileType>(*
this,
toOpaqueUid(tid));
1144 constant.Value, module);
1145 if (!location_or_err) {
1147 "Failed to make constant location expression for {1}: {0}",
1153 bool external =
false;
1154 bool artificial =
false;
1155 bool location_is_constant_data =
true;
1156 bool static_member =
false;
1157 VariableSP var_sp = std::make_shared<Variable>(
1158 toOpaqueUid(var_id), constant.Name.str().c_str(), global_name.c_str(),
1160 external, artificial, location_is_constant_data, static_member);
1167 if (emplace_result.second) {
1169 emplace_result.first->second = var_sp;
1174 return emplace_result.first->second;
1184 if (emplace_result.second)
1185 emplace_result.first->second =
CreateFunction(func_id, comp_unit);
1187 return emplace_result.first->second;
1193 auto emplace_result =
1195 if (emplace_result.second)
1199 return emplace_result.first->second;
1205 return iter->second.get();
1225 if (index >= UINT16_MAX)
1248 auto *section_list =
1249 m_objfile_sp->GetModule()->GetObjectFile()->GetSectionList();
1253 PublicSym32 last_sym;
1254 size_t last_sym_idx = 0;
1262 auto finish_last_symbol = [&](
const PublicSym32 *next) {
1269 if (next && last_sym.Segment == next->Segment) {
1270 assert(last_sym.Offset <= next->Offset);
1271 last->
SetByteSize(next->Offset - last_sym.Offset);
1274 assert(section_sp->GetByteSize() >= last_sym.Offset);
1275 assert(!next || next->Segment > last_sym.Segment);
1276 last->
SetByteSize(section_sp->GetByteSize() - last_sym.Offset);
1281 for (
auto pid :
m_index->publics().getAddressMap()) {
1283 CVSymbol sym =
m_index->ReadSymbolRecord(global);
1284 auto kind = sym.kind();
1285 if (kind != S_PUB32)
1287 auto pub_or_err = SymbolDeserializer::deserializeAs<PublicSym32>(sym);
1290 "Failed to deserialize PublicSym32 record: {0}");
1293 PublicSym32 pub = std::move(*pub_or_err);
1294 finish_last_symbol(&pub);
1296 if (!section_sp || last_sym.Segment != pub.Segment)
1297 section_sp = section_list->FindSectionByID(pub.Segment);
1303 if ((pub.Flags & PublicSymFlags::Function) != PublicSymFlags::None ||
1304 (pub.Flags & PublicSymFlags::Code) != PublicSymFlags::None)
1324 finish_last_symbol(
nullptr);
1336 for (
auto iter = syms.begin(); iter != syms.end(); ++iter) {
1337 if (iter->kind() != S_LPROC32 && iter->kind() != S_GPROC32)
1347 return new_count - count;
1352 uint32_t flags = eSymbolContextCompUnit;
1353 flags |= eSymbolContextVariable;
1354 flags |= eSymbolContextFunction;
1355 flags |= eSymbolContextBlock;
1356 flags |= eSymbolContextLineEntry;
1357 return (resolve_scope & flags) != 0;
1361 const Address &addr, SymbolContextItem resolve_scope, SymbolContext &sc) {
1363 uint32_t resolved_flags = 0;
1367 std::optional<uint16_t> modi =
m_index->GetModuleIndexForVa(file_addr);
1375 resolved_flags |= eSymbolContextCompUnit;
1378 if (resolve_scope & eSymbolContextFunction ||
1379 resolve_scope & eSymbolContextBlock) {
1381 std::vector<SymbolAndUid> matches =
m_index->FindSymbolsByVa(file_addr);
1385 for (
const auto &match : llvm::reverse(matches)) {
1389 PdbCompilandSymId csid = match.uid.asCompilandSym();
1390 CVSymbol cvs =
m_index->ReadSymbolRecord(csid);
1392 if (type != PDB_SymType::Function && type != PDB_SymType::Block)
1394 if (type == PDB_SymType::Function) {
1399 addr_t offset = file_addr - func_base;
1404 if (type == PDB_SymType::Block) {
1412 addr_t offset = file_addr - func_base;
1417 resolved_flags |= eSymbolContextFunction;
1419 resolved_flags |= eSymbolContextBlock;
1424 if (resolve_scope & eSymbolContextLineEntry) {
1427 if (line_table->FindLineEntryByAddress(addr, sc.
line_entry))
1428 resolved_flags |= eSymbolContextLineEntry;
1432 return resolved_flags;
1439 const uint32_t prev_size = sc_list.
GetSize();
1440 if (resolve_scope & eSymbolContextCompUnit) {
1449 if (file_spec_matches_cu_file_spec) {
1455 return sc_list.
GetSize() - prev_size;
1474 std::set<LineTable::Entry, LineTableEntryComparator> line_set;
1479 for (
const DebugSubsectionRecord &dssr :
1481 if (dssr.kind() != DebugSubsectionKind::Lines)
1484 DebugLinesSubsectionRef lines;
1485 llvm::BinaryStreamReader reader(dssr.getRecordData());
1486 if (
auto EC = lines.initialize(reader)) {
1487 llvm::consumeError(std::move(EC));
1491 const LineFragmentHeader *lfh = lines.header();
1492 uint64_t virtual_addr =
1493 m_index->MakeVirtualAddress(lfh->RelocSegment, lfh->RelocOffset);
1497 for (
const LineColumnEntry &group : lines) {
1498 llvm::Expected<uint32_t> file_index_or_err =
1500 if (!file_index_or_err)
1502 uint32_t file_index = file_index_or_err.get();
1506 for (
const LineNumberEntry &entry : group.LineNumbers) {
1507 LineInfo cur_info(entry.Flags);
1509 if (cur_info.isAlwaysStepInto() || cur_info.isNeverStepInto())
1512 uint64_t addr = virtual_addr + entry.Offset;
1514 bool is_statement = cur_info.isStatement();
1518 uint32_t lno = cur_info.getStartLine();
1521 is_prologue, is_epilogue,
false);
1523 auto iter = line_set.find(new_entry);
1524 if (iter != line_set.end() && iter->is_terminal_entry)
1525 line_set.erase(iter);
1526 line_set.insert(new_entry);
1533 line_entry.
data = {file_index, lno};
1535 LineInfo last_line(group.LineNumbers.back().Flags);
1536 line_set.emplace(virtual_addr + lfh->CodeSize, last_line.getEndLine(), 0,
1537 file_index,
false,
false,
false,
false,
true);
1540 line_entry.
SetRangeEnd(virtual_addr + lfh->CodeSize);
1549 const CVSymbolArray &syms = cii->
m_debug_stream.getSymbolArray();
1550 for (
auto iter = syms.begin(); iter != syms.end();) {
1551 if (iter->kind() != S_LPROC32 && iter->kind() != S_GPROC32) {
1556 uint32_t record_offset = iter.offset();
1557 CVSymbol func_record =
1570 if (kind != S_INLINESITE)
1575 for (
const auto &line_entry :
1580 if (!line_entry.is_terminal_entry)
1581 line_set.erase(line_entry);
1582 line_set.insert(line_entry);
1590 iter = syms.at(getScopeEndOffset(func_record));
1596 std::vector<LineTable::Sequence> sequence(1);
1597 for (
const auto &line_entry : line_set) {
1599 sequence.back(), line_entry.file_addr, line_entry.line,
1600 line_entry.column, line_entry.file_idx,
1601 line_entry.is_start_of_statement, line_entry.is_start_of_basic_block,
1602 line_entry.is_prologue_end, line_entry.is_epilogue_begin,
1603 line_entry.is_terminal_entry);
1606 std::make_unique<LineTable>(&comp_unit, std::move(sequence));
1608 if (line_table->GetSize() == 0)
1620llvm::Expected<uint32_t>
1624 return llvm::make_error<RawError>(raw_error_code::no_entry);
1626 const auto &checksums = cii.
m_strings.checksums().getArray();
1627 const auto &strings = cii.
m_strings.strings();
1631 auto iter = checksums.at(file_id);
1632 if (iter == checksums.end())
1633 return llvm::make_error<RawError>(raw_error_code::no_entry);
1635 llvm::Expected<llvm::StringRef> efn = strings.getString(iter->FileNameOffset);
1637 return efn.takeError();
1643 return std::distance(cii.
m_file_list.begin(), fn_iter);
1644 return llvm::make_error<RawError>(raw_error_code::no_entry);
1658 f.starts_with(
"/") ? FileSpec::Style::posix : FileSpec::Style::windows;
1660 support_files.
Append(spec);
1666 const SymbolContext &sc, std::vector<SourceModule> &imported_modules) {
1679 CVSymbol sym = cii->
m_debug_stream.readSymbolAtOffset(
id.offset);
1682 InlineSiteSym inline_site(
static_cast<SymbolRecordKind
>(sym.kind()));
1684 SymbolDeserializer::deserializeAs<InlineSiteSym>(sym, inline_site)) {
1686 "Failed to deserialize InlineSiteSym record: {0}");
1691 std::shared_ptr<InlineSite> inline_site_sp =
1692 std::make_shared<InlineSite>(parent_id);
1695 auto iter = cii->
m_inline_map.find(inline_site.Inlinee);
1698 InlineeSourceLine inlinee_line = iter->second;
1702 llvm::Expected<uint32_t> file_index_or_err =
1704 if (!file_index_or_err)
1706 uint32_t file_offset = file_index_or_err.get();
1708 uint32_t decl_line = inlinee_line.Header->SourceLineNum;
1709 std::unique_ptr<Declaration> decl_up =
1710 std::make_unique<Declaration>(decl_file, decl_line);
1713 uint32_t code_offset = 0;
1714 int32_t line_offset = 0;
1715 std::optional<uint32_t> code_offset_base;
1716 std::optional<uint32_t> code_offset_end;
1717 std::optional<int32_t> cur_line_offset;
1718 std::optional<int32_t> next_line_offset;
1719 std::optional<uint32_t> next_file_offset;
1721 bool is_terminal_entry =
false;
1722 bool is_start_of_statement =
true;
1724 bool is_prologue_end =
true;
1726 auto update_code_offset = [&](uint32_t code_delta) {
1727 if (!code_offset_base)
1728 code_offset_base = code_offset;
1729 else if (!code_offset_end)
1730 code_offset_end = *code_offset_base + code_delta;
1732 auto update_line_offset = [&](int32_t line_delta) {
1733 line_offset += line_delta;
1734 if (!code_offset_base || !cur_line_offset)
1735 cur_line_offset = line_offset;
1737 next_line_offset = line_offset;
1740 auto update_file_offset = [&](uint32_t offset) {
1741 if (!code_offset_base)
1742 file_offset = offset;
1744 next_file_offset = offset;
1747 for (
auto &annot : inline_site.annotations()) {
1748 switch (annot.OpCode) {
1749 case BinaryAnnotationsOpCode::CodeOffset:
1750 case BinaryAnnotationsOpCode::ChangeCodeOffset:
1751 case BinaryAnnotationsOpCode::ChangeCodeOffsetBase:
1752 code_offset += annot.U1;
1753 update_code_offset(annot.U1);
1755 case BinaryAnnotationsOpCode::ChangeLineOffset:
1756 update_line_offset(annot.S1);
1758 case BinaryAnnotationsOpCode::ChangeCodeLength:
1759 update_code_offset(annot.U1);
1760 code_offset += annot.U1;
1761 is_terminal_entry =
true;
1763 case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
1764 code_offset += annot.U1;
1765 update_code_offset(annot.U1);
1766 update_line_offset(annot.S1);
1768 case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
1769 code_offset += annot.U2;
1770 update_code_offset(annot.U2);
1771 update_code_offset(annot.U1);
1772 code_offset += annot.U1;
1773 is_terminal_entry =
true;
1775 case BinaryAnnotationsOpCode::ChangeFile:
1776 update_file_offset(annot.U1);
1783 if (code_offset_base && code_offset_end && cur_line_offset) {
1785 *code_offset_base, *code_offset_end - *code_offset_base,
1786 decl_line + *cur_line_offset));
1788 if (next_file_offset)
1789 file_offset = *next_file_offset;
1790 if (next_line_offset) {
1791 cur_line_offset = next_line_offset;
1792 next_line_offset = std::nullopt;
1794 code_offset_base = is_terminal_entry ? std::nullopt : code_offset_end;
1795 code_offset_end = next_file_offset = std::nullopt;
1797 if (code_offset_base && cur_line_offset) {
1798 if (is_terminal_entry) {
1800 func_base + *code_offset_base, decl_line + *cur_line_offset, 0,
1801 file_offset,
false,
false,
false,
false,
true);
1802 inline_site_sp->line_entries.push_back(line_entry);
1805 decl_line + *cur_line_offset, 0,
1806 file_offset, is_start_of_statement,
false,
1807 is_prologue_end,
false,
false);
1808 inline_site_sp->line_entries.push_back(line_entry);
1809 is_prologue_end =
false;
1810 is_start_of_statement =
false;
1813 if (is_terminal_entry)
1814 is_start_of_statement =
true;
1815 is_terminal_entry =
false;
1818 inline_site_sp->ranges.Sort();
1821 std::unique_ptr<Declaration> callsite_up;
1822 if (!inline_site_sp->ranges.IsEmpty()) {
1823 auto *entry = inline_site_sp->ranges.GetEntryAtIndex(0);
1824 addr_t base_offset = entry->GetRangeBase();
1830 std::shared_ptr<InlineSite> parent_site =
1833 parent_site->inline_function_info->GetDeclaration().GetFile();
1834 if (
auto *parent_entry =
1835 parent_site->ranges.FindEntryThatContains(base_offset)) {
1837 std::make_unique<Declaration>(parent_decl_file, parent_entry->data);
1842 func_base + base_offset)) {
1846 std::make_unique<Declaration>(callsite_file, entry->data.second);
1852 std::string inlinee_name;
1853 llvm::Expected<CVType> inlinee_cvt =
1854 m_index->ipi().typeCollection().getTypeOrError(inline_site.Inlinee);
1856 inlinee_name =
"[error reading function name: " +
1857 llvm::toString(inlinee_cvt.takeError()) +
"]";
1858 }
else if (inlinee_cvt->kind() == LF_MFUNC_ID) {
1859 MemberFuncIdRecord mfr;
1860 if (
auto err = TypeDeserializer::deserializeAs<MemberFuncIdRecord>(
1861 *inlinee_cvt, mfr)) {
1863 "[error reading function name: " + llvm::toString(std::move(err)) +
1866 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
1867 inlinee_name.append(std::string(types.getTypeName(mfr.ClassType)));
1868 inlinee_name.append(
"::");
1869 inlinee_name.append(mfr.getName().str());
1871 }
else if (inlinee_cvt->kind() == LF_FUNC_ID) {
1874 TypeDeserializer::deserializeAs<FuncIdRecord>(*inlinee_cvt, fir)) {
1876 "[error reading function name: " + llvm::toString(std::move(err)) +
1879 TypeIndex parent_idx = fir.getParentScope();
1880 if (!parent_idx.isNoneType()) {
1881 LazyRandomTypeCollection &ids =
m_index->ipi().typeCollection();
1882 inlinee_name.append(std::string(ids.getTypeName(parent_idx)));
1883 inlinee_name.append(
"::");
1885 inlinee_name.append(fir.getName().str());
1888 inline_site_sp->inline_function_info = std::make_shared<InlineFunctionInfo>(
1889 inlinee_name.c_str(), llvm::StringRef(), decl_up.get(),
1900 std::set<uint64_t> remove_uids;
1902 if (kind == S_GPROC32 || kind == S_LPROC32 || kind == S_BLOCK32 ||
1903 kind == S_INLINESITE) {
1905 if (kind == S_INLINESITE)
1912 for (uint64_t uid : remove_uids) {
1924 CVSymbolArray syms =
1928 for (
auto iter = syms.begin(); iter != syms.end(); ++iter) {
1930 if (fn(iter->kind(), child_id))
1942 auto ts = *ts_or_err;
1949 ast_builder->
Dump(s, filter, show_color);
1957 std::map<std::pair<uint16_t, uint32_t>, uint32_t> func_addr_ids;
1960 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
1961 CVSymbol sym =
m_index->symrecords().readRecord(gid);
1962 auto kind = sym.kind();
1965 llvm::StringRef name;
1967 case SymbolKind::S_GDATA32:
1968 case SymbolKind::S_LDATA32: {
1969 auto data_or_err = SymbolDeserializer::deserializeAs<DataSym>(sym);
1972 "Failed to deserialize DataSym record: {0}");
1975 name = data_or_err->Name;
1978 case SymbolKind::S_GTHREAD32:
1979 case SymbolKind::S_LTHREAD32: {
1981 SymbolDeserializer::deserializeAs<ThreadLocalDataSym>(sym);
1984 "Failed to deserialize ThreadLocalDataSym record: {0}");
1987 name = data_or_err->Name;
1990 case SymbolKind::S_CONSTANT: {
1991 auto data_or_err = SymbolDeserializer::deserializeAs<ConstantSym>(sym);
1994 "Failed to deserialize ConstantSym record: {0}");
1997 name = data_or_err->Name;
2004 if (!name.empty()) {
2013 if (kind != S_PROCREF && kind != S_LPROCREF)
2019 auto ref_or_err = SymbolDeserializer::deserializeAs<ProcRefSym>(sym);
2022 "Failed to deserialize ProcRefSym record: {0}");
2025 ProcRefSym ref = std::move(*ref_or_err);
2026 if (ref.Name.empty())
2031 m_index->compilands().GetOrCreateCompiland(ref.modi());
2032 auto iter = cci.
m_debug_stream.getSymbolArray().at(ref.SymOffset);
2035 kind = iter->kind();
2036 if (kind != S_GPROC32 && kind != S_LPROC32)
2039 auto proc_or_err = SymbolDeserializer::deserializeAs<ProcSym>(*iter);
2042 "Failed to deserialize ProcSym record: {0}");
2045 ProcSym proc = std::move(*proc_or_err);
2046 if ((proc.Flags & ProcSymFlags::IsUnreachable) != ProcSymFlags::None)
2048 if (proc.Name.empty() || proc.FunctionType.isSimple())
2054 func_addr_ids.emplace(std::make_pair(proc.Segment, proc.CodeOffset), gid);
2057 if (basename.empty())
2058 basename = proc.Name;
2064 auto type =
m_index->tpi().getType(proc.FunctionType);
2065 if (type.kind() == LF_MFUNCTION) {
2066 MemberFunctionRecord mfr;
2067 if (
auto err = TypeDeserializer::deserializeAs<MemberFunctionRecord>(
2071 "Failed to deserialize MemberFunctionRecord record ({1}): {0}",
2073 }
else if (!mfr.getThisType().isNoneType())
2079 for (
auto pid :
m_index->publics().getPublicsTable()) {
2081 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2082 auto kind = sym.kind();
2083 if (kind != S_PUB32)
2085 auto pub_or_err = SymbolDeserializer::deserializeAs<PublicSym32>(sym);
2088 "Failed to deserialize PublicSym32 record: {0}");
2091 PublicSym32 pub = std::move(*pub_or_err);
2098 auto it = func_addr_ids.find({pub.Segment, pub.Offset});
2099 if (it != func_addr_ids.end())
2121 std::vector<uint32_t> results;
2124 size_t n_matches = 0;
2125 for (uint32_t gid : results) {
2128 if (parent_decl_ctx.
IsValid() &&
2137 if (++n_matches >= max_matches)
2149 if (name_type_mask & eFunctionNameTypeFull)
2152 if (!(name_type_mask & eFunctionNameTypeFull ||
2153 name_type_mask & eFunctionNameTypeBase ||
2154 name_type_mask & eFunctionNameTypeMethod))
2158 std::set<uint32_t> resolved_ids;
2160 std::vector<uint32_t> ids;
2161 if (!Names.GetValues(name, ids))
2164 for (uint32_t
id : ids) {
2165 if (!resolved_ids.insert(
id).second)
2169 if (parent_decl_ctx.
IsValid() &&
2173 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2174 auto kind = sym.kind();
2175 lldbassert(kind == S_PROCREF || kind == S_LPROCREF);
2177 auto proc_or_err = SymbolDeserializer::deserializeAs<ProcRefSym>(sym);
2180 "Failed to deserialize ProcRefSym record: {0}");
2183 ProcRefSym proc = std::move(*proc_or_err);
2189 m_index->compilands().GetOrCreateCompiland(proc.modi());
2205 if (name_type_mask & eFunctionNameTypeFull)
2207 if (name_type_mask & eFunctionNameTypeBase)
2209 if (name_type_mask & eFunctionNameTypeMethod)
2214 bool include_inlines,
2229 std::vector<uint32_t> matches;
2232 for (uint32_t match_idx : matches) {
2234 if (context.empty())
2243 if (results.
Done(query))
2250 uint32_t max_matches,
2253 std::vector<TypeIndex> matches =
m_index->tpi().findRecordsByName(name);
2254 if (max_matches > 0 && max_matches < matches.size())
2255 matches.resize(max_matches);
2257 for (TypeIndex ti : matches) {
2273 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
2276 for (
auto ti = types.getFirst(); ti; ti = types.getNext(*ti)) {
2279 (void)type->GetFullCompilerType();
2283 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
2285 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2286 if (sym.kind() != S_UDT)
2289 auto udt_or_err = SymbolDeserializer::deserializeAs<UDTSym>(sym);
2292 "Failed to deserialize UDTSym record: {0}");
2295 UDTSym udt = std::move(*udt_or_err);
2296 bool is_typedef =
true;
2298 CVType cvt =
m_index->tpi().getType(udt.Type);
2300 if (name == udt.Name)
2312 return new_count - old_count;
2320 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
2322 CVSymbol sym =
m_index->ReadSymbolRecord(global);
2327 switch (sym.kind()) {
2328 case SymbolKind::S_GDATA32:
2329 case SymbolKind::S_LDATA32:
2330 case SymbolKind::S_GTHREAD32:
2331 case SymbolKind::S_LTHREAD32: {
2358 bool location_is_constant_data = is_constant;
2362 assert(sym.kind() == S_CONSTANT);
2363 ConstantSym constant(sym.kind());
2365 SymbolDeserializer::deserializeAs<ConstantSym>(sym, constant)) {
2367 "Failed to deserialize ConstantSym record: {0}");
2371 var_info.
name = constant.Name;
2372 var_info.
type = constant.Type;
2374 constant.Type,
m_index->tpi(), constant.Value, module);
2375 if (!location_or_err) {
2377 "Failed to make constant location expression for {1}: {0}",
2385 Block *func_block = block;
2406 std::string name = var_info.
name.str();
2409 std::make_shared<SymbolFileType>(*
this, type_sp->GetID());
2414 bool external =
false;
2415 bool artificial =
false;
2416 bool static_member =
false;
2418 VariableSP var_sp = std::make_shared<Variable>(
2419 toOpaqueUid(var_id), name.c_str(), name.c_str(), sftype, var_scope, block,
2420 scope_ranges, &decl, var_info.
location, external, artificial,
2421 location_is_constant_data, static_member);
2424 if (
auto err = ts_or_err.takeError())
2426 auto ts = *ts_or_err;
2429 ast_builder->EnsureVariable(scope_id, var_id);
2439 bool is_param,
bool is_constant) {
2442 return iter->second;
2448 CVSymbol sym =
m_index->ReadSymbolRecord(
id);
2451 auto udt_or_err = SymbolDeserializer::deserializeAs<UDTSym>(sym);
2454 "Failed to deserialize UDTSym record: {0}");
2457 UDTSym udt = std::move(*udt_or_err);
2462 if (
auto err = ts_or_err.takeError())
2464 auto ts = *ts_or_err;
2472 ct = target_type->GetForwardCompilerType();
2476 llvm::expectedToOptional(target_type->GetByteSize(
nullptr)),
2477 nullptr, target_type->GetID(),
2485 return iter->second;
2499 uint32_t params_remaining = 0;
2500 switch (sym.kind()) {
2503 ProcSym proc(
static_cast<SymbolRecordKind
>(sym.kind()));
2504 if (
auto err = SymbolDeserializer::deserializeAs<ProcSym>(sym, proc)) {
2506 "Failed to deserialize ProcSym record: {0}");
2509 CVType signature =
m_index->tpi().getType(proc.FunctionType);
2510 if (signature.kind() == LF_PROCEDURE) {
2511 ProcedureRecord sig;
2512 if (llvm::Error e = TypeDeserializer::deserializeAs<ProcedureRecord>(
2514 llvm::consumeError(std::move(e));
2517 params_remaining = sig.getParameterCount();
2518 }
else if (signature.kind() == LF_MFUNCTION) {
2519 MemberFunctionRecord sig;
2520 if (llvm::Error e = TypeDeserializer::deserializeAs<MemberFunctionRecord>(
2522 llvm::consumeError(std::move(e));
2525 params_remaining = sig.getParameterCount();
2535 lldbassert(
false &&
"Symbol is not a block!");
2541 variables = std::make_shared<VariableList>();
2545 CVSymbolArray syms = limitSymbolArrayToScope(
2551 auto iter = syms.begin();
2552 auto end = syms.end();
2554 while (iter != end) {
2555 uint32_t record_offset = iter.offset();
2556 CVSymbol variable_cvs = *iter;
2562 if (variable_cvs.kind() == S_BLOCK32 ||
2563 variable_cvs.kind() == S_INLINESITE) {
2564 uint32_t block_end = getScopeEndOffset(variable_cvs);
2566 iter = syms.at(block_end);
2570 bool is_param = params_remaining > 0;
2572 switch (variable_cvs.kind()) {
2574 case S_REGREL32_INDIR:
2581 variables->AddVariableIfUnique(variable);
2588 variables->AddVariableIfUnique(variable);
2624 variables = std::make_shared<VariableList>();
2630 llvm_unreachable(
"Unreachable!");
2635 if (
auto err = ts_or_err.takeError())
2637 auto ts = *ts_or_err;
2649 if (
auto err = ts_or_err.takeError())
2651 auto ts = *ts_or_err;
2663 if (
auto err = ts_or_err.takeError())
2665 auto ts = *ts_or_err;
2676 auto iter =
m_types.find(type_uid);
2683 return &*iter->second;
2688 if (type_id.
index.isNoneType())
2697std::optional<SymbolFile::ArrayInfo>
2700 return std::nullopt;
2716 TypeClass type_mask,
2725 if (
auto err = ts_or_err.takeError())
2727 auto ts = *ts_or_err;
2730 auto *
clang = llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
2741llvm::Expected<lldb::TypeSystemSP>
2743 auto type_system_or_err =
2744 m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
2745 if (type_system_or_err)
2746 if (
auto ts = *type_system_or_err)
2747 ts->SetSymbolFile(
this);
2748 return type_system_or_err;
2753 return m_index->pdb().getFileSize();
2757 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
2759 llvm::DenseMap<TypeIndex, TypeIndex> forward_to_full;
2760 llvm::DenseMap<TypeIndex, TypeIndex> full_to_forward;
2762 struct RecordIndices {
2767 llvm::StringMap<RecordIndices> record_indices;
2769 for (
auto ti = types.getFirst(); ti; ti = types.getNext(*ti)) {
2770 CVType type = types.getType(*ti);
2776 RecordIndices &indices = record_indices[tag.
asTag().getUniqueName()];
2777 if (tag.
asTag().isForwardRef()) {
2778 indices.forward = *ti;
2786 if (indices.full != TypeIndex::None() &&
2787 indices.forward != TypeIndex::None()) {
2788 forward_to_full[indices.forward] = indices.full;
2789 full_to_forward[indices.full] = indices.forward;
2795 if (tag.
asTag().isForwardRef() || !tag.
asTag().containsNestedClass())
2799 ProcessTpiStream(
PdbIndex &index, TypeIndex parent,
2801 llvm::DenseMap<TypeIndex, TypeIndex> &parents)
2802 : index(index), parents(parents), parent(parent),
2803 parent_cvt(parent_cvt) {}
2806 llvm::DenseMap<TypeIndex, TypeIndex> &parents;
2808 unsigned unnamed_type_index = 1;
2812 llvm::Error visitKnownMember(CVMemberRecord &CVR,
2813 NestedTypeRecord &Record)
override {
2814 std::string unnamed_type_name;
2815 if (Record.Name.empty()) {
2817 llvm::formatv(
"<unnamed-type-$S{0}>", unnamed_type_index).str();
2818 Record.Name = unnamed_type_name;
2819 ++unnamed_type_index;
2821 std::optional<CVTagRecord> tag =
2824 return llvm::ErrorSuccess();
2826 parents[Record.Type] = parent;
2827 return llvm::ErrorSuccess();
2831 CVType field_list_cvt =
m_index->tpi().getType(tag.
asTag().FieldList);
2833 FieldListRecord field_list;
2834 if (llvm::Error
error = TypeDeserializer::deserializeAs<FieldListRecord>(
2835 field_list_cvt, field_list))
2836 llvm::consumeError(std::move(
error));
2837 if (llvm::Error
error = visitMemberRecordStream(field_list.Data, process))
2838 llvm::consumeError(std::move(
error));
2850 std::vector<TypeIndex> full_keys;
2851 std::vector<TypeIndex> fwd_keys;
2853 TypeIndex key = entry.first;
2854 TypeIndex value = entry.second;
2856 auto iter = forward_to_full.find(value);
2857 if (iter != forward_to_full.end())
2858 entry.second = iter->second;
2860 iter = forward_to_full.find(key);
2861 if (iter != forward_to_full.end())
2862 fwd_keys.push_back(key);
2864 full_keys.push_back(key);
2866 for (TypeIndex fwd : fwd_keys) {
2867 TypeIndex full = forward_to_full[fwd];
2871 for (TypeIndex full : full_keys) {
2872 TypeIndex fwd = full_to_forward[full];
2877std::optional<PdbCompilandSymId>
2879 CVSymbol sym =
m_index->ReadSymbolRecord(
id);
2880 if (symbolOpensScope(sym.kind())) {
2883 id.offset = getScopeParentOffset(sym);
2887 return std::nullopt;
2896 auto begin = syms.begin();
2897 auto end = syms.at(
id.offset);
2898 std::vector<PdbCompilandSymId> scope_stack;
2900 while (begin != end) {
2901 if (begin.offset() >
id.offset) {
2903 lldbassert(
false &&
"Invalid compiland symbol id!");
2904 return std::nullopt;
2909 if (symbolOpensScope(begin->kind())) {
2912 uint32_t scope_end = getScopeEndOffset(*begin);
2913 if (scope_end <
id.offset) {
2914 begin = syms.at(scope_end);
2917 scope_stack.emplace_back(
id.modi, begin.offset());
2919 }
else if (symbolEndsScope(begin->kind())) {
2920 scope_stack.pop_back();
2924 if (scope_stack.empty())
2925 return std::nullopt;
2927 return scope_stack.back();
2930std::optional<llvm::codeview::TypeIndex>
2934 return std::nullopt;
2935 return parent_iter->second;
2938std::vector<CompilerContext>
2940 CVType type =
m_index->tpi().getType(ti);
2946 std::optional<Type::ParsedName> parsed_name =
2951 std::vector<CompilerContext> ctx;
2953 for (llvm::StringRef scope : parsed_name->scope) {
2960 for (
auto &el : llvm::reverse(llvm::drop_end(ctx))) {
2966 type =
m_index->tpi().getType(ti);
2967 switch (type.kind()) {
2987std::optional<llvm::StringRef>
2992 return std::nullopt;
2995 if (sym_record.kind() != S_LPROC32 && sym_record.kind() != S_GPROC32)
2996 return std::nullopt;
2998 ProcSym proc(
static_cast<SymbolRecordKind
>(sym_record.kind()));
2999 if (
auto err = SymbolDeserializer::deserializeAs<ProcSym>(sym_record, proc)) {
3001 "Failed to deserialize ProcSym record: {0}");
3002 return std::nullopt;
3009std::optional<llvm::StringRef>
3011 TypeIndex function_type) {
3012 auto symbol =
m_index->publics().findByAddress(
m_index->symrecords(),
3015 return std::nullopt;
3017 llvm::StringRef name = symbol->first.Name;
3020 if (!function_type.isNoneType() &&
3021 (symbol->first.Flags & PublicSymFlags::Function) != PublicSymFlags::None)
3038 if (!mangled.starts_with(
'_') ||
3039 m_index->dbi().getMachineType() != PDB_Machine::x86)
3043 PDB_CallingConv cc = PDB_CallingConv::NearC;
3044 if (cvt.kind() == LF_PROCEDURE) {
3045 ProcedureRecord proc;
3046 if (llvm::Error
error =
3047 TypeDeserializer::deserializeAs<ProcedureRecord>(cvt, proc))
3048 llvm::consumeError(std::move(
error));
3050 }
else if (cvt.kind() == LF_MFUNCTION) {
3051 MemberFunctionRecord mfunc;
3052 if (llvm::Error
error =
3053 TypeDeserializer::deserializeAs<MemberFunctionRecord>(cvt, mfunc))
3054 llvm::consumeError(std::move(
error));
3055 cc = mfunc.CallConv;
3062 if (cc == PDB_CallingConv::NearC || cc == PDB_CallingConv::FarC)
3063 return mangled.drop_front();
3069 for (CVType cvt :
m_index->ipi().typeArray()) {
3070 switch (cvt.kind()) {
3071 case LF_UDT_SRC_LINE: {
3072 UdtSourceLineRecord udt_src;
3073 if (
auto err = TypeDeserializer::deserializeAs(cvt, udt_src)) {
3075 "Failed to deserialize UdtSourceLineRecord record: {0}");
3081 udt_src.LineNumber});
3083 case LF_UDT_MOD_SRC_LINE: {
3084 UdtModSourceLineRecord udt_mod_src;
3085 if (
auto err = TypeDeserializer::deserializeAs(cvt, udt_mod_src)) {
3088 "Failed to deserialize UdtModSourceLineRecord record: {0}");
3098 udt_mod_src.LineNumber});
3106llvm::Expected<Declaration>
3112 return llvm::createStringError(
"No UDT declaration found");
3114 llvm::StringRef file_name;
3115 if (it->second.IsIpiIndex) {
3116 CVType cvt =
m_index->ipi().getType(it->second.FileNameIndex);
3117 if (cvt.kind() != LF_STRING_ID)
3118 return llvm::createStringError(
"File name was not a LF_STRING_ID");
3121 if (
auto err = TypeDeserializer::deserializeAs(cvt, sid))
3122 return std::move(err);
3123 file_name = sid.String;
3126 auto string_table =
m_index->pdb().getStringTable();
3128 return string_table.takeError();
3130 llvm::Expected<llvm::StringRef>
string =
3131 string_table->getStringTable().getString(
3132 it->second.FileNameIndex.getIndex());
3134 return string.takeError();
3135 file_name = *string;
3139 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.
const ConstString & 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
std::shared_ptr< lldb_private::Section > SectionSP
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::CompileUnit > CompUnitSP
@ eValueTypeVariableGlobal
globals variable
@ eValueTypeVariableLocal
function local variables
@ eValueTypeVariableArgument
function argument variables
@ eValueTypeVariableStatic
static variable
@ eValueTypeVariableThreadLocal
thread local storage variable
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