27#include "llvm/DebugInfo/CodeView/CVRecord.h"
28#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
29#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
30#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
31#include "llvm/DebugInfo/CodeView/RecordName.h"
32#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
33#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
34#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
35#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
36#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
37#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
38#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
39#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
40#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
41#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
42#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
43#include "llvm/DebugInfo/PDB/PDB.h"
44#include "llvm/DebugInfo/PDB/PDBTypes.h"
45#include "llvm/Demangle/MicrosoftDemangle.h"
46#include "llvm/Object/COFF.h"
47#include "llvm/Support/Allocator.h"
48#include "llvm/Support/BinaryStreamReader.h"
49#include "llvm/Support/Error.h"
50#include "llvm/Support/ErrorOr.h"
51#include "llvm/Support/MemoryBuffer.h"
80 case PDB_Lang::ObjCpp:
87static std::unique_ptr<PDBFile>
90 using namespace llvm::object;
91 auto expected_binary = createBinary(exe_path);
94 if (!expected_binary) {
95 llvm::consumeError(expected_binary.takeError());
98 OwningBinary<Binary> binary = std::move(*expected_binary);
102 auto *obj = llvm::dyn_cast<llvm::object::COFFObjectFile>(binary.getBinary());
105 const llvm::codeview::DebugInfo *pdb_info =
nullptr;
108 llvm::StringRef pdb_file;
109 if (llvm::Error e = obj->getDebugPDBInfo(pdb_info, pdb_file)) {
110 consumeError(std::move(e));
120 pdb_file = exe_dir.CopyByAppendingPathComponent(pdb_name).GetPathAsConstString().GetStringRef();
128 auto expected_info = pdb->getPDBInfoStream();
129 if (!expected_info) {
130 llvm::consumeError(expected_info.takeError());
133 llvm::codeview::GUID guid;
134 memcpy(&guid, pdb_info->PDB70.Signature, 16);
136 if (expected_info->getGuid() != guid)
155 case SimpleTypeKind::Boolean128:
156 case SimpleTypeKind::Boolean16:
157 case SimpleTypeKind::Boolean32:
158 case SimpleTypeKind::Boolean64:
159 case SimpleTypeKind::Boolean8:
161 case SimpleTypeKind::Byte:
162 case SimpleTypeKind::UnsignedCharacter:
163 return "unsigned char";
164 case SimpleTypeKind::NarrowCharacter:
166 case SimpleTypeKind::SignedCharacter:
167 case SimpleTypeKind::SByte:
168 return "signed char";
169 case SimpleTypeKind::Character16:
171 case SimpleTypeKind::Character32:
173 case SimpleTypeKind::Character8:
175 case SimpleTypeKind::Complex80:
176 case SimpleTypeKind::Complex64:
177 case SimpleTypeKind::Complex32:
179 case SimpleTypeKind::Float128:
180 case SimpleTypeKind::Float80:
181 return "long double";
182 case SimpleTypeKind::Float64:
184 case SimpleTypeKind::Float32:
186 case SimpleTypeKind::Float16:
188 case SimpleTypeKind::Int128:
190 case SimpleTypeKind::Int64:
191 case SimpleTypeKind::Int64Quad:
193 case SimpleTypeKind::Int32:
195 case SimpleTypeKind::Int16:
197 case SimpleTypeKind::UInt128:
198 return "unsigned __int128";
199 case SimpleTypeKind::UInt64:
200 case SimpleTypeKind::UInt64Quad:
202 case SimpleTypeKind::HResult:
204 case SimpleTypeKind::UInt32:
206 case SimpleTypeKind::UInt16:
207 case SimpleTypeKind::UInt16Short:
208 return "unsigned short";
209 case SimpleTypeKind::Int32Long:
211 case SimpleTypeKind::UInt32Long:
212 return "unsigned long";
213 case SimpleTypeKind::Void:
215 case SimpleTypeKind::WideCharacter:
233static std::optional<CVTagRecord>
252 if (Record.Type.isSimple())
255 CVType cvt = tpi.getType(Record.Type);
264 std::string qname = std::string(parent.
asTag().getUniqueName());
265 if (qname.size() < 4 || child.
asTag().getUniqueName().size() < 4)
271 qname[3] = child.
asTag().getUniqueName()[3];
275 piece += Record.Name;
276 piece.push_back(
'@');
277 qname.insert(4, std::move(piece));
278 if (qname != child.
asTag().UniqueName)
281 return std::move(child);
297 return "Microsoft PDB debug symbol cross-platform file reader.";
310 uint32_t abilities = 0;
317 if (
auto *pdb = llvm::dyn_cast<ObjectFilePDB>(
m_objfile_sp.get())) {
318 pdb_file = &pdb->GetPDBFile();
329 if (!expected_index) {
330 llvm::consumeError(expected_index.takeError());
333 m_index = std::move(*expected_index);
342 if (
m_index->dbi().isStripped())
353 m_index->ParseSectionContribs();
355 auto ts_or_err =
m_objfile_sp->GetModule()->GetTypeSystemForLanguage(
357 if (
auto err = ts_or_err.takeError()) {
359 "Failed to initialize: {0}");
361 if (
auto ts = *ts_or_err)
362 ts->SetSymbolFile(
this);
368 const DbiModuleList &modules =
m_index->dbi().modules();
369 uint32_t count = modules.getModuleCount();
376 DbiModuleDescriptor last = modules.getModuleDescriptor(count - 1);
377 if (last.getModuleName() ==
"* Linker *")
387 BlockSP child_block = std::make_shared<Block>(opaque_block_uid);
389 if (
auto err = ts_or_err.takeError())
391 auto ts = *ts_or_err;
396 switch (sym.kind()) {
403 Block &block = func->GetBlock(
false);
415 BlockSym block(
static_cast<SymbolRecordKind
>(sym.kind()));
416 cantFail(SymbolDeserializer::deserializeAs<BlockSym>(sym, block));
423 m_index->MakeVirtualAddress(block.Segment, block.CodeOffset);
426 if (block_base >= func_base)
427 child_block->AddRange(
Block::Range(block_base - func_base, block.CodeSize));
430 "S_BLOCK32 at modi: {0:d} offset: {1:d}: adding range "
431 "[{2:x16}-{3:x16}) which has a base that is less than the "
433 "low PC 0x%" PRIx64
". Please file a bug and attach the file at the "
434 "start of this error message",
436 block_base + block.CodeSize, func_base);
440 m_blocks.insert({opaque_block_uid, child_block});
445 comp_unit->GetLineTable();
447 std::shared_ptr<InlineSite> inline_site =
m_inline_sites[opaque_block_uid];
452 for (
size_t i = 0; i < inline_site->ranges.GetSize(); ++i) {
453 auto *entry = inline_site->ranges.GetEntryAtIndex(i);
454 child_block->AddRange(
455 Block::Range(entry->GetRangeBase(), entry->GetByteSize()));
457 child_block->FinalizeRanges();
460 Declaration &decl = inline_site->inline_function_info->GetDeclaration();
461 Declaration &callsite = inline_site->inline_function_info->GetCallSite();
462 child_block->SetInlinedFunctionInfo(
463 inline_site->inline_function_info->GetName().GetCString(),
nullptr,
465 m_blocks.insert({opaque_block_uid, child_block});
469 lldbassert(
false &&
"Symbol is not a block!");
482 lldbassert(sym_record.kind() == S_LPROC32 || sym_record.kind() == S_GPROC32);
491 comp_unit.
GetModule()->GetSectionList());
495 ProcSym proc(
static_cast<SymbolRecordKind
>(sym_record.kind()));
496 cantFail(SymbolDeserializer::deserializeAs<ProcSym>(sym_record, proc));
497 if (proc.FunctionType == TypeIndex::None())
505 FunctionSP func_sp = std::make_shared<Function>(
507 func_type.get(), func_range);
512 if (
auto err = ts_or_err.takeError())
514 auto ts = *ts_or_err;
517 ts->GetNativePDBParser()->GetOrCreateFunctionDecl(func_id);
532 llvm::SmallString<64> source_file_name =
533 m_index->compilands().GetMainSourceFile(cci);
534 FileSpec fs(llvm::sys::path::convert_to_slash(
535 source_file_name, llvm::sys::path::Style::windows_backslash));
537 CompUnitSP cu_sp = std::make_shared<CompileUnit>(
538 m_objfile_sp->GetModule(),
nullptr, std::make_shared<SupportFile>(fs),
546 const ModifierRecord &mr,
548 TpiStream &stream =
m_index->tpi();
551 if (mr.ModifiedType.isSimple())
554 name = computeTypeName(stream.typeCollection(), mr.ModifiedType);
559 modified_type->GetByteSize(
nullptr),
nullptr,
566 const llvm::codeview::PointerRecord &pr,
572 if (pr.isPointerToMember()) {
573 MemberPointerInfo mpi = pr.getMemberInfo();
586 if (ti == TypeIndex::NullptrT()) {
593 if (ti.getSimpleMode() != SimpleTypeMode::Direct) {
595 uint32_t pointer_size = 0;
596 switch (ti.getSimpleMode()) {
597 case SimpleTypeMode::FarPointer32:
598 case SimpleTypeMode::NearPointer32:
601 case SimpleTypeMode::NearPointer64:
613 if (ti.getSimpleKind() == SimpleTypeKind::NotTranslated)
625 if (!record.hasUniqueName()) {
627 llvm::ArrayRef<MSVCUndecoratedNameSpecifier> specs = parser.
GetSpecifiers();
629 return std::string(specs.back().GetBaseName());
632 llvm::ms_demangle::Demangler demangler;
633 std::string_view sv(record.UniqueName.begin(), record.UniqueName.size());
634 llvm::ms_demangle::TagTypeNode *ttn = demangler.parseTagUniqueName(sv);
636 return std::string(record.Name);
638 llvm::ms_demangle::IdentifierNode *idn =
639 ttn->QualifiedName->getUnqualifiedIdentifier();
640 return idn->toString();
645 const TagRecord &record,
658 const ClassRecord &cr,
664 const UnionRecord &ur,
670 const EnumRecord &er,
678 underlying_type->GetByteSize(
nullptr),
nullptr,
684 const ArrayRecord &ar,
693 array_sp->SetEncodingType(element_type.get());
698 const MemberFunctionRecord &mfr,
707 const ProcedureRecord &pr,
716 if (type_id.
index.isSimple())
720 CVType cvt = stream.getType(type_id.
index);
722 if (cvt.kind() == LF_MODIFIER) {
723 ModifierRecord modifier;
725 TypeDeserializer::deserializeAs<ModifierRecord>(cvt, modifier));
729 if (cvt.kind() == LF_POINTER) {
730 PointerRecord pointer;
732 TypeDeserializer::deserializeAs<PointerRecord>(cvt, pointer));
738 llvm::cantFail(TypeDeserializer::deserializeAs<ClassRecord>(cvt, cr));
742 if (cvt.kind() == LF_ENUM) {
744 llvm::cantFail(TypeDeserializer::deserializeAs<EnumRecord>(cvt, er));
748 if (cvt.kind() == LF_UNION) {
750 llvm::cantFail(TypeDeserializer::deserializeAs<UnionRecord>(cvt, ur));
754 if (cvt.kind() == LF_ARRAY) {
756 llvm::cantFail(TypeDeserializer::deserializeAs<ArrayRecord>(cvt, ar));
760 if (cvt.kind() == LF_PROCEDURE) {
762 llvm::cantFail(TypeDeserializer::deserializeAs<ProcedureRecord>(cvt, pr));
765 if (cvt.kind() == LF_MFUNCTION) {
766 MemberFunctionRecord mfr;
767 llvm::cantFail(TypeDeserializer::deserializeAs<MemberFunctionRecord>(cvt, mfr));
777 std::optional<PdbTypeSymId> full_decl_uid;
779 auto expected_full_ti =
780 m_index->tpi().findFullDeclForForwardRef(type_id.
index);
781 if (!expected_full_ti)
782 llvm::consumeError(expected_full_ti.takeError());
783 else if (*expected_full_ti != type_id.
index) {
791 if (full_iter !=
m_types.end()) {
792 TypeSP result = full_iter->second;
801 PdbTypeSymId best_decl_id = full_decl_uid ? *full_decl_uid : type_id;
803 if (
auto err = ts_or_err.takeError())
805 auto ts = *ts_or_err;
843 CVSymbol sym =
m_index->symrecords().readRecord(var_id.
offset);
844 if (sym.kind() == S_CONSTANT)
849 llvm::StringRef name;
851 uint16_t section = 0;
853 bool is_external =
false;
854 switch (sym.kind()) {
859 DataSym ds(sym.kind());
860 llvm::cantFail(SymbolDeserializer::deserializeAs<DataSym>(sym, ds));
865 section = ds.Segment;
866 offset = ds.DataOffset;
867 addr =
m_index->MakeVirtualAddress(ds.Segment, ds.DataOffset);
874 ThreadLocalDataSym tlds(sym.kind());
876 SymbolDeserializer::deserializeAs<ThreadLocalDataSym>(sym, tlds));
879 section = tlds.Segment;
880 offset = tlds.DataOffset;
881 addr =
m_index->MakeVirtualAddress(tlds.Segment, tlds.DataOffset);
886 llvm_unreachable(
"unreachable!");
890 std::optional<uint16_t> modi =
m_index->GetModuleIndexForVa(addr);
901 std::make_shared<SymbolFileType>(*
this,
toOpaqueUid(tid));
904 if (
auto err = ts_or_err.takeError())
906 auto ts = *ts_or_err;
910 ts->GetNativePDBParser()->GetOrCreateVariableDecl(var_id);
917 std::string global_name(
"::");
919 bool artificial =
false;
920 bool location_is_constant_data =
false;
921 bool static_member =
false;
922 VariableSP var_sp = std::make_shared<Variable>(
923 toOpaqueUid(var_id), name.str().c_str(), global_name.c_str(), type_sp,
924 scope, comp_unit.get(), ranges, &decl, location, is_external, artificial,
925 location_is_constant_data, static_member);
932 const CVSymbol &cvs) {
933 TpiStream &tpi =
m_index->tpi();
934 ConstantSym constant(cvs.kind());
936 llvm::cantFail(SymbolDeserializer::deserializeAs<ConstantSym>(cvs, constant));
937 std::string global_name(
"::");
938 global_name += constant.Name;
941 std::make_shared<SymbolFileType>(*
this,
toOpaqueUid(tid));
948 constant.Type, tpi, constant.Value, module),
951 bool external =
false;
952 bool artificial =
false;
953 bool location_is_constant_data =
true;
954 bool static_member =
false;
955 VariableSP var_sp = std::make_shared<Variable>(
956 toOpaqueUid(var_id), constant.Name.str().c_str(), global_name.c_str(),
958 external, artificial, location_is_constant_data, static_member);
965 if (emplace_result.second) {
967 emplace_result.first->second = var_sp;
972 return emplace_result.first->second;
982 if (emplace_result.second)
983 emplace_result.first->second =
CreateFunction(func_id, comp_unit);
985 return emplace_result.first->second;
991 auto emplace_result =
993 if (emplace_result.second)
997 return emplace_result.first->second;
1003 return *iter->second;
1024 if (index >= UINT16_MAX)
1052 uint16_t modi = uid.asCompiland().modi;
1057 for (
auto iter = syms.begin(); iter != syms.end(); ++iter) {
1058 if (iter->kind() != S_LPROC32 && iter->kind() != S_GPROC32)
1068 return new_count - count;
1073 uint32_t flags = eSymbolContextCompUnit;
1074 flags |= eSymbolContextVariable;
1075 flags |= eSymbolContextFunction;
1076 flags |= eSymbolContextBlock;
1077 flags |= eSymbolContextLineEntry;
1078 return (resolve_scope & flags) != 0;
1084 uint32_t resolved_flags = 0;
1088 std::optional<uint16_t> modi =
m_index->GetModuleIndexForVa(file_addr);
1096 resolved_flags |= eSymbolContextCompUnit;
1099 if (resolve_scope & eSymbolContextFunction ||
1100 resolve_scope & eSymbolContextBlock) {
1102 std::vector<SymbolAndUid> matches =
m_index->FindSymbolsByVa(file_addr);
1106 for (
const auto &match : llvm::reverse(matches)) {
1111 CVSymbol cvs =
m_index->ReadSymbolRecord(csid);
1113 if (type != PDB_SymType::Function && type != PDB_SymType::Block)
1115 if (type == PDB_SymType::Function) {
1121 addr_t offset = file_addr - func_base;
1126 if (type == PDB_SymType::Block) {
1133 addr_t offset = file_addr - func_base;
1138 resolved_flags |= eSymbolContextFunction;
1140 resolved_flags |= eSymbolContextBlock;
1145 if (resolve_scope & eSymbolContextLineEntry) {
1148 if (line_table->FindLineEntryByAddress(addr, sc.
line_entry))
1149 resolved_flags |= eSymbolContextLineEntry;
1153 return resolved_flags;
1160 const uint32_t prev_size = sc_list.
GetSize();
1161 if (resolve_scope & eSymbolContextCompUnit) {
1170 if (file_spec_matches_cu_file_spec) {
1176 return sc_list.
GetSize() - prev_size;
1195 std::set<LineTable::Entry, LineTableEntryComparator> line_set;
1200 for (
const DebugSubsectionRecord &dssr :
1202 if (dssr.kind() != DebugSubsectionKind::Lines)
1205 DebugLinesSubsectionRef lines;
1206 llvm::BinaryStreamReader reader(dssr.getRecordData());
1207 if (
auto EC = lines.initialize(reader)) {
1208 llvm::consumeError(std::move(EC));
1212 const LineFragmentHeader *lfh = lines.header();
1213 uint64_t virtual_addr =
1214 m_index->MakeVirtualAddress(lfh->RelocSegment, lfh->RelocOffset);
1218 for (
const LineColumnEntry &group : lines) {
1219 llvm::Expected<uint32_t> file_index_or_err =
1221 if (!file_index_or_err)
1223 uint32_t file_index = file_index_or_err.get();
1227 for (
const LineNumberEntry &entry : group.LineNumbers) {
1228 LineInfo cur_info(entry.Flags);
1230 if (cur_info.isAlwaysStepInto() || cur_info.isNeverStepInto())
1233 uint64_t addr = virtual_addr + entry.Offset;
1235 bool is_statement = cur_info.isStatement();
1239 uint32_t lno = cur_info.getStartLine();
1242 is_prologue, is_epilogue,
false);
1244 auto iter = line_set.find(new_entry);
1245 if (iter != line_set.end() && iter->is_terminal_entry)
1246 line_set.erase(iter);
1247 line_set.insert(new_entry);
1254 line_entry.
data = {file_index, lno};
1256 LineInfo last_line(group.LineNumbers.back().Flags);
1257 line_set.emplace(virtual_addr + lfh->CodeSize, last_line.getEndLine(), 0,
1258 file_index,
false,
false,
false,
false,
true);
1261 line_entry.
SetRangeEnd(virtual_addr + lfh->CodeSize);
1270 const CVSymbolArray &syms = cii->
m_debug_stream.getSymbolArray();
1271 for (
auto iter = syms.begin(); iter != syms.end();) {
1272 if (iter->kind() != S_LPROC32 && iter->kind() != S_GPROC32) {
1277 uint32_t record_offset = iter.offset();
1278 CVSymbol func_record =
1287 comp_unit.
GetModule()->GetSectionList());
1293 if (kind != S_INLINESITE)
1298 for (
const auto &line_entry :
1303 if (!line_entry.is_terminal_entry)
1304 line_set.erase(line_entry);
1305 line_set.insert(line_entry);
1313 iter = syms.at(getScopeEndOffset(func_record));
1319 auto line_table = std::make_unique<LineTable>(&comp_unit);
1320 std::unique_ptr<LineSequence> sequence(
1321 line_table->CreateLineSequenceContainer());
1322 for (
const auto &line_entry : line_set) {
1323 line_table->AppendLineEntryToSequence(
1324 sequence.get(), line_entry.file_addr, line_entry.line,
1325 line_entry.column, line_entry.file_idx,
1326 line_entry.is_start_of_statement, line_entry.is_start_of_basic_block,
1327 line_entry.is_prologue_end, line_entry.is_epilogue_begin,
1328 line_entry.is_terminal_entry);
1330 line_table->InsertSequence(sequence.get());
1332 if (line_table->GetSize() == 0)
1344llvm::Expected<uint32_t>
1348 return llvm::make_error<RawError>(raw_error_code::no_entry);
1350 const auto &checksums = cii.
m_strings.checksums().getArray();
1351 const auto &strings = cii.
m_strings.strings();
1355 auto iter = checksums.at(file_id);
1356 if (iter == checksums.end())
1357 return llvm::make_error<RawError>(raw_error_code::no_entry);
1359 llvm::Expected<llvm::StringRef> efn = strings.getString(iter->FileNameOffset);
1361 return efn.takeError();
1367 return std::distance(cii.
m_file_list.begin(), fn_iter);
1368 return llvm::make_error<RawError>(raw_error_code::no_entry);
1382 f.starts_with(
"/") ? FileSpec::Style::posix : FileSpec::Style::windows;
1384 support_files.
Append(spec);
1390 const SymbolContext &sc, std::vector<SourceModule> &imported_modules) {
1403 CVSymbol sym = cii->
m_debug_stream.readSymbolAtOffset(
id.offset);
1406 InlineSiteSym inline_site(
static_cast<SymbolRecordKind
>(sym.kind()));
1407 cantFail(SymbolDeserializer::deserializeAs<InlineSiteSym>(sym, inline_site));
1410 std::shared_ptr<InlineSite> inline_site_sp =
1411 std::make_shared<InlineSite>(parent_id);
1414 auto iter = cii->
m_inline_map.find(inline_site.Inlinee);
1417 InlineeSourceLine inlinee_line = iter->second;
1421 llvm::Expected<uint32_t> file_index_or_err =
1423 if (!file_index_or_err)
1425 uint32_t file_offset = file_index_or_err.get();
1427 uint32_t decl_line = inlinee_line.Header->SourceLineNum;
1428 std::unique_ptr<Declaration> decl_up =
1429 std::make_unique<Declaration>(decl_file, decl_line);
1432 uint32_t code_offset = 0;
1433 int32_t line_offset = 0;
1434 std::optional<uint32_t> code_offset_base;
1435 std::optional<uint32_t> code_offset_end;
1436 std::optional<int32_t> cur_line_offset;
1437 std::optional<int32_t> next_line_offset;
1438 std::optional<uint32_t> next_file_offset;
1440 bool is_terminal_entry =
false;
1441 bool is_start_of_statement =
true;
1443 bool is_prologue_end =
true;
1445 auto update_code_offset = [&](uint32_t code_delta) {
1446 if (!code_offset_base)
1447 code_offset_base = code_offset;
1448 else if (!code_offset_end)
1449 code_offset_end = *code_offset_base + code_delta;
1451 auto update_line_offset = [&](int32_t line_delta) {
1452 line_offset += line_delta;
1453 if (!code_offset_base || !cur_line_offset)
1454 cur_line_offset = line_offset;
1456 next_line_offset = line_offset;
1459 auto update_file_offset = [&](uint32_t offset) {
1460 if (!code_offset_base)
1461 file_offset = offset;
1463 next_file_offset = offset;
1466 for (
auto &annot : inline_site.annotations()) {
1467 switch (annot.OpCode) {
1468 case BinaryAnnotationsOpCode::CodeOffset:
1469 case BinaryAnnotationsOpCode::ChangeCodeOffset:
1470 case BinaryAnnotationsOpCode::ChangeCodeOffsetBase:
1471 code_offset += annot.U1;
1472 update_code_offset(annot.U1);
1474 case BinaryAnnotationsOpCode::ChangeLineOffset:
1475 update_line_offset(annot.S1);
1477 case BinaryAnnotationsOpCode::ChangeCodeLength:
1478 update_code_offset(annot.U1);
1479 code_offset += annot.U1;
1480 is_terminal_entry =
true;
1482 case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
1483 code_offset += annot.U1;
1484 update_code_offset(annot.U1);
1485 update_line_offset(annot.S1);
1487 case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
1488 code_offset += annot.U2;
1489 update_code_offset(annot.U2);
1490 update_code_offset(annot.U1);
1491 code_offset += annot.U1;
1492 is_terminal_entry =
true;
1494 case BinaryAnnotationsOpCode::ChangeFile:
1495 update_file_offset(annot.U1);
1502 if (code_offset_base && code_offset_end && cur_line_offset) {
1504 *code_offset_base, *code_offset_end - *code_offset_base,
1505 decl_line + *cur_line_offset));
1507 if (next_file_offset)
1508 file_offset = *next_file_offset;
1509 if (next_line_offset) {
1510 cur_line_offset = next_line_offset;
1511 next_line_offset = std::nullopt;
1513 code_offset_base = is_terminal_entry ? std::nullopt : code_offset_end;
1514 code_offset_end = next_file_offset = std::nullopt;
1516 if (code_offset_base && cur_line_offset) {
1517 if (is_terminal_entry) {
1519 func_base + *code_offset_base, decl_line + *cur_line_offset, 0,
1520 file_offset,
false,
false,
false,
false,
true);
1521 inline_site_sp->line_entries.push_back(line_entry);
1524 decl_line + *cur_line_offset, 0,
1525 file_offset, is_start_of_statement,
false,
1526 is_prologue_end,
false,
false);
1527 inline_site_sp->line_entries.push_back(line_entry);
1528 is_prologue_end =
false;
1529 is_start_of_statement =
false;
1532 if (is_terminal_entry)
1533 is_start_of_statement =
true;
1534 is_terminal_entry =
false;
1537 inline_site_sp->ranges.Sort();
1540 std::unique_ptr<Declaration> callsite_up;
1541 if (!inline_site_sp->ranges.IsEmpty()) {
1542 auto *entry = inline_site_sp->ranges.GetEntryAtIndex(0);
1543 addr_t base_offset = entry->GetRangeBase();
1549 std::shared_ptr<InlineSite> parent_site =
1552 parent_site->inline_function_info->GetDeclaration().GetFile();
1553 if (
auto *parent_entry =
1554 parent_site->ranges.FindEntryThatContains(base_offset)) {
1556 std::make_unique<Declaration>(parent_decl_file, parent_entry->data);
1561 func_base + base_offset)) {
1565 std::make_unique<Declaration>(callsite_file, entry->data.second);
1571 CVType inlinee_cvt =
m_index->ipi().getType(inline_site.Inlinee);
1572 std::string inlinee_name;
1573 if (inlinee_cvt.kind() == LF_MFUNC_ID) {
1574 MemberFuncIdRecord mfr;
1576 TypeDeserializer::deserializeAs<MemberFuncIdRecord>(inlinee_cvt, mfr));
1577 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
1578 inlinee_name.append(std::string(types.getTypeName(mfr.ClassType)));
1579 inlinee_name.append(
"::");
1580 inlinee_name.append(mfr.getName().str());
1581 }
else if (inlinee_cvt.kind() == LF_FUNC_ID) {
1583 cantFail(TypeDeserializer::deserializeAs<FuncIdRecord>(inlinee_cvt, fir));
1584 TypeIndex parent_idx = fir.getParentScope();
1585 if (!parent_idx.isNoneType()) {
1586 LazyRandomTypeCollection &ids =
m_index->ipi().typeCollection();
1587 inlinee_name.append(std::string(ids.getTypeName(parent_idx)));
1588 inlinee_name.append(
"::");
1590 inlinee_name.append(fir.getName().str());
1592 inline_site_sp->inline_function_info = std::make_shared<InlineFunctionInfo>(
1593 inlinee_name.c_str(), llvm::StringRef(), decl_up.get(),
1604 std::set<uint64_t> remove_uids;
1606 if (kind == S_GPROC32 || kind == S_LPROC32 || kind == S_BLOCK32 ||
1607 kind == S_INLINESITE) {
1609 if (kind == S_INLINESITE)
1616 for (uint64_t uid : remove_uids) {
1626 CVSymbolArray syms =
1630 for (
auto iter = syms.begin(); iter != syms.end(); ++iter) {
1632 if (fn(iter->kind(), child_id))
1643 auto ts = *ts_or_err;
1647 clang->GetNativePDBParser()->Dump(s);
1654 using SymbolAndOffset = std::pair<uint32_t, llvm::codeview::CVSymbol>;
1656 std::vector<SymbolAndOffset> results =
m_index->globals().findRecordsByName(
1658 for (
const SymbolAndOffset &result : results) {
1659 switch (result.second.kind()) {
1660 case SymbolKind::S_GDATA32:
1661 case SymbolKind::S_LDATA32:
1662 case SymbolKind::S_GTHREAD32:
1663 case SymbolKind::S_LTHREAD32:
1664 case SymbolKind::S_CONSTANT: {
1683 if (name_type_mask & eFunctionNameTypeFull)
1687 if (!(name_type_mask & eFunctionNameTypeFull ||
1688 name_type_mask & eFunctionNameTypeMethod))
1691 using SymbolAndOffset = std::pair<uint32_t, llvm::codeview::CVSymbol>;
1693 std::vector<SymbolAndOffset> matches =
m_index->globals().findRecordsByName(
1695 for (
const SymbolAndOffset &match : matches) {
1696 if (match.second.kind() != S_PROCREF && match.second.kind() != S_LPROCREF)
1698 ProcRefSym proc(match.second.kind());
1699 cantFail(SymbolDeserializer::deserializeAs<ProcRefSym>(match.second, proc));
1705 m_index->compilands().GetOrCreateCompiland(proc.modi());
1717 bool include_inlines,
1729 std::vector<TypeIndex> matches =
1732 for (TypeIndex type_idx : matches) {
1742 if (results.
Done(query))
1749 uint32_t max_matches,
1752 std::vector<TypeIndex> matches =
m_index->tpi().findRecordsByName(name);
1753 if (max_matches > 0 && max_matches < matches.size())
1754 matches.resize(max_matches);
1756 for (TypeIndex ti : matches) {
1772 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
1775 for (
auto ti = types.getFirst(); ti; ti = types.getNext(*ti)) {
1778 (void)type->GetFullCompilerType();
1782 for (
const uint32_t gid :
m_index->globals().getGlobalsTable()) {
1784 CVSymbol sym =
m_index->ReadSymbolRecord(global);
1785 if (sym.kind() != S_UDT)
1788 UDTSym udt = llvm::cantFail(SymbolDeserializer::deserializeAs<UDTSym>(sym));
1789 bool is_typedef =
true;
1791 CVType cvt =
m_index->tpi().getType(udt.Type);
1793 if (name == udt.Name)
1805 return new_count - old_count;
1822 Block *func_block = █
1844 std::string name = var_info.
name.str();
1847 std::make_shared<SymbolFileType>(*
this, type_sp->GetID());
1852 bool external =
false;
1853 bool artificial =
false;
1854 bool location_is_constant_data =
false;
1855 bool static_member =
false;
1857 VariableSP var_sp = std::make_shared<Variable>(
1858 toOpaqueUid(var_id), name.c_str(), name.c_str(), sftype, var_scope,
1859 &block, scope_ranges, &decl, var_info.
location, external, artificial,
1860 location_is_constant_data, static_member);
1863 if (
auto err = ts_or_err.takeError())
1865 auto ts = *ts_or_err;
1869 ts->GetNativePDBParser()->GetOrCreateVariableDecl(scope_id, var_id);
1879 return iter->second;
1885 CVSymbol sym =
m_index->ReadSymbolRecord(
id);
1888 UDTSym udt = llvm::cantFail(SymbolDeserializer::deserializeAs<UDTSym>(sym));
1893 if (
auto err = ts_or_err.takeError())
1895 auto ts = *ts_or_err;
1899 ts->GetNativePDBParser()->GetOrCreateTypedefDecl(
id);
1905 decl, target_type->GetForwardCompilerType(),
1912 return iter->second;
1924 uint32_t params_remaining = 0;
1925 switch (sym.kind()) {
1928 ProcSym proc(
static_cast<SymbolRecordKind
>(sym.kind()));
1929 cantFail(SymbolDeserializer::deserializeAs<ProcSym>(sym, proc));
1930 CVType signature =
m_index->tpi().getType(proc.FunctionType);
1931 if (signature.kind() == LF_PROCEDURE) {
1932 ProcedureRecord sig;
1933 if (llvm::Error e = TypeDeserializer::deserializeAs<ProcedureRecord>(
1935 llvm::consumeError(std::move(e));
1938 params_remaining = sig.getParameterCount();
1939 }
else if (signature.kind() == LF_MFUNCTION) {
1940 MemberFunctionRecord sig;
1941 if (llvm::Error e = TypeDeserializer::deserializeAs<MemberFunctionRecord>(
1943 llvm::consumeError(std::move(e));
1946 params_remaining = sig.getParameterCount();
1956 lldbassert(
false &&
"Symbol is not a block!");
1962 variables = std::make_shared<VariableList>();
1966 CVSymbolArray syms = limitSymbolArrayToScope(
1972 auto iter = syms.begin();
1973 auto end = syms.end();
1975 while (iter != end) {
1976 uint32_t record_offset = iter.offset();
1977 CVSymbol variable_cvs = *iter;
1983 if (variable_cvs.kind() == S_BLOCK32 ||
1984 variable_cvs.kind() == S_INLINESITE) {
1985 uint32_t block_end = getScopeEndOffset(variable_cvs);
1987 iter = syms.at(block_end);
1991 bool is_param = params_remaining > 0;
1993 switch (variable_cvs.kind()) {
2001 variables->AddVariableIfUnique(variable);
2037 variables = std::make_shared<VariableList>();
2043 llvm_unreachable(
"Unreachable!");
2048 if (
auto err = ts_or_err.takeError())
2050 auto ts = *ts_or_err;
2054 if (
auto decl = ts->GetNativePDBParser()->GetOrCreateDeclForUid(uid))
2062 if (
auto err = ts_or_err.takeError())
2064 auto ts = *ts_or_err;
2069 clang::DeclContext *context =
2080 if (
auto err = ts_or_err.takeError())
2082 auto ts = *ts_or_err;
2095 auto iter =
m_types.find(type_uid);
2102 return &*iter->second;
2107 if (type_id.
index.isNoneType())
2116std::optional<SymbolFile::ArrayInfo>
2119 return std::nullopt;
2126 if (!clang_type_system)
2130 static_cast<PdbAstBuilder *
>(clang_type_system->GetNativePDBParser());
2134 clang::QualType qt =
2141 TypeClass type_mask,
2149llvm::Expected<lldb::TypeSystemSP>
2151 auto type_system_or_err =
2152 m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
2153 if (type_system_or_err)
2154 if (
auto ts = *type_system_or_err)
2155 ts->SetSymbolFile(
this);
2156 return type_system_or_err;
2161 return m_index->pdb().getFileSize();
2165 LazyRandomTypeCollection &types =
m_index->tpi().typeCollection();
2167 llvm::DenseMap<TypeIndex, TypeIndex> forward_to_full;
2168 llvm::DenseMap<TypeIndex, TypeIndex> full_to_forward;
2170 struct RecordIndices {
2175 llvm::StringMap<RecordIndices> record_indices;
2177 for (
auto ti = types.getFirst(); ti; ti = types.getNext(*ti)) {
2178 CVType type = types.getType(*ti);
2184 RecordIndices &indices = record_indices[tag.
asTag().getUniqueName()];
2185 if (tag.
asTag().isForwardRef())
2186 indices.forward = *ti;
2190 if (indices.full != TypeIndex::None() &&
2191 indices.forward != TypeIndex::None()) {
2192 forward_to_full[indices.forward] = indices.full;
2193 full_to_forward[indices.full] = indices.forward;
2199 if (tag.
asTag().isForwardRef() || !tag.
asTag().containsNestedClass())
2203 ProcessTpiStream(
PdbIndex &index, TypeIndex parent,
2205 llvm::DenseMap<TypeIndex, TypeIndex> &parents)
2206 : index(index), parents(parents), parent(parent),
2207 parent_cvt(parent_cvt) {}
2210 llvm::DenseMap<TypeIndex, TypeIndex> &parents;
2212 unsigned unnamed_type_index = 1;
2216 llvm::Error visitKnownMember(CVMemberRecord &CVR,
2217 NestedTypeRecord &Record)
override {
2218 std::string unnamed_type_name;
2219 if (Record.Name.empty()) {
2221 llvm::formatv(
"<unnamed-type-$S{0}>", unnamed_type_index).str();
2222 Record.Name = unnamed_type_name;
2223 ++unnamed_type_index;
2225 std::optional<CVTagRecord> tag =
2228 return llvm::ErrorSuccess();
2230 parents[Record.Type] = parent;
2231 return llvm::ErrorSuccess();
2235 CVType field_list_cvt =
m_index->tpi().getType(tag.
asTag().FieldList);
2237 FieldListRecord field_list;
2238 if (llvm::Error
error = TypeDeserializer::deserializeAs<FieldListRecord>(
2239 field_list_cvt, field_list))
2240 llvm::consumeError(std::move(
error));
2241 if (llvm::Error
error = visitMemberRecordStream(field_list.Data, process))
2242 llvm::consumeError(std::move(
error));
2250 std::vector<TypeIndex> full_keys;
2251 std::vector<TypeIndex> fwd_keys;
2253 TypeIndex key = entry.first;
2254 TypeIndex value = entry.second;
2256 auto iter = forward_to_full.find(value);
2257 if (iter != forward_to_full.end())
2258 entry.second = iter->second;
2260 iter = forward_to_full.find(key);
2261 if (iter != forward_to_full.end())
2262 fwd_keys.push_back(key);
2264 full_keys.push_back(key);
2266 for (TypeIndex fwd : fwd_keys) {
2267 TypeIndex full = forward_to_full[fwd];
2271 for (TypeIndex full : full_keys) {
2272 TypeIndex fwd = full_to_forward[full];
2277std::optional<PdbCompilandSymId>
2279 CVSymbol sym =
m_index->ReadSymbolRecord(
id);
2280 if (symbolOpensScope(sym.kind())) {
2283 id.offset = getScopeParentOffset(sym);
2287 return std::nullopt;
2296 auto begin = syms.begin();
2297 auto end = syms.at(
id.offset);
2298 std::vector<PdbCompilandSymId> scope_stack;
2300 while (begin != end) {
2301 if (begin.offset() >
id.offset) {
2303 lldbassert(
false &&
"Invalid compiland symbol id!");
2304 return std::nullopt;
2309 if (symbolOpensScope(begin->kind())) {
2312 uint32_t scope_end = getScopeEndOffset(*begin);
2313 if (scope_end <
id.offset) {
2314 begin = syms.at(scope_end);
2317 scope_stack.emplace_back(
id.modi, begin.offset());
2319 }
else if (symbolEndsScope(begin->kind())) {
2320 scope_stack.pop_back();
2324 if (scope_stack.empty())
2325 return std::nullopt;
2327 return scope_stack.back();
2330std::optional<llvm::codeview::TypeIndex>
2334 return std::nullopt;
2335 return parent_iter->second;
static llvm::raw_ostream & error(Stream &strm)
#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 bool IsFunctionPrologue(const CompilandIndexItem &cci, lldb::addr_t addr)
llvm::ArrayRef< MSVCUndecoratedNameSpecifier > GetSpecifiers() const
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
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)
Function * CalculateSymbolContextFunction() override
void SetVariableList(lldb::VariableListSP &variable_list_sp)
Set accessor for the variable list.
Block * GetParent() const
Get the parent block.
size_t GetNumRanges() const
bool GetStartAddress(Address &addr)
void SetDidParseVariables(bool b, bool set_children)
void AddRange(const Range &range)
Add a new offset range to this block.
void AddChild(const lldb::BlockSP &child_block_sp)
Add a child to this object.
bool CanImport(const CompilerType &type)
Returns true iff the given type was copied from another TypeSystemClang and the original type in this...
bool CompleteType(const CompilerType &compiler_type)
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.
std::shared_ptr< TypeSystemType > dyn_cast_or_null()
Return a shared_ptr<TypeSystemType> if dyn_cast succeeds.
Generic representation of a type in a programming language.
TypeSystemSPWrapper GetTypeSystem() const
Accessors.
lldb::opaque_compiler_type_t GetOpaqueQualType() const
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
"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.
static bool Match(const FileSpec &pattern, const FileSpec &file)
Match FileSpec pattern against FileSpec file.
const ConstString & GetFilename() const
Filename string const get accessor.
FileSpec CopyByRemovingLastPathComponent() const
llvm::sys::path::Style Style
static FileSystem & Instance()
A class that describes a function.
const AddressRange & GetAddressRange()
Block & GetBlock(bool can_create)
Get accessor for the block list.
A class that handles mangled names.
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)
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.
Containing protected virtual methods for child classes to override.
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)
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.
Provides public interface for all SymbolFiles.
virtual std::recursive_mutex & GetModuleMutex() const
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
void Insert(const lldb::TypeSP &type)
void Insert(const lldb::TypeSP &type)
A class that contains all state required for type lookups.
std::vector< lldb_private::CompilerContext > & GetContextRef()
Access the internal compiler context array.
ConstString GetTypeBasename() const
Get the type basename to use when searching the type indexes in each SymbolFile object.
bool ContextMatches(llvm::ArrayRef< lldb_private::CompilerContext > context) const
Check of a CompilerContext array from matching type from a symbol file matches the m_context.
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.
void AddVariable(const lldb::VariableSP &var_sp)
ClangASTImporter & GetClangASTImporter()
clang::DeclContext * GetParentDeclContext(PdbSymUid uid)
CompilerDeclContext ToCompilerDeclContext(clang::DeclContext &context)
clang::DeclContext * FromCompilerDeclContext(CompilerDeclContext context)
CompilerType ToCompilerType(clang::QualType qt)
bool CompleteType(clang::QualType qt)
clang::DeclContext * GetOrCreateDeclContextForUid(PdbSymUid uid)
void ParseDeclsForContext(clang::DeclContext &context)
clang::BlockDecl * GetOrCreateBlockDecl(PdbCompilandSymId block_id)
clang::QualType GetOrCreateType(PdbTypeSymId type)
clang::FunctionDecl * GetOrCreateInlinedFunctionDecl(PdbCompilandSymId inlinesite_id)
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
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.
lldb::VariableSP CreateGlobalVariable(PdbGlobalSymId var_id)
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language) override
void InitializeObject() override
Initialize the SymbolFile object.
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
lldb::VariableSP GetOrCreateLocalVariable(PdbCompilandSymId scope_id, PdbCompilandSymId var_id, bool is_param)
Block & CreateBlock(PdbCompilandSymId block_id)
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
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 DumpClangAST(Stream &s) override
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)
void AddSymbols(Symtab &symtab) override
std::optional< llvm::codeview::TypeIndex > GetParentType(llvm::codeview::TypeIndex ti)
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::VariableSP CreateLocalVariable(PdbCompilandSymId scope_id, PdbCompilandSymId var_id, bool is_param)
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.
size_t ParseTypes(lldb_private::CompileUnit &comp_unit) override
lldb::addr_t m_obj_load_address
size_t ParseBlocksRecursive(Function &func) override
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
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
static void DebuggerInitialize(Debugger &debugger)
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)
Block & GetOrCreateBlock(PdbCompilandSymId block_id)
llvm::DenseMap< llvm::codeview::TypeIndex, llvm::codeview::TypeIndex > m_parent_types
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override
lldb::TypeSP CreateFunctionType(PdbTypeSymId type_id, const llvm::codeview::MemberFunctionRecord &pr, CompilerType ct)
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
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)
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)
DWARFExpression MakeConstantLocationExpression(llvm::codeview::TypeIndex underlying_ti, llvm::pdb::TpiStream &tpi, const llvm::APSInt &constant, lldb::ModuleSP module)
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::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.
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