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__
|
|
|
|
|
2012-06-28 00:05:13 +00:00
|
|
|
#include "DIE.h"
|
2010-01-19 06:19:05 +00:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2009-05-15 09:23:25 +00:00
|
|
|
#include "llvm/ADT/FoldingSet.h"
|
2012-10-31 13:45:49 +00:00
|
|
|
#include "llvm/ADT/SetVector.h"
|
2010-04-05 05:24:55 +00:00
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
2009-05-15 09:23:25 +00:00
|
|
|
#include "llvm/ADT/StringMap.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "llvm/CodeGen/AsmPrinter.h"
|
|
|
|
#include "llvm/CodeGen/LexicalScopes.h"
|
|
|
|
#include "llvm/DebugInfo.h"
|
|
|
|
#include "llvm/MC/MachineLocation.h"
|
2010-04-05 05:24:55 +00:00
|
|
|
#include "llvm/Support/Allocator.h"
|
2010-09-13 20:04:49 +00:00
|
|
|
#include "llvm/Support/DebugLoc.h"
|
2009-05-15 09:23:25 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class CompileUnit;
|
2012-01-26 20:44:57 +00:00
|
|
|
class ConstantInt;
|
|
|
|
class ConstantFP;
|
2009-11-17 09:17:08 +00:00
|
|
|
class DbgVariable;
|
2009-05-15 09:23:25 +00:00
|
|
|
class MachineFrameInfo;
|
|
|
|
class MachineModuleInfo;
|
2010-04-28 01:03:09 +00:00
|
|
|
class MachineOperand;
|
2009-08-22 20:48:53 +00:00
|
|
|
class MCAsmInfo;
|
2010-04-05 05:24:55 +00:00
|
|
|
class DIEAbbrev;
|
|
|
|
class DIE;
|
|
|
|
class DIEBlock;
|
|
|
|
class DIEEntry;
|
2009-05-15 09:23:25 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief This class is used to record source line correspondence.
|
2009-11-17 09:17:08 +00:00
|
|
|
class SrcLineInfo {
|
2009-05-15 09:23:25 +00:00
|
|
|
unsigned Line; // Source line number.
|
|
|
|
unsigned Column; // Source column.
|
|
|
|
unsigned SourceID; // Source ID number.
|
2010-03-14 08:15:55 +00:00
|
|
|
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)
|
|
|
|
: 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
|
|
|
};
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief This struct describes location entries emitted in the .debug_loc
|
|
|
|
/// section.
|
2013-07-03 22:40:18 +00:00
|
|
|
class DotDebugLocEntry {
|
|
|
|
// Begin and end symbols for the address range that this location is valid.
|
2011-02-04 22:57:18 +00:00
|
|
|
const MCSymbol *Begin;
|
|
|
|
const MCSymbol *End;
|
2013-07-03 22:40:18 +00:00
|
|
|
|
|
|
|
// Type of entry that this represents.
|
2011-07-08 16:49:43 +00:00
|
|
|
enum EntryType {
|
|
|
|
E_Location,
|
|
|
|
E_Integer,
|
|
|
|
E_ConstantFP,
|
|
|
|
E_ConstantInt
|
|
|
|
};
|
|
|
|
enum EntryType EntryKind;
|
|
|
|
|
|
|
|
union {
|
|
|
|
int64_t Int;
|
|
|
|
const ConstantFP *CFP;
|
|
|
|
const ConstantInt *CIP;
|
|
|
|
} Constants;
|
2013-07-03 22:40:18 +00:00
|
|
|
|
|
|
|
// The location in the machine frame.
|
|
|
|
MachineLocation Loc;
|
|
|
|
|
|
|
|
// The variable to which this location entry corresponds.
|
|
|
|
const MDNode *Variable;
|
|
|
|
|
|
|
|
// Whether this location has been merged.
|
|
|
|
bool Merged;
|
|
|
|
|
|
|
|
public:
|
2013-07-03 08:26:07 +00:00
|
|
|
DotDebugLocEntry() : Begin(0), End(0), Variable(0), Merged(false) {
|
|
|
|
Constants.Int = 0;
|
|
|
|
}
|
2011-04-28 02:22:40 +00:00
|
|
|
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L,
|
2012-11-21 00:03:28 +00:00
|
|
|
const MDNode *V)
|
2013-07-03 08:26:07 +00:00
|
|
|
: Begin(B), End(E), Loc(L), Variable(V), Merged(false) {
|
|
|
|
Constants.Int = 0;
|
|
|
|
EntryKind = E_Location;
|
|
|
|
}
|
2011-06-01 22:03:25 +00:00
|
|
|
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, int64_t i)
|
2013-07-03 08:26:07 +00:00
|
|
|
: Begin(B), End(E), Variable(0), Merged(false) {
|
|
|
|
Constants.Int = i;
|
|
|
|
EntryKind = E_Integer;
|
|
|
|
}
|
2011-07-08 16:49:43 +00:00
|
|
|
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantFP *FPtr)
|
2013-07-03 08:26:07 +00:00
|
|
|
: Begin(B), End(E), Variable(0), Merged(false) {
|
|
|
|
Constants.CFP = FPtr;
|
|
|
|
EntryKind = E_ConstantFP;
|
|
|
|
}
|
2012-09-10 23:34:03 +00:00
|
|
|
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E,
|
|
|
|
const ConstantInt *IPtr)
|
2013-07-03 08:26:07 +00:00
|
|
|
: Begin(B), End(E), Variable(0), Merged(false) {
|
|
|
|
Constants.CIP = IPtr;
|
|
|
|
EntryKind = E_ConstantInt;
|
|
|
|
}
|
2011-06-01 22:03:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Empty entries are also used as a trigger to emit temp label. Such
|
2011-02-04 22:57:18 +00:00
|
|
|
/// labels are referenced is used to find debug_loc offset for a given DIE.
|
|
|
|
bool isEmpty() { return Begin == 0 && End == 0; }
|
|
|
|
bool isMerged() { return Merged; }
|
|
|
|
void Merge(DotDebugLocEntry *Next) {
|
|
|
|
if (!(Begin && Loc == Next->Loc && End == Next->Begin))
|
|
|
|
return;
|
|
|
|
Next->Begin = Begin;
|
|
|
|
Merged = true;
|
|
|
|
}
|
2011-07-08 16:49:43 +00:00
|
|
|
bool isLocation() const { return EntryKind == E_Location; }
|
|
|
|
bool isInt() const { return EntryKind == E_Integer; }
|
|
|
|
bool isConstantFP() const { return EntryKind == E_ConstantFP; }
|
|
|
|
bool isConstantInt() const { return EntryKind == E_ConstantInt; }
|
2013-07-03 08:13:55 +00:00
|
|
|
int64_t getInt() const { return Constants.Int; }
|
|
|
|
const ConstantFP *getConstantFP() const { return Constants.CFP; }
|
|
|
|
const ConstantInt *getConstantInt() const { return Constants.CIP; }
|
2013-07-03 22:40:18 +00:00
|
|
|
const MDNode *getVariable() const { return Variable; }
|
|
|
|
const MCSymbol *getBeginSym() const { return Begin; }
|
|
|
|
const MCSymbol *getEndSym() const { return End; }
|
|
|
|
MachineLocation getLoc() const { return Loc; }
|
|
|
|
};
|
2011-02-04 22:57:18 +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.
|
2011-04-12 22:53:02 +00:00
|
|
|
class DbgVariable {
|
|
|
|
DIVariable Var; // Variable Descriptor.
|
|
|
|
DIE *TheDIE; // Variable DIE.
|
|
|
|
unsigned DotDebugLocOffset; // Offset in DotDebugLocEntries.
|
2011-08-15 19:01:20 +00:00
|
|
|
DbgVariable *AbsVar; // Corresponding Abstract variable, if any.
|
2011-08-15 21:24:36 +00:00
|
|
|
const MachineInstr *MInsn; // DBG_VALUE instruction of the variable.
|
|
|
|
int FrameIndex;
|
2011-04-12 22:53:02 +00:00
|
|
|
public:
|
|
|
|
// AbsVar may be NULL.
|
2012-11-21 00:03:28 +00:00
|
|
|
DbgVariable(DIVariable V, DbgVariable *AV)
|
2011-08-15 21:24:36 +00:00
|
|
|
: Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
|
2011-08-15 21:35:16 +00:00
|
|
|
FrameIndex(~0) {}
|
2011-04-12 22:53:02 +00:00
|
|
|
|
|
|
|
// Accessors.
|
|
|
|
DIVariable getVariable() const { return Var; }
|
|
|
|
void setDIE(DIE *D) { TheDIE = D; }
|
|
|
|
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; }
|
2011-08-15 21:24:36 +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.
|
2013-08-08 01:41:00 +00:00
|
|
|
uint16_t 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.
|
2011-08-15 18:40:16 +00:00
|
|
|
bool isArtificial() const {
|
|
|
|
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
|
|
|
|
|
|
|
bool isObjectPointer() const {
|
|
|
|
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
|
|
|
|
2011-04-12 22:53:02 +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();
|
|
|
|
}
|
|
|
|
bool isBlockByrefVariable() 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.isBlockByrefVariable();
|
|
|
|
}
|
2012-11-21 00:03:28 +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();
|
|
|
|
}
|
|
|
|
uint64_t getAddrElement(unsigned i) const {
|
|
|
|
return Var.getAddrElement(i);
|
|
|
|
}
|
|
|
|
DIType getType() const;
|
|
|
|
};
|
|
|
|
|
2012-12-10 23:34:43 +00:00
|
|
|
/// \brief Collects and handles information specific to a particular
|
|
|
|
/// collection of units.
|
|
|
|
class DwarfUnits {
|
|
|
|
// Target of Dwarf emission, used for sizing of abbreviations.
|
|
|
|
AsmPrinter *Asm;
|
|
|
|
|
|
|
|
// Used to uniquely define abbreviations.
|
|
|
|
FoldingSet<DIEAbbrev> *AbbreviationsSet;
|
|
|
|
|
|
|
|
// A list of all the unique abbreviations in use.
|
|
|
|
std::vector<DIEAbbrev *> *Abbreviations;
|
|
|
|
|
|
|
|
// A pointer to all units in the section.
|
|
|
|
SmallVector<CompileUnit *, 1> CUs;
|
|
|
|
|
2012-12-27 02:14:01 +00:00
|
|
|
// Collection of strings for this unit and assorted symbols.
|
2013-07-03 20:36:36 +00:00
|
|
|
// A String->Symbol mapping of strings used by indirect
|
|
|
|
// references.
|
|
|
|
typedef StringMap<std::pair<MCSymbol*, unsigned>,
|
|
|
|
BumpPtrAllocator&> StrPool;
|
2013-01-08 22:22:06 +00:00
|
|
|
StrPool StringPool;
|
2012-12-20 21:58:36 +00:00
|
|
|
unsigned NextStringPoolNumber;
|
2012-12-27 02:14:01 +00:00
|
|
|
std::string StringPref;
|
2012-12-20 21:58:36 +00:00
|
|
|
|
2013-01-15 23:56:56 +00:00
|
|
|
// Collection of addresses for this unit and assorted labels.
|
2013-07-03 20:36:36 +00:00
|
|
|
// A Symbol->unsigned mapping of addresses used by indirect
|
|
|
|
// references.
|
|
|
|
typedef DenseMap<const MCExpr *, unsigned> AddrPool;
|
2013-01-15 23:56:56 +00:00
|
|
|
AddrPool AddressPool;
|
|
|
|
unsigned NextAddrPoolNumber;
|
|
|
|
|
2012-12-10 23:34:43 +00:00
|
|
|
public:
|
|
|
|
DwarfUnits(AsmPrinter *AP, FoldingSet<DIEAbbrev> *AS,
|
2013-01-08 22:22:06 +00:00
|
|
|
std::vector<DIEAbbrev *> *A, const char *Pref,
|
2013-07-03 21:23:59 +00:00
|
|
|
BumpPtrAllocator &DA)
|
|
|
|
: Asm(AP), AbbreviationsSet(AS), Abbreviations(A), StringPool(DA),
|
|
|
|
NextStringPoolNumber(0), StringPref(Pref), AddressPool(),
|
|
|
|
NextAddrPoolNumber(0) {}
|
2012-12-10 23:34:43 +00:00
|
|
|
|
|
|
|
/// \brief Compute the size and offset of a DIE given an incoming Offset.
|
|
|
|
unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
|
|
|
|
|
|
|
|
/// \brief Compute the size and offset of all the DIEs.
|
|
|
|
void computeSizeAndOffsets();
|
|
|
|
|
|
|
|
/// \brief Define a unique number for the abbreviation.
|
|
|
|
void assignAbbrevNumber(DIEAbbrev &Abbrev);
|
|
|
|
|
|
|
|
/// \brief Add a unit to the list of CUs.
|
|
|
|
void addUnit(CompileUnit *CU) { CUs.push_back(CU); }
|
2012-12-15 00:04:07 +00:00
|
|
|
|
|
|
|
/// \brief Emit all of the units to the section listed with the given
|
|
|
|
/// abbreviation section.
|
2013-07-03 21:23:59 +00:00
|
|
|
void emitUnits(DwarfDebug *DD, const MCSection *USection,
|
|
|
|
const MCSection *ASection, const MCSymbol *ASectionSym);
|
2012-12-20 21:58:36 +00:00
|
|
|
|
2012-12-27 02:14:01 +00:00
|
|
|
/// \brief Emit all of the strings to the section given.
|
2013-07-03 21:23:59 +00:00
|
|
|
void emitStrings(const MCSection *StrSection, const MCSection *OffsetSection,
|
|
|
|
const MCSymbol *StrSecSym);
|
2012-12-27 02:14:01 +00:00
|
|
|
|
2013-01-15 23:56:56 +00:00
|
|
|
/// \brief Emit all of the addresses to the section given.
|
2013-07-03 21:23:59 +00:00
|
|
|
void emitAddresses(const MCSection *AddrSection);
|
2013-01-15 23:56:56 +00:00
|
|
|
|
2012-12-20 21:58:36 +00:00
|
|
|
/// \brief Returns the entry into the start of the pool.
|
|
|
|
MCSymbol *getStringPoolSym();
|
|
|
|
|
|
|
|
/// \brief Returns an entry into the string pool with the given
|
|
|
|
/// string text.
|
|
|
|
MCSymbol *getStringPoolEntry(StringRef Str);
|
|
|
|
|
2013-01-07 19:32:41 +00:00
|
|
|
/// \brief Returns the index into the string pool with the given
|
|
|
|
/// string text.
|
|
|
|
unsigned getStringPoolIndex(StringRef Str);
|
|
|
|
|
2012-12-20 21:58:36 +00:00
|
|
|
/// \brief Returns the string pool.
|
2013-01-08 22:22:06 +00:00
|
|
|
StrPool *getStringPool() { return &StringPool; }
|
2013-01-15 23:56:56 +00:00
|
|
|
|
|
|
|
/// \brief Returns the index into the address pool with the given
|
|
|
|
/// label/symbol.
|
2013-07-03 21:23:59 +00:00
|
|
|
unsigned getAddrPoolIndex(const MCExpr *Sym);
|
|
|
|
unsigned getAddrPoolIndex(const MCSymbol *Sym);
|
2013-01-15 23:56:56 +00:00
|
|
|
|
|
|
|
/// \brief Returns the address pool.
|
|
|
|
AddrPool *getAddrPool() { return &AddressPool; }
|
2013-03-12 18:27:15 +00:00
|
|
|
|
|
|
|
/// \brief for a given compile unit DIE, returns offset from beginning of
|
|
|
|
/// debug info.
|
|
|
|
unsigned getCUOffset(DIE *Die);
|
2012-12-10 23:34:43 +00:00
|
|
|
};
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Collects and handles dwarf debug information.
|
2010-04-05 00:13:49 +00:00
|
|
|
class DwarfDebug {
|
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-07-14 22:23:54 +00:00
|
|
|
// Handle to the a compile unit used for the inline extension handling.
|
2010-05-10 22:49:55 +00:00
|
|
|
CompileUnit *FirstCU;
|
2011-08-16 22:09:43 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Maps MDNode with its corresponding CompileUnit.
|
2010-05-10 22:49:55 +00:00
|
|
|
DenseMap <const MDNode *, CompileUnit *> CUMap;
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Maps subprogram MDNode with its corresponding CompileUnit.
|
2011-08-16 22:09:43 +00:00
|
|
|
DenseMap <const MDNode *, CompileUnit *> SPMap;
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Used to uniquely define abbreviations.
|
2009-05-15 09:23:25 +00:00
|
|
|
FoldingSet<DIEAbbrev> AbbreviationsSet;
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// A list of all the unique abbreviations in use.
|
2009-05-15 09:23:25 +00:00
|
|
|
std::vector<DIEAbbrev *> Abbreviations;
|
|
|
|
|
2013-03-07 01:42:00 +00:00
|
|
|
// Stores the current file ID for a given compile unit.
|
|
|
|
DenseMap <unsigned, unsigned> FileIDCUMap;
|
|
|
|
// Source id map, i.e. CUID, source filename and directory,
|
2012-11-27 22:43:45 +00:00
|
|
|
// separated by a zero byte, mapped to a unique id.
|
2012-06-09 10:34:15 +00:00
|
|
|
StringMap<unsigned, BumpPtrAllocator&> SourceIdMap;
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Provides a unique id per text section.
|
2012-10-31 13:45:49 +00:00
|
|
|
SetVector<const MCSection*> SectionMap;
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2013-07-08 21:16:18 +00:00
|
|
|
// List of arguments for current function.
|
2011-03-01 22:58:55 +00:00
|
|
|
SmallVector<DbgVariable *, 8> CurrentFnArguments;
|
|
|
|
|
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.
|
2013-07-03 04:40:27 +00:00
|
|
|
typedef DenseMap<LexicalScope *,
|
|
|
|
SmallVector<DbgVariable *, 8> > ScopeVariablesMap;
|
|
|
|
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
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
// Collection of DotDebugLocEntry.
|
2010-05-25 23:40:22 +00:00
|
|
|
SmallVector<DotDebugLocEntry, 4> DotDebugLocEntries;
|
|
|
|
|
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.
|
2011-03-26 02:19:36 +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.
|
2011-03-26 02:19:36 +00:00
|
|
|
typedef DenseMap<const MDNode*, SmallVector<const MachineInstr*, 4> >
|
|
|
|
DbgValueHistoryMap;
|
|
|
|
DbgValueHistoryMap DbgValues;
|
2011-03-22 22:33:08 +00:00
|
|
|
|
2010-04-16 23:33:45 +00:00
|
|
|
SmallVector<const MCSymbol *, 8> DebugRangeSymbols;
|
2010-04-22 20:56:35 +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;
|
|
|
|
|
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;
|
2012-12-27 02:14:01 +00:00
|
|
|
MCSymbol *DwarfAbbrevDWOSectionSym, *DwarfStrDWOSectionSym;
|
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;
|
|
|
|
|
2012-12-10 22:25:41 +00:00
|
|
|
// Counter for assigning globally unique IDs for CUs.
|
|
|
|
unsigned GlobalCUIndexCount;
|
|
|
|
|
2012-12-10 23:34:43 +00:00
|
|
|
// Holder for the file specific debug information.
|
|
|
|
DwarfUnits InfoHolder;
|
|
|
|
|
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
|
|
|
|
2012-12-10 22:25:41 +00:00
|
|
|
// Whether or not we're emitting info for older versions of gdb on darwin.
|
|
|
|
bool IsDarwinGDBCompat;
|
2012-12-03 18:45:45 +00:00
|
|
|
|
2013-07-03 01:57:26 +00:00
|
|
|
// Holder for imported entities.
|
|
|
|
typedef SmallVector<std::pair<const MDNode *, const MDNode *>, 32>
|
|
|
|
ImportedEntityMap;
|
|
|
|
ImportedEntityMap ScopesWithImportedEntities;
|
|
|
|
|
2013-07-26 17:02:41 +00:00
|
|
|
// Holder for types that are going to be extracted out into a type unit.
|
|
|
|
std::vector<DIE *> TypeUnits;
|
|
|
|
|
2013-08-26 23:24:35 +00:00
|
|
|
// Whether to emit the pubnames/pubtypes sections.
|
|
|
|
bool HasDwarfPubSections;
|
|
|
|
|
|
|
|
// Version of dwarf we're emitting.
|
|
|
|
unsigned DwarfVersion;
|
|
|
|
|
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.
|
|
|
|
|
2013-02-06 21:53:56 +00:00
|
|
|
// The CUs left in the original object file for separated debug info.
|
|
|
|
SmallVector<CompileUnit *, 1> SkeletonCUs;
|
2012-12-19 22:02:53 +00:00
|
|
|
|
2012-12-27 02:14:01 +00:00
|
|
|
// Used to uniquely define abbreviations for the skeleton emission.
|
2012-12-19 22:02:53 +00:00
|
|
|
FoldingSet<DIEAbbrev> SkeletonAbbrevSet;
|
|
|
|
|
|
|
|
// A list of all the unique abbreviations in use.
|
|
|
|
std::vector<DIEAbbrev *> SkeletonAbbrevs;
|
|
|
|
|
2012-12-27 02:14:01 +00:00
|
|
|
// Holder for the skeleton information.
|
2012-12-10 23:34:43 +00:00
|
|
|
DwarfUnits SkeletonHolder;
|
2012-12-10 19:51:13 +00:00
|
|
|
|
2013-09-05 18:48:31 +00:00
|
|
|
// Maps from a type identifier to the actual MDNode.
|
|
|
|
DITypeIdentifierMap TypeIdentifierMap;
|
|
|
|
|
2011-03-31 16:53:49 +00:00
|
|
|
private:
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2011-08-10 20:55:27 +00:00
|
|
|
void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
|
2009-11-10 23:06:00 +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.
|
2011-08-15 22:24:32 +00:00
|
|
|
DIE *updateSubprogramScopeDIE(CompileUnit *SPCU, const MDNode *SPNode);
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Construct new DW_TAG_lexical_block for this scope and
|
|
|
|
/// attach DW_AT_low_pc/DW_AT_high_pc labels.
|
2011-08-15 22:24:32 +00:00
|
|
|
DIE *constructLexicalScopeDIE(CompileUnit *TheCU, LexicalScope *Scope);
|
2009-11-21 02:48:08 +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.
|
2011-08-15 22:24:32 +00:00
|
|
|
DIE *constructInlinedScopeDIE(CompileUnit *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.
|
2011-08-15 22:04:40 +00:00
|
|
|
DIE *constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope);
|
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-12-19 22:02:53 +00:00
|
|
|
/// \brief Emit a set of abbreviations to the specific section.
|
|
|
|
void emitAbbrevs(const MCSection *, std::vector<DIEAbbrev*> *);
|
|
|
|
|
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-09 20:03:17 +00:00
|
|
|
void emitDebugPubNames();
|
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.
|
2009-11-24 01:14:22 +00:00
|
|
|
void emitDebugPubTypes();
|
|
|
|
|
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
|
|
|
|
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 visible names into a debug macinfo section.
|
2009-11-21 02:48:08 +00:00
|
|
|
void emitDebugMacInfo();
|
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
|
|
|
|
2012-12-10 19:51:21 +00:00
|
|
|
/// \brief Construct the split debug info compile unit for the debug info
|
|
|
|
/// section.
|
2013-08-26 23:50:43 +00:00
|
|
|
CompileUnit *constructSkeletonCU(const CompileUnit *CU);
|
2012-11-30 23:59:06 +00:00
|
|
|
|
2012-12-19 22:02:53 +00:00
|
|
|
/// \brief Emit the local split abbreviations.
|
|
|
|
void emitSkeletonAbbrevs(const MCSection *);
|
|
|
|
|
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();
|
|
|
|
|
2012-12-27 02:14:01 +00:00
|
|
|
/// \brief Emit the debug str dwo section.
|
|
|
|
void emitDebugStrDWO();
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Create new CompileUnit for the given metadata node with tag
|
|
|
|
/// DW_TAG_compile_unit.
|
2011-08-16 22:09:43 +00:00
|
|
|
CompileUnit *constructCompileUnit(const MDNode *N);
|
2010-05-10 22:49:55 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Construct subprogram DIE.
|
2011-08-15 23:36:40 +00:00
|
|
|
void constructSubprogramDIE(CompileUnit *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.
|
|
|
|
void constructImportedEntityDIE(CompileUnit *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.
|
2013-05-08 06:01:38 +00:00
|
|
|
void constructImportedEntityDIE(CompileUnit *TheCU, const MDNode *N,
|
2013-05-06 23:33:07 +00:00
|
|
|
DIE *Context);
|
|
|
|
|
|
|
|
/// \brief Construct import_module DIE.
|
2013-05-08 06:01:38 +00:00
|
|
|
void constructImportedEntityDIE(CompileUnit *TheCU,
|
2013-05-07 21:35:53 +00:00
|
|
|
const DIImportedEntity &Module,
|
2013-05-06 23:33:07 +00:00
|
|
|
DIE *Context);
|
|
|
|
|
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.
|
2011-03-01 22:58:55 +00:00
|
|
|
bool addCurrentFnArgument(const MachineFunction *MF,
|
2011-08-10 20:55:27 +00:00
|
|
|
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.
|
2010-06-25 22:07:34 +00:00
|
|
|
void collectVariableInfo(const MachineFunction *,
|
|
|
|
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.
|
2010-05-20 19:57:06 +00:00
|
|
|
void collectVariableInfoFromMMITable(const MachineFunction * MF,
|
|
|
|
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) {
|
|
|
|
LabelsBeforeInsn.insert(std::make_pair(MI, (MCSymbol*)0));
|
|
|
|
}
|
|
|
|
|
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) {
|
|
|
|
LabelsAfterInsn.insert(std::make_pair(MI, (MCSymbol*)0));
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-04-05 05:32:45 +00:00
|
|
|
public:
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Main entry points.
|
|
|
|
//
|
|
|
|
DwarfDebug(AsmPrinter *A, Module *M);
|
|
|
|
~DwarfDebug();
|
|
|
|
|
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.
|
2010-04-05 05:32:45 +00:00
|
|
|
void endModule();
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Gather pre-function debug information.
|
2010-04-05 05:32:45 +00:00
|
|
|
void beginFunction(const MachineFunction *MF);
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Gather and emit post-function debug information.
|
2010-04-05 05:32:45 +00:00
|
|
|
void endFunction(const MachineFunction *MF);
|
2009-05-15 09:23:25 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Process beginning of an instruction.
|
2010-10-26 17:49:02 +00:00
|
|
|
void beginInstruction(const MachineInstr *MI);
|
2009-11-10 23:06:00 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Process end of an instruction.
|
2010-10-26 17:49:02 +00:00
|
|
|
void endInstruction(const MachineInstr *MI);
|
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.
|
|
|
|
void addTypeUnitType(DIE *Die) { TypeUnits.push_back(Die); }
|
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Look up the source id with the given directory and source file
|
|
|
|
/// names. If none currently exists, create a new id and insert it in the
|
|
|
|
/// SourceIds map.
|
2013-03-07 01:42:00 +00:00
|
|
|
unsigned getOrCreateSourceID(StringRef DirName, StringRef FullName,
|
|
|
|
unsigned CUID);
|
2011-04-12 22:53:02 +00:00
|
|
|
|
2012-12-15 00:04:07 +00:00
|
|
|
/// \brief Recursively Emits a debug information entry.
|
2012-12-19 22:02:53 +00:00
|
|
|
void emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs);
|
2012-12-15 00:04:07 +00:00
|
|
|
|
2012-11-27 22:43:45 +00:00
|
|
|
/// \brief Returns whether or not to limit some of our debug
|
2012-08-23 22:36:36 +00:00
|
|
|
/// output to the limitations of darwin gdb.
|
2012-11-21 00:34:35 +00:00
|
|
|
bool useDarwinGDBCompat() { return IsDarwinGDBCompat; }
|
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.
|
2012-11-21 00:34:35 +00:00
|
|
|
bool useDwarfAccelTables() { 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.
|
|
|
|
bool useSplitDwarf() { 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
|
|
|
|
2013-09-09 19:03:51 +00:00
|
|
|
/// Find the MDNode for the given scope reference.
|
2013-09-10 18:30:07 +00:00
|
|
|
template <typename T>
|
|
|
|
T resolve(DIRef<T> Ref) const {
|
|
|
|
return Ref.resolve(TypeIdentifierMap);
|
|
|
|
}
|
2013-09-05 18:48:31 +00:00
|
|
|
|
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);
|
|
|
|
|
2009-11-10 23:06:00 +00:00
|
|
|
};
|
2009-05-15 09:23:25 +00:00
|
|
|
} // End of namespace llvm
|
|
|
|
|
|
|
|
#endif
|