Added support for generate DWARF .debug_aranges sections automatically.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191052 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Richard Mitton
2013-09-19 23:21:01 +00:00
parent 70e0b047be
commit 5cc319a42a
18 changed files with 453 additions and 26 deletions

View File

@@ -300,6 +300,12 @@ public:
unsigned getCUOffset(DIE *Die);
};
/// \brief Helper used to pair up a symbol and it's DWARF compile unit.
struct SymbolCU {
const MCSymbol *Sym;
CompileUnit *CU;
};
/// \brief Collects and handles dwarf debug information.
class DwarfDebug {
// Target of Dwarf emission.
@@ -332,8 +338,12 @@ class DwarfDebug {
// separated by a zero byte, mapped to a unique id.
StringMap<unsigned, BumpPtrAllocator&> SourceIdMap;
// List of all labels used in the output.
std::vector<SymbolCU> Labels;
// Provides a unique id per text section.
SetVector<const MCSection*> SectionMap;
typedef DenseMap<const MCSection *, SmallVector<SymbolCU, 8> > SectionMapType;
SectionMapType SectionMap;
// List of arguments for current function.
SmallVector<DbgVariable *, 8> CurrentFnArguments;
@@ -669,6 +679,9 @@ public:
/// type units.
void addTypeUnitType(DIE *Die) { TypeUnits.push_back(Die); }
/// \brief Add a label so that arange data can be generated for it.
void addLabel(SymbolCU SCU) { Labels.push_back(SCU); }
/// \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.