LLVM
8.0.1
|
#include "CodeViewDebug.h"
#include "DwarfExpression.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h"
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/EnumTables.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeTableCollection.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <limits>
#include <string>
#include <utility>
#include <vector>
Go to the source code of this file.
Classes | |
struct | llvm::CodeViewDebug::TypeLoweringScope |
struct | llvm::ClassInfo |
struct | llvm::ClassInfo::MemberInfo |
|
static |
Definition at line 449 of file CodeViewDebug.cpp.
References B, llvm::SmallVectorTemplateCommon< T >::begin(), llvm::COFF::DEBUG_SECTION_MAGIC, E, llvm::SmallVectorTemplateCommon< T >::end(), llvm::find(), FuncId, llvm::DebugLoc::get(), llvm::DebugLoc::getCol(), llvm::DebugLoc::getLine(), llvm::DebugHandlerBase::PrevInstLoc, and llvm::SmallVectorTemplateBase< T >::push_back().
|
static |
Definition at line 1147 of file CodeViewDebug.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorBase::empty(), and llvm::DbgVariableLocation::LoadChain.
Referenced by needsReferenceType().
|
static |
Only call this on endian-specific types like ulittle16_t and little32_t, or structs composed of them.
Definition at line 2552 of file CodeViewDebug.cpp.
References llvm::SmallVectorImpl< T >::append(), assert(), llvm::codeview::DefRangeRegisterRelSym::Header::BasePointerOffset, llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorImpl< char >::clear(), llvm::dyn_cast(), emitNullTerminatedSymbolName(), llvm::codeview::encodeFramePtrReg(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::N86::ESP, llvm::codeview::DefRangeRegisterRelSym::Header::Flags, llvm::LexicalScope::getChildren(), llvm::codeview::TypeIndex::getIndex(), llvm::DebugHandlerBase::getLabelAfterInsn(), llvm::DebugHandlerBase::getLabelBeforeInsn(), llvm::DIScope::getName(), llvm::LexicalScope::getRanges(), llvm::LexicalScope::getScopeNode(), llvm::LexicalScope::isAbstractScope(), llvm::codeview::DefRangeRegisterSym::Header::MayHaveNoName, llvm::codeview::DefRangeSubfieldRegisterSym::Header::MayHaveNoName, llvm::Intrinsic::memcpy, llvm::None, llvm::codeview::DefRangeSubfieldRegisterSym::Header::OffsetInParent, llvm::SmallVectorTemplateBase< T, bool >::push_back(), Reg, llvm::codeview::DefRangeRegisterSym::Header::Register, llvm::codeview::DefRangeSubfieldRegisterSym::Header::Register, llvm::codeview::DefRangeRegisterRelSym::Header::Register, and llvm::SmallVectorImpl< char >::resize().
|
static |
Given a DWARF calling convention, get the CodeView equivalent.
If we don't have a translation, use the NearC convention.
Definition at line 1729 of file CodeViewDebug.cpp.
References llvm::DebugHandlerBase::Asm, llvm::SmallVectorTemplateCommon< T >::back(), llvm::ArrayRef< T >::drop_front(), llvm::SmallVectorBase::empty(), getBaseType(), llvm::DISubroutineType::getCC(), llvm::MCAsmInfo::getCodePointerSize(), getFunctionOptions(), llvm::DIType::getSizeInBits(), llvm::DINode::getTag(), llvm::DISubroutineType::getTypeArray(), llvm::AsmPrinter::MAI, llvm::makeArrayRef(), llvm::None, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorBase::size(), llvm::DITypeRefArray::size(), and llvm::ArrayRef< T >::size().
|
static |
Definition at line 585 of file CodeViewDebug.cpp.
References llvm::DebugHandlerBase::Asm, assert(), B, llvm::COFF::DEBUG_HASHES_SECTION_MAGIC, llvm::StringRef::drop_front(), E, llvm::MCStreamer::EmitBytes(), llvm::errs(), llvm::formatv(), llvm::MCObjectFileInfo::getCOFFDebugTypesSection(), llvm::MCObjectFileInfo::getCOFFGlobalTypeHashesSection(), llvm::MCAsmInfo::getCommentString(), llvm::codeview::TypeIndex::getIndex(), llvm::AsmPrinter::getObjFileLowering(), llvm::Record::getType(), llvm_unreachable, llvm::logAllUnhandledErrors(), llvm::AsmPrinter::MAI, llvm::codeview::MaxRecordLength, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::ScopedPrinter::setPrefix(), llvm::SmallVectorBase::size(), llvm::raw_svector_ostream::str(), llvm::codeview::CVRecord< Kind >::str_data(), llvm::StringRef::take_front(), and llvm::codeview::visitTypeRecord().
Referenced by copyBytesForDefRange(), and getSymbolName().
|
static |
Return ClassOptions that should be present on both the forward declaration and the defintion of a tag type.
Definition at line 1936 of file CodeViewDebug.cpp.
References llvm::codeview::ContinuationRecordBuilder::begin(), llvm::StringRef::empty(), llvm::Enumerator, llvm::DICompositeType::getBaseType(), llvm::DICompositeType::getElements(), llvm::DIScope::getFile(), getFullyQualifiedName(), llvm::DICompositeType::getIdentifier(), llvm::DIType::getLine(), llvm::DIScope::getScope(), llvm::DIType::getScope(), llvm::DINode::getTag(), llvm::APSInt::getUnsigned(), llvm::DIType::isForwardDecl(), llvm::None, llvm::TypedDINodeRef< T >::resolve(), and llvm::codeview::ContinuationRecordBuilder::writeMemberType().
Referenced by shouldAlwaysEmitCompleteClassType().
Definition at line 293 of file CodeViewDebug.cpp.
References getQualifiedName(), and getQualifiedNameComponents().
Referenced by getCommonClassOptions(), getFullyQualifiedName(), and shouldAlwaysEmitCompleteClassType().
Definition at line 311 of file CodeViewDebug.cpp.
References assert(), FuncId, getFullyQualifiedName(), llvm::DIScope::getName(), getPrettyScopeName(), llvm::DIScope::getScope(), I, llvm::TypedDINodeRef< T >::resolve(), and llvm::StringRef::split().
|
static |
Definition at line 372 of file CodeViewDebug.cpp.
References assert(), llvm::DIScope::getName(), llvm::DISubroutineType::getTypeArray(), I, isTrivial(), and llvm::None.
Referenced by dwarfCCToCodeView().
Definition at line 249 of file CodeViewDebug.cpp.
References llvm::StringRef::empty(), llvm::DIScope::getName(), and llvm::DINode::getTag().
Referenced by getFullyQualifiedName(), getQualifiedNameComponents(), and shouldEmitUdt().
|
static |
Definition at line 281 of file CodeViewDebug.cpp.
References llvm::reverse().
Referenced by getFullyQualifiedName(), and shouldEmitUdt().
|
static |
Definition at line 267 of file CodeViewDebug.cpp.
References llvm::dyn_cast(), getPrettyScopeName(), llvm::DIScope::getScope(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::TypedDINodeRef< T >::resolve().
Referenced by getFullyQualifiedName(), and shouldEmitUdt().
|
static |
Definition at line 1926 of file CodeViewDebug.cpp.
References llvm::tgtok::Class, llvm::DINode::getTag(), and llvm_unreachable.
Referenced by shouldAlwaysEmitCompleteClassType().
|
static |
Definition at line 779 of file CodeViewDebug.cpp.
References llvm::MachineModuleInfo::getModule(), llvm::Module::getNamedMetadata(), llvm::DebugHandlerBase::MMI, llvm::NamedMDNode::operands(), and llvm::codeview::GlobalTypeTableBuilder::writeLeafType().
|
static |
Definition at line 2856 of file CodeViewDebug.cpp.
References assert(), llvm::MCContext::createTempSymbol(), emitNullTerminatedSymbolName(), llvm::MachineModuleInfo::getContext(), llvm::MachineModuleInfo::getModule(), llvm::Module::getNamedMetadata(), llvm::codeview::getSymbolTypeNames(), llvm::Module::globals(), llvm::DebugHandlerBase::MMI, llvm::NamedMDNode::operands(), and shouldEmitUdt().
Referenced by llvm::object::ExportDirectoryEntryRef::ExportDirectoryEntryRef(), llvm::pdb::GSIHashStreamBuilder::finalizeBuckets(), llvm::object::COFFObjectFile::getAuxSymbol(), llvm::object::COFFObjectFile::getLoadConfig64(), llvm::object::WasmObjectFile::getNumImportedEvents(), and llvm::object::ImportedSymbolRef::ImportedSymbolRef().
|
static |
Definition at line 367 of file CodeViewDebug.cpp.
References llvm::DIType::getFlags().
Referenced by despeculateCountZeros(), and getFunctionOptions().
|
static |
Definition at line 96 of file CodeViewDebug.cpp.
References llvm::codeview::ARM64, llvm::codeview::Pentium3, llvm::report_fatal_error(), llvm::codeview::Thumb, and llvm::codeview::X64.
Referenced by llvm::CodeViewDebug::CodeViewDebug().
|
static |
Definition at line 676 of file CodeViewDebug.cpp.
References C, llvm::codeview::Cobol, llvm::codeview::Cpp, D, llvm::codeview::Fortran, llvm::codeview::Java, llvm::codeview::Masm, llvm::codeview::Pascal, and llvm::IndexedInstrProf::Version.
|
static |
Definition at line 1151 of file CodeViewDebug.cpp.
References llvm::DebugHandlerBase::Asm, assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), canUseReferenceType(), E, llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::DbgVariableLocation::extractFromMachineInstruction(), llvm::MCRegisterInfo::getCodeViewRegNum(), llvm::DebugHandlerBase::getLabelBeforeInsn(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), I, llvm::MachineInstr::isDebugValue(), llvm::DbgVariableLocation::LoadChain, llvm::AsmPrinter::MF, llvm::SmallVectorBase::size(), and TRI.
|
static |
Definition at line 719 of file CodeViewDebug.cpp.
References C, llvm::MachineModuleInfo::getModule(), llvm::Module::getNamedMetadata(), llvm::DebugHandlerBase::MMI, N, llvm::NamedMDNode::operands(), and llvm::IndexedInstrProf::Version.
Referenced by getOSTypeFromMCVM(), getOSTypeFromPlatform(), and isSDKVersionToken().
|
static |
Definition at line 2140 of file CodeViewDebug.cpp.
References assert(), llvm::ClassInfo::MemberInfo::BaseOffset, llvm::codeview::ContinuationRecordBuilder::begin(), llvm::codeview::ContainsNestedClass, llvm::StringRef::empty(), getCommonClassOptions(), llvm::DIType::getFlags(), getFullyQualifiedName(), llvm::DICompositeType::getIdentifier(), llvm::DIType::getName(), llvm::DIType::getOffsetInBits(), getRecordKind(), llvm::DIType::getSizeInBits(), llvm::DINode::getTag(), I, llvm::ClassInfo::Inheritance, llvm::pdb::Int32, llvm::DIType::isBitField(), llvm::DIType::isForwardDecl(), llvm::DIType::isStaticMember(), Kind, llvm_unreachable, llvm::ClassInfo::Members, llvm::ClassInfo::MemberInfo::MemberTypeNode, llvm::ClassInfo::Methods, Name, llvm::codeview::Nested, llvm::ClassInfo::NestedTypes, llvm::None, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::report_fatal_error(), llvm::TypedDINodeRef< T >::resolve(), llvm::MDNode::resolve(), llvm::sort(), llvm::StringRef::startswith(), std::swap(), translateAccessFlags(), translateMethodKindFlags(), translateMethodOptionFlags(), llvm::codeview::TypeRef, llvm::ClassInfo::VShapeTI, and llvm::codeview::ContinuationRecordBuilder::writeMemberType().
Definition at line 1376 of file CodeViewDebug.cpp.
References assert(), llvm::dyn_cast(), llvm::StringRef::empty(), llvm::DICompositeType::getBaseType(), llvm::DebugHandlerBase::getBaseTypeSize(), llvm::DICompositeType::getElements(), llvm::DIBasicType::getEncoding(), getName(), llvm::DIType::getName(), getPrettyScopeName(), getQualifiedName(), getQualifiedNameComponents(), llvm::DIType::getScope(), llvm::codeview::TypeIndex::getSimpleKind(), llvm::codeview::TypeIndex::getSimpleMode(), llvm::DIType::getSizeInBits(), llvm::DINode::getTag(), llvm::pdb::Int32, llvm::DIType::isForwardDecl(), llvm::DIType::isObjectPointer(), llvm::codeview::TypeIndex::isSimple(), Kind, LLVM_FALLTHROUGH, llvm_unreachable, Mode, Name, llvm::None, llvm::TypedDINodeRef< T >::resolve(), llvm::MDNode::resolve(), T, llvm::AMDGPU::HSAMD::Kernel::Arg::Key::TypeName, and llvm::pdb::UInt32.
Referenced by getSymbolName().
|
static |
Definition at line 1884 of file CodeViewDebug.cpp.
References llvm::DINode::FlagAccessibility, and llvm_unreachable.
Referenced by shouldAlwaysEmitCompleteClassType().
|
static |
Definition at line 1906 of file CodeViewDebug.cpp.
References llvm_unreachable, and llvm::Reloc::Static.
Referenced by shouldAlwaysEmitCompleteClassType().
|
static |
Definition at line 1897 of file CodeViewDebug.cpp.
References llvm::None.
Referenced by shouldAlwaysEmitCompleteClassType().
|
static |
Definition at line 1676 of file CodeViewDebug.cpp.
References assert(), llvm::DINode::FlagPtrToMemberRep, llvm::DIType::getFlags(), llvm::DIType::getSizeInBits(), llvm::DINode::getTag(), llvm_unreachable, and llvm::Unknown.