summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorAlexey Lapshin <a.v.lapshin@mail.ru>2020-01-09 16:02:50 +0300
committerAlexey Lapshin <a.v.lapshin@mail.ru>2020-01-13 23:33:25 +0300
commitf163755eb0a86508d3bfe1822b7f635952b66104 (patch)
tree8d2600c2bd514a9cd5194b4c20a7d5e3f422d4ef /llvm/include
parentd0aad9f56e1588effa94b15804b098e6307da6b4 (diff)
downloadbcm5719-llvm-f163755eb0a86508d3bfe1822b7f635952b66104.tar.gz
bcm5719-llvm-f163755eb0a86508d3bfe1822b7f635952b66104.zip
[Dsymutil][Debuginfo][NFC] #3 Refactor dsymutil to separate DWARF optimizing part.
Summary: This is the next portion of patches for dsymutil. Create DwarfEmitter interface to generate all debug info tables. Put DwarfEmitter into DwarfLinker library and make tools/dsymutil/DwarfStreamer to be child of DwarfEmitter. It passes check-all testing. MD5 checksum for clang .dSYM bundle matches for the dsymutil with/without that patch. Reviewers: JDevlieghere, friss, dblaikie, aprantl Reviewed By: JDevlieghere Subscribers: merge_guards_bot, hiraditya, thegameg, probinson, llvm-commits Tags: #llvm, #debug-info Differential Revision: https://reviews.llvm.org/D72476
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/DWARFLinker/DWARFLinker.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
index 218c9641bfb..80df01ca053 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -9,10 +9,12 @@
#ifndef LLVM_DWARFLINKER_DWARFLINKER_H
#define LLVM_DWARFLINKER_DWARFLINKER_H
+#include "llvm/CodeGen/AccelTable.h"
#include "llvm/CodeGen/NonRelocatableStringpool.h"
#include "llvm/DWARFLinker/DWARFLinkerDeclContext.h"
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
+#include "llvm/MC/MCDwarf.h"
#include <map>
namespace llvm {
@@ -81,6 +83,116 @@ public:
virtual void clear() = 0;
};
+/// DwarfEmitter presents interface to generate all debug info tables.
+class DwarfEmitter {
+public:
+ virtual ~DwarfEmitter();
+
+ /// Emit DIE containing warnings.
+ virtual void emitPaperTrailWarningsDie(const Triple &Triple, DIE &Die) = 0;
+
+ /// Emit section named SecName with content equals to
+ /// corresponding section in Obj.
+ virtual void emitSectionContents(const object::ObjectFile &Obj,
+ StringRef SecName) = 0;
+
+ /// Emit the abbreviation table \p Abbrevs to the debug_abbrev section.
+ virtual void
+ emitAbbrevs(const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs,
+ unsigned DwarfVersion) = 0;
+
+ /// Emit the string table described by \p Pool.
+ virtual void emitStrings(const NonRelocatableStringpool &Pool) = 0;
+
+ /// Emit DWARF debug names.
+ virtual void
+ emitDebugNames(AccelTable<DWARF5AccelTableStaticData> &Table) = 0;
+
+ /// Emit Apple namespaces accelerator table.
+ virtual void
+ emitAppleNamespaces(AccelTable<AppleAccelTableStaticOffsetData> &Table) = 0;
+
+ /// Emit Apple names accelerator table.
+ virtual void
+ emitAppleNames(AccelTable<AppleAccelTableStaticOffsetData> &Table) = 0;
+
+ /// Emit Apple Objective-C accelerator table.
+ virtual void
+ emitAppleObjc(AccelTable<AppleAccelTableStaticOffsetData> &Table) = 0;
+
+ /// Emit Apple type accelerator table.
+ virtual void
+ emitAppleTypes(AccelTable<AppleAccelTableStaticTypeData> &Table) = 0;
+
+ /// Emit debug_ranges for \p FuncRange by translating the
+ /// original \p Entries.
+ virtual void emitRangesEntries(
+ int64_t UnitPcOffset, uint64_t OrigLowPc,
+ const FunctionIntervals::const_iterator &FuncRange,
+ const std::vector<DWARFDebugRangeList::RangeListEntry> &Entries,
+ unsigned AddressSize) = 0;
+
+ /// Emit debug_aranges entries for \p Unit and if \p DoRangesSection is true,
+ /// also emit the debug_ranges entries for the DW_TAG_compile_unit's
+ /// DW_AT_ranges attribute.
+ virtual void emitUnitRangesEntries(CompileUnit &Unit,
+ bool DoRangesSection) = 0;
+
+ /// Copy the debug_line over to the updated binary while unobfuscating the
+ /// file names and directories.
+ virtual void translateLineTable(DataExtractor LineData, uint64_t Offset) = 0;
+
+ /// Emit the line table described in \p Rows into the debug_line section.
+ virtual void emitLineTableForUnit(MCDwarfLineTableParams Params,
+ StringRef PrologueBytes,
+ unsigned MinInstLength,
+ std::vector<DWARFDebugLine::Row> &Rows,
+ unsigned AdddressSize) = 0;
+
+ /// Emit the .debug_pubnames contribution for \p Unit.
+ virtual void emitPubNamesForUnit(const CompileUnit &Unit) = 0;
+
+ /// Emit the .debug_pubtypes contribution for \p Unit.
+ virtual void emitPubTypesForUnit(const CompileUnit &Unit) = 0;
+
+ /// Emit a CIE.
+ virtual void emitCIE(StringRef CIEBytes) = 0;
+
+ /// Emit an FDE with data \p Bytes.
+ virtual void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint32_t Address,
+ StringRef Bytes) = 0;
+
+ /// Emit the debug_loc contribution for \p Unit by copying the entries from
+ /// \p Dwarf and offsetting them. Update the location attributes to point to
+ /// the new entries.
+ virtual void emitLocationsForUnit(
+ const CompileUnit &Unit, DWARFContext &Dwarf,
+ std::function<void(StringRef, SmallVectorImpl<uint8_t> &)>
+ ProcessExpr) = 0;
+
+ /// Emit the compilation unit header for \p Unit in the
+ /// debug_info section.
+ ///
+ /// As a side effect, this also switches the current Dwarf version
+ /// of the MC layer to the one of U.getOrigUnit().
+ virtual void emitCompileUnitHeader(CompileUnit &Unit) = 0;
+
+ /// Recursively emit the DIE tree rooted at \p Die.
+ virtual void emitDIE(DIE &Die) = 0;
+
+ /// Returns size of generated .debug_line section.
+ virtual uint64_t getLineSectionSize() const = 0;
+
+ /// Returns size of generated .debug_frame section.
+ virtual uint64_t getFrameSectionSize() const = 0;
+
+ /// Returns size of generated .debug_ranges section.
+ virtual uint64_t getRangesSectionSize() const = 0;
+
+ /// Returns size of generated .debug_info section.
+ virtual uint64_t getDebugInfoSectionSize() const = 0;
+};
+
} // end namespace llvm
#endif // LLVM_DWARFLINKER_DWARFLINKER_H
OpenPOWER on IntegriCloud