2009-05-15 09:23:25 +00:00
|
|
|
//===-- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework ------*- C++ -*--===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains support for writing dwarf debug info into asm files.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef CODEGEN_ASMPRINTER_DWARFDEBUG_H__
|
|
|
|
#define CODEGEN_ASMPRINTER_DWARFDEBUG_H__
|
|
|
|
|
2014-04-23 18:54:00 +00:00
|
|
|
#include "DwarfFile.h"
|
2013-12-03 15:10:23 +00:00
|
|
|
#include "AsmPrinterHandler.h"
|
2012-06-28 00:05:13 +00:00
|
|
|
#include "DIE.h"
|
2014-04-01 21:49:04 +00:00
|
|
|
#include "DebugLocEntry.h"
|
2014-04-02 01:43:18 +00:00
|
|
|
#include "DebugLocList.h"
|
2014-04-23 23:37:35 +00:00
|
|
|
#include "DwarfAccelTable.h"
|
2010-01-19 06:19:05 +00:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2014-03-18 20:58:35 +00:00
|
|
|
#include "llvm/ADT/MapVector.h"
|
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
|
|
|
#include "llvm/ADT/StringMap.h"
|
2009-05-15 09:23:25 +00:00
|
|
|
#include "llvm/ADT/FoldingSet.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "llvm/CodeGen/LexicalScopes.h"
|
2014-03-06 00:46:21 +00:00
|
|
|
#include "llvm/IR/DebugInfo.h"
|
2014-03-18 20:58:35 +00:00
|
|
|
#include "llvm/IR/DebugLoc.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "llvm/MC/MachineLocation.h"
|
2014-03-18 01:17:26 +00:00
|
|
|
#include "llvm/MC/MCDwarf.h"
|
2010-04-05 05:24:55 +00:00
|
|
|
#include "llvm/Support/Allocator.h"
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2014-04-22 22:39:41 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2009-05-15 09:23:25 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
2014-03-18 02:34:52 +00:00
|
|
|
class AsmPrinter;
|
2014-03-07 22:40:37 +00:00
|
|
|
class ByteStreamer;
|
2012-01-26 20:44:57 +00:00
|
|
|
class ConstantInt;
|
|
|
|
class ConstantFP;
|
2014-03-18 20:37:10 +00:00
|
|
|
class DwarfCompileUnit;
|
|
|
|
class DwarfDebug;
|
|
|
|
class DwarfTypeUnit;
|
|
|
|
class DwarfUnit;
|
2009-05-15 09:23:25 +00:00
|
|
|
class MachineModuleInfo;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief This class is used to record source line correspondence.
|
2013-09-11 18:05:11 +00:00
|
|
|
class SrcLineInfo {
|
2013-12-09 23:32:48 +00:00
|
|
|
unsigned Line; // Source line number.
|
|
|
|
unsigned Column; // Source column.
|
|
|
|
unsigned SourceID; // Source ID number.
|
|
|
|
MCSymbol *Label; // Label in code ID number.
|
2009-05-15 09:23:25 +00:00
|
|
|
public:
|
2010-03-14 08:15:55 +00:00
|
|
|
SrcLineInfo(unsigned L, unsigned C, unsigned S, MCSymbol *label)
|
2013-12-09 23:32:48 +00:00
|
|
|
: Line(L), Column(C), SourceID(S), Label(label) {}
|
2009-05-15 09:23:25 +00:00
|
|
|
|
|
|
|
// Accessors
|
|
|
|
unsigned getLine() const { return Line; }
|
|
|
|
unsigned getColumn() const { return Column; }
|
|
|
|
unsigned getSourceID() const { return SourceID; }
|
2010-03-14 08:15:55 +00:00
|
|
|
MCSymbol *getLabel() const { return Label; }
|
2009-05-15 09:23:25 +00:00
|
|
|
};
|
|
|
|
|
2011-04-12 22:53:02 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief This class is used to track local variable information.
|
2013-09-11 18:05:11 +00:00
|
|
|
class DbgVariable {
|
2013-12-09 23:32:48 +00:00
|
|
|
DIVariable Var; // Variable Descriptor.
|
|
|
|
DIE *TheDIE; // Variable DIE.
|
|
|
|
unsigned DotDebugLocOffset; // Offset in DotDebugLocEntries.
|
|
|
|
DbgVariable *AbsVar; // Corresponding Abstract variable, if any.
|
|
|
|
const MachineInstr *MInsn; // DBG_VALUE instruction of the variable.
|
2011-08-15 21:24:36 +00:00
|
|
|
int FrameIndex;
|
2013-10-05 01:43:03 +00:00
|
|
|
DwarfDebug *DD;
|
2013-12-09 23:32:48 +00:00
|
|
|
|
2011-04-12 22:53:02 +00:00
|
|
|
public:
|
|
|
|
// AbsVar may be NULL.
|
2013-10-05 01:43:03 +00:00
|
|
|
DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
|
2013-12-09 23:32:48 +00:00
|
|
|
: Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
|
|
|
|
FrameIndex(~0), DD(DD) {}
|
2011-04-12 22:53:02 +00:00
|
|
|
|
|
|
|
// Accessors.
|
2013-12-09 23:32:48 +00:00
|
|
|
DIVariable getVariable() const { return Var; }
|
2014-04-25 17:32:19 +00:00
|
|
|
void setDIE(DIE &D) { TheDIE = &D; }
|
2013-12-09 23:32:48 +00:00
|
|
|
DIE *getDIE() const { return TheDIE; }
|
|
|
|
void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }
|
|
|
|
unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; }
|
|
|
|
StringRef getName() const { return Var.getName(); }
|
2011-08-15 19:01:20 +00:00
|
|
|
DbgVariable *getAbstractVariable() const { return AbsVar; }
|
2013-12-09 23:32:48 +00:00
|
|
|
const MachineInstr *getMInsn() const { return MInsn; }
|
|
|
|
void setMInsn(const MachineInstr *M) { MInsn = M; }
|
|
|
|
int getFrameIndex() const { return FrameIndex; }
|
|
|
|
void setFrameIndex(int FI) { FrameIndex = FI; }
|
2012-11-21 00:03:28 +00:00
|
|
|
// Translate tag to proper Dwarf tag.
|
2014-04-12 02:24:04 +00:00
|
|
|
dwarf::Tag getTag() const {
|
2011-08-15 18:35:42 +00:00
|
|
|
if (Var.getTag() == dwarf::DW_TAG_arg_variable)
|
|
|
|
return dwarf::DW_TAG_formal_parameter;
|
2012-11-21 00:03:28 +00:00
|
|
|
|
2011-08-15 18:35:42 +00:00
|
|
|
return dwarf::DW_TAG_variable;
|
|
|
|
}
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Return true if DbgVariable is artificial.
|
2013-12-09 23:32:48 +00:00
|
|
|
bool isArtificial() const {
|
2011-08-15 18:40:16 +00:00
|
|
|
if (Var.isArtificial())
|
|
|
|
return true;
|
2012-09-21 22:18:52 +00:00
|
|
|
if (getType().isArtificial())
|
2011-08-15 18:40:16 +00:00
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
2012-09-12 23:36:19 +00:00
|
|
|
|
2013-12-09 23:32:48 +00:00
|
|
|
bool isObjectPointer() const {
|
2012-09-12 23:36:19 +00:00
|
|
|
if (Var.isObjectPointer())
|
|
|
|
return true;
|
2012-09-21 22:18:52 +00:00
|
|
|
if (getType().isObjectPointer())
|
2012-09-12 23:36:19 +00:00
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
2012-11-21 00:03:28 +00:00
|
|
|
|
2013-12-09 23:32:48 +00:00
|
|
|
bool variableHasComplexAddress() const {
|
2013-07-08 18:33:29 +00:00
|
|
|
assert(Var.isVariable() && "Invalid complex DbgVariable!");
|
2011-04-12 22:53:02 +00:00
|
|
|
return Var.hasComplexAddress();
|
|
|
|
}
|
2014-03-18 02:34:58 +00:00
|
|
|
bool isBlockByrefVariable() const;
|
2013-12-09 23:32:48 +00:00
|
|
|
unsigned getNumAddrElements() const {
|
2013-07-08 18:33:29 +00:00
|
|
|
assert(Var.isVariable() && "Invalid complex DbgVariable!");
|
2011-04-12 22:53:02 +00:00
|
|
|
return Var.getNumAddrElements();
|
|
|
|
}
|
2013-12-09 23:32:48 +00:00
|
|
|
uint64_t getAddrElement(unsigned i) const { return Var.getAddrElement(i); }
|
2011-04-12 22:53:02 +00:00
|
|
|
DIType getType() const;
|
2013-10-08 19:07:44 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// resolve - Look in the DwarfDebug map for the MDNode that
|
|
|
|
/// corresponds to the reference.
|
|
|
|
template <typename T> T resolve(DIRef<T> Ref) const;
|
2011-04-12 22:53:02 +00:00
|
|
|
};
|
|
|
|
|
2012-12-10 23:34:43 +00:00
|
|
|
|
2013-10-24 21:20:23 +00:00
|
|
|
/// \brief Helper used to pair up a symbol and its DWARF compile unit.
|
2013-09-19 23:21:01 +00:00
|
|
|
struct SymbolCU {
|
2013-12-09 23:57:44 +00:00
|
|
|
SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {}
|
2013-09-19 23:21:01 +00:00
|
|
|
const MCSymbol *Sym;
|
2013-12-09 23:57:44 +00:00
|
|
|
DwarfCompileUnit *CU;
|
2013-09-19 23:21:01 +00:00
|
|
|
};
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Collects and handles dwarf debug information.
|
2013-12-03 15:10:23 +00:00
|
|
|
class DwarfDebug : public AsmPrinterHandler {
|
2012-11-27 22:43:45 +00:00
|
|
|
// Target of Dwarf emission.
|
2010-04-05 00:13:49 +00:00
|
|
|
AsmPrinter *Asm;
|
2010-04-05 05:31:04 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Collected machine module information.
|
2010-04-05 00:13:49 +00:00
|
|
|
MachineModuleInfo *MMI;
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// All DIEValues are allocated through this allocator.
|
2012-06-09 10:34:15 +00:00
|
|
|
BumpPtrAllocator DIEValueAllocator;
|
|
|
|
|
2013-12-03 22:05:55 +00:00
|
|
|
// Handle to the compile unit used for the inline extension handling,
|
|
|
|
// this is just so that the DIEValue allocator has a place to store
|
|
|
|
// the particular elements.
|
|
|
|
// FIXME: Store these off of DwarfDebug instead?
|
2013-12-09 23:57:44 +00:00
|
|
|
DwarfCompileUnit *FirstCU;
|
2011-08-16 22:09:43 +00:00
|
|
|
|
2013-12-09 23:57:44 +00:00
|
|
|
// Maps MDNode with its corresponding DwarfCompileUnit.
|
2014-01-29 22:06:23 +00:00
|
|
|
MapVector<const MDNode *, DwarfCompileUnit *> CUMap;
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2013-12-09 23:57:44 +00:00
|
|
|
// Maps subprogram MDNode with its corresponding DwarfCompileUnit.
|
|
|
|
DenseMap<const MDNode *, DwarfCompileUnit *> SPMap;
|
2011-08-16 22:09:43 +00:00
|
|
|
|
2013-12-09 23:57:44 +00:00
|
|
|
// Maps a CU DIE with its corresponding DwarfCompileUnit.
|
|
|
|
DenseMap<const DIE *, DwarfCompileUnit *> CUDieMap;
|
2013-10-29 22:57:10 +00:00
|
|
|
|
2014-03-20 19:16:20 +00:00
|
|
|
/// Maps MDNodes for type system with the corresponding DIEs. These DIEs can
|
2013-10-31 17:54:35 +00:00
|
|
|
/// be shared across CUs, that is why we keep the map here instead
|
2013-12-09 23:57:44 +00:00
|
|
|
/// of in DwarfCompileUnit.
|
2013-10-31 17:54:35 +00:00
|
|
|
DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap;
|
|
|
|
|
2013-10-03 08:54:43 +00:00
|
|
|
// List of all labels used in aranges generation.
|
|
|
|
std::vector<SymbolCU> ArangeLabels;
|
2013-09-19 23:21:01 +00:00
|
|
|
|
2013-09-23 17:56:20 +00:00
|
|
|
// Size of each symbol emitted (for those symbols that have a specific size).
|
2013-12-09 23:32:48 +00:00
|
|
|
DenseMap<const MCSymbol *, uint64_t> SymSize;
|
2013-09-23 17:56:20 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Provides a unique id per text section.
|
2013-09-19 23:21:01 +00:00
|
|
|
typedef DenseMap<const MCSection *, SmallVector<SymbolCU, 8> > SectionMapType;
|
|
|
|
SectionMapType SectionMap;
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2013-07-08 21:16:18 +00:00
|
|
|
// List of arguments for current function.
|
2014-04-22 05:41:06 +00:00
|
|
|
SmallVector<DbgVariable *, 8> CurrentFnArguments;
|
2011-03-01 22:58:55 +00:00
|
|
|
|
2011-08-10 20:55:27 +00:00
|
|
|
LexicalScopes LScopes;
|
2010-03-25 15:09:44 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Collection of abstract subprogram DIEs.
|
2010-07-07 22:20:57 +00:00
|
|
|
DenseMap<const MDNode *, DIE *> AbstractSPDies;
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Collection of dbg variables of a scope.
|
2014-04-22 05:41:06 +00:00
|
|
|
typedef DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8> >
|
2013-12-09 23:32:48 +00:00
|
|
|
ScopeVariablesMap;
|
2013-07-03 04:40:27 +00:00
|
|
|
ScopeVariablesMap ScopeVariables;
|
2009-11-10 23:06:00 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Collection of abstract variables.
|
2010-05-07 20:54:48 +00:00
|
|
|
DenseMap<const MDNode *, DbgVariable *> AbstractVariables;
|
2009-11-10 23:06:00 +00:00
|
|
|
|
2014-04-02 01:43:18 +00:00
|
|
|
// Collection of DebugLocEntry. Stored in a linked list so that DIELocLists
|
|
|
|
// can refer to them in spite of insertions into this list.
|
|
|
|
SmallVector<DebugLocList, 4> DotDebugLocEntries;
|
2010-05-25 23:40:22 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Collection of subprogram DIEs that are marked (at the end of the module)
|
|
|
|
// as DW_AT_inline.
|
2009-11-10 23:06:00 +00:00
|
|
|
SmallPtrSet<DIE *, 4> InlinedSubprogramDIEs;
|
|
|
|
|
2012-12-20 21:58:40 +00:00
|
|
|
// This is a collection of subprogram MDNodes that are processed to
|
|
|
|
// create DIEs.
|
2010-06-28 18:25:03 +00:00
|
|
|
SmallPtrSet<const MDNode *, 16> ProcessedSPNodes;
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Maps instruction with label emitted before instruction.
|
2010-04-27 19:46:33 +00:00
|
|
|
DenseMap<const MachineInstr *, MCSymbol *> LabelsBeforeInsn;
|
2010-04-08 16:50:29 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Maps instruction with label emitted after instruction.
|
2010-04-27 19:46:33 +00:00
|
|
|
DenseMap<const MachineInstr *, MCSymbol *> LabelsAfterInsn;
|
2010-04-08 16:50:29 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Every user variable mentioned by a DBG_VALUE instruction in order of
|
|
|
|
// appearance.
|
2013-12-09 23:32:48 +00:00
|
|
|
SmallVector<const MDNode *, 8> UserVariables;
|
2010-05-26 19:37:24 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// For each user variable, keep a list of DBG_VALUE instructions in order.
|
|
|
|
// The list can also contain normal instructions that clobber the previous
|
|
|
|
// DBG_VALUE.
|
2013-12-09 23:32:48 +00:00
|
|
|
typedef DenseMap<const MDNode *, SmallVector<const MachineInstr *, 4> >
|
|
|
|
DbgValueHistoryMap;
|
2011-03-26 02:19:36 +00:00
|
|
|
DbgValueHistoryMap DbgValues;
|
2011-03-22 22:33:08 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Previous instruction's location information. This is used to determine
|
|
|
|
// label location to indicate scope boundries in dwarf debug info.
|
2010-04-02 19:42:39 +00:00
|
|
|
DebugLoc PrevInstLoc;
|
2010-04-16 23:33:45 +00:00
|
|
|
MCSymbol *PrevLabel;
|
2010-03-29 17:20:31 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// This location indicates end of function prologue and beginning of function
|
|
|
|
// body.
|
2011-05-11 19:22:19 +00:00
|
|
|
DebugLoc PrologEndLoc;
|
|
|
|
|
2013-12-03 15:10:23 +00:00
|
|
|
// If nonnull, stores the current machine function we're processing.
|
|
|
|
const MachineFunction *CurFn;
|
|
|
|
|
|
|
|
// If nonnull, stores the current machine instruction we're processing.
|
|
|
|
const MachineInstr *CurMI;
|
|
|
|
|
2014-03-20 19:16:16 +00:00
|
|
|
// If nonnull, stores the section that the previous function was allocated to
|
|
|
|
// emitting.
|
|
|
|
const MCSection *PrevSection;
|
|
|
|
|
|
|
|
// If nonnull, stores the CU in which the previous subprogram was contained.
|
|
|
|
const DwarfCompileUnit *PrevCU;
|
|
|
|
|
2010-04-04 22:59:04 +00:00
|
|
|
// Section Symbols: these are assembler temporary labels that are emitted at
|
|
|
|
// the beginning of each supported dwarf section. These are used to form
|
|
|
|
// section offsets and are created by EmitSectionLabels.
|
2011-05-06 14:56:22 +00:00
|
|
|
MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
|
2010-04-16 23:33:45 +00:00
|
|
|
MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
|
2013-04-07 03:43:09 +00:00
|
|
|
MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym, *DwarfAddrSectionSym;
|
2010-05-25 23:40:22 +00:00
|
|
|
MCSymbol *FunctionBeginSym, *FunctionEndSym;
|
2013-12-30 17:22:27 +00:00
|
|
|
MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym;
|
2014-04-01 16:09:49 +00:00
|
|
|
MCSymbol *DwarfStrDWOSectionSym;
|
2013-09-30 23:14:16 +00:00
|
|
|
MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;
|
2010-07-08 20:10:35 +00:00
|
|
|
|
2011-11-02 20:55:33 +00:00
|
|
|
// As an optimization, there is no need to emit an entry in the directory
|
2013-07-03 01:57:23 +00:00
|
|
|
// table for the same directory as DW_AT_comp_dir.
|
2011-11-02 20:55:33 +00:00
|
|
|
StringRef CompilationDir;
|
|
|
|
|
2013-12-03 00:45:45 +00:00
|
|
|
// Counter for assigning globally unique IDs for ranges.
|
|
|
|
unsigned GlobalRangeCount;
|
|
|
|
|
2012-12-10 23:34:43 +00:00
|
|
|
// Holder for the file specific debug information.
|
2013-12-05 18:06:10 +00:00
|
|
|
DwarfFile InfoHolder;
|
2012-12-10 23:34:43 +00:00
|
|
|
|
2012-11-21 00:17:49 +00:00
|
|
|
// Holders for the various debug information flags that we might need to
|
|
|
|
// have exposed. See accessor functions below for description.
|
2012-11-29 22:56:13 +00:00
|
|
|
|
2013-07-03 01:57:26 +00:00
|
|
|
// Holder for imported entities.
|
|
|
|
typedef SmallVector<std::pair<const MDNode *, const MDNode *>, 32>
|
2013-12-09 23:32:48 +00:00
|
|
|
ImportedEntityMap;
|
2013-07-03 01:57:26 +00:00
|
|
|
ImportedEntityMap ScopesWithImportedEntities;
|
|
|
|
|
2013-12-17 23:32:35 +00:00
|
|
|
// Map from MDNodes for user-defined types to the type units that describe
|
|
|
|
// them.
|
|
|
|
DenseMap<const MDNode *, const DwarfTypeUnit *> DwarfTypeUnits;
|
2013-07-26 17:02:41 +00:00
|
|
|
|
2013-08-26 23:24:35 +00:00
|
|
|
// Whether to emit the pubnames/pubtypes sections.
|
|
|
|
bool HasDwarfPubSections;
|
|
|
|
|
2014-01-15 00:04:29 +00:00
|
|
|
// Whether or not to use AT_ranges for compilation units.
|
|
|
|
bool HasCURanges;
|
|
|
|
|
2014-01-28 00:49:26 +00:00
|
|
|
// Whether we emitted a function into a section other than the default
|
|
|
|
// text.
|
|
|
|
bool UsedNonDefaultText;
|
|
|
|
|
2013-08-26 23:24:35 +00:00
|
|
|
// Version of dwarf we're emitting.
|
|
|
|
unsigned DwarfVersion;
|
|
|
|
|
2013-11-21 22:56:11 +00:00
|
|
|
// Maps from a type identifier to the actual MDNode.
|
|
|
|
DITypeIdentifierMap TypeIdentifierMap;
|
|
|
|
|
2012-11-29 22:56:13 +00:00
|
|
|
// DWARF5 Experimental Options
|
2012-11-21 00:34:35 +00:00
|
|
|
bool HasDwarfAccelTables;
|
2012-12-10 19:51:21 +00:00
|
|
|
bool HasSplitDwarf;
|
2013-07-02 23:40:10 +00:00
|
|
|
|
2012-12-11 19:42:09 +00:00
|
|
|
// Separated Dwarf Variables
|
2012-12-10 19:51:13 +00:00
|
|
|
// In general these will all be for bits that are left in the
|
|
|
|
// original object file, rather than things that are meant
|
|
|
|
// to be in the .dwo sections.
|
|
|
|
|
2012-12-27 02:14:01 +00:00
|
|
|
// Holder for the skeleton information.
|
2013-12-05 18:06:10 +00:00
|
|
|
DwarfFile SkeletonHolder;
|
2012-12-10 19:51:13 +00:00
|
|
|
|
2014-03-19 00:11:28 +00:00
|
|
|
/// Store file names for type units under fission in a line table header that
|
|
|
|
/// will be emitted into debug_line.dwo.
|
|
|
|
// FIXME: replace this with a map from comp_dir to table so that we can emit
|
|
|
|
// multiple tables during LTO each of which uses directory 0, referencing the
|
|
|
|
// comp_dir of all the type units that use it.
|
2014-03-18 02:13:23 +00:00
|
|
|
MCDwarfDwoLineTable SplitTypeUnitFileTable;
|
2014-03-18 01:17:26 +00:00
|
|
|
|
2014-03-19 00:11:28 +00:00
|
|
|
// True iff there are multiple CUs in this module.
|
|
|
|
bool SingleCU;
|
|
|
|
|
2014-04-23 21:20:10 +00:00
|
|
|
AddressPool AddrPool;
|
|
|
|
|
2014-04-23 23:37:35 +00:00
|
|
|
DwarfAccelTable AccelNames;
|
2014-04-24 00:53:32 +00:00
|
|
|
DwarfAccelTable AccelObjC;
|
2014-04-24 01:02:42 +00:00
|
|
|
DwarfAccelTable AccelNamespace;
|
2014-04-24 01:23:49 +00:00
|
|
|
DwarfAccelTable AccelTypes;
|
2014-04-23 23:37:35 +00:00
|
|
|
|
2014-03-19 00:11:28 +00:00
|
|
|
MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
|
|
|
|
|
2014-04-22 05:41:06 +00:00
|
|
|
void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
|
2009-11-10 23:06:00 +00:00
|
|
|
|
2014-04-22 21:27:37 +00:00
|
|
|
const SmallVectorImpl<std::unique_ptr<DwarfUnit>> &getUnits() {
|
2013-12-09 23:32:48 +00:00
|
|
|
return InfoHolder.getUnits();
|
|
|
|
}
|
2013-11-26 19:14:34 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Find abstract variable associated with Var.
|
2010-05-20 16:36:41 +00:00
|
|
|
DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc);
|
2009-11-10 23:06:00 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Find DIE for the given subprogram and attach appropriate
|
|
|
|
/// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global
|
|
|
|
/// variables in this scope then create and insert DIEs for these
|
|
|
|
/// variables.
|
2014-04-22 22:39:41 +00:00
|
|
|
DIE *updateSubprogramScopeDIE(DwarfCompileUnit &SPCU, DISubprogram SP);
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2013-12-03 00:45:56 +00:00
|
|
|
/// \brief A helper function to check whether the DIE for a given Scope is
|
|
|
|
/// going to be null.
|
2013-09-10 18:40:41 +00:00
|
|
|
bool isLexicalScopeDIENull(LexicalScope *Scope);
|
2009-11-21 02:48:08 +00:00
|
|
|
|
2013-12-03 00:45:59 +00:00
|
|
|
/// \brief A helper function to construct a RangeSpanList for a given
|
|
|
|
/// lexical scope.
|
2014-04-25 18:26:14 +00:00
|
|
|
void addScopeRangeList(DwarfCompileUnit &TheCU, DIE &ScopeDIE,
|
2013-12-03 00:45:59 +00:00
|
|
|
const SmallVectorImpl<InsnRange> &Range);
|
|
|
|
|
2013-12-03 00:45:54 +00:00
|
|
|
/// \brief Construct new DW_TAG_lexical_block for this scope and
|
|
|
|
/// attach DW_AT_low_pc/DW_AT_high_pc labels.
|
2014-04-22 22:39:41 +00:00
|
|
|
DIE *constructLexicalScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope);
|
2013-12-03 00:45:54 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief This scope represents inlined body of a function. Construct
|
|
|
|
/// DIE to represent this concrete inlined copy of the function.
|
2014-04-22 22:39:41 +00:00
|
|
|
DIE *constructInlinedScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope);
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Construct a DIE for this scope.
|
2014-04-22 22:39:41 +00:00
|
|
|
DIE *constructScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope);
|
2013-09-10 18:40:41 +00:00
|
|
|
/// A helper function to create children of a Scope DIE.
|
2014-04-22 22:39:41 +00:00
|
|
|
DIE *createScopeChildrenDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope,
|
2013-12-09 23:32:48 +00:00
|
|
|
SmallVectorImpl<DIE *> &Children);
|
2009-11-21 02:48:08 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit initial Dwarf sections with a label at the start of each one.
|
2012-11-21 00:34:35 +00:00
|
|
|
void emitSectionLabels();
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Compute the size and offset of a DIE given an incoming Offset.
|
2012-11-20 22:14:13 +00:00
|
|
|
unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Compute the size and offset of all the DIEs.
|
2009-11-21 02:48:08 +00:00
|
|
|
void computeSizeAndOffsets();
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Attach DW_AT_inline attribute with inlined subprogram DIEs.
|
2012-11-22 00:59:49 +00:00
|
|
|
void computeInlinedDIEs();
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Collect info for variables that were optimized out.
|
2012-11-22 00:59:49 +00:00
|
|
|
void collectDeadVariables();
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Finish off debug information after all functions have been
|
|
|
|
/// processed.
|
2012-11-22 00:59:49 +00:00
|
|
|
void finalizeModuleInfo();
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit labels to close any remaining sections that have been left
|
|
|
|
/// open.
|
2012-11-22 00:59:49 +00:00
|
|
|
void endSections();
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit the debug info section.
|
2009-11-21 02:48:08 +00:00
|
|
|
void emitDebugInfo();
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit the abbreviation section.
|
2012-11-20 23:30:11 +00:00
|
|
|
void emitAbbreviations();
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit the last address of the section and the end of
|
2009-05-15 09:23:25 +00:00
|
|
|
/// the line matrix.
|
2009-11-21 02:48:08 +00:00
|
|
|
void emitEndOfLineMatrix(unsigned SectionEnd);
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit visible names into a hashed accelerator table section.
|
2011-11-07 09:24:32 +00:00
|
|
|
void emitAccelNames();
|
2012-11-21 00:03:28 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit objective C classes and categories into a hashed
|
2011-11-07 09:24:32 +00:00
|
|
|
/// accelerator table section.
|
|
|
|
void emitAccelObjC();
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit namespace dies into a hashed accelerator table.
|
2011-11-07 09:24:32 +00:00
|
|
|
void emitAccelNamespaces();
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit type dies into a hashed accelerator table.
|
2011-11-07 09:24:32 +00:00
|
|
|
void emitAccelTypes();
|
2012-11-21 00:03:28 +00:00
|
|
|
|
2013-02-12 18:00:14 +00:00
|
|
|
/// \brief Emit visible names into a debug pubnames section.
|
2013-09-13 00:35:05 +00:00
|
|
|
/// \param GnuStyle determines whether or not we want to emit
|
|
|
|
/// additional information into the table ala newer gcc for gdb
|
|
|
|
/// index.
|
|
|
|
void emitDebugPubNames(bool GnuStyle = false);
|
2013-02-12 18:00:14 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit visible types into a debug pubtypes section.
|
2013-09-13 00:35:05 +00:00
|
|
|
/// \param GnuStyle determines whether or not we want to emit
|
|
|
|
/// additional information into the table ala newer gcc for gdb
|
|
|
|
/// index.
|
|
|
|
void emitDebugPubTypes(bool GnuStyle = false);
|
2009-11-24 01:14:22 +00:00
|
|
|
|
2014-03-11 23:18:15 +00:00
|
|
|
void
|
|
|
|
emitDebugPubSection(bool GnuStyle, const MCSection *PSec, StringRef Name,
|
|
|
|
const StringMap<const DIE *> &(DwarfUnit::*Accessor)()
|
|
|
|
const);
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit visible names into a debug str section.
|
2009-11-21 02:48:08 +00:00
|
|
|
void emitDebugStr();
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit visible names into a debug loc section.
|
2009-11-21 02:48:08 +00:00
|
|
|
void emitDebugLoc();
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2014-04-02 01:50:20 +00:00
|
|
|
/// \brief Emit visible names into a debug loc dwo section.
|
|
|
|
void emitDebugLocDWO();
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit visible names into a debug aranges section.
|
2012-11-21 00:34:35 +00:00
|
|
|
void emitDebugARanges();
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit visible names into a debug ranges section.
|
2009-11-21 02:48:08 +00:00
|
|
|
void emitDebugRanges();
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit inline info using custom format.
|
2009-11-21 02:48:08 +00:00
|
|
|
void emitDebugInlineInfo();
|
2009-05-20 23:19:06 +00:00
|
|
|
|
2012-12-10 19:51:21 +00:00
|
|
|
/// DWARF 5 Experimental Split Dwarf Emitters
|
2012-11-30 23:59:06 +00:00
|
|
|
|
2014-01-09 04:28:46 +00:00
|
|
|
/// \brief Initialize common features of skeleton units.
|
2014-04-25 18:26:14 +00:00
|
|
|
void initSkeletonUnit(const DwarfUnit &U, DIE &Die,
|
2014-04-22 22:39:41 +00:00
|
|
|
std::unique_ptr<DwarfUnit> NewU);
|
2014-01-09 04:28:46 +00:00
|
|
|
|
2012-12-10 19:51:21 +00:00
|
|
|
/// \brief Construct the split debug info compile unit for the debug info
|
|
|
|
/// section.
|
2014-04-22 22:39:41 +00:00
|
|
|
DwarfCompileUnit &constructSkeletonCU(const DwarfCompileUnit &CU);
|
2012-11-30 23:59:06 +00:00
|
|
|
|
2014-01-10 01:38:41 +00:00
|
|
|
/// \brief Construct the split debug info compile unit for the debug info
|
|
|
|
/// section.
|
2014-04-22 22:39:41 +00:00
|
|
|
DwarfTypeUnit &constructSkeletonTU(DwarfTypeUnit &TU);
|
2014-01-10 01:38:41 +00:00
|
|
|
|
2012-11-30 23:59:06 +00:00
|
|
|
/// \brief Emit the debug info dwo section.
|
|
|
|
void emitDebugInfoDWO();
|
|
|
|
|
2012-12-19 22:02:53 +00:00
|
|
|
/// \brief Emit the debug abbrev dwo section.
|
|
|
|
void emitDebugAbbrevDWO();
|
|
|
|
|
2014-03-18 01:17:26 +00:00
|
|
|
/// \brief Emit the debug line dwo section.
|
|
|
|
void emitDebugLineDWO();
|
|
|
|
|
2012-12-27 02:14:01 +00:00
|
|
|
/// \brief Emit the debug str dwo section.
|
|
|
|
void emitDebugStrDWO();
|
|
|
|
|
2013-12-04 21:31:26 +00:00
|
|
|
/// Flags to let the linker know we have emitted new style pubnames. Only
|
|
|
|
/// emit it here if we don't have a skeleton CU for split dwarf.
|
2014-04-25 18:26:14 +00:00
|
|
|
void addGnuPubAttributes(DwarfUnit &U, DIE &D) const;
|
2013-12-04 21:31:26 +00:00
|
|
|
|
2013-12-09 23:57:44 +00:00
|
|
|
/// \brief Create new DwarfCompileUnit for the given metadata node with tag
|
2012-11-27 22:43:45 +00:00
|
|
|
/// DW_TAG_compile_unit.
|
2014-04-22 22:39:41 +00:00
|
|
|
DwarfCompileUnit &constructDwarfCompileUnit(DICompileUnit DIUnit);
|
2010-05-10 22:49:55 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Construct subprogram DIE.
|
2014-04-22 22:39:41 +00:00
|
|
|
void constructSubprogramDIE(DwarfCompileUnit &TheCU, const MDNode *N);
|
2009-05-20 23:19:06 +00:00
|
|
|
|
2013-05-07 21:35:53 +00:00
|
|
|
/// \brief Construct imported_module or imported_declaration DIE.
|
2014-04-22 22:39:41 +00:00
|
|
|
void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N);
|
2013-04-22 06:12:31 +00:00
|
|
|
|
2013-05-06 23:33:07 +00:00
|
|
|
/// \brief Construct import_module DIE.
|
2014-04-22 22:39:41 +00:00
|
|
|
void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N,
|
2013-05-06 23:33:07 +00:00
|
|
|
DIE *Context);
|
|
|
|
|
|
|
|
/// \brief Construct import_module DIE.
|
2014-04-22 22:39:41 +00:00
|
|
|
void constructImportedEntityDIE(DwarfCompileUnit &TheCU,
|
2013-12-09 23:32:48 +00:00
|
|
|
const DIImportedEntity &Module, DIE *Context);
|
2013-05-06 23:33:07 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Register a source line with debug info. Returns the unique
|
|
|
|
/// label that was emitted and which provides correspondence to the
|
|
|
|
/// source line list.
|
2011-05-11 19:22:19 +00:00
|
|
|
void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope,
|
|
|
|
unsigned Flags);
|
2012-11-21 00:03:28 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Indentify instructions that are marking the beginning of or
|
|
|
|
/// ending of a scope.
|
2010-04-08 18:43:56 +00:00
|
|
|
void identifyScopeMarkers();
|
2010-04-08 15:37:09 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief If Var is an current function argument that add it in
|
|
|
|
/// CurrentFnArguments list.
|
2014-04-22 05:41:06 +00:00
|
|
|
bool addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope);
|
2011-03-01 22:58:55 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Populate LexicalScope entries with variables' info.
|
2013-12-03 15:10:23 +00:00
|
|
|
void collectVariableInfo(SmallPtrSet<const MDNode *, 16> &ProcessedVars);
|
2012-11-21 00:03:28 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Collect variable information from the side table maintained
|
|
|
|
/// by MMI.
|
2013-12-03 15:10:23 +00:00
|
|
|
void collectVariableInfoFromMMITable(SmallPtrSet<const MDNode *, 16> &P);
|
2011-03-26 02:19:36 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Ensure that a label will be emitted before MI.
|
2011-03-26 02:19:36 +00:00
|
|
|
void requestLabelBeforeInsn(const MachineInstr *MI) {
|
2013-12-09 23:32:48 +00:00
|
|
|
LabelsBeforeInsn.insert(std::make_pair(MI, (MCSymbol *)0));
|
2011-03-26 02:19:36 +00:00
|
|
|
}
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Return Label preceding the instruction.
|
2013-01-15 23:56:56 +00:00
|
|
|
MCSymbol *getLabelBeforeInsn(const MachineInstr *MI);
|
2011-03-26 02:19:36 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Ensure that a label will be emitted after MI.
|
2011-03-26 02:19:36 +00:00
|
|
|
void requestLabelAfterInsn(const MachineInstr *MI) {
|
2013-12-09 23:32:48 +00:00
|
|
|
LabelsAfterInsn.insert(std::make_pair(MI, (MCSymbol *)0));
|
2011-03-26 02:19:36 +00:00
|
|
|
}
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Return Label immediately following the instruction.
|
2013-01-15 23:56:56 +00:00
|
|
|
MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
|
2011-03-26 02:19:36 +00:00
|
|
|
|
2014-04-25 18:26:14 +00:00
|
|
|
void attachLowHighPC(DwarfCompileUnit &Unit, DIE &D, MCSymbol *Begin,
|
2014-03-07 18:49:45 +00:00
|
|
|
MCSymbol *End);
|
|
|
|
|
2010-04-05 05:32:45 +00:00
|
|
|
public:
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Main entry points.
|
|
|
|
//
|
|
|
|
DwarfDebug(AsmPrinter *A, Module *M);
|
|
|
|
|
2013-10-31 17:54:35 +00:00
|
|
|
void insertDIE(const MDNode *TypeMD, DIE *Die) {
|
|
|
|
MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
|
|
|
|
}
|
|
|
|
DIE *getDIE(const MDNode *TypeMD) {
|
|
|
|
return MDTypeNodeToDieMap.lookup(TypeMD);
|
|
|
|
}
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit all Dwarf sections that should come prior to the
|
2010-04-05 05:32:45 +00:00
|
|
|
/// content.
|
2012-11-19 22:42:15 +00:00
|
|
|
void beginModule();
|
2010-04-05 05:32:45 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Emit all Dwarf sections that should come after the content.
|
2014-03-08 06:31:39 +00:00
|
|
|
void endModule() override;
|
2010-04-05 05:32:45 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Gather pre-function debug information.
|
2014-03-08 06:31:39 +00:00
|
|
|
void beginFunction(const MachineFunction *MF) override;
|
2010-04-05 05:32:45 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Gather and emit post-function debug information.
|
2014-03-08 06:31:39 +00:00
|
|
|
void endFunction(const MachineFunction *MF) override;
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Process beginning of an instruction.
|
2014-03-08 06:31:39 +00:00
|
|
|
void beginInstruction(const MachineInstr *MI) override;
|
2009-11-10 23:06:00 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Process end of an instruction.
|
2014-03-08 06:31:39 +00:00
|
|
|
void endInstruction() override;
|
2011-04-12 22:53:02 +00:00
|
|
|
|
2013-07-26 17:02:41 +00:00
|
|
|
/// \brief Add a DIE to the set of types that we're going to pull into
|
|
|
|
/// type units.
|
2014-02-12 00:31:30 +00:00
|
|
|
void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
|
2014-04-25 18:26:14 +00:00
|
|
|
DIE &Die, DICompositeType CTy);
|
2013-07-26 17:02:41 +00:00
|
|
|
|
2013-09-19 23:21:01 +00:00
|
|
|
/// \brief Add a label so that arange data can be generated for it.
|
2013-10-03 08:54:43 +00:00
|
|
|
void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
|
2013-09-19 23:21:01 +00:00
|
|
|
|
2013-09-23 17:56:20 +00:00
|
|
|
/// \brief For symbols that have a size designated (e.g. common symbols),
|
|
|
|
/// this tracks that size.
|
2014-03-08 06:31:39 +00:00
|
|
|
void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {
|
2013-12-09 23:32:48 +00:00
|
|
|
SymSize[Sym] = Size;
|
|
|
|
}
|
2013-09-23 17:56:20 +00:00
|
|
|
|
2012-12-15 00:04:07 +00:00
|
|
|
/// \brief Recursively Emits a debug information entry.
|
2014-04-14 22:45:02 +00:00
|
|
|
void emitDIE(DIE &Die);
|
2012-12-15 00:04:07 +00:00
|
|
|
|
2012-11-21 00:03:31 +00:00
|
|
|
// Experimental DWARF5 features.
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Returns whether or not to emit tables that dwarf consumers can
|
|
|
|
/// use to accelerate lookup.
|
2014-03-06 00:00:53 +00:00
|
|
|
bool useDwarfAccelTables() const { return HasDwarfAccelTables; }
|
2012-11-21 00:03:31 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Returns whether or not to change the current debug info for the
|
2012-12-10 19:51:21 +00:00
|
|
|
/// split dwarf proposal support.
|
2014-03-06 00:00:53 +00:00
|
|
|
bool useSplitDwarf() const { return HasSplitDwarf; }
|
2013-07-02 23:40:10 +00:00
|
|
|
|
|
|
|
/// Returns the Dwarf Version.
|
|
|
|
unsigned getDwarfVersion() const { return DwarfVersion; }
|
2013-09-05 18:48:31 +00:00
|
|
|
|
2014-03-05 22:41:20 +00:00
|
|
|
/// Returns the section symbol for the .debug_loc section.
|
|
|
|
MCSymbol *getDebugLocSym() const { return DwarfDebugLocSectionSym; }
|
|
|
|
|
2014-03-20 19:16:16 +00:00
|
|
|
/// Returns the previous section that was emitted into.
|
|
|
|
const MCSection *getPrevSection() const { return PrevSection; }
|
|
|
|
|
|
|
|
/// Returns the previous CU that was being updated
|
|
|
|
const DwarfCompileUnit *getPrevCU() const { return PrevCU; }
|
|
|
|
|
2014-03-08 00:29:41 +00:00
|
|
|
/// Returns the entries for the .debug_loc section.
|
2014-04-02 01:43:18 +00:00
|
|
|
const SmallVectorImpl<DebugLocList> &
|
2014-03-24 22:38:38 +00:00
|
|
|
getDebugLocEntries() const {
|
2014-03-08 00:29:41 +00:00
|
|
|
return DotDebugLocEntries;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// \brief Emit an entry for the debug loc section. This can be used to
|
|
|
|
/// handle an entry that's going to be emitted into the debug loc section.
|
2014-03-18 02:18:24 +00:00
|
|
|
void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocEntry &Entry);
|
2014-03-08 00:29:41 +00:00
|
|
|
|
2014-04-01 16:17:41 +00:00
|
|
|
/// Emit the location for a debug loc entry, including the size header.
|
|
|
|
void emitDebugLocEntryLocation(const DebugLocEntry &Entry);
|
|
|
|
|
2013-10-05 00:32:34 +00:00
|
|
|
/// Find the MDNode for the given reference.
|
|
|
|
template <typename T> T resolve(DIRef<T> Ref) const {
|
2013-09-10 18:30:07 +00:00
|
|
|
return Ref.resolve(TypeIdentifierMap);
|
|
|
|
}
|
2013-09-05 18:48:31 +00:00
|
|
|
|
2014-03-18 02:34:58 +00:00
|
|
|
/// \brief Return the TypeIdentifierMap.
|
2014-03-18 20:39:54 +00:00
|
|
|
const DITypeIdentifierMap &getTypeIdentifierMap() const {
|
2014-03-18 02:34:58 +00:00
|
|
|
return TypeIdentifierMap;
|
|
|
|
}
|
|
|
|
|
2014-03-06 00:00:56 +00:00
|
|
|
/// Find the DwarfCompileUnit for the given CU Die.
|
|
|
|
DwarfCompileUnit *lookupUnit(const DIE *CU) const {
|
|
|
|
return CUDieMap.lookup(CU);
|
|
|
|
}
|
2013-09-09 19:05:21 +00:00
|
|
|
/// isSubprogramContext - Return true if Context is either a subprogram
|
|
|
|
/// or another context nested inside a subprogram.
|
|
|
|
bool isSubprogramContext(const MDNode *Context);
|
2014-04-23 21:20:10 +00:00
|
|
|
|
2014-04-25 18:52:29 +00:00
|
|
|
void addSubprogramNames(DISubprogram SP, DIE &Die);
|
2014-04-23 23:37:35 +00:00
|
|
|
|
2014-04-23 21:20:10 +00:00
|
|
|
AddressPool &getAddressPool() { return AddrPool; }
|
2014-04-23 23:37:35 +00:00
|
|
|
|
2014-04-25 18:52:29 +00:00
|
|
|
void addAccelName(StringRef Name, const DIE &Die);
|
2014-04-24 00:53:32 +00:00
|
|
|
|
2014-04-25 18:52:29 +00:00
|
|
|
void addAccelObjC(StringRef Name, const DIE &Die);
|
2014-04-24 01:02:42 +00:00
|
|
|
|
2014-04-25 18:52:29 +00:00
|
|
|
void addAccelNamespace(StringRef Name, const DIE &Die);
|
2014-04-24 01:23:49 +00:00
|
|
|
|
2014-04-25 18:52:29 +00:00
|
|
|
void addAccelType(StringRef Name, const DIE &Die, char Flags);
|
2009-11-10 23:06:00 +00:00
|
|
|
};
|
2009-05-15 09:23:25 +00:00
|
|
|
} // End of namespace llvm
|
|
|
|
|
|
|
|
#endif
|