diff options
| author | 2018-04-06 14:26:03 +0000 | |
|---|---|---|
| committer | 2018-04-06 14:26:03 +0000 | |
| commit | bdabc2f19ffb9e20600dad6e8a300842a7bda50e (patch) | |
| tree | c50e7b2e5449b074651bb82a58517a8ebc4a8cf7 /gnu/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | |
| parent | Print a 'p' flag for file descriptors that were opened after pledge(2). (diff) | |
| download | wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.tar.xz wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.zip | |
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h')
| -rw-r--r-- | gnu/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 114 |
1 files changed, 48 insertions, 66 deletions
diff --git a/gnu/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/gnu/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 78ee9a16202..2ae0b418a91 100644 --- a/gnu/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/gnu/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -1,4 +1,4 @@ -//===-- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework ------*- C++ -*--===// +//===- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -14,40 +14,52 @@ #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H +#include "AddressPool.h" #include "DbgValueHistoryCalculator.h" #include "DebugHandlerBase.h" #include "DebugLocStream.h" #include "DwarfAccelTable.h" #include "DwarfFile.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/MapVector.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" -#include "llvm/CodeGen/DIE.h" -#include "llvm/CodeGen/LexicalScopes.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/BinaryFormat/Dwarf.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/IR/DebugInfo.h" +#include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DebugLoc.h" +#include "llvm/IR/Metadata.h" #include "llvm/MC/MCDwarf.h" -#include "llvm/MC/MachineLocation.h" #include "llvm/Support/Allocator.h" #include "llvm/Target/TargetOptions.h" +#include <cassert> +#include <cstdint> +#include <limits> #include <memory> +#include <utility> +#include <vector> namespace llvm { class AsmPrinter; class ByteStreamer; -class ConstantInt; -class ConstantFP; class DebugLocEntry; +class DIE; class DwarfCompileUnit; -class DwarfDebug; class DwarfTypeUnit; class DwarfUnit; -class MachineModuleInfo; +class LexicalScope; +class MachineFunction; +class MCSection; +class MCSymbol; +class MDNode; +class Module; //===----------------------------------------------------------------------===// /// This class is used to track local variable information. @@ -89,7 +101,7 @@ public: assert(!MInsn && "Already initialized?"); assert((!E || E->isValid()) && "Expected valid expression"); - assert(FI != INT_MAX && "Expected valid index"); + assert(FI != std::numeric_limits<int>::max() && "Expected valid index"); FrameIndexExprs.push_back({FI, E}); } @@ -111,10 +123,12 @@ public: // Accessors. const DILocalVariable *getVariable() const { return Var; } const DILocation *getInlinedAt() const { return IA; } + const DIExpression *getSingleExpression() const { assert(MInsn && FrameIndexExprs.size() <= 1); return FrameIndexExprs.size() ? FrameIndexExprs[0].Expr : nullptr; } + void setDIE(DIE &D) { TheDIE = &D; } DIE *getDIE() const { return TheDIE; } void setDebugLocListIndex(unsigned O) { DebugLocListIndex = O; } @@ -124,30 +138,7 @@ public: /// Get the FI entries, sorted by fragment offset. ArrayRef<FrameIndexExpr> getFrameIndexExprs() const; bool hasFrameIndexExprs() const { return !FrameIndexExprs.empty(); } - - void addMMIEntry(const DbgVariable &V) { - assert(DebugLocListIndex == ~0U && !MInsn && "not an MMI entry"); - assert(V.DebugLocListIndex == ~0U && !V.MInsn && "not an MMI entry"); - assert(V.Var == Var && "conflicting variable"); - assert(V.IA == IA && "conflicting inlined-at location"); - - assert(!FrameIndexExprs.empty() && "Expected an MMI entry"); - assert(!V.FrameIndexExprs.empty() && "Expected an MMI entry"); - - if (FrameIndexExprs.size()) { - auto *Expr = FrameIndexExprs.back().Expr; - // Get rid of duplicate non-fragment entries. More than one non-fragment - // dbg.declare makes no sense so ignore all but the first. - if (!Expr || !Expr->isFragment()) - return; - } - FrameIndexExprs.append(V.FrameIndexExprs.begin(), V.FrameIndexExprs.end()); - assert(all_of(FrameIndexExprs, - [](FrameIndexExpr &FIE) { - return FIE.Expr && FIE.Expr->isFragment(); - }) && - "conflicting locations for variable"); - } + void addMMIEntry(const DbgVariable &V); // Translate tag to proper Dwarf tag. dwarf::Tag getTag() const { @@ -157,6 +148,7 @@ public: return dwarf::DW_TAG_variable; } + /// Return true if DbgVariable is artificial. bool isArtificial() const { if (Var->isArtificial()) @@ -182,6 +174,7 @@ public: "Invalid Expr for DBG_VALUE"); return !FrameIndexExprs.empty(); } + bool isBlockByrefVariable() const; const DIType *getType() const; @@ -191,10 +184,10 @@ private: } }; - /// Helper used to pair up a symbol and its DWARF compile unit. struct SymbolCU { SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {} + const MCSymbol *Sym; DwarfCompileUnit *CU; }; @@ -230,7 +223,7 @@ class DwarfDebug : public DebugHandlerBase { ProcessedSPNodes; /// If nonnull, stores the current machine function we're processing. - const MachineFunction *CurFn; + const MachineFunction *CurFn = nullptr; /// If nonnull, stores the CU in which the previous subprogram was contained. const DwarfCompileUnit *PrevCU; @@ -296,17 +289,7 @@ class DwarfDebug : public DebugHandlerBase { DwarfAccelTable AccelTypes; // Identify a debugger for "tuning" the debug info. - DebuggerKind DebuggerTuning; - - /// \defgroup DebuggerTuning Predicates to tune DWARF for a given debugger. - /// - /// Returns whether we are "tuning" for a given debugger. - /// Should be used only within the constructor, to set feature flags. - /// @{ - bool tuneForGDB() const { return DebuggerTuning == DebuggerKind::GDB; } - bool tuneForLLDB() const { return DebuggerTuning == DebuggerKind::LLDB; } - bool tuneForSCE() const { return DebuggerTuning == DebuggerKind::SCE; } - /// @} + DebuggerKind DebuggerTuning = DebuggerKind::Default; MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &); @@ -314,7 +297,7 @@ class DwarfDebug : public DebugHandlerBase { return InfoHolder.getUnits(); } - typedef DbgValueHistoryMap::InlinedVariable InlinedVariable; + using InlinedVariable = DbgValueHistoryMap::InlinedVariable; void ensureAbstractVariableIsCreated(DwarfCompileUnit &CU, InlinedVariable Var, const MDNode *Scope); @@ -358,21 +341,12 @@ class DwarfDebug : public DebugHandlerBase { /// Emit type dies into a hashed accelerator table. void emitAccelTypes(); - /// Emit visible names into a debug pubnames section. - /// \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); + /// Emit visible names and types into debug pubnames and pubtypes sections. + void emitDebugPubSections(); - /// Emit visible types into a debug pubtypes section. - /// \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); - - void emitDebugPubSection( - bool GnuStyle, MCSection *PSec, StringRef Name, - const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const); + void emitDebugPubSection(bool GnuStyle, StringRef Name, + DwarfCompileUnit *TheU, + const StringMap<const DIE *> &Globals); /// Emit null-terminated strings into a debug str section. void emitDebugStr(); @@ -561,11 +535,19 @@ public: /// going to be null. bool isLexicalScopeDIENull(LexicalScope *Scope); - bool hasDwarfPubSections(bool includeMinimalInlineScopes) const; - /// Find the matching DwarfCompileUnit for the given CU DIE. DwarfCompileUnit *lookupCU(const DIE *Die) { return CUDieMap.lookup(Die); } + + /// \defgroup DebuggerTuning Predicates to tune DWARF for a given debugger. + /// + /// Returns whether we are "tuning" for a given debugger. + /// @{ + bool tuneForGDB() const { return DebuggerTuning == DebuggerKind::GDB; } + bool tuneForLLDB() const { return DebuggerTuning == DebuggerKind::LLDB; } + bool tuneForSCE() const { return DebuggerTuning == DebuggerKind::SCE; } + /// @} }; -} // End of namespace llvm -#endif +} // end namespace llvm + +#endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H |
