Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
LVCodeViewReader.cpp
Go to the documentation of this file.
1//===-- LVCodeViewReader.cpp ----------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This implements the LVCodeViewReader class.
10//
11//===----------------------------------------------------------------------===//
12
13#include "llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h"
14#include "llvm/DebugInfo/CodeView/CVSymbolVisitor.h"
15#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
16#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
17#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
18#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h"
19#include "llvm/DebugInfo/LogicalView/Core/LVLine.h"
20#include "llvm/DebugInfo/LogicalView/Core/LVScope.h"
21#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
22#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
23#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
24#include "llvm/DebugInfo/PDB/Native/LinePrinter.h"
25#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
26#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
27#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
28#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
29#include "llvm/Object/COFF.h"
30#include "llvm/Support/Errc.h"
31#include "llvm/Support/Error.h"
32#include "llvm/Support/FormatAdapters.h"
33#include "llvm/Support/FormatVariadic.h"
34#include "llvm/Support/WithColor.h"
35
36using namespacellvm;
37using namespacellvm::codeview;
38using namespacellvm::logicalview;
39using namespacellvm::msf;
40using namespacellvm::object;
41using namespacellvm::pdb;
42
43#define DEBUG_TYPE "CodeViewReader"
44
45StringRefLVCodeViewReader::getSymbolKindName(SymbolKindKind) {
46switch (Kind) {
47#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
48 case EnumName: \
49 return #EnumName;
50#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
51default:
52return"UnknownSym";
53 }
54llvm_unreachable("Unknown SymbolKind::Kind");
55}
56
57std::stringLVCodeViewReader::formatRegisterId(RegisterIdRegister,
58CPUType CPU) {
59#define RETURN_CASE(Enum, X, Ret) \
60 case Enum::X: \
61 return Ret;
62
63if (CPU == CPUType::ARMNT) {
64switch (Register) {
65#define CV_REGISTERS_ARM
66#define CV_REGISTER(name, val) RETURN_CASE(RegisterId, name, #name)
67#include "llvm/DebugInfo/CodeView/CodeViewRegisters.def"
68#undef CV_REGISTER
69#undef CV_REGISTERS_ARM
70
71default:
72break;
73 }
74 }elseif (CPU == CPUType::ARM64) {
75switch (Register) {
76#define CV_REGISTERS_ARM64
77#define CV_REGISTER(name, val) RETURN_CASE(RegisterId, name, #name)
78#include "llvm/DebugInfo/CodeView/CodeViewRegisters.def"
79#undef CV_REGISTER
80#undef CV_REGISTERS_ARM64
81
82default:
83break;
84 }
85 }else {
86switch (Register) {
87#define CV_REGISTERS_X86
88#define CV_REGISTER(name, val) RETURN_CASE(RegisterId, name, #name)
89#include "llvm/DebugInfo/CodeView/CodeViewRegisters.def"
90#undef CV_REGISTER
91#undef CV_REGISTERS_X86
92
93default:
94break;
95 }
96 }
97return"formatUnknownEnum(Id)";
98}
99
100void LVCodeViewReader::printRelocatedField(StringRefLabel,
101constcoff_section *CoffSection,
102uint32_t RelocOffset,
103uint32_tOffset,
104StringRef *RelocSym) {
105StringRef SymStorage;
106StringRef &Symbol = RelocSym ? *RelocSym : SymStorage;
107if (!resolveSymbolName(CoffSection, RelocOffset, Symbol))
108W.printSymbolOffset(Label, Symbol,Offset);
109else
110W.printHex(Label, RelocOffset);
111}
112
113voidLVCodeViewReader::getLinkageName(constcoff_section *CoffSection,
114uint32_t RelocOffset,uint32_tOffset,
115StringRef *RelocSym) {
116StringRef SymStorage;
117StringRef &Symbol = RelocSym ? *RelocSym : SymStorage;
118if (resolveSymbolName(CoffSection, RelocOffset, Symbol))
119 Symbol ="";
120}
121
122Expected<StringRef>
123LVCodeViewReader::getFileNameForFileOffset(uint32_t FileOffset,
124constSymbolGroup *SG) {
125if (SG) {
126Expected<StringRef>Filename = SG->getNameFromChecksums(FileOffset);
127if (!Filename) {
128consumeError(Filename.takeError());
129returnStringRef("");
130 }
131return *Filename;
132 }
133
134// The file checksum subsection should precede all references to it.
135if (!CVFileChecksumTable.valid() || !CVStringTable.valid())
136returncreateStringError(object_error::parse_failed, getFileName());
137
138VarStreamArray<FileChecksumEntry>::Iterator Iter =
139 CVFileChecksumTable.getArray().at(FileOffset);
140
141// Check if the file checksum table offset is valid.
142if (Iter == CVFileChecksumTable.end())
143returncreateStringError(object_error::parse_failed, getFileName());
144
145Expected<StringRef> NameOrErr = CVStringTable.getString(Iter->FileNameOffset);
146if (!NameOrErr)
147returncreateStringError(object_error::parse_failed, getFileName());
148return *NameOrErr;
149}
150
151Error LVCodeViewReader::printFileNameForOffset(StringRefLabel,
152uint32_t FileOffset,
153constSymbolGroup *SG) {
154Expected<StringRef> NameOrErr = getFileNameForFileOffset(FileOffset, SG);
155if (!NameOrErr)
156return NameOrErr.takeError();
157W.printHex(Label, *NameOrErr, FileOffset);
158returnError::success();
159}
160
161void LVCodeViewReader::cacheRelocations() {
162for (constSectionRef &Section : getObj().sections()) {
163constcoff_section *CoffSection = getObj().getCOFFSection(Section);
164
165for (constRelocationRef &Relocacion :Section.relocations())
166RelocMap[CoffSection].push_back(Relocacion);
167
168// Sort relocations by address.
169llvm::sort(RelocMap[CoffSection], [](RelocationRef L,RelocationRef R) {
170returnL.getOffset() <R.getOffset();
171 });
172 }
173}
174
175// Given a section and an offset into this section the function returns the
176// symbol used for the relocation at the offset.
177Error LVCodeViewReader::resolveSymbol(constcoff_section *CoffSection,
178uint64_tOffset,SymbolRef &Sym) {
179constauto &Relocations =RelocMap[CoffSection];
180basic_symbol_iterator SymI = getObj().symbol_end();
181for (constRelocationRef &Relocation : Relocations) {
182uint64_t RelocationOffset = Relocation.getOffset();
183
184if (RelocationOffset ==Offset) {
185 SymI = Relocation.getSymbol();
186break;
187 }
188 }
189if (SymI == getObj().symbol_end())
190return make_error<StringError>("Unknown Symbol",inconvertibleErrorCode());
191Sym = *SymI;
192returnErrorSuccess();
193}
194
195// Given a section and an offset into this section the function returns the
196// name of the symbol used for the relocation at the offset.
197Error LVCodeViewReader::resolveSymbolName(constcoff_section *CoffSection,
198uint64_tOffset,StringRef &Name) {
199SymbolRefSymbol;
200if (Error E = resolveSymbol(CoffSection,Offset, Symbol))
201return E;
202Expected<StringRef> NameOrErr =Symbol.getName();
203if (!NameOrErr)
204return NameOrErr.takeError();
205Name = *NameOrErr;
206returnErrorSuccess();
207}
208
209// CodeView and DWARF can have references to compiler generated elements,
210// used for initialization. The MSVC includes in the PDBs, internal compile
211// units, associated with the MS runtime support. We mark them as 'system'
212// and they are printed only if the command line option 'internal=system'.
213boolLVCodeViewReader::isSystemEntry(LVElement *Element,StringRefName) const{
214Name =Name.empty() ? Element->getName() :Name;
215autoFind = [=](constchar *String) ->bool {returnName.contains(String); };
216auto Starts = [=](constchar *Pattern) ->bool {
217returnName.starts_with(Pattern);
218 };
219auto CheckExclude = [&]() ->bool {
220if (Starts("__") || Starts("_PMD") || Starts("_PMFN"))
221returntrue;
222if (Find("_s__"))
223returntrue;
224if (Find("_CatchableType") ||Find("_TypeDescriptor"))
225returntrue;
226if (Find("Intermediate\\vctools"))
227returntrue;
228if (Find("$initializer$") ||Find("dynamic initializer"))
229returntrue;
230if (Find("`vftable'") ||Find("_GLOBAL__sub"))
231returntrue;
232returnfalse;
233 };
234bool Excluded = CheckExclude();
235if (Excluded)
236 Element->setIsSystem();
237
238return Excluded;
239}
240
241Error LVCodeViewReader::collectInlineeInfo(
242DebugInlineeLinesSubsectionRef &Lines,constllvm::pdb::SymbolGroup *SG) {
243for (constInlineeSourceLine &Line : Lines) {
244TypeIndex TIInlinee =Line.Header->Inlinee;
245uint32_t LineNumber =Line.Header->SourceLineNum;
246uint32_t FileOffset =Line.Header->FileID;
247LLVM_DEBUG({
248DictScope S(W,"InlineeSourceLine");
249 LogicalVisitor.printTypeIndex("Inlinee", TIInlinee,StreamTPI);
250if (Error Err = printFileNameForOffset("FileID", FileOffset, SG))
251return Err;
252W.printNumber("SourceLineNum", LineNumber);
253
254if (Lines.hasExtraFiles()) {
255W.printNumber("ExtraFileCount",Line.ExtraFiles.size());
256ListScopeExtraFiles(W,"ExtraFiles");
257for (const ulittle32_t &FID :Line.ExtraFiles)
258if (Error Err = printFileNameForOffset("FileID", FID, SG))
259return Err;
260 }
261 });
262Expected<StringRef> NameOrErr = getFileNameForFileOffset(FileOffset, SG);
263if (!NameOrErr)
264return NameOrErr.takeError();
265 LogicalVisitor.addInlineeInfo(TIInlinee, LineNumber, *NameOrErr);
266 }
267
268returnError::success();
269}
270
271Error LVCodeViewReader::traverseInlineeLines(StringRef Subsection) {
272BinaryStreamReader SR(Subsection,llvm::endianness::little);
273DebugInlineeLinesSubsectionRefLines;
274if (Error E =Lines.initialize(SR))
275returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
276
277return collectInlineeInfo(Lines);
278}
279
280Error LVCodeViewReader::createLines(
281constFixedStreamArray<LineNumberEntry> &LineNumbers,LVAddress Addendum,
282uint32_t Segment,uint32_t Begin,uint32_tSize,uint32_t NameIndex,
283constSymbolGroup *SG) {
284LLVM_DEBUG({
285uint32_tEnd = Begin +Size;
286W.getOStream() <<formatv("{0:x-4}:{1:x-8}-{2:x-8}\n", Segment, Begin,End);
287 });
288
289for (constLineNumberEntry &Line :LineNumbers) {
290if (Line.Offset >=Size)
291returncreateStringError(object_error::parse_failed, getFileName());
292
293LineInfo LI(Line.Flags);
294
295LLVM_DEBUG({
296W.getOStream() <<formatv(
297"{0} {1:x-8}\n", utostr(LI.getStartLine()),
298fmt_align(Begin +Line.Offset,AlignStyle::Right, 8,'0'));
299 });
300
301// The 'processLines()' function will move each created logical line
302// to its enclosing logical scope, using the debug ranges information
303// and they will be released when its scope parent is deleted.
304LVLineDebug *LineDebug = createLineDebug();
305CULines.push_back(LineDebug);
306LVAddressAddress =linearAddress(Segment, Begin +Line.Offset);
307 LineDebug->setAddress(Address + Addendum);
308
309if (LI.isAlwaysStepInto())
310 LineDebug->setIsAlwaysStepInto();
311elseif (LI.isNeverStepInto())
312 LineDebug->setIsNeverStepInto();
313else
314 LineDebug->setLineNumber(LI.getStartLine());
315
316if (LI.isStatement())
317 LineDebug->setIsNewStatement();
318
319Expected<StringRef> NameOrErr = getFileNameForFileOffset(NameIndex, SG);
320if (!NameOrErr)
321return NameOrErr.takeError();
322 LineDebug->setFilename(*NameOrErr);
323 }
324
325returnError::success();
326}
327
328Error LVCodeViewReader::initializeFileAndStringTables(
329BinaryStreamReader &Reader) {
330while (Reader.bytesRemaining() > 0 &&
331 (!CVFileChecksumTable.valid() || !CVStringTable.valid())) {
332// The section consists of a number of subsection in the following format:
333// |SubSectionType|SubSectionSize|Contents...|
334uint32_t SubType, SubSectionSize;
335
336if (Error E = Reader.readInteger(SubType))
337returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
338if (Error E = Reader.readInteger(SubSectionSize))
339returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
340
341StringRef Contents;
342if (Error E = Reader.readFixedString(Contents, SubSectionSize))
343returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
344
345BinaryStreamRefST(Contents,llvm::endianness::little);
346switch (DebugSubsectionKind(SubType)) {
347case DebugSubsectionKind::FileChecksums:
348if (Error E = CVFileChecksumTable.initialize(ST))
349returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
350break;
351case DebugSubsectionKind::StringTable:
352if (Error E = CVStringTable.initialize(ST))
353returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
354break;
355default:
356break;
357 }
358
359uint32_t PaddedSize =alignTo(SubSectionSize, 4);
360if (Error E = Reader.skip(PaddedSize - SubSectionSize))
361returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
362 }
363
364returnError::success();
365}
366
367Error LVCodeViewReader::loadTypeServer(TypeServer2Record &TS) {
368LLVM_DEBUG({
369W.printString("Guid",formatv("{0}", TS.getGuid()).str());
370W.printNumber("Age", TS.getAge());
371W.printString("Name", TS.getName());
372 });
373
374SmallString<128> ServerName(TS.getName());
375 BuffOrErr =MemoryBuffer::getFile(ServerName);
376if (BuffOrErr.getError()) {
377// The server name does not exist. Try in the same directory as the
378// input file.
379 ServerName =createAlternativePath(ServerName);
380 BuffOrErr =MemoryBuffer::getFile(ServerName);
381if (BuffOrErr.getError()) {
382// For the error message, use the original type server name.
383returncreateStringError(errc::bad_file_descriptor,
384"File '%s' does not exist.",
385 TS.getName().str().c_str());
386 }
387 }
388 MemBuffer = std::move(BuffOrErr.get());
389
390// Check if the buffer corresponds to a PDB file.
391assert(identify_magic((*MemBuffer).getBuffer()) ==file_magic::pdb &&
392"Invalid PDB file.");
393
394if (Error Err =loadDataForPDB(PDB_ReaderType::Native, ServerName, Session))
395returncreateStringError(errorToErrorCode(std::move(Err)),"%s",
396 ServerName.c_str());
397
398 PdbSession.reset(static_cast<NativeSession *>(Session.release()));
399PDBFile &Pdb = PdbSession->getPDBFile();
400
401// Just because a file with a matching name was found and it was an actual
402// PDB file doesn't mean it matches. For it to match the InfoStream's GUID
403// must match the GUID specified in the TypeServer2 record.
404Expected<InfoStream &> expectedInfo =Pdb.getPDBInfoStream();
405if (!expectedInfo || expectedInfo->getGuid() != TS.getGuid())
406returncreateStringError(errc::invalid_argument,"signature_out_of_date");
407
408// The reader needs to switch to a type server, to process the types from
409// the server. We need to keep the original input source, as reading other
410// sections will require the input associated with the loaded object file.
411 TypeServer = std::make_shared<InputFile>(&Pdb);
412 LogicalVisitor.setInput(TypeServer);
413
414LazyRandomTypeCollection &Types = types();
415LazyRandomTypeCollection &Ids = ids();
416if (Error Err = traverseTypes(Pdb, Types, Ids))
417return Err;
418
419returnError::success();
420}
421
422Error LVCodeViewReader::loadPrecompiledObject(PrecompRecord &Precomp,
423CVTypeArray &CVTypesObj) {
424LLVM_DEBUG({
425W.printHex("Count", Precomp.getTypesCount());
426W.printHex("Signature", Precomp.getSignature());
427W.printString("PrecompFile", Precomp.getPrecompFilePath());
428 });
429
430SmallString<128> ServerName(Precomp.getPrecompFilePath());
431 BuffOrErr =MemoryBuffer::getFile(ServerName);
432if (BuffOrErr.getError()) {
433// The server name does not exist. Try in the directory as the input file.
434 ServerName =createAlternativePath(ServerName);
435if (BuffOrErr.getError()) {
436// For the error message, use the original type server name.
437returncreateStringError(errc::bad_file_descriptor,
438"File '%s' does not exist.",
439 Precomp.getPrecompFilePath().str().c_str());
440 }
441 }
442 MemBuffer = std::move(BuffOrErr.get());
443
444Expected<std::unique_ptr<Binary>> BinOrErr =createBinary(*MemBuffer);
445if (errorToErrorCode(BinOrErr.takeError()))
446returncreateStringError(errc::not_supported,
447"Binary object format in '%s' is not supported.",
448 ServerName.c_str());
449
450Binary &BinaryObj = *BinOrErr.get();
451if (!BinaryObj.isCOFF())
452returncreateStringError(errc::not_supported,"'%s' is not a COFF object.",
453 ServerName.c_str());
454
455 Builder = std::make_unique<AppendingTypeTableBuilder>(BuilderAllocator);
456
457// The MSVC precompiled header object file, should contain just a single
458// ".debug$P" section.
459COFFObjectFile &Obj = *cast<COFFObjectFile>(&BinaryObj);
460for (constSectionRef &Section : Obj.sections()) {
461Expected<StringRef> SectionNameOrErr =Section.getName();
462if (!SectionNameOrErr)
463return SectionNameOrErr.takeError();
464if (*SectionNameOrErr ==".debug$P") {
465Expected<StringRef> DataOrErr =Section.getContents();
466if (!DataOrErr)
467return DataOrErr.takeError();
468uint32_tMagic;
469if (Error Err =consume(*DataOrErr,Magic))
470return Err;
471if (Magic !=COFF::DEBUG_SECTION_MAGIC)
472returnerrorCodeToError(object_error::parse_failed);
473
474 ReaderPrecomp = std::make_unique<BinaryStreamReader>(
475 *DataOrErr,llvm::endianness::little);
476cantFail(
477 ReaderPrecomp->readArray(CVTypesPrecomp, ReaderPrecomp->getLength()));
478
479// Append all the type records up to the LF_ENDPRECOMP marker and
480// check if the signatures match.
481for (constCVType &Type : CVTypesPrecomp) {
482ArrayRef<uint8_t> TypeData =Type.data();
483if (Type.kind() == LF_ENDPRECOMP) {
484EndPrecompRecord EndPrecomp =cantFail(
485 TypeDeserializer::deserializeAs<EndPrecompRecord>(TypeData));
486if (Precomp.getSignature() != EndPrecomp.getSignature())
487returncreateStringError(errc::invalid_argument,"no matching pch");
488break;
489 }
490 Builder->insertRecordBytes(TypeData);
491 }
492// Done processing .debug$P, break out of section loop.
493break;
494 }
495 }
496
497// Append all the type records, skipping the first record which is the
498// reference to the precompiled header object information.
499for (constCVType &Type : CVTypesObj) {
500ArrayRef<uint8_t> TypeData =Type.data();
501if (Type.kind() != LF_PRECOMP)
502 Builder->insertRecordBytes(TypeData);
503 }
504
505// Set up a type stream that refers to the added type records.
506 Builder->ForEachRecord(
507 [&](TypeIndex TI,constCVType &Type) { TypeArray.push_back(Type); });
508
509 ItemStream =
510 std::make_unique<BinaryItemStream<CVType>>(llvm::endianness::little);
511 ItemStream->setItems(TypeArray);
512 TypeStream.setUnderlyingStream(*ItemStream);
513
514 PrecompHeader =
515 std::make_shared<LazyRandomTypeCollection>(TypeStream, TypeArray.size());
516
517// Change the original input source to use the collected type records.
518 LogicalVisitor.setInput(PrecompHeader);
519
520LazyRandomTypeCollection &Types = types();
521LazyRandomTypeCollection &Ids = ids();
522LVTypeVisitor TDV(W, &LogicalVisitor, Types, Ids,StreamTPI,
523 LogicalVisitor.getShared());
524returnvisitTypeStream(Types, TDV);
525}
526
527Error LVCodeViewReader::traverseTypeSection(StringRefSectionName,
528constSectionRef &Section) {
529LLVM_DEBUG({
530ListScopeD(W,"CodeViewTypes");
531W.printNumber("Section",SectionName, getObj().getSectionID(Section));
532 });
533
534Expected<StringRef> DataOrErr =Section.getContents();
535if (!DataOrErr)
536return DataOrErr.takeError();
537uint32_tMagic;
538if (Error Err =consume(*DataOrErr,Magic))
539return Err;
540if (Magic !=COFF::DEBUG_SECTION_MAGIC)
541returnerrorCodeToError(object_error::parse_failed);
542
543// Get the first type record. It will indicate if this object uses a type
544// server (/Zi) or a PCH file (/Yu).
545CVTypeArray CVTypes;
546BinaryStreamReader Reader(*DataOrErr,llvm::endianness::little);
547cantFail(Reader.readArray(CVTypes, Reader.getLength()));
548CVTypeArray::Iterator FirstType = CVTypes.begin();
549
550// The object was compiled with /Zi. It uses types from a type server PDB.
551if (FirstType->kind() == LF_TYPESERVER2) {
552TypeServer2Record TS =cantFail(
553 TypeDeserializer::deserializeAs<TypeServer2Record>(FirstType->data()));
554return loadTypeServer(TS);
555 }
556
557// The object was compiled with /Yc or /Yu. It uses types from another
558// object file with a matching signature.
559if (FirstType->kind() == LF_PRECOMP) {
560PrecompRecord Precomp =cantFail(
561 TypeDeserializer::deserializeAs<PrecompRecord>(FirstType->data()));
562return loadPrecompiledObject(Precomp, CVTypes);
563 }
564
565LazyRandomTypeCollection &Types = types();
566LazyRandomTypeCollection &Ids = ids();
567Types.reset(*DataOrErr, 100);
568LVTypeVisitor TDV(W, &LogicalVisitor, Types, Ids,StreamTPI,
569 LogicalVisitor.getShared());
570returnvisitTypeStream(Types, TDV);
571}
572
573Error LVCodeViewReader::traverseTypes(PDBFile &Pdb,
574LazyRandomTypeCollection &Types,
575LazyRandomTypeCollection &Ids) {
576// Traverse types (TPI and IPI).
577auto VisitTypes = [&](LazyRandomTypeCollection &Types,
578LazyRandomTypeCollection &Ids,
579SpecialStream StreamIdx) ->Error {
580LVTypeVisitor TDV(W, &LogicalVisitor, Types, Ids, StreamIdx,
581 LogicalVisitor.getShared());
582returnvisitTypeStream(Types, TDV);
583 };
584
585Expected<TpiStream &> StreamTpiOrErr =Pdb.getPDBTpiStream();
586if (!StreamTpiOrErr)
587return StreamTpiOrErr.takeError();
588TpiStream &StreamTpi = *StreamTpiOrErr;
589 StreamTpi.buildHashMap();
590LLVM_DEBUG({
591W.getOStream() <<formatv("Showing {0:N} TPI records\n",
592 StreamTpi.getNumTypeRecords());
593 });
594if (Error Err = VisitTypes(Types, Ids,StreamTPI))
595return Err;
596
597Expected<TpiStream &> StreamIpiOrErr =Pdb.getPDBIpiStream();
598if (!StreamIpiOrErr)
599return StreamIpiOrErr.takeError();
600TpiStream &StreamIpi = *StreamIpiOrErr;
601 StreamIpi.buildHashMap();
602LLVM_DEBUG({
603W.getOStream() <<formatv("Showing {0:N} IPI records\n",
604 StreamIpi.getNumTypeRecords());
605 });
606return VisitTypes(Ids, Ids,StreamIPI);
607}
608
609Error LVCodeViewReader::traverseSymbolsSubsection(StringRef Subsection,
610constSectionRef &Section,
611StringRef SectionContents) {
612ArrayRef<uint8_t> BinaryData(Subsection.bytes_begin(),
613 Subsection.bytes_end());
614LVSymbolVisitorDelegate VisitorDelegate(this, Section, &getObj(),
615 SectionContents);
616CVSymbolArray Symbols;
617BinaryStreamReader Reader(BinaryData,llvm::endianness::little);
618if (Error E = Reader.readArray(Symbols, Reader.getLength()))
619returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
620
621LazyRandomTypeCollection &Types = types();
622LazyRandomTypeCollection &Ids = ids();
623SymbolVisitorCallbackPipeline Pipeline;
624SymbolDeserializer Deserializer(&VisitorDelegate,
625 CodeViewContainer::ObjectFile);
626// As we are processing a COFF format, use TPI as IPI, so the generic code
627// to process the CodeView format does not contain any additional checks.
628LVSymbolVisitor Traverser(this,W, &LogicalVisitor, Types, Ids,
629 &VisitorDelegate, LogicalVisitor.getShared());
630
631 Pipeline.addCallbackToPipeline(Deserializer);
632 Pipeline.addCallbackToPipeline(Traverser);
633CVSymbolVisitor Visitor(Pipeline);
634return Visitor.visitSymbolStream(Symbols);
635}
636
637Error LVCodeViewReader::traverseSymbolSection(StringRefSectionName,
638constSectionRef &Section) {
639LLVM_DEBUG({
640ListScopeD(W,"CodeViewDebugInfo");
641W.printNumber("Section",SectionName, getObj().getSectionID(Section));
642 });
643
644Expected<StringRef> SectionOrErr =Section.getContents();
645if (!SectionOrErr)
646return SectionOrErr.takeError();
647StringRef SectionContents = *SectionOrErr;
648StringRefData = SectionContents;
649
650SmallVector<StringRef, 10> SymbolNames;
651StringMap<StringRef> FunctionLineTables;
652
653uint32_tMagic;
654if (Error E =consume(Data,Magic))
655returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
656
657if (Magic !=COFF::DEBUG_SECTION_MAGIC)
658returncreateStringError(object_error::parse_failed, getFileName());
659
660BinaryStreamReader FSReader(Data,llvm::endianness::little);
661if (Error Err = initializeFileAndStringTables(FSReader))
662return Err;
663
664while (!Data.empty()) {
665// The section consists of a number of subsection in the following format:
666// |SubSectionType|SubSectionSize|Contents...|
667uint32_t SubType, SubSectionSize;
668if (Error E =consume(Data, SubType))
669returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
670if (Error E =consume(Data, SubSectionSize))
671returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
672
673// Process the subsection as normal even if the ignore bit is set.
674 SubType &= ~SubsectionIgnoreFlag;
675
676// Get the contents of the subsection.
677if (SubSectionSize >Data.size())
678returncreateStringError(object_error::parse_failed, getFileName());
679StringRef Contents =Data.substr(0, SubSectionSize);
680
681// Add SubSectionSize to the current offset and align that offset
682// to find the next subsection.
683size_tSectionOffset =Data.data() - SectionContents.data();
684size_t NextOffset =SectionOffset + SubSectionSize;
685 NextOffset =alignTo(NextOffset, 4);
686if (NextOffset > SectionContents.size())
687returncreateStringError(object_error::parse_failed, getFileName());
688Data = SectionContents.drop_front(NextOffset);
689
690switch (DebugSubsectionKind(SubType)) {
691case DebugSubsectionKind::Symbols:
692if (Error Err =
693 traverseSymbolsSubsection(Contents, Section, SectionContents))
694return Err;
695break;
696
697case DebugSubsectionKind::InlineeLines:
698if (Error Err = traverseInlineeLines(Contents))
699return Err;
700break;
701
702case DebugSubsectionKind::Lines:
703// Holds a PC to file:line table. Some data to parse this subsection
704// is stored in the other subsections, so just check sanity and store
705// the pointers for deferred processing.
706
707// Collect function and ranges only if we need to print logical lines.
708if (options().getGeneralCollectRanges()) {
709
710if (SubSectionSize < 12) {
711// There should be at least three words to store two function
712// relocations and size of the code.
713returncreateStringError(object_error::parse_failed, getFileName());
714 }
715
716StringRefSymbolName;
717if (Error Err = resolveSymbolName(getObj().getCOFFSection(Section),
718SectionOffset, SymbolName))
719returncreateStringError(errorToErrorCode(std::move(Err)),
720 getFileName());
721
722LLVM_DEBUG({W.printString("Symbol Name", SymbolName); });
723if (FunctionLineTables.count(SymbolName) != 0) {
724// Saw debug info for this function already?
725returncreateStringError(object_error::parse_failed, getFileName());
726 }
727
728 FunctionLineTables[SymbolName] = Contents;
729 SymbolNames.push_back(SymbolName);
730 }
731break;
732
733// Do nothing for unrecognized subsections.
734default:
735break;
736 }
737W.flush();
738 }
739
740// Traverse the line tables now that we've read all the subsections and
741// know all the required information.
742for (StringRef SymbolName : SymbolNames) {
743LLVM_DEBUG({
744ListScope S(W,"FunctionLineTable");
745W.printString("Symbol Name", SymbolName);
746 });
747
748BinaryStreamReader Reader(FunctionLineTables[SymbolName],
749llvm::endianness::little);
750
751DebugLinesSubsectionRefLines;
752if (Error E =Lines.initialize(Reader))
753returncreateStringError(errorToErrorCode(std::move(E)), getFileName());
754
755// Find the associated symbol table information.
756LVSymbolTableEntrySymbolTableEntry =getSymbolTableEntry(SymbolName);
757LVScope *Function =SymbolTableEntry.Scope;
758if (!Function)
759continue;
760
761LVAddress Addendum =SymbolTableEntry.Address;
762LVSectionIndex SectionIndex =SymbolTableEntry.SectionIndex;
763
764// The given scope represents the function that contains the line numbers.
765// Collect all generated debug lines associated with the function.
766CULines.clear();
767
768// For the given scope, collect all scopes ranges.
769LVRange *ScopesWithRanges =getSectionRanges(SectionIndex);
770 ScopesWithRanges->clear();
771Function->getRanges(*ScopesWithRanges);
772 ScopesWithRanges->sort();
773
774uint16_t Segment =Lines.header()->RelocSegment;
775uint32_t Begin =Lines.header()->RelocOffset;
776uint32_tSize =Lines.header()->CodeSize;
777for (constLineColumnEntry &Block : Lines)
778if (Error Err = createLines(Block.LineNumbers, Addendum, Segment, Begin,
779Size,Block.NameIndex))
780return Err;
781
782// Include lines from any inlined functions within the current function.
783includeInlineeLines(SectionIndex,Function);
784
785if (Error Err =createInstructions(Function, SectionIndex))
786return Err;
787
788processLines(&CULines, SectionIndex,Function);
789 }
790
791returnError::success();
792}
793
794voidLVCodeViewReader::sortScopes() {Root->sort(); }
795
796voidLVCodeViewReader::print(raw_ostream &OS) const{
797LLVM_DEBUG(dbgs() <<"CreateReaders\n");
798}
799
800void LVCodeViewReader::mapRangeAddress(constObjectFile &Obj,
801constSectionRef &Section,
802bool IsComdat) {
803if (!Obj.isCOFF())
804return;
805
806constCOFFObjectFile *Object = cast<COFFObjectFile>(&Obj);
807
808for (constSymbolRef &Sym : Object->symbols()) {
809if (!Section.containsSymbol(Sym))
810continue;
811
812COFFSymbolRef Symbol = Object->getCOFFSymbol(Sym);
813if (Symbol.getComplexType() !=llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION)
814continue;
815
816StringRef SymbolName;
817Expected<StringRef> SymNameOrErr = Object->getSymbolName(Symbol);
818if (!SymNameOrErr) {
819W.startLine() <<"Invalid symbol name: " << Symbol.getSectionNumber()
820 <<"\n";
821consumeError(SymNameOrErr.takeError());
822continue;
823 }
824 SymbolName = *SymNameOrErr;
825
826LLVM_DEBUG({
827Expected<const coff_section *> SectionOrErr =
828 Object->getSection(Symbol.getSectionNumber());
829if (!SectionOrErr) {
830W.startLine() <<"Invalid section number: " << Symbol.getSectionNumber()
831 <<"\n";
832consumeError(SectionOrErr.takeError());
833return;
834 }
835W.printNumber("Section #", Symbol.getSectionNumber());
836W.printString("Name", SymbolName);
837W.printHex("Value", Symbol.getValue());
838 });
839
840// Record the symbol name (linkage) and its loading address.
841addToSymbolTable(SymbolName,Symbol.getValue(),Symbol.getSectionNumber(),
842 IsComdat);
843 }
844}
845
846ErrorLVCodeViewReader::createScopes(COFFObjectFile &Obj) {
847if (Error Err = loadTargetInfo(Obj))
848return Err;
849
850// Initialization required when processing a COFF file:
851// Cache the symbols relocations.
852// Create a mapping for virtual addresses.
853// Get the functions entry points.
854 cacheRelocations();
855mapVirtualAddress(Obj);
856
857for (constSectionRef &Section : Obj.sections()) {
858Expected<StringRef> SectionNameOrErr =Section.getName();
859if (!SectionNameOrErr)
860return SectionNameOrErr.takeError();
861// .debug$T is a standard CodeView type section, while .debug$P is the
862// same format but used for MSVC precompiled header object files.
863if (*SectionNameOrErr ==".debug$T" || *SectionNameOrErr ==".debug$P")
864if (Error Err = traverseTypeSection(*SectionNameOrErr, Section))
865return Err;
866 }
867
868// Process collected namespaces.
869 LogicalVisitor.processNamespaces();
870
871for (constSectionRef &Section : Obj.sections()) {
872Expected<StringRef> SectionNameOrErr =Section.getName();
873if (!SectionNameOrErr)
874return SectionNameOrErr.takeError();
875if (*SectionNameOrErr ==".debug$S")
876if (Error Err = traverseSymbolSection(*SectionNameOrErr, Section))
877return Err;
878 }
879
880// Check if we have to close the Compile Unit scope.
881 LogicalVisitor.closeScope();
882
883// Traverse the strings recorded and transform them into filenames.
884 LogicalVisitor.processFiles();
885
886// Process collected element lines.
887 LogicalVisitor.processLines();
888
889// Translate composite names into a single component.
890Root->transformScopedName();
891returnError::success();
892}
893
894ErrorLVCodeViewReader::createScopes(PDBFile &Pdb) {
895if (Error Err = loadTargetInfo(Pdb))
896return Err;
897
898if (!Pdb.hasPDBTpiStream() || !Pdb.hasPDBDbiStream())
899returnError::success();
900
901// Open the executable associated with the PDB file and get the section
902// addresses used to calculate linear addresses for CodeView Symbols.
903if (!ExePath.empty()) {
904ErrorOr<std::unique_ptr<MemoryBuffer>> BuffOrErr =
905MemoryBuffer::getFileOrSTDIN(ExePath);
906if (BuffOrErr.getError()) {
907returncreateStringError(errc::bad_file_descriptor,
908"File '%s' does not exist.", ExePath.c_str());
909 }
910 BinaryBuffer = std::move(BuffOrErr.get());
911
912// Check if the buffer corresponds to a PECOFF executable.
913assert(identify_magic(BinaryBuffer->getBuffer()) ==
914file_magic::pecoff_executable &&
915"Invalid PECOFF executable file.");
916
917Expected<std::unique_ptr<Binary>> BinOrErr =
918createBinary(BinaryBuffer->getMemBufferRef());
919if (errorToErrorCode(BinOrErr.takeError())) {
920returncreateStringError(errc::not_supported,
921"Binary object format in '%s' is not supported.",
922 ExePath.c_str());
923 }
924 BinaryExecutable = std::move(*BinOrErr);
925if (COFFObjectFile *COFFObject =
926 dyn_cast<COFFObjectFile>(BinaryExecutable.get()))
927mapVirtualAddress(*COFFObject);
928 }
929
930// In order to generate a full logical view, we have to traverse both
931// streams TPI and IPI if they are present. The following table gives
932// the stream where a specified type is located. If the IPI stream is
933// not present, all the types are located in the TPI stream.
934//
935// TPI Stream:
936// LF_POINTER LF_MODIFIER LF_PROCEDURE LF_MFUNCTION
937// LF_LABEL LF_ARGLIST LF_FIELDLIST LF_ARRAY
938// LF_CLASS LF_STRUCTURE LF_INTERFACE LF_UNION
939// LF_ENUM LF_TYPESERVER2 LF_VFTABLE LF_VTSHAPE
940// LF_BITFIELD LF_METHODLIST LF_PRECOMP LF_ENDPRECOMP
941//
942// IPI stream:
943// LF_FUNC_ID LF_MFUNC_ID LF_BUILDINFO
944// LF_SUBSTR_LIST LF_STRING_ID LF_UDT_SRC_LINE
945// LF_UDT_MOD_SRC_LINE
946
947LazyRandomTypeCollection &Types = types();
948LazyRandomTypeCollection &Ids = ids();
949if (Error Err = traverseTypes(Pdb, Types, Ids))
950return Err;
951
952// Process collected namespaces.
953 LogicalVisitor.processNamespaces();
954
955LLVM_DEBUG({W.getOStream() <<"Traversing inlined lines\n"; });
956
957auto VisitInlineeLines = [&](int32_t Modi,constSymbolGroup &SG,
958DebugInlineeLinesSubsectionRef &Lines) ->Error {
959return collectInlineeInfo(Lines, &SG);
960 };
961
962FilterOptions Filters = {};
963LinePrinterPrinter(/*Indent=*/2,false,nulls(), Filters);
964constPrintScope HeaderScope(Printer,/*IndentLevel=*/2);
965if (Error Err = iterateModuleSubsections<DebugInlineeLinesSubsectionRef>(
966 Input, HeaderScope, VisitInlineeLines))
967return Err;
968
969// Traverse global symbols.
970LLVM_DEBUG({W.getOStream() <<"Traversing global symbols\n"; });
971if (Pdb.hasPDBGlobalsStream()) {
972Expected<GlobalsStream &> GlobalsOrErr =Pdb.getPDBGlobalsStream();
973if (!GlobalsOrErr)
974return GlobalsOrErr.takeError();
975GlobalsStream &Globals = *GlobalsOrErr;
976constGSIHashTable &Table = Globals.getGlobalsTable();
977Expected<SymbolStream &> ExpectedSyms =Pdb.getPDBSymbolStream();
978if (ExpectedSyms) {
979
980SymbolVisitorCallbackPipeline Pipeline;
981SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb);
982LVSymbolVisitor Traverser(this,W, &LogicalVisitor, Types, Ids,nullptr,
983 LogicalVisitor.getShared());
984
985// As the global symbols do not have an associated Compile Unit, create
986// one, as the container for all global symbols.
987RecordPrefixPrefix(SymbolKind::S_COMPILE3);
988CVSymbolSymbol(&Prefix,sizeof(Prefix));
989uint32_tOffset = 0;
990if (Error Err = Traverser.visitSymbolBegin(Symbol,Offset))
991consumeError(std::move(Err));
992else {
993// The CodeView compile unit containing the global symbols does not
994// have a name; generate one using its parent name (object filename)
995// follow by the '_global' string.
996 std::stringName(CompileUnit->getParentScope()->getName());
997CompileUnit->setName(Name.append("_global"));
998
999 Pipeline.addCallbackToPipeline(Deserializer);
1000 Pipeline.addCallbackToPipeline(Traverser);
1001CVSymbolVisitor Visitor(Pipeline);
1002
1003BinaryStreamRef SymStream =
1004 ExpectedSyms->getSymbolArray().getUnderlyingStream();
1005for (uint32_t PubSymOff : Table) {
1006Expected<CVSymbol>Sym =readSymbolFromStream(SymStream, PubSymOff);
1007if (Sym) {
1008if (Error Err = Visitor.visitSymbolRecord(*Sym, PubSymOff))
1009returncreateStringError(errorToErrorCode(std::move(Err)),
1010 getFileName());
1011 }else {
1012consumeError(Sym.takeError());
1013 }
1014 }
1015 }
1016
1017 LogicalVisitor.closeScope();
1018 }else {
1019consumeError(ExpectedSyms.takeError());
1020 }
1021 }
1022
1023// Traverse symbols (DBI).
1024LLVM_DEBUG({W.getOStream() <<"Traversing symbol groups\n"; });
1025
1026auto VisitSymbolGroup = [&](uint32_t Modi,constSymbolGroup &SG) ->Error {
1027Expected<ModuleDebugStreamRef> ExpectedModS =
1028getModuleDebugStream(Pdb, Modi);
1029if (ExpectedModS) {
1030ModuleDebugStreamRef &ModS = *ExpectedModS;
1031
1032LLVM_DEBUG({
1033W.getOStream() <<formatv("Traversing Group: Mod {0:4}\n", Modi);
1034 });
1035
1036SymbolVisitorCallbackPipeline Pipeline;
1037SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb);
1038LVSymbolVisitor Traverser(this,W, &LogicalVisitor, Types, Ids,nullptr,
1039 LogicalVisitor.getShared());
1040
1041 Pipeline.addCallbackToPipeline(Deserializer);
1042 Pipeline.addCallbackToPipeline(Traverser);
1043CVSymbolVisitor Visitor(Pipeline);
1044BinarySubstreamRefSS = ModS.getSymbolsSubstream();
1045if (Error Err =
1046 Visitor.visitSymbolStream(ModS.getSymbolArray(),SS.Offset))
1047returncreateStringError(errorToErrorCode(std::move(Err)),
1048 getFileName());
1049 }else {
1050// If the module stream does not exist, it is not an error condition.
1051consumeError(ExpectedModS.takeError());
1052 }
1053
1054returnError::success();
1055 };
1056
1057if (Error Err =iterateSymbolGroups(Input, HeaderScope, VisitSymbolGroup))
1058return Err;
1059
1060// At this stage, the logical view contains all scopes, symbols and types.
1061// For PDBs we can use the module id, to access its specific compile unit.
1062// The line record addresses has been already resolved, so we can apply the
1063// flow as when processing DWARF.
1064
1065LLVM_DEBUG({W.getOStream() <<"Traversing lines\n"; });
1066
1067// Record all line records for a Compile Unit.
1068CULines.clear();
1069
1070auto VisitDebugLines = [this](int32_t Modi,constSymbolGroup &SG,
1071DebugLinesSubsectionRef &Lines) ->Error {
1072if (!options().getPrintLines())
1073returnError::success();
1074
1075uint16_t Segment =Lines.header()->RelocSegment;
1076uint32_t Begin =Lines.header()->RelocOffset;
1077uint32_tSize =Lines.header()->CodeSize;
1078
1079LLVM_DEBUG({W.getOStream() <<formatv("Modi = {0}\n", Modi); });
1080
1081// We have line information for a new module; finish processing the
1082// collected information for the current module. Once it is done, start
1083// recording the line information for the new module.
1084if (CurrentModule != Modi) {
1085if (Error Err = processModule())
1086return Err;
1087CULines.clear();
1088 CurrentModule = Modi;
1089 }
1090
1091for (constLineColumnEntry &Block : Lines)
1092if (Error Err = createLines(Block.LineNumbers,/*Addendum=*/0, Segment,
1093 Begin,Size,Block.NameIndex, &SG))
1094return Err;
1095
1096returnError::success();
1097 };
1098
1099if (Error Err = iterateModuleSubsections<DebugLinesSubsectionRef>(
1100 Input, HeaderScope, VisitDebugLines))
1101return Err;
1102
1103// Check if we have to close the Compile Unit scope.
1104 LogicalVisitor.closeScope();
1105
1106// Process collected element lines.
1107 LogicalVisitor.processLines();
1108
1109// Translate composite names into a single component.
1110Root->transformScopedName();
1111returnError::success();
1112}
1113
1114Error LVCodeViewReader::processModule() {
1115if (LVScope *Scope =getScopeForModule(CurrentModule)) {
1116CompileUnit =static_cast<LVScopeCompileUnit *>(Scope);
1117
1118LLVM_DEBUG({dbgs() <<"Processing Scope: " <<Scope->getName() <<"\n"; });
1119
1120// For the given compile unit, collect all scopes ranges.
1121// For a complete ranges and lines mapping, the logical view support
1122// needs for the compile unit to have a low and high pc values. We
1123// can traverse the 'Modules' section and get the information for the
1124// specific module. Another option, is from all the ranges collected
1125// to take the first and last values.
1126LVSectionIndex SectionIndex =DotTextSectionIndex;
1127LVRange *ScopesWithRanges =getSectionRanges(SectionIndex);
1128 ScopesWithRanges->clear();
1129CompileUnit->getRanges(*ScopesWithRanges);
1130if (!ScopesWithRanges->empty())
1131CompileUnit->addObject(ScopesWithRanges->getLower(),
1132 ScopesWithRanges->getUpper());
1133 ScopesWithRanges->sort();
1134
1135if (Error Err =createInstructions())
1136return Err;
1137
1138// Include lines from any inlined functions within the current function.
1139includeInlineeLines(SectionIndex, Scope);
1140
1141processLines(&CULines, SectionIndex,nullptr);
1142 }
1143
1144returnError::success();
1145}
1146
1147// In order to create the scopes, the CodeView Reader will:
1148// = Traverse the TPI/IPI stream (Type visitor):
1149// Collect forward references, scoped names, type indexes that will represent
1150// a logical element, strings, line records, linkage names.
1151// = Traverse the symbols section (Symbol visitor):
1152// Create the scopes tree and creates the required logical elements, by
1153// using the collected indexes from the type visitor.
1154ErrorLVCodeViewReader::createScopes() {
1155LLVM_DEBUG({
1156W.startLine() <<"\n";
1157W.printString("File", getFileName().str());
1158W.printString("Exe", ExePath);
1159W.printString("Format",FileFormatName);
1160 });
1161
1162if (Error Err =LVReader::createScopes())
1163return Err;
1164
1165 LogicalVisitor.setRoot(Root);
1166
1167if (isObj()) {
1168if (Error Err =createScopes(getObj()))
1169return Err;
1170 }else {
1171if (Error Err =createScopes(getPdb()))
1172return Err;
1173 }
1174
1175returnError::success();
1176}
1177
1178Error LVCodeViewReader::loadTargetInfo(constObjectFile &Obj) {
1179// Detect the architecture from the object file. We usually don't need OS
1180// info to lookup a target and create register info.
1181Triple TT;
1182 TT.setArch(Triple::ArchType(Obj.getArch()));
1183 TT.setVendor(Triple::UnknownVendor);
1184 TT.setOS(Triple::UnknownOS);
1185
1186// Features to be passed to target/subtarget
1187Expected<SubtargetFeatures> Features = Obj.getFeatures();
1188SubtargetFeatures FeaturesValue;
1189if (!Features) {
1190consumeError(Features.takeError());
1191 FeaturesValue =SubtargetFeatures();
1192 }
1193 FeaturesValue = *Features;
1194returnloadGenericTargetInfo(TT.str(), FeaturesValue.getString());
1195}
1196
1197Error LVCodeViewReader::loadTargetInfo(constPDBFile &Pdb) {
1198Triple TT;
1199 TT.setArch(Triple::ArchType::x86_64);
1200 TT.setVendor(Triple::UnknownVendor);
1201 TT.setOS(Triple::Win32);
1202
1203StringRef TheFeature ="";
1204
1205returnloadGenericTargetInfo(TT.str(), TheFeature);
1206}
1207
1208std::stringLVCodeViewReader::getRegisterName(LVSmall Opcode,
1209ArrayRef<uint64_t>Operands) {
1210// Get Compilation Unit CPU Type.
1211CPUType CPU =getCompileUnitCPUType();
1212// For CodeView the register always is in Operands[0];
1213RegisterIdRegister = (RegisterId(Operands[0]));
1214returnformatRegisterId(Register, CPU);
1215}
sections
bbsections Prepares for basic block sections
Definition:BasicBlockSections.cpp:139
CVSymbolVisitor.h
CVTypeVisitor.h
Printer
dxil pretty DXIL Metadata Pretty Printer
Definition:DXILPrettyPrinter.cpp:305
DbiStream.h
LLVM_DEBUG
#define LLVM_DEBUG(...)
Definition:Debug.h:106
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
End
bool End
Definition:ELF_riscv.cpp:480
Sym
Symbol * Sym
Definition:ELF_riscv.cpp:479
Errc.h
FormatAdapters.h
FormatVariadic.h
GlobalsStream.h
InfoStream.h
LVCodeViewReader.h
LVLine.h
LVScope.h
LazyRandomTypeCollection.h
LinePrinter.h
Find
static const T * Find(StringRef S, ArrayRef< T > A)
Find KV in array using binary search.
Definition:MCSubtargetInfo.cpp:26
Operands
mir Rename Register Operands
Definition:MIRNamerPass.cpp:74
COFF.h
PDBFile.h
if
if(PassOpts->AAPipeline)
Definition:PassBuilderBindings.cpp:64
RawConstants.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OS
raw_pwrite_stream & OS
Definition:SampleProfWriter.cpp:51
SymbolDeserializer.h
getSectionID
static unsigned getSectionID(const ObjectFile &O, SectionRef Sec)
Definition:SymbolSize.cpp:29
SymbolStream.h
SymbolVisitorCallbackPipeline.h
TpiStream.h
WithColor.h
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition:BinaryStreamReader.h:29
llvm::BinaryStreamReader::getLength
uint64_t getLength() const
Definition:BinaryStreamReader.h:247
llvm::BinaryStreamReader::readInteger
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
Definition:BinaryStreamReader.h:67
llvm::BinaryStreamReader::bytesRemaining
uint64_t bytesRemaining() const
Definition:BinaryStreamReader.h:248
llvm::BinaryStreamReader::readFixedString
Error readFixedString(StringRef &Dest, uint32_t Length)
Read a Length byte string into Dest.
Definition:BinaryStreamReader.cpp:121
llvm::BinaryStreamReader::readArray
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
Definition:BinaryStreamReader.h:178
llvm::BinaryStreamReader::skip
Error skip(uint64_t Amount)
Advance the stream's offset by Amount bytes.
Definition:BinaryStreamReader.cpp:147
llvm::BinaryStreamRef
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Definition:BinaryStreamRef.h:154
llvm::DenseMap< uint64_t, uint64_t >
llvm::ErrorOr
Represents either an error or a value T.
Definition:ErrorOr.h:56
llvm::ErrorOr::get
reference get()
Definition:ErrorOr.h:149
llvm::ErrorOr::getError
std::error_code getError() const
Definition:ErrorOr.h:152
llvm::ErrorSuccess
Subclass of Error for the sole purpose of identifying the success path in the type system.
Definition:Error.h:335
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:Error.h:160
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition:Error.h:337
llvm::Expected
Tagged union holding either a T or a Error.
Definition:Error.h:481
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition:Error.h:608
llvm::Expected::get
reference get()
Returns a reference to the stored T value.
Definition:Error.h:578
llvm::FixedStreamArray
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
Definition:BinaryStreamArray.h:259
llvm::Function
Definition:Function.h:63
llvm::MemoryBuffer::getFileOrSTDIN
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
Definition:MemoryBuffer.cpp:163
llvm::MemoryBuffer::getFile
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
Definition:MemoryBuffer.cpp:260
llvm::Pattern
Definition:FileCheckImpl.h:565
llvm::Register
Wrapper class representing virtual and physical registers.
Definition:Register.h:19
llvm::ScopedPrinter::flush
void flush()
Definition:ScopedPrinter.h:119
llvm::ScopedPrinter::printString
virtual void printString(StringRef Value)
Definition:ScopedPrinter.h:361
llvm::ScopedPrinter::getOStream
virtual raw_ostream & getOStream()
Definition:ScopedPrinter.h:433
llvm::ScopedPrinter::startLine
virtual raw_ostream & startLine()
Definition:ScopedPrinter.h:428
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, char Value)
Definition:ScopedPrinter.h:201
llvm::ScopedPrinter::printHex
void printHex(StringRef Label, T Value)
Definition:ScopedPrinter.h:348
llvm::ScopedPrinter::printSymbolOffset
void printSymbolOffset(StringRef Label, StringRef Symbol, T Value)
Definition:ScopedPrinter.h:357
llvm::SmallString
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition:SmallString.h:26
llvm::SmallVectorImpl::clear
void clear()
Definition:SmallVector.h:610
llvm::SmallVectorTemplateBase::push_back
void push_back(const T &Elt)
Definition:SmallVector.h:413
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition:StringMap.h:128
llvm::StringMap::count
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition:StringMap.h:276
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StringRef::str
std::string str() const
str - Get the contents as an std::string.
Definition:StringRef.h:229
llvm::StringRef::bytes_end
const unsigned char * bytes_end() const
Definition:StringRef.h:131
llvm::StringRef::drop_front
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
Definition:StringRef.h:609
llvm::StringRef::size
constexpr size_t size() const
size - Get the string size.
Definition:StringRef.h:150
llvm::StringRef::data
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition:StringRef.h:144
llvm::StringRef::bytes_begin
const unsigned char * bytes_begin() const
Definition:StringRef.h:128
llvm::SubtargetFeatures
Manages the enabling and disabling of subtarget specific features.
Definition:SubtargetFeature.h:174
llvm::SubtargetFeatures::getString
std::string getString() const
Returns features as a string.
Definition:SubtargetFeature.cpp:54
llvm::SymbolTableEntry
Symbol info for RuntimeDyld.
Definition:RuntimeDyldImpl.h:218
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition:Triple.h:44
llvm::Triple::UnknownOS
@ UnknownOS
Definition:Triple.h:200
llvm::Triple::Win32
@ Win32
Definition:Triple.h:215
llvm::Triple::ArchType
ArchType
Definition:Triple.h:46
llvm::Triple::x86_64
@ x86_64
Definition:Triple.h:86
llvm::Triple::UnknownVendor
@ UnknownVendor
Definition:Triple.h:181
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::VarStreamArrayIterator
VarStreamArray represents an array of variable length records backed by a stream.
Definition:BinaryStreamArray.h:158
llvm::VarStreamArray< CVType >
llvm::VarStreamArray::setUnderlyingStream
void setUnderlyingStream(BinaryStreamRef NewStream, uint32_t NewSkew=0)
Definition:BinaryStreamArray.h:142
llvm::VarStreamArray::at
Iterator at(uint32_t Offset) const
given an offset into the array's underlying stream, return an iterator to the record at that offset.
Definition:BinaryStreamArray.h:134
llvm::VarStreamArray::begin
Iterator begin(bool *HadError=nullptr) const
Definition:BinaryStreamArray.h:108
llvm::codeview::CVRecord< TypeLeafKind >
llvm::codeview::CVSymbolVisitor
Definition:CVSymbolVisitor.h:19
llvm::codeview::DebugChecksumsSubsectionRef::initialize
Error initialize(BinaryStreamReader Reader)
Definition:DebugChecksumsSubsection.cpp:51
llvm::codeview::DebugChecksumsSubsectionRef::end
Iterator end() const
Definition:DebugChecksumsSubsection.h:69
llvm::codeview::DebugChecksumsSubsectionRef::valid
bool valid() const
Definition:DebugChecksumsSubsection.h:63
llvm::codeview::DebugChecksumsSubsectionRef::getArray
const FileChecksumArray & getArray() const
Definition:DebugChecksumsSubsection.h:71
llvm::codeview::DebugInlineeLinesSubsectionRef
Definition:DebugInlineeLinesSubsection.h:60
llvm::codeview::DebugLinesSubsectionRef
Definition:DebugLinesSubsection.h:79
llvm::codeview::DebugStringTableSubsectionRef::valid
bool valid() const
Definition:DebugStringTableSubsection.h:44
llvm::codeview::DebugStringTableSubsectionRef::getString
Expected< StringRef > getString(uint32_t Offset) const
Definition:DebugStringTableSubsection.cpp:34
llvm::codeview::DebugStringTableSubsectionRef::initialize
Error initialize(BinaryStreamRef Contents)
Definition:DebugStringTableSubsection.cpp:24
llvm::codeview::EndPrecompRecord
Definition:TypeRecord.h:945
llvm::codeview::EndPrecompRecord::getSignature
uint32_t getSignature() const
Definition:TypeRecord.h:950
llvm::codeview::LazyRandomTypeCollection
Provides amortized O(1) random access to a CodeView type stream.
Definition:LazyRandomTypeCollection.h:48
llvm::codeview::LineInfo
Definition:Line.h:20
llvm::codeview::Line
Definition:Line.h:90
llvm::codeview::PrecompRecord
Definition:TypeRecord.h:928
llvm::codeview::PrecompRecord::getSignature
uint32_t getSignature() const
Definition:TypeRecord.h:935
llvm::codeview::PrecompRecord::getPrecompFilePath
StringRef getPrecompFilePath() const
Definition:TypeRecord.h:936
llvm::codeview::PrecompRecord::getTypesCount
uint32_t getTypesCount() const
Definition:TypeRecord.h:934
llvm::codeview::SymbolDeserializer
Definition:SymbolDeserializer.h:24
llvm::codeview::SymbolVisitorCallbackPipeline
Definition:SymbolVisitorCallbackPipeline.h:20
llvm::codeview::SymbolVisitorCallbackPipeline::addCallbackToPipeline
void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks)
Definition:SymbolVisitorCallbackPipeline.h:56
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition:TypeIndex.h:96
llvm::codeview::TypeServer2Record
Definition:TypeRecord.h:575
llvm::codeview::TypeServer2Record::getName
StringRef getName() const
Definition:TypeRecord.h:587
llvm::codeview::TypeServer2Record::getGuid
const GUID & getGuid() const
Definition:TypeRecord.h:585
llvm::codeview::TypeServer2Record::getAge
uint32_t getAge() const
Definition:TypeRecord.h:586
llvm::dwarf_linker::classic::CompileUnit
Stores all information relating to a compile unit, be it in its original instance in the object file ...
Definition:DWARFLinkerCompileUnit.h:63
llvm::logicalview::LVBinaryReader::getSymbolTableEntry
const LVSymbolTableEntry & getSymbolTableEntry(StringRef Name)
Definition:LVBinaryReader.cpp:134
llvm::logicalview::LVBinaryReader::includeInlineeLines
void includeInlineeLines(LVSectionIndex SectionIndex, LVScope *Function)
Definition:LVBinaryReader.cpp:893
llvm::logicalview::LVBinaryReader::linearAddress
LVAddress linearAddress(uint16_t Segment, uint32_t Offset, LVAddress Addendum=0)
Definition:LVBinaryReader.h:212
llvm::logicalview::LVBinaryReader::CULines
LVLines CULines
Definition:LVBinaryReader.h:115
llvm::logicalview::LVBinaryReader::addToSymbolTable
void addToSymbolTable(StringRef Name, LVScope *Function, LVSectionIndex SectionIndex=0)
Definition:LVBinaryReader.cpp:121
llvm::logicalview::LVBinaryReader::processLines
void processLines(LVLines *DebugLines, LVSectionIndex SectionIndex)
Definition:LVBinaryReader.cpp:789
llvm::logicalview::LVBinaryReader::mapVirtualAddress
void mapVirtualAddress(const object::ObjectFile &Obj)
Definition:LVBinaryReader.cpp:147
llvm::logicalview::LVBinaryReader::getSectionRanges
LVRange * getSectionRanges(LVSectionIndex SectionIndex)
Definition:LVBinaryReader.cpp:383
llvm::logicalview::LVBinaryReader::loadGenericTargetInfo
Error loadGenericTargetInfo(StringRef TheTriple, StringRef TheFeatures)
Definition:LVBinaryReader.cpp:277
llvm::logicalview::LVBinaryReader::createInstructions
Error createInstructions()
Definition:LVBinaryReader.cpp:541
llvm::logicalview::LVCodeViewReader::getLinkageName
void getLinkageName(const llvm::object::coff_section *CoffSection, uint32_t RelocOffset, uint32_t Offset, StringRef *RelocSym)
Definition:LVCodeViewReader.cpp:113
llvm::logicalview::LVCodeViewReader::print
void print(raw_ostream &OS) const
Definition:LVCodeViewReader.cpp:796
llvm::logicalview::LVCodeViewReader::formatRegisterId
static std::string formatRegisterId(RegisterId Register, CPUType CPU)
Definition:LVCodeViewReader.cpp:57
llvm::logicalview::LVCodeViewReader::getRegisterName
std::string getRegisterName(LVSmall Opcode, ArrayRef< uint64_t > Operands) override
Definition:LVCodeViewReader.cpp:1208
llvm::logicalview::LVCodeViewReader::getScopeForModule
LVScope * getScopeForModule(uint32_t Modi)
Definition:LVCodeViewReader.h:210
llvm::logicalview::LVCodeViewReader::createScopes
Error createScopes() override
Definition:LVCodeViewReader.cpp:1154
llvm::logicalview::LVCodeViewReader::getSymbolKindName
static StringRef getSymbolKindName(SymbolKind Kind)
Definition:LVCodeViewReader.cpp:45
llvm::logicalview::LVCodeViewReader::isSystemEntry
bool isSystemEntry(LVElement *Element, StringRef Name) const override
Definition:LVCodeViewReader.cpp:213
llvm::logicalview::LVCodeViewReader::sortScopes
void sortScopes() override
Definition:LVCodeViewReader.cpp:794
llvm::logicalview::LVElement
Definition:LVElement.h:67
llvm::logicalview::LVElement::getName
StringRef getName() const override
Definition:LVElement.h:184
llvm::logicalview::LVLineDebug
Definition:LVLine.h:114
llvm::logicalview::LVLogicalVisitor::addInlineeInfo
void addInlineeInfo(TypeIndex TI, uint32_t LineNumber, StringRef Filename)
Definition:LVCodeViewVisitor.h:302
llvm::logicalview::LVLogicalVisitor::closeScope
void closeScope()
Definition:LVCodeViewVisitor.h:331
llvm::logicalview::LVLogicalVisitor::printTypeIndex
void printTypeIndex(StringRef FieldName, TypeIndex TI, uint32_t StreamIdx)
Definition:LVCodeViewVisitor.cpp:1738
llvm::logicalview::LVLogicalVisitor::setRoot
void setRoot(LVScope *Root)
Definition:LVCodeViewVisitor.h:337
llvm::logicalview::LVLogicalVisitor::processNamespaces
void processNamespaces()
Definition:LVCodeViewVisitor.cpp:3383
llvm::logicalview::LVLogicalVisitor::getShared
LVShared * getShared()
Definition:LVCodeViewVisitor.h:350
llvm::logicalview::LVLogicalVisitor::setInput
void setInput(std::shared_ptr< llvm::pdb::InputFile > TypeServer)
Definition:LVCodeViewVisitor.h:295
llvm::logicalview::LVLogicalVisitor::processLines
void processLines()
Definition:LVCodeViewVisitor.cpp:3354
llvm::logicalview::LVLogicalVisitor::processFiles
void processFiles()
Definition:LVCodeViewVisitor.cpp:3388
llvm::logicalview::LVRange
Definition:LVRange.h:49
llvm::logicalview::LVRange::clear
void clear()
Definition:LVRange.h:76
llvm::logicalview::LVRange::empty
bool empty() const
Definition:LVRange.h:81
llvm::logicalview::LVRange::sort
void sort()
Definition:LVRange.cpp:127
llvm::logicalview::LVRange::getLower
LVAddress getLower() const
Definition:LVRange.h:71
llvm::logicalview::LVRange::getUpper
LVAddress getUpper() const
Definition:LVRange.h:72
llvm::logicalview::LVReader::W
ScopedPrinter & W
Definition:LVReader.h:128
llvm::logicalview::LVReader::FileFormatName
std::string FileFormatName
Definition:LVReader.h:127
llvm::logicalview::LVReader::getCompileUnitCPUType
codeview::CPUType getCompileUnitCPUType()
Definition:LVReader.h:254
llvm::logicalview::LVReader::createAlternativePath
std::string createAlternativePath(StringRef From)
Definition:LVReader.h:155
llvm::logicalview::LVReader::DotTextSectionIndex
LVSectionIndex DotTextSectionIndex
Definition:LVReader.h:133
llvm::logicalview::LVReader::Root
LVScopeRoot * Root
Definition:LVReader.h:125
llvm::logicalview::LVReader::createScopes
virtual Error createScopes()
Definition:LVReader.h:141
llvm::logicalview::LVScopeCompileUnit
Definition:LVScope.h:397
llvm::logicalview::LVScopeRoot::transformScopedName
void transformScopedName()
Definition:LVScope.cpp:2020
llvm::logicalview::LVScope
Definition:LVScope.h:73
llvm::logicalview::LVScope::sort
void sort()
Definition:LVScope.cpp:674
llvm::logicalview::LVSymbolVisitorDelegate
Definition:LVCodeViewVisitor.h:85
llvm::logicalview::LVSymbolVisitor
Definition:LVCodeViewVisitor.h:124
llvm::logicalview::LVTypeVisitor
Definition:LVCodeViewVisitor.h:39
llvm::object::Binary
Definition:Binary.h:32
llvm::object::Binary::isCOFF
bool isCOFF() const
Definition:Binary.h:131
llvm::object::COFFObjectFile
Definition:COFF.h:879
llvm::object::COFFObjectFile::symbol_end
basic_symbol_iterator symbol_end() const override
Definition:COFFObjectFile.cpp:1035
llvm::object::COFFObjectFile::getCOFFSection
const coff_section * getCOFFSection(const SectionRef &Section) const
Definition:COFFObjectFile.cpp:1350
llvm::object::COFFSymbolRef
Definition:COFF.h:284
llvm::object::ObjectFile
This class is the base class for all object file types.
Definition:ObjectFile.h:229
llvm::object::ObjectFile::getFeatures
virtual Expected< SubtargetFeatures > getFeatures() const =0
llvm::object::ObjectFile::sections
section_iterator_range sections() const
Definition:ObjectFile.h:329
llvm::object::ObjectFile::getArch
virtual Triple::ArchType getArch() const =0
llvm::object::RelocationRef
This is a value type class that represents a single relocation in the list of relocations in the obje...
Definition:ObjectFile.h:52
llvm::object::SectionRef
This is a value type class that represents a single section in the list of sections in the object fil...
Definition:ObjectFile.h:81
llvm::object::SymbolRef
This is a value type class that represents a single symbol in the list of symbols in the object file.
Definition:ObjectFile.h:168
llvm::object::content_iterator
Definition:SymbolicFile.h:69
llvm::pdb::GSIHashTable
A readonly view of a hash table used in the globals and publics streams.
Definition:GlobalsStream.h:50
llvm::pdb::GlobalsStream
Definition:GlobalsStream.h:70
llvm::pdb::GlobalsStream::getGlobalsTable
const GSIHashTable & getGlobalsTable() const
Definition:GlobalsStream.h:74
llvm::pdb::LinePrinter
Definition:LinePrinter.h:50
llvm::pdb::ModuleDebugStreamRef
Definition:ModuleDebugStream.h:31
llvm::pdb::ModuleDebugStreamRef::getSymbolsSubstream
BinarySubstreamRef getSymbolsSubstream() const
Definition:ModuleDebugStream.cpp:93
llvm::pdb::ModuleDebugStreamRef::getSymbolArray
const codeview::CVSymbolArray & getSymbolArray() const
Definition:ModuleDebugStream.h:48
llvm::pdb::NativeSession
Definition:NativeSession.h:32
llvm::pdb::PDBFile
Definition:PDBFile.h:40
llvm::pdb::SymbolGroup
Definition:InputFile.h:90
llvm::pdb::SymbolGroup::getNameFromChecksums
Expected< StringRef > getNameFromChecksums(uint32_t Offset) const
Definition:InputFile.cpp:239
llvm::pdb::TpiStream
Definition:TpiStream.h:34
llvm::pdb::TpiStream::buildHashMap
void buildHashMap()
Definition:TpiStream.cpp:143
llvm::pdb::TpiStream::getNumTypeRecords
uint32_t getNumTypeRecords() const
Definition:TpiStream.cpp:128
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:raw_ostream.h:52
uint16_t
uint32_t
uint64_t
uint8_t
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
Error.h
llvm::AMDGPU::HSAMD::Kernel::Key::SymbolName
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
Definition:AMDGPUMetadata.h:387
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition:ARMBuildAttributes.h:82
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition:ARMBuildAttributes.h:83
llvm::ARM_MB::ST
@ ST
Definition:ARMBaseInfo.h:73
llvm::COFF::DEBUG_SECTION_MAGIC
@ DEBUG_SECTION_MAGIC
Definition:COFF.h:821
llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION
@ IMAGE_SYM_DTYPE_FUNCTION
A function that returns a base type.
Definition:COFF.h:275
llvm::M68k::MemAddrModeKind::L
@ L
llvm::RISCVFenceField::R
@ R
Definition:RISCVBaseInfo.h:373
llvm::X86AS::SS
@ SS
Definition:X86.h:212
llvm::cl::Prefix
@ Prefix
Definition:CommandLine.h:158
llvm::codeview
Definition:AppendingTypeTableBuilder.h:22
llvm::codeview::DebugSubsectionKind
DebugSubsectionKind
Definition:CodeView.h:322
llvm::codeview::DebugSubsectionKind::Lines
@ Lines
llvm::codeview::InlineeLinesSignature::ExtraFiles
@ ExtraFiles
llvm::codeview::RegisterId
RegisterId
Definition:CodeView.h:529
llvm::codeview::CPUType
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
Definition:CodeView.h:76
llvm::codeview::visitTypeStream
Error visitTypeStream(const CVTypeArray &Types, TypeVisitorCallbacks &Callbacks, VisitorDataSource Source=VDS_BytesPresent)
Definition:CVTypeVisitor.cpp:233
llvm::codeview::SymbolKind
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
Definition:CodeView.h:48
llvm::codeview::D
@ D
The DMD compiler emits 'D' for the CV source language.
Definition:CodeView.h:173
llvm::codeview::CodeViewContainer::Pdb
@ Pdb
llvm::codeview::readSymbolFromStream
Expected< CVSymbol > readSymbolFromStream(BinaryStreamRef Stream, uint32_t Offset)
Definition:RecordSerialization.cpp:151
llvm::jitlink::Scope
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface o...
Definition:JITLink.h:412
llvm::logicalview
Definition:LVCompare.h:20
llvm::logicalview::LVCompareKind::Types
@ Types
llvm::logicalview::LVAttributeKind::Filename
@ Filename
llvm::logicalview::LVAttributeKind::Offset
@ Offset
llvm::logicalview::options
LVOptions & options()
Definition:LVOptions.h:445
llvm::logicalview::LVSortMode::Name
@ Name
llvm::msf
Definition:IMSFFile.h:18
llvm::msf::Magic
static const char Magic[]
Definition:MSFCommon.h:23
llvm::object
Definition:DWARFDebugLoc.h:24
llvm::object::Kind
Kind
Definition:COFFModuleDefinition.cpp:31
llvm::object::createBinary
Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr, bool InitContent=true)
Create a Binary from Source, autodetecting the file type.
Definition:Binary.cpp:45
llvm::pdb
Definition:LVCodeViewReader.h:44
llvm::pdb::PDB_TableType::LineNumbers
@ LineNumbers
llvm::pdb::SpecialStream
SpecialStream
Definition:RawConstants.h:72
llvm::pdb::StreamTPI
@ StreamTPI
Definition:RawConstants.h:79
llvm::pdb::StreamIPI
@ StreamIPI
Definition:RawConstants.h:81
llvm::pdb::PDB_SymType::Label
@ Label
llvm::pdb::getModuleDebugStream
Expected< ModuleDebugStreamRef > getModuleDebugStream(PDBFile &File, StringRef &ModuleName, uint32_t Index)
Definition:InputFile.cpp:39
llvm::pdb::loadDataForPDB
Error loadDataForPDB(PDB_ReaderType Type, StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition:PDB.cpp:22
llvm::pdb::iterateSymbolGroups
Error iterateSymbolGroups(InputFile &Input, const PrintScope &HeaderScope, CallbackT Callback)
Definition:InputFile.h:177
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::identify_magic
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
Definition:Magic.cpp:33
llvm::PseudoProbeType::Block
@ Block
llvm::AlignStyle::Right
@ Right
llvm::inconvertibleErrorCode
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition:Error.cpp:98
llvm::createStringError
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition:Error.h:1291
llvm::errc::bad_file_descriptor
@ bad_file_descriptor
llvm::errc::not_supported
@ not_supported
llvm::errc::invalid_argument
@ invalid_argument
llvm::AtomicOrderingCABI::consume
@ consume
llvm::formatv
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
Definition:FormatVariadic.h:252
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition:STLExtras.h:1664
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition:Debug.cpp:163
llvm::nulls
raw_ostream & nulls()
This returns a reference to a raw_ostream which simply discards output.
Definition:raw_ostream.cpp:918
llvm::CaptureComponents::Address
@ Address
llvm::cantFail
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition:Error.h:756
llvm::alignTo
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition:Alignment.h:155
llvm::fmt_align
support::detail::AlignAdapter< T > fmt_align(T &&Item, AlignStyle Where, size_t Amount, char Fill=' ')
Definition:FormatAdapters.h:89
llvm::HighlightColor::String
@ String
llvm::errorCodeToError
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Definition:Error.cpp:111
llvm::endianness::little
@ little
llvm::Data
@ Data
Definition:SIMachineScheduler.h:55
llvm::errorToErrorCode
std::error_code errorToErrorCode(Error Err)
Helper for converting an ECError to a std::error_code.
Definition:Error.cpp:117
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition:Error.h:1069
FilterOptions
Definition:LinePrinter.h:24
llvm::BinarySubstreamRef
Definition:BinaryStreamRef.h:196
llvm::DictScope
Definition:ScopedPrinter.h:849
llvm::ListScope
Definition:ScopedPrinter.h:868
llvm::SectionName
Definition:DWARFSection.h:21
llvm::codeview::InlineeSourceLine
Definition:DebugInlineeLinesSubsection.h:44
llvm::codeview::LineColumnEntry
Definition:DebugLinesSubsection.h:65
llvm::codeview::LineNumberEntry
Definition:DebugLinesSubsection.h:54
llvm::codeview::RecordPrefix
Definition:RecordSerialization.h:32
llvm::file_magic::pdb
@ pdb
Windows PDB debug info file.
Definition:Magic.h:54
llvm::file_magic::pecoff_executable
@ pecoff_executable
PECOFF executable file.
Definition:Magic.h:49
llvm::logicalview::LVSymbolTableEntry
Definition:LVBinaryReader.h:36
llvm::object::coff_section
Definition:COFF.h:448
llvm::pdb::PrintScope
Definition:LinePrinter.h:117
llvm::pdb::SectionOffset
Definition:RawTypes.h:19

Generated on Fri Jul 18 2025 11:13:44 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp