[llvm] r217186 - [ dwarfdump ] Add symbolic dump of known DWARF attribute values.
Frederic Riss
friss at apple.com
Thu Sep 4 12:39:21 PDT 2014
Author: friss
Date: Thu Sep 4 14:39:20 2014
New Revision: 217186
URL: http://llvm.org/viewvc/llvm-project?rev=217186&view=rev
Log:
[ dwarfdump ] Add symbolic dump of known DWARF attribute values.
Reviewed By: dblaikie
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5187
Modified:
llvm/trunk/include/llvm/Support/Dwarf.h
llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp
llvm/trunk/lib/Support/Dwarf.cpp
llvm/trunk/test/DebugInfo/X86/debug-info-access.ll
llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll
llvm/trunk/test/DebugInfo/X86/empty-and-one-elem-array.ll
llvm/trunk/test/DebugInfo/X86/empty-array.ll
llvm/trunk/test/DebugInfo/X86/fission-cu.ll
llvm/trunk/test/DebugInfo/X86/nondefault-subrange-array.ll
llvm/trunk/test/Linker/type-unique-simple2-a.ll
Modified: llvm/trunk/include/llvm/Support/Dwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.h (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.h Thu Sep 4 14:39:20 2014
@@ -950,6 +950,10 @@ private:
};
};
+/// Returns the symbolic string representing Val when used as a value
+/// for attribute Attr.
+const char *AttributeValueString(uint16_t Attr, unsigned Val);
+
} // End of namespace dwarf
} // End of namespace llvm
Modified: llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFDebugInfoEntry.cpp Thu Sep 4 14:39:20 2014
@@ -86,7 +86,17 @@ void DWARFDebugInfoEntryMinimal::dumpAtt
return;
OS << "\t(";
- formValue.dump(OS, u);
+
+ const char *Name = nullptr;
+ if (Optional<uint64_t> Val = formValue.getAsUnsignedConstant())
+ Name = AttributeValueString(attr, *Val);
+
+ if (Name) {
+ OS << Name;
+ } else {
+ formValue.dump(OS, u);
+ }
+
OS << ")\n";
}
Modified: llvm/trunk/lib/Support/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Dwarf.cpp (original)
+++ llvm/trunk/lib/Support/Dwarf.cpp Thu Sep 4 14:39:20 2014
@@ -795,3 +795,34 @@ const char *llvm::dwarf::GDBIndexEntryLi
}
llvm_unreachable("Unknown GDBIndexEntryLinkage value");
}
+
+const char *llvm::dwarf::AttributeValueString(uint16_t Attr, unsigned Val) {
+ switch (Attr) {
+ case DW_AT_accessibility:
+ return AccessibilityString(Val);
+ case DW_AT_virtuality:
+ return VirtualityString(Val);
+ case DW_AT_language:
+ return LanguageString(Val);
+ case DW_AT_encoding:
+ return AttributeEncodingString(Val);
+ case DW_AT_decimal_sign:
+ return DecimalSignString(Val);
+ case DW_AT_endianity:
+ return EndianityString(Val);
+ case DW_AT_visibility:
+ return VisibilityString(Val);
+ case DW_AT_identifier_case:
+ return CaseString(Val);
+ case DW_AT_calling_convention:
+ return ConventionString(Val);
+ case DW_AT_inline:
+ return InlineCodeString(Val);
+ case DW_AT_ordering:
+ return ArrayOrderString(Val);
+ case DW_AT_discr_value:
+ return DiscriminantString(Val);
+ }
+
+ return nullptr;
+}
Modified: llvm/trunk/test/DebugInfo/X86/debug-info-access.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-info-access.ll?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-info-access.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-info-access.ll Thu Sep 4 14:39:20 2014
@@ -46,22 +46,22 @@
;
; CHECK: DW_TAG_inheritance
; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_accessibility {{.*}}(0x01)
+; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public)
;
; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}}"public_static")
; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_accessibility {{.*}}(0x01)
+; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public)
;
; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name {{.*}}"pub")
; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_accessibility {{.*}}(0x01)
+; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_public)
;
; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name {{.*}}"prot")
; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_accessibility {{.*}}(0x02)
+; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_protected)
;
; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name {{.*}}"priv_default")
@@ -71,7 +71,7 @@
; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}}"union_priv")
; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_accessibility {{.*}}(0x03)
+; CHECK: DW_AT_accessibility {{.*}}(DW_ACCESS_private)
;
; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name {{.*}}"union_pub_default")
Modified: llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-info-static-member.ll Thu Sep 4 14:39:20 2014
@@ -101,33 +101,33 @@ declare void @llvm.dbg.declare(metadata,
; PRESENT-NEXT: DW_AT_name {{.*}} "a"
; PRESENT: DW_AT_external
; PRESENT: DW_AT_declaration
-; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x03)
+; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_private)
; PRESENT: DW_TAG_member
; PRESENT-NEXT: DW_AT_name {{.*}} "const_a"
; PRESENT: DW_AT_external
; PRESENT: DW_AT_declaration
-; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x03)
+; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_private)
; PRESENT: DW_AT_const_value {{.*}} (1)
; PRESENT: 0x[[DECL_B:[0-9a-f]+]]: DW_TAG_member
; PRESENT-NEXT: DW_AT_name {{.*}} "b"
-; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x02)
+; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_protected)
; PRESENT: DW_TAG_member
; PRESENT-NEXT: DW_AT_name {{.*}} "const_b"
-; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x02)
+; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_protected)
; PRESENT: DW_AT_const_value [DW_FORM_udata] (1078523331)
; PRESENT: 0x[[DECL_C:[0-9a-f]+]]: DW_TAG_member
; PRESENT-NEXT: DW_AT_name {{.*}} "c"
-; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x01)
+; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
; PRESENT: DW_TAG_member
; PRESENT-NEXT: DW_AT_name {{.*}} "const_c"
-; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x01)
+; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
; PRESENT: DW_AT_const_value {{.*}} (18)
; While we're here, a normal member has data_member_location and
; accessibility attributes.
; PRESENT: DW_TAG_member
; PRESENT-NEXT: DW_AT_name {{.*}} "d"
; PRESENT: DW_AT_data_member_location
-; PRESENT: DW_AT_accessibility [DW_FORM_data1] (0x01)
+; PRESENT: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
; PRESENT: NULL
; Definitions point back to their declarations, and have a location.
; PRESENT: DW_TAG_variable
@@ -151,33 +151,33 @@ declare void @llvm.dbg.declare(metadata,
; DARWINP-NEXT: DW_AT_name {{.*}} "a"
; DARWINP: DW_AT_external
; DARWINP: DW_AT_declaration
-; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x03)
+; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_private)
; DARWINP: DW_TAG_member
; DARWINP-NEXT: DW_AT_name {{.*}} "const_a"
; DARWINP: DW_AT_external
; DARWINP: DW_AT_declaration
-; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x03)
+; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_private)
; DARWINP: DW_AT_const_value {{.*}} (1)
; DARWINP: 0x[[DECL_B:[0-9a-f]+]]: DW_TAG_member
; DARWINP-NEXT: DW_AT_name {{.*}} "b"
-; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x02)
+; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_protected)
; DARWINP: DW_TAG_member
; DARWINP-NEXT: DW_AT_name {{.*}} "const_b"
-; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x02)
+; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_protected)
; DARWINP: DW_AT_const_value [DW_FORM_udata] (1078523331)
; DARWINP: 0x[[DECL_C:[0-9a-f]+]]: DW_TAG_member
; DARWINP-NEXT: DW_AT_name {{.*}} "c"
-; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x01)
+; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
; DARWINP: DW_TAG_member
; DARWINP-NEXT: DW_AT_name {{.*}} "const_c"
-; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x01)
+; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
; DARWINP: DW_AT_const_value {{.*}} (18)
; While we're here, a normal member has data_member_location and
; accessibility attributes.
; DARWINP: DW_TAG_member
; DARWINP-NEXT: DW_AT_name {{.*}} "d"
; DARWINP: DW_AT_data_member_location
-; DARWINP: DW_AT_accessibility [DW_FORM_data1] (0x01)
+; DARWINP: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
; DARWINP: NULL
; Definitions point back to their declarations, and have a location.
; DARWINP: DW_TAG_variable
Modified: llvm/trunk/test/DebugInfo/X86/empty-and-one-elem-array.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/empty-and-one-elem-array.ll?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/empty-and-one-elem-array.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/empty-and-one-elem-array.ll Thu Sep 4 14:39:20 2014
@@ -30,7 +30,7 @@ declare void @llvm.dbg.declare(metadata,
; CHECK: DW_TAG_base_type
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "int")
-; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x05)
+; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (DW_ATE_signed)
; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04)
; int foo::b[1]:
Modified: llvm/trunk/test/DebugInfo/X86/empty-array.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/empty-array.ll?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/empty-array.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/empty-array.ll Thu Sep 4 14:39:20 2014
@@ -22,7 +22,7 @@
; CHECK: [[BASE2]]: DW_TAG_base_type
; CHECK-NEXT: DW_AT_name
; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x08)
-; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x07)
+; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (DW_ATE_unsigned)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!21}
Modified: llvm/trunk/test/DebugInfo/X86/fission-cu.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-cu.ll?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/fission-cu.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/fission-cu.ll Thu Sep 4 14:39:20 2014
@@ -65,7 +65,7 @@
; CHECK: .debug_info.dwo contents:
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000000) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
-; CHECK: DW_AT_language [DW_FORM_data2] (0x000c)
+; CHECK: DW_AT_language [DW_FORM_data2] (DW_LANG_C99)
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000001) string = "baz.c")
; CHECK-NOT: DW_AT_low_pc
; CHECK-NOT: DW_AT_stmt_list
Modified: llvm/trunk/test/DebugInfo/X86/nondefault-subrange-array.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/nondefault-subrange-array.ll?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/nondefault-subrange-array.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/nondefault-subrange-array.ll Thu Sep 4 14:39:20 2014
@@ -25,7 +25,7 @@
; CHECK: [[BASE2]]: DW_TAG_base_type
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "sizetype")
; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x08)
-; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x07)
+; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (DW_ATE_unsigned)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!21}
Modified: llvm/trunk/test/Linker/type-unique-simple2-a.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/type-unique-simple2-a.ll?rev=217186&r1=217185&r2=217186&view=diff
==============================================================================
--- llvm/trunk/test/Linker/type-unique-simple2-a.ll (original)
+++ llvm/trunk/test/Linker/type-unique-simple2-a.ll Thu Sep 4 14:39:20 2014
@@ -19,7 +19,7 @@
; }
;
; CHECK: _ZN1A6setFooEv
-; CHECK: DW_AT_accessibility [DW_FORM_data1] (0x01)
+; CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
; CHECK-NOT: DW_AT_accessibility
; CHECK: DW_TAG
More information about the llvm-commits
mailing list