[llvm] r345203 - Make llvm-dwarfdump -name work on type units.
Paul Robinson via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 24 14:51:55 PDT 2018
Author: probinson
Date: Wed Oct 24 14:51:55 2018
New Revision: 345203
URL: http://llvm.org/viewvc/llvm-project?rev=345203&view=rev
Log:
Make llvm-dwarfdump -name work on type units.
Differential Revision: https://reviews.llvm.org/D53672
Added:
llvm/trunk/test/tools/llvm-dwarfdump/X86/typeunit-name.s
Modified:
llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
Added: llvm/trunk/test/tools/llvm-dwarfdump/X86/typeunit-name.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/typeunit-name.s?rev=345203&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/typeunit-name.s (added)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/typeunit-name.s Wed Oct 24 14:51:55 2018
@@ -0,0 +1,100 @@
+# Demonstrate that -name works with type units.
+# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
+# RUN: llvm-dwarfdump -name=V4_type_unit -name=V5_split_type_unit %t.o | FileCheck %s
+#
+# The names should appear twice, once for the unit and once for the type DIE,
+# because we give them the same name.
+# CHECK: V4_type_unit
+# CHECK: V4_type_unit
+# CHECK: V5_split_type_unit
+# CHECK: V5_split_type_unit
+
+ .section .debug_str,"MS", at progbits,1
+str_TU_4:
+ .asciz "V4_type_unit"
+
+ .section .debug_str.dwo,"MS", at progbits,1
+dwo_TU_5:
+ .asciz "V5_split_type_unit"
+
+# Abbrev section for the normal type unit.
+ .section .debug_abbrev,"", at progbits
+ .byte 0x01 # Abbrev code
+ .byte 0x41 # DW_TAG_type_unit
+ .byte 0x01 # DW_CHILDREN_yes
+ .byte 0x03 # DW_AT_name
+ .byte 0x0e # DW_FORM_strp
+ .byte 0x00 # EOM(1)
+ .byte 0x00 # EOM(2)
+ .byte 0x02 # Abbrev code
+ .byte 0x13 # DW_TAG_structure_type
+ .byte 0x00 # DW_CHILDREN_no (no members)
+ .byte 0x03 # DW_AT_name
+ .byte 0x0e # DW_FORM_strp
+ .byte 0x00 # EOM(1)
+ .byte 0x00 # EOM(2)
+ .byte 0x00 # EOM(3)
+
+# And a .dwo copy for the .dwo section.
+ .section .debug_abbrev.dwo,"", at progbits
+ .byte 0x01 # Abbrev code
+ .byte 0x41 # DW_TAG_type_unit
+ .byte 0x01 # DW_CHILDREN_yes
+ .byte 0x03 # DW_AT_name
+ .byte 0x0e # DW_FORM_strp
+ .byte 0x00 # EOM(1)
+ .byte 0x00 # EOM(2)
+ .byte 0x02 # Abbrev code
+ .byte 0x13 # DW_TAG_structure_type
+ .byte 0x00 # DW_CHILDREN_no (no members)
+ .byte 0x03 # DW_AT_name
+ .byte 0x0e # DW_FORM_strp
+ .byte 0x00 # EOM(1)
+ .byte 0x00 # EOM(2)
+ .byte 0x00 # EOM(3)
+
+ .section .debug_types,"", at progbits
+
+# DWARF v4 Type unit header. Normal/split are identical so we do only one.
+TU_4_start:
+ .long TU_4_end-TU_4_version # Length of Unit
+TU_4_version:
+ .short 4 # DWARF version number
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .quad 0x0011223344556677 # Type Signature
+ .long TU_4_type-TU_4_start # Type offset
+# The type-unit DIE, which has a name.
+ .byte 1
+ .long str_TU_4
+# The type DIE, which has the same name.
+TU_4_type:
+ .byte 2
+ .long str_TU_4
+ .byte 0 # NULL
+ .byte 0 # NULL
+TU_4_end:
+
+ .section .debug_types.dwo,"", at progbits
+# FIXME: DWARF v5 wants type units in .debug_info[.dwo] not .debug_types[.dwo].
+
+# DWARF v5 split type unit header.
+TU_split_5_start:
+ .long TU_split_5_end-TU_split_5_version # Length of Unit
+TU_split_5_version:
+ .short 5 # DWARF version number
+ .byte 6 # DWARF Unit Type
+ .byte 8 # Address Size (in bytes)
+ .long .debug_abbrev.dwo # Offset Into Abbrev. Section
+ .quad 0x8899aabbccddeeff # Type Signature
+ .long TU_split_5_type-TU_split_5_start # Type offset
+# The type-unit DIE, which has a name.
+ .byte 1
+ .long dwo_TU_5
+# The type DIE, which has the same name.
+TU_split_5_type:
+ .byte 2
+ .long dwo_TU_5
+ .byte 0 # NULL
+ .byte 0 # NULL
+TU_split_5_end:
Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=345203&r1=345202&r2=345203&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Wed Oct 24 14:51:55 2018
@@ -422,8 +422,8 @@ static bool dumpObjectFile(ObjectFile &O
for (auto name : Name)
Names.insert((IgnoreCase && !UseRegex) ? StringRef(name).lower() : name);
- filterByName(Names, DICtx.compile_units(), OS);
- filterByName(Names, DICtx.dwo_compile_units(), OS);
+ filterByName(Names, DICtx.normal_units(), OS);
+ filterByName(Names, DICtx.dwo_units(), OS);
return true;
}
More information about the llvm-commits
mailing list