[llvm] r323084 - [BinaryFormat] Add .debug_names support
Pavel Labath via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 22 01:41:37 PST 2018
Author: labath
Date: Mon Jan 22 01:41:36 2018
New Revision: 323084
URL: http://llvm.org/viewvc/llvm-project?rev=323084&view=rev
Log:
[BinaryFormat] Add .debug_names support
Summary:
This adds a definition of the .debug_names section and the new constants
(DW_IDX_???) which are used in it.
Reviewers: JDevlieghere, aprantl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42296
Modified:
llvm/trunk/include/llvm/BinaryFormat/Dwarf.def
llvm/trunk/include/llvm/BinaryFormat/Dwarf.h
llvm/trunk/lib/BinaryFormat/Dwarf.cpp
Modified: llvm/trunk/include/llvm/BinaryFormat/Dwarf.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/Dwarf.def?rev=323084&r1=323083&r2=323084&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Dwarf.def (original)
+++ llvm/trunk/include/llvm/BinaryFormat/Dwarf.def Mon Jan 22 01:41:36 2018
@@ -12,15 +12,15 @@
//===----------------------------------------------------------------------===//
// TODO: Add other DW-based macros.
-#if !(defined HANDLE_DW_TAG || defined HANDLE_DW_AT || \
- defined HANDLE_DW_FORM || defined HANDLE_DW_OP || \
- defined HANDLE_DW_LANG || defined HANDLE_DW_ATE || \
- defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
- defined HANDLE_DW_CC || defined HANDLE_DW_LNS || \
- defined HANDLE_DW_LNE || defined HANDLE_DW_LNCT || \
- defined HANDLE_DW_MACRO || defined HANDLE_DW_RLE || \
- defined HANDLE_DW_CFA || defined HANDLE_DW_APPLE_PROPERTY || \
- defined HANDLE_DW_UT || defined HANDLE_DWARF_SECTION)
+#if !( \
+ defined HANDLE_DW_TAG || defined HANDLE_DW_AT || defined HANDLE_DW_FORM || \
+ defined HANDLE_DW_OP || defined HANDLE_DW_LANG || defined HANDLE_DW_ATE || \
+ defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
+ defined HANDLE_DW_CC || defined HANDLE_DW_LNS || defined HANDLE_DW_LNE || \
+ defined HANDLE_DW_LNCT || defined HANDLE_DW_MACRO || \
+ defined HANDLE_DW_RLE || defined HANDLE_DW_CFA || \
+ defined HANDLE_DW_APPLE_PROPERTY || defined HANDLE_DW_UT || \
+ defined HANDLE_DWARF_SECTION || defined HANDLE_DW_IDX)
#error "Missing macro definition of HANDLE_DW*"
#endif
@@ -96,6 +96,10 @@
#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME)
#endif
+#ifndef HANDLE_DW_IDX
+#define HANDLE_DW_IDX(ID, NAME)
+#endif
+
HANDLE_DW_TAG(0x0000, null, 2, DWARF)
HANDLE_DW_TAG(0x0001, array_type, 2, DWARF)
HANDLE_DW_TAG(0x0002, class_type, 2, DWARF)
@@ -839,6 +843,7 @@ HANDLE_DWARF_SECTION(DebugLine, ".debug_
HANDLE_DWARF_SECTION(DebugLoc, ".debug_loc", "debug-loc")
HANDLE_DWARF_SECTION(DebugFrame, ".debug_frame", "debug-frame")
HANDLE_DWARF_SECTION(DebugMacro, ".debug_macro", "debug-macro")
+HANDLE_DWARF_SECTION(DebugNames, ".debug_names", "debug-names")
HANDLE_DWARF_SECTION(DebugRanges, ".debug_ranges", "debug-ranges")
HANDLE_DWARF_SECTION(DebugPubnames, ".debug_pubnames", "debug-pubnames")
HANDLE_DWARF_SECTION(DebugPubtypes, ".debug_pubtypes", "debug-pubtypes")
@@ -855,6 +860,12 @@ HANDLE_DWARF_SECTION(AppleNamespaces, ".
HANDLE_DWARF_SECTION(AppleObjC, ".apple_objc", "apple-objc")
HANDLE_DWARF_SECTION(GdbIndex, ".gdb_index", "gdb-index")
+HANDLE_DW_IDX(0x01, compile_unit)
+HANDLE_DW_IDX(0x02, type_unit)
+HANDLE_DW_IDX(0x03, die_offset)
+HANDLE_DW_IDX(0x04, parent)
+HANDLE_DW_IDX(0x05, type_hash)
+
#undef HANDLE_DW_TAG
#undef HANDLE_DW_AT
@@ -874,3 +885,4 @@ HANDLE_DWARF_SECTION(GdbIndex, ".gdb_ind
#undef HANDLE_DW_APPLE_PROPERTY
#undef HANDLE_DW_UT
#undef HANDLE_DWARF_SECTION
+#undef HANDLE_DW_IDX
Modified: llvm/trunk/include/llvm/BinaryFormat/Dwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/Dwarf.h?rev=323084&r1=323083&r2=323084&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Dwarf.h (original)
+++ llvm/trunk/include/llvm/BinaryFormat/Dwarf.h Mon Jan 22 01:41:36 2018
@@ -325,6 +325,13 @@ enum UnitType : unsigned char {
DW_UT_hi_user = 0xff
};
+enum Index {
+#define HANDLE_DW_IDX(ID, NAME) DW_IDX_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_IDX_lo_user = 0x2000,
+ DW_IDX_hi_user = 0x3fff
+};
+
inline bool isUnitType(uint8_t UnitType) {
switch (UnitType) {
case DW_UT_compile:
@@ -420,6 +427,7 @@ StringRef UnitTypeString(unsigned);
StringRef AtomTypeString(unsigned Atom);
StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind);
StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
+StringRef IndexString(unsigned Idx);
/// @}
/// \defgroup DwarfConstantsParsing Dwarf constants parsing functions
Modified: llvm/trunk/lib/BinaryFormat/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/BinaryFormat/Dwarf.cpp?rev=323084&r1=323083&r2=323084&view=diff
==============================================================================
--- llvm/trunk/lib/BinaryFormat/Dwarf.cpp (original)
+++ llvm/trunk/lib/BinaryFormat/Dwarf.cpp Mon Jan 22 01:41:36 2018
@@ -567,6 +567,17 @@ StringRef llvm::dwarf::AttributeValueStr
return StringRef();
}
+StringRef llvm::dwarf::IndexString(unsigned Idx) {
+ switch (Idx) {
+ default:
+ return StringRef();
+#define HANDLE_DW_IDX(ID, NAME) \
+ case DW_IDX_##NAME: \
+ return "DW_IDX_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version,
bool ExtensionsOk) {
if (FormVendor(F) == DWARF_VENDOR_DWARF) {
More information about the llvm-commits
mailing list