LLVM 17.0.0git
|
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAddr.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAranges.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
#include "llvm/DebugInfo/DWARF/DWARFListTable.h"
#include "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
#include "llvm/DebugInfo/DWARF/DWARFVerifier.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Object/Decompressor.h"
#include "llvm/Object/MachO.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/RelocationResolver.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cstdint>
#include <deque>
#include <map>
#include <string>
#include <utility>
#include <vector>
Go to the source code of this file.
Classes | |
struct | SymInfo |
SymInfo contains information about symbol: it's address and section index which is -1LL for absolute symbols. More... | |
Macros | |
#define | DEBUG_TYPE "dwarf" |
Typedefs | |
using | DWARFLineTable = DWARFDebugLine::LineTable |
using | FileLineInfoKind = DILineInfoSpecifier::FileLineInfoKind |
using | FunctionNameKind = DILineInfoSpecifier::FunctionNameKind |
using | ContributionCollection = std::vector< std::optional< StrOffsetsContributionDescriptor > > |
Functions | |
static void | dumpUUID (raw_ostream &OS, const ObjectFile &Obj) |
Dump the UUID load command. | |
static ContributionCollection | collectContributionData (DWARFContext::unit_iterator_range Units) |
static void | dumpStringOffsetsSection (raw_ostream &OS, DIDumpOptions DumpOpts, StringRef SectionName, const DWARFObject &Obj, const DWARFSection &StringOffsetsSection, StringRef StringSection, DWARFContext::unit_iterator_range Units, bool LittleEndian) |
static void | dumpAddrSection (raw_ostream &OS, DWARFDataExtractor &AddrData, DIDumpOptions DumpOpts, uint16_t Version, uint8_t AddrSize) |
static void | dumpRnglistsSection (raw_ostream &OS, DWARFDataExtractor &rnglistData, llvm::function_ref< std::optional< object::SectionedAddress >(uint32_t)> LookupPooledAddress, DIDumpOptions DumpOpts) |
static void | dumpLoclistsSection (raw_ostream &OS, DIDumpOptions DumpOpts, DWARFDataExtractor Data, const DWARFObject &Obj, std::optional< uint64_t > DumpOffset) |
static void | dumpPubTableSection (raw_ostream &OS, DIDumpOptions DumpOpts, DWARFDataExtractor Data, bool GnuStyle) |
void | fixupIndex (const DWARFObject &DObj, DWARFContext &C, DWARFUnitIndex &Index) |
template<typename T > | |
static T & | getAccelTable (std::unique_ptr< T > &Cache, const DWARFObject &Obj, const DWARFSection &Section, StringRef StringSection, bool IsLittleEndian) |
static bool | getFunctionNameAndStartLineForAddress (DWARFCompileUnit *CU, uint64_t Address, FunctionNameKind Kind, DILineInfoSpecifier::FileLineInfoKind FileNameKind, std::string &FunctionName, std::string &StartFile, uint32_t &StartLine, std::optional< uint64_t > &StartAddress) |
TODO: change input parameter from "uint64_t Address" into "SectionedAddress Address". | |
static std::optional< int64_t > | getExpressionFrameOffset (ArrayRef< uint8_t > Expr, std::optional< unsigned > FrameBaseReg) |
static Error | createError (const Twine &Reason, llvm::Error E) |
static Expected< SymInfo > | getSymbolInfo (const object::ObjectFile &Obj, const RelocationRef &Reloc, const LoadedObjectInfo *L, std::map< SymbolRef, SymInfo > &Cache) |
Returns the address of symbol relocation used against and a section index. | |
static bool | isRelocScattered (const object::ObjectFile &Obj, const RelocationRef &Reloc) |
#define DEBUG_TYPE "dwarf" |
Definition at line 66 of file DWARFContext.cpp.
using ContributionCollection = std::vector<std::optional<StrOffsetsContributionDescriptor> > |
Definition at line 104 of file DWARFContext.cpp.
Definition at line 68 of file DWARFContext.cpp.
Definition at line 69 of file DWARFContext.cpp.
Definition at line 70 of file DWARFContext.cpp.
|
static |
Definition at line 110 of file DWARFContext.cpp.
References llvm::CallingConv::C, and llvm::sort().
Referenced by dumpStringOffsetsSection().
|
static |
Definition at line 1519 of file DWARFContext.cpp.
References E, llvm::inconvertibleErrorCode(), and llvm::dwarf::toString().
|
static |
Definition at line 222 of file DWARFContext.cpp.
References llvm::DWARFDebugAddrTable::dump(), llvm::DWARFDebugAddrTable::extract(), llvm::DWARFDebugAddrTable::getFullLength(), llvm::DataExtractor::isValidOffset(), llvm::Offset, llvm::DIDumpOptions::RecoverableErrorHandler, and llvm::DIDumpOptions::WarningHandler.
Referenced by llvm::DWARFContext::dump().
|
static |
Definition at line 310 of file DWARFContext.cpp.
References llvm::Data, llvm::DWARFLocationTable::dumpLocationList(), llvm::DWARFDebugLoclists::dumpRange(), E, llvm::Offset, and llvm::DIDumpOptions::RecoverableErrorHandler.
Referenced by llvm::DWARFContext::dump().
|
static |
Definition at line 342 of file DWARFContext.cpp.
References llvm::Data, llvm::DWARFDebugPubTable::dump(), llvm::DWARFDebugPubTable::extract(), and llvm::DIDumpOptions::RecoverableErrorHandler.
Referenced by llvm::DWARFContext::dump().
|
static |
Definition at line 245 of file DWARFContext.cpp.
References llvm::DWARFListTableBase< DWARFListType >::dump(), llvm::DWARFListTableBase< DWARFListType >::extract(), llvm::DataExtractor::isValidOffset(), llvm::DWARFListTableBase< DWARFListType >::length(), llvm::Length, llvm::Offset, and llvm::DIDumpOptions::RecoverableErrorHandler.
Referenced by llvm::DWARFContext::dump().
|
static |
Definition at line 149 of file DWARFContext.cpp.
References collectContributionData(), llvm::createStringError(), llvm::DWARFSection::Data, llvm::dwarf::DWARF32, llvm::format(), llvm::Format, llvm::dwarf::FormatString(), llvm::DataExtractor::getCStr(), llvm::dwarf::getDwarfOffsetByteSize(), llvm::DWARFDataExtractor::getRelocatedValue(), llvm::invalid_argument, llvm::Offset, llvm::DIDumpOptions::RecoverableErrorHandler, and llvm::StringRef::size().
Referenced by llvm::DWARFContext::dump().
|
static |
Dump the UUID load command.
Definition at line 83 of file DWARFContext.cpp.
References llvm::raw_ostream::write_uuid().
Referenced by llvm::DWARFContext::dump().
void fixupIndex | ( | const DWARFObject & | DObj, |
DWARFContext & | C, | ||
DWARFUnitIndex & | Index | ||
) |
Definition at line 782 of file DWARFContext.cpp.
References llvm::CallingConv::C, llvm::DWARFSection::Data, llvm::Data, llvm::StringRef::empty(), llvm::DWARFObject::forEachInfoDWOSections(), llvm::DWARFObject::getCUIndexSection(), llvm::Offset, and llvm::StringRef::size().
Referenced by llvm::DWARFContext::getCUIndex(), and llvm::DWARFContext::getTUIndex().
|
static |
Definition at line 996 of file DWARFContext.cpp.
References llvm::consumeError(), and E.
Referenced by llvm::DWARFContext::getAppleNames(), llvm::DWARFContext::getAppleNamespaces(), llvm::DWARFContext::getAppleObjC(), llvm::DWARFContext::getAppleTypes(), and llvm::DWARFContext::getDebugNames().
|
static |
Definition at line 1214 of file DWARFContext.cpp.
References llvm::ArrayRef< T >::data(), llvm::decodeSLEB128(), llvm::ArrayRef< T >::empty(), llvm::ArrayRef< T >::end(), llvm::Offset, and llvm::ArrayRef< T >::size().
|
static |
TODO: change input parameter from "uint64_t Address" into "SectionedAddress Address".
Definition at line 1179 of file DWARFContext.cpp.
References llvm::Address, llvm::SmallVectorBase< Size_T >::empty(), Name, and llvm::dwarf::toSectionedAddress().
Referenced by llvm::DWARFContext::getLineInfoForAddress(), and llvm::DWARFContext::getLineInfoForAddressRange().
|
static |
Returns the address of symbol relocation used against and a section index.
Used for futher relocations computation. Symbol's section load address is
Definition at line 1533 of file DWARFContext.cpp.
References llvm::createError(), llvm::object::SymbolRef::getAddress(), llvm::object::RelocationRef::getRawDataRefImpl(), llvm::object::SymbolRef::getSection(), llvm::LoadedObjectInfo::getSectionLoadAddress(), llvm::object::RelocationRef::getSymbol(), llvm::object::ObjectFile::section_end(), llvm::object::SymbolicFile::symbol_end(), and llvm::Expected< T >::takeError().
|
static |
Definition at line 1588 of file DWARFContext.cpp.
References llvm::object::RelocationRef::getRawDataRefImpl(), llvm::object::MachOObjectFile::getRelocation(), and llvm::object::MachOObjectFile::isRelocationScattered().