1//===-- LVBinaryReader.cpp ------------------------------------------------===//
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
7//===----------------------------------------------------------------------===//
9// This implements the LVBinaryReader class.
11//===----------------------------------------------------------------------===//
21 #define DEBUG_TYPE "BinaryReader"
23// Function names extracted from the object symbol table.
26 std::string SymbolName(
Name);
28 SymbolNames.try_emplace(SymbolName,
Function, 0, SectionIndex,
false);
30 // Update a recorded entry with its logical scope and section index.
33 It->second.SectionIndex = SectionIndex;
44 std::string SymbolName(
Name);
45 auto [It,
Inserted] = SymbolNames.try_emplace(SymbolName,
nullptr,
Address,
46 SectionIndex, IsComdat);
48 // Update a recorded symbol name with its logical scope.
62 std::string SymbolName(
Name);
64 if (SymbolName.empty())
67 auto It = SymbolNames.find(SymbolName);
68 if (It == SymbolNames.end())
71 // Update a recorded entry with its logical scope, only if the scope has
72 // ranges. That is the case when in DWARF there are 2 DIEs connected via
73 // the DW_AT_specification.
76 SectionIndex = It->second.SectionIndex;
81 if (It->second.IsComdat)
90 LVSymbolNames::iterator Iter = SymbolNames.find(
Name);
91 return Iter != SymbolNames.end() ? Iter->second :
Empty;
94 LVSymbolNames::iterator Iter = SymbolNames.find(
Name);
95 return Iter != SymbolNames.end() ? Iter->second.Address : 0;
98 LVSymbolNames::iterator Iter = SymbolNames.find(
Name);
99 return Iter != SymbolNames.end() ? Iter->second.SectionIndex
103 LVSymbolNames::iterator Iter = SymbolNames.find(
Name);
104 return Iter != SymbolNames.end() ? Iter->second.IsComdat :
false;
108 OS <<
"Symbol Table\n";
109 for (LVSymbolNames::reference Entry : SymbolNames) {
111 LVScope *Scope = SymbolName.Scope;
113 OS <<
"Index: " <<
hexValue(SymbolName.SectionIndex, 5)
114 <<
" Comdat: " << (SymbolName.IsComdat ?
"Y" :
"N")
116 <<
" Address: " <<
hexValue(SymbolName.Address)
117 <<
" Name: " << Entry.first <<
"\n";
128 SymbolTable.add(
Name,
Address, SectionIndex, IsComdat);
131 return SymbolTable.update(
Function);
135 return SymbolTable.getEntry(
Name);
138 return SymbolTable.getAddress(
Name);
141 return SymbolTable.getIndex(
Name);
144 return SymbolTable.getIsComdat(
Name);
152 if (!SectionNameOrErr)
155 Name = *SectionNameOrErr;
157 <<
"Address: " <<
hexValue(Section.getAddress()) <<
", "
158 <<
"Size: " <<
hexValue(Section.getSize()) <<
", "
159 <<
"Name: " <<
Name <<
"\n";
160 dbgs() <<
"isCompressed: " << Section.isCompressed() <<
", "
161 <<
"isText: " << Section.isText() <<
", "
162 <<
"isData: " << Section.isData() <<
", "
163 <<
"isBSS: " << Section.isBSS() <<
", "
164 <<
"isVirtual: " << Section.isVirtual() <<
"\n";
165 dbgs() <<
"isBitcode: " << Section.isBitcode() <<
", "
166 <<
"isStripped: " << Section.isStripped() <<
", "
167 <<
"isBerkeleyText: " << Section.isBerkeleyText() <<
", "
168 <<
"isBerkeleyData: " << Section.isBerkeleyData() <<
", "
169 <<
"isDebugSection: " << Section.isDebugSection() <<
"\n";
173 if (!Section.isText() || Section.isVirtual() || !Section.getSize())
176 // Record section information required for symbol resolution.
177 // Note: The section index returned by 'getIndex()' is one based.
178 Sections.emplace(Section.getIndex(), Section);
179 addSectionAddress(Section);
181 // Identify the ".text" section.
183 if (!SectionNameOrErr) {
187 if (*SectionNameOrErr ==
".text" || *SectionNameOrErr ==
"CODE" ||
188 *SectionNameOrErr ==
".code") {
190 // If the object is WebAssembly, update the address offset that
191 // will be added to DWARF DW_AT_* attributes.
197 // Process the symbol table.
201 dbgs() <<
"\nSections Information:\n";
202 for (LVSections::reference Entry : Sections) {
206 if (!SectionNameOrErr)
209 <<
" Name: " << *SectionNameOrErr <<
"\n"
210 <<
"Size: " <<
hexValue(Section.getSize()) <<
"\n"
211 <<
"VirtualAddress: " <<
hexValue(VirtualAddress) <<
"\n"
212 <<
"SectionAddress: " <<
hexValue(Section.getAddress()) <<
"\n";
214 dbgs() <<
"\nObject Section Information:\n";
215 for (LVSectionAddresses::const_reference Entry : SectionAddresses)
217 <<
hexValue(Entry.first + Entry.second.getSize())
218 <<
"] Size: " <<
hexValue(Entry.second.getSize()) <<
"\n";
225 ImageBaseAddress = ImageBase.
get();
228 dbgs() <<
"ImageBaseAddress: " <<
hexValue(ImageBaseAddress) <<
"\n";
234 if (!Section.isText() || Section.isVirtual() || !Section.getSize())
239 bool IsComdat = (COFFSection->Characteristics & Flags) == Flags;
241 // Record section information required for symbol resolution.
242 // Note: The section index returned by 'getIndex()' is zero based.
243 Sections.emplace(Section.getIndex() + 1, Section);
244 addSectionAddress(Section);
246 // Additional initialization on the specific object format.
251 dbgs() <<
"\nSections Information:\n";
252 for (LVSections::reference Entry : Sections) {
257 if (!SectionNameOrErr)
260 <<
" Name: " << *SectionNameOrErr <<
"\n"
261 <<
"Size: " <<
hexValue(Section.getSize()) <<
"\n"
262 <<
"VirtualAddress: " <<
hexValue(VirtualAddress) <<
"\n"
263 <<
"SectionAddress: " <<
hexValue(Section.getAddress()) <<
"\n"
264 <<
"PointerToRawData: " <<
hexValue(COFFSection->PointerToRawData)
266 <<
"SizeOfRawData: " <<
hexValue(COFFSection->SizeOfRawData)
269 dbgs() <<
"\nObject Section Information:\n";
270 for (LVSectionAddresses::const_reference Entry : SectionAddresses)
272 <<
hexValue(Entry.first + Entry.second.getSize())
273 <<
"] Size: " <<
hexValue(Entry.second.getSize()) <<
"\n";
280 Triple TheTriple(TripleName);
281 std::string TargetLookupError;
287 // Register information.
291 "no register info for target " + TripleName);
292 MRI.reset(RegisterInfo);
294 // Assembler properties and features.
299 "no assembly info for target " + TripleName);
302 // Target subtargets.
307 "no subtarget info for target " + TripleName);
308 STI.reset(SubtargetInfo);
310 // Instructions Info.
312 if (!InstructionInfo)
314 "no instruction info for target " + TripleName);
315 MII.reset(InstructionInfo);
317 MC = std::make_unique<MCContext>(
Triple(TheTriple),
MAI.get(),
MRI.get(),
324 "no disassembler for target " + TripleName);
329 if (!InstructionPrinter)
331 "no target assembly language printer for target " +
333 MIP.reset(InstructionPrinter);
342 // Return the 'text' section with the code for this logical scope.
343 // COFF: SectionIndex is zero. Use 'SectionAddresses' data.
344 // ELF: SectionIndex is the section index in the file.
346 LVSections::iterator Iter = Sections.find(SectionIndex);
347 if (Iter == Sections.end()) {
349 "invalid section index for: '%s'",
350 Scope->getName().str().c_str());
353 return std::make_pair(Section.getAddress(), Section);
356 // Ensure a valid starting address for the public names.
357 LVSectionAddresses::const_iterator Iter =
358 SectionAddresses.upper_bound(
Address);
359 if (Iter == SectionAddresses.begin())
361 "invalid section address for: '%s'",
362 Scope->getName().str().c_str());
364 // Get section that contains the code for this function.
365 Iter = SectionAddresses.lower_bound(
Address);
366 if (Iter != SectionAddresses.begin())
368 return std::make_pair(Iter->first, Iter->second);
374 assert(Scope &&
"Scope is null.");
376 // Skip stripped functions.
377 if (Scope->getIsDiscarded())
380 // Find associated address and size for the given function entry point.
385 dbgs() <<
"\nPublic Name instructions: '" << Scope->getName() <<
"' / '"
386 << Scope->getLinkageName() <<
"'\n"
387 <<
"DIE Offset: " <<
hexValue(Scope->getOffset()) <<
" Range: ["
394 return SectionOrErr.takeError();
396 uint64_t SectionAddress = (*SectionOrErr).first;
399 if (!SectionContentsOrErr)
400 return SectionOrErr.takeError();
402 // There are cases where the section size is smaller than the [LowPC,HighPC]
403 // range; it causes us to decode invalid addresses. The recorded size in the
404 // logical scope is one less than the real size.
407 <<
", Section Size: " <<
hexValue(Section.getSize()) <<
"\n";
409 Size = std::min(
Size + 1, Section.getSize());
420 "Failed to parse instructions; offset beyond section size");
427 if (!SectionNameOrErr)
430 dbgs() <<
"Section Index: " <<
hexValue(Section.getIndex()) <<
" ["
433 <<
"] Name: '" << *SectionNameOrErr <<
"'\n"
438 // Address for first instruction line.
440 auto InstructionsSP = std::make_unique<LVLines>();
442 DiscoveredLines.emplace_back(std::move(InstructionsSP));
444 while (Begin < End) {
455 if (BytesConsumed == 0)
456 // Skip invalid bytes
468 std::string BufferCodes;
480 // Here we add logical lines to the Instructions. Later on,
481 // the 'processLines()' function will move each created logical line
482 // to its enclosing logical scope, using the debug ranges information
483 // and they will be released when its scope parent is deleted.
492 Begin += BytesConsumed;
498 <<
" Scope DIE: " <<
hexValue(Scope->getOffset()) <<
"\n"
499 <<
"Address: " <<
hexValue(FirstAddress)
500 <<
format(
" - Collected instructions lines: %d\n",
508 // The scope in the assembler names is linked to its own instructions.
509 ScopeInstructions.add(SectionIndex, Scope, &
Instructions);
510 AssemblerMappings.add(SectionIndex, FirstAddress, Scope);
517 if (!
options().getPrintInstructions())
528 if (!
options().getPrintInstructions())
533 dbgs() <<
"\nPublic Names (Scope):\n";
534 for (LVPublicNames::const_reference
Name :
CompileUnit->getPublicNames()) {
540 <<
"DIE Offset: " <<
hexValue(Scope->getOffset()) <<
" Range: ["
542 <<
"Name: '" << Scope->getName() <<
"' / '"
543 << Scope->getLinkageName() <<
"'\n";
547 // For each public name in the current compile unit, create the line
548 // records that represent the executable instructions.
549 for (LVPublicNames::const_reference
Name :
CompileUnit->getPublicNames()) {
551 // The symbol table extracted from the object file always contains a
552 // non-empty name (linkage name). However, the logical scope does not
553 // guarantee to have a name for the linkage name (main is one case).
554 // For those cases, set the linkage name the same as the name.
555 if (!Scope->getLinkageNameIndex())
556 Scope->setLinkageName(Scope->getName());
565// During the traversal of the debug information sections, we created the
566// logical lines representing the disassembled instructions from the text
567// section and the logical lines representing the line records from the
568// debug line section. Using the ranges associated with the logical scopes,
569// we will allocate those logical lines to their logical scopes.
573 assert(DebugLines &&
"DebugLines is null.");
575 // Just return if this compilation unit does not have any line records
576 // and no instruction lines were created.
577 if (DebugLines->
empty() && !
options().getPrintInstructions())
580 // Merge the debug lines and instruction lines using their text address;
581 // the logical line representing the debug line record is followed by the
582 // line(s) representing the disassembled instructions, whose addresses are
583 // equal or greater that the line address and less than the address of the
584 // next debug line record.
588 dbgs() <<
format(
"\nProcess debug lines: %d\n", DebugLines->
size());
591 <<
", (" <<
Line->getLineNumber() <<
")"
592 << ((Index % PerLine) ?
" " :
"\n");
595 dbgs() << ((Index % PerLine) ?
"\n" :
"");
598 bool TraverseLines =
true;
600 while (TraverseLines && Iter != DebugLines->
end()) {
601 uint64_t DebugAddress = (*Iter)->getAddress();
603 // Get the function with an entry point that matches this line and
604 // its associated assembler entries. In the case of COMDAT, the input
605 // 'Function' is not null. Use it to find its address ranges.
608 Scope = AssemblerMappings.find(SectionIndex, DebugAddress);
615 // Get the associated instructions for the found 'Scope'.
617 LVLines *Lines = ScopeInstructions.find(SectionIndex, Scope);
619 InstructionLines = std::move(*Lines);
624 <<
" Scope DIE: " <<
hexValue(Scope->getOffset()) <<
"\n"
625 <<
format(
"Process instruction lines: %d\n",
626 InstructionLines.
size());
633 // Continue with next debug line if there are not instructions lines.
634 if (InstructionLines.
empty()) {
639 for (
LVLine *InstructionLine : InstructionLines) {
640 uint64_t InstructionAddress = InstructionLine->getAddress();
642 dbgs() <<
"Instruction address: " <<
hexValue(InstructionAddress)
646 while (Iter != DebugLines->
end()) {
647 DebugAddress = (*Iter)->getAddress();
649 bool IsDebug = (*Iter)->getIsLineDebug();
650 dbgs() <<
"Line " << (IsDebug ?
"dbg:" :
"ins:") <<
" ["
653 dbgs() <<
format(
" %d", (*Iter)->getLineNumber());
656 // Instruction address before debug line.
657 if (InstructionAddress < DebugAddress) {
659 dbgs() <<
"Inserted instruction address: "
660 <<
hexValue(InstructionAddress) <<
" before line: "
661 <<
format(
"%d", (*Iter)->getLineNumber()) <<
" ["
664 Iter = DebugLines->
insert(Iter, InstructionLine);
665 // The returned iterator points to the inserted instruction.
666 // Skip it and point to the line acting as reference.
672 if (Iter == DebugLines->
end()) {
673 // We have reached the end of the source lines and the current
674 // instruction line address is greater than the last source line.
675 TraverseLines =
false;
690 << ((
Line->getIsLineDebug())
691 ?
Line->lineNumberAsStringStripped(
/*ShowZero=*/true)
697 // If this compilation unit does not have line records, traverse its scopes
698 // and take any collected instruction lines as the working set in order
699 // to move them to their associated scope.
700 if (DebugLines->
empty()) {
702 for (
LVScope *Scope : *Scopes) {
703 LVLines *Lines = ScopeInstructions.find(Scope);
709 <<
" Scope DIE: " <<
hexValue(Scope->getOffset()) <<
"\n"
710 <<
format(
"Instruction lines: %d\n", Lines->size());
717 if (Scope->getIsArtificial()) {
718 // Add the instruction lines to their artificial scope.
720 Scope->addElement(
Line);
722 DebugLines->
append(*Lines);
732 // Process collected lines.
735 // Using the current line address, get its associated lexical scope and
736 // add the line information to it.
739 // If missing scope, use the compile unit.
743 << ((
Line->getIsLineDebug())
744 ?
Line->lineNumberAsStringStripped(
/*ShowZero=*/true)
750 // Add line object to scope.
753 // Report any line zero.
754 if (
options().getWarningLines() &&
Line->getIsLineDebug() &&
755 !
Line->getLineNumber())
758 // Some compilers generate ranges in the compile unit; other compilers
759 // only DW_AT_low_pc/DW_AT_high_pc. In order to correctly map global
760 // variables, we need to generate the map ranges for the compile unit.
761 // If we use the ranges stored at the scope level, there are cases where
762 // the address referenced by a symbol location, is not in the enclosing
763 // scope, but in an outer one. By using the ranges stored in the compile
764 // unit, we can catch all those addresses.
765 if (
Line->getIsLineDebug())
768 // Resolve any given pattern.
777 assert(DebugLines &&
"DebugLines is null.");
778 if (DebugLines->
empty() && !ScopeInstructions.findMap(SectionIndex))
781 // If the Compile Unit does not contain comdat functions, use the whole
782 // set of debug lines, as the addresses don't have conflicts.
788 // Find the indexes for the lines whose address is zero.
789 std::vector<size_t> AddressZero;
792 while (It != std::end(*DebugLines)) {
793 AddressZero.emplace_back(std::distance(std::begin(*DebugLines), It));
794 It = std::find_if(std::next(It), std::end(*DebugLines),
798 // If the set of debug lines does not contain any line with address zero,
799 // use the whole set. It means we are dealing with an initialization
800 // section from a fully linked binary.
801 if (AddressZero.empty()) {
806 // The Compile unit contains comdat functions. Traverse the collected
807 // debug lines and identify logical groups based on their start and
808 // address. Each group starts with a zero address.
809 // Begin, End, Address, IsDone.
810 using LVBucket = std::tuple<size_t, size_t, LVAddress, bool>;
811 std::vector<LVBucket> Buckets;
817 for (Index = 0; Index < AddressZero.size() - 1; ++Index) {
818 Begin = AddressZero[Index];
819 End = AddressZero[Index + 1] - 1;
820 Address = (*DebugLines)[End]->getAddress();
821 Buckets.emplace_back(Begin, End,
Address,
false);
824 // Add the last bucket.
826 Begin = AddressZero[Index];
827 End = DebugLines->
size() - 1;
828 Address = (*DebugLines)[End]->getAddress();
829 Buckets.emplace_back(Begin, End,
Address,
false);
833 dbgs() <<
"\nDebug Lines buckets: " << Buckets.size() <<
"\n";
834 for (LVBucket &Bucket : Buckets) {
837 <<
"Address: " <<
hexValue(std::get<2>(Bucket)) <<
"\n";
841 // Traverse the sections and buckets looking for matches on the section
842 // sizes. In the unlikely event of different buckets with the same size
843 // process them in order and mark them as done.
845 for (LVSections::reference Entry : Sections) {
851 <<
" , Section Size: " <<
hexValue(Section.getSize())
852 <<
" , Section Address: " <<
hexValue(Section.getAddress())
856 for (LVBucket &Bucket : Buckets) {
857 if (std::get<3>(Bucket))
858 // Already done for previous section.
860 if (
Size == std::get<2>(Bucket)) {
861 // We have a match on the section size.
865 DebugLines->
begin() + std::get<1>(Bucket) + 1;
867 Group.push_back(*Iter);
868 processLines(&Group, SectionIndex,
/*Function=*/nullptr);
869 std::get<3>(Bucket) =
true;
876// Traverse the scopes for the given 'Function' looking for any inlined
877// scopes with inlined lines, which are found in 'CUInlineeLines'.
881 std::function<void(
LVScope * Parent)> FindInlinedScopes =
884 for (
LVScope *Scope : *Scopes) {
885 LVInlineeLine::iterator Iter = CUInlineeLines.find(Scope);
886 if (Iter != CUInlineeLines.end())
888 FindInlinedScopes(Scope);
892 // Find all inlined scopes for the given 'Function'.
894 for (LVInlineeLine::iterator InlineeIter : InlineeIters) {
895 LVScope *Scope = InlineeIter->first;
898 // TODO: Convert this into a reference.
901 dbgs() <<
"Inlined lines for: " << Scope->getName() <<
"\n";
904 <<
Line->getLineNumber() <<
"\n";
908 <<
Line->getLineNumber() <<
")\n";
912 // The inlined lines must be merged using its address, in order to keep
913 // the real order of the instructions. The inlined lines are mixed with
914 // the other non-inlined lines.
916 // First address of inlinee code.
923 // 'Iter' points to the line where the inlined function is called.
924 // Emulate the DW_AT_call_line attribute.
925 Scope->setCallLineNumber((*Iter)->getLineNumber());
926 // Mark the referenced line as the start of the inlined function.
927 // Skip the first line during the insertion, as the address and
928 // line number as the same. Otherwise we have to erase and insert.
929 (*Iter)->setLineNumber((*
InlineeLines->begin())->getLineNumber());
935 // Remove this set of lines from the container; each inlined function
936 // creates an unique set of lines. Remove only the created container.
937 CUInlineeLines.erase(InlineeIter);
941 dbgs() <<
"Merged Inlined lines for: " <<
Function->getName() <<
"\n";
945 <<
Line->getLineNumber() <<
")\n";
951 OS <<
"LVBinaryReader\n";
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
LocallyHashedType DenseMapInfo< LocallyHashedType >::Empty
Annotations lets you mark points and ranges inside source code, for tests:
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Represents either an error or a value T.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
This class is intended to be used as a base class for asm properties and features specific to the tar...
unsigned getAssemblerDialect() const
Superclass for all disassemblers.
DecodeStatus
Ternary decode status.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
void setPrintImmHex(bool Value)
Instances of this class represent a single low-level machine instruction.
Interface to description of machine instruction set.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
iterator insert(iterator I, T &&Elt)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
StringRef trim(char Char) const
Return string with consecutive Char characters starting from the left and right removed.
Target - Wrapper for Target specific information.
MCSubtargetInfo * createMCSubtargetInfo(StringRef TheTriple, StringRef CPU, StringRef Features) const
MCRegisterInfo * createMCRegInfo(StringRef TT) const
MCDisassembler * createMCDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx) const
MCAsmInfo * createMCAsmInfo(const MCRegisterInfo &MRI, StringRef TheTriple, const MCTargetOptions &Options) const
MCInstPrinter * createMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI) const
MCInstrInfo * createMCInstrInfo() const
createMCInstrInfo - Create a MCInstrInfo implementation.
Triple - Helper class for working with autoconf configuration names.
const LVSymbolTableEntry & getSymbolTableEntry(StringRef Name)
LVSectionIndex updateSymbolTable(LVScope *Function)
Expected< std::pair< LVSectionIndex, object::SectionRef > > getSection(LVScope *Scope, LVAddress Address, LVSectionIndex SectionIndex)
std::unique_ptr< MCContext > MC
void includeInlineeLines(LVSectionIndex SectionIndex, LVScope *Function)
std::unique_ptr< const MCInstrInfo > MII
Error loadGenericTargetInfo(StringRef TheTriple, StringRef TheFeatures, StringRef TheCPU)
LVAddress getSymbolTableAddress(StringRef Name)
void print(raw_ostream &OS) const
std::unique_ptr< const MCSubtargetInfo > STI
void addToSymbolTable(StringRef Name, LVScope *Function, LVSectionIndex SectionIndex=0)
virtual void mapRangeAddress(const object::ObjectFile &Obj)
void processLines(LVLines *DebugLines, LVSectionIndex SectionIndex)
void mapVirtualAddress(const object::ObjectFile &Obj)
std::unique_ptr< const MCAsmInfo > MAI
LVSectionIndex getSymbolTableIndex(StringRef Name)
bool getSymbolTableIsComdat(StringRef Name)
std::unique_ptr< const MCRegisterInfo > MRI
std::unique_ptr< const MCDisassembler > MD
Error createInstructions()
std::unique_ptr< MCInstPrinter > MIP
LVAddress WasmCodeSectionOffset
uint64_t getAddress() const
void resolvePatternMatch(LVLine *Line)
LVScope * getEntry(LVAddress Address) const
LVRange * getSectionRanges(LVSectionIndex SectionIndex)
LVSectionIndex getDotTextSectionIndex() const
LVScopeCompileUnit * CompileUnit
LVSectionIndex DotTextSectionIndex
void addElement(LVElement *Element)
const LVScopes * getScopes() const
LVSectionIndex getIndex(StringRef Name)
bool getIsComdat(StringRef Name)
void print(raw_ostream &OS)
LVAddress getAddress(StringRef Name)
void add(StringRef Name, LVScope *Function, LVSectionIndex SectionIndex=0)
LVSectionIndex update(LVScope *Function)
const LVSymbolTableEntry & getEntry(StringRef Name)
uint64_t getImageBase() const
const coff_section * getCOFFSection(const SectionRef &Section) const
This class is the base class for all object file types.
section_iterator_range sections() const
This is a value type class that represents a single section in the list of sections in the object fil...
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
std::string & str()
Returns the string's reference.
A raw_ostream that writes to an SmallVector or SmallString.
FormattedNumber hexValue(uint64_t N, unsigned Width=HEX_WIDTH, bool Upper=false)
std::pair< LVAddress, uint64_t > LVNameInfo
constexpr LVSectionIndex UndefinedSectionIndex
SmallVector< LVScope *, 8 > LVScopes
SmallVector< LVLine *, 8 > LVLines
This is an optimization pass for GlobalISel generic memory operations.
FormattedNumber format_decimal(int64_t N, unsigned Width)
format_decimal - Output N as a right justified, fixed-width decimal.
ArrayRef< CharT > arrayRefFromStringRef(StringRef Input)
Construct a string ref from an array ref of unsigned chars.
LLVM_ABI raw_fd_ostream & outs()
This returns a reference to a raw_fd_ostream for standard output.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
support::detail::AlignAdapter< T > fmt_align(T &&Item, AlignStyle Where, size_t Amount, char Fill=' ')
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
void consumeError(Error Err)
Consume a Error without doing anything.
FormattedBytes format_bytes(ArrayRef< uint8_t > Bytes, std::optional< uint64_t > FirstByteOffset=std::nullopt, uint32_t NumPerLine=16, uint8_t ByteGroupSize=4, uint32_t IndentLevel=0, bool Upper=false)
static const Target * lookupTarget(StringRef TripleStr, std::string &Error)
lookupTarget - Lookup a target based on a target triple.
support::ulittle32_t VirtualAddress