[PATCH] D112151: [llvm-dwarfdump] Add a test for --summarize-types

Owen Reynolds via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 20 09:21:40 PDT 2021


gbreynoo created this revision.
gbreynoo added reviewers: MaskRay, dblaikie, Higuoxing, jhenderson.
Herald added a subscriber: cmtice.
gbreynoo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I could not find a test for --summarize-types, this change adds one.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112151

Files:
  llvm/test/tools/llvm-dwarfdump/X86/summarize-types.s


Index: llvm/test/tools/llvm-dwarfdump/X86/summarize-types.s
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-dwarfdump/X86/summarize-types.s
@@ -0,0 +1,53 @@
+## Demonstrate that --summarize-types abbreviates output of type information
+# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
+
+# RUN: llvm-dwarfdump --debug-types %t.o | FileCheck %s
+# RUN: llvm-dwarfdump --debug-types --summarize-types %t.o | \
+# RUN: FileCheck %s --check-prefix=SUMMARIZED --match-full-lines
+
+# CHECK: .debug_types contents:
+# CHECK-NEXT: 0x00000000: Type Unit:
+# CHECK-SAME: length = 0x0000001a
+# CHECK-SAME: format = DWARF32
+# CHECK-SAME: version = 0x0004
+# CHECK-SAME: abbr_offset = 0x0000
+# CHECK-SAME: addr_size = 0x08
+# CHECK-SAME: name = 'foo'
+# CHECK-SAME: type_signature = 0x0011223344556677
+# CHECK-SAME: type_offset = 0x0017 (next unit at 0x0000001e)
+# CHECK: DW_AT_name ("foo")
+
+# SUMMARIZED: .debug_types contents:
+# SUMMARIZED-NEXT: name = 'foo', type_signature = 0x0011223344556677, length = 0x0000001a
+# SUMMARIZED-NOT: DW_AT_name ("foo")
+
+    .section .debug_str,"MS", at progbits,1
+.Lfoo:
+    .asciz  "foo"
+    
+    .section .debug_abbrev,"", at progbits
+    .byte 0x01  # Abbrev code
+    .byte 0x36  # DW_TAG_base_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
+.Lstart:
+    .long  .Lend-.Lversion   # Length of Unit
+.Lversion:
+    .short 4                 # DWARF version number
+    .long .debug_abbrev      # Offset Into Abbrev. Section
+    .byte 8                  # Address Size (in bytes)
+    .quad 0x0011223344556677 # Type Signature
+    .long .Ltype-.Lstart     # Type offset
+.Ltype:
+    .byte 1
+    .long .Lfoo
+    .byte 0
+    .byte 0
+.Lend:
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112151.380988.patch
Type: text/x-patch
Size: 1950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211020/85e1c277/attachment.bin>


More information about the llvm-commits mailing list