brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.4 KiB · c2a9714 Raw
270 lines · plain
1# RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o %t.o2# RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=COMMON %s3#4# Test object to verify dwarfdump handles v5 string offset tables in Mach-O.5# This is similar to dwarfdump-str-offsets.s with 2 CUs and 1 TU, but no6# split sections.7#8	.section	__DWARF,__debug_str,regular,debug9Linfo_string:10	.asciz "Handmade DWARF producer"11str_CU1:12        .asciz "Compile_Unit_1"13str_CU1_dir:14        .asciz "/home/test/CU1"15str_CU2:16        .asciz "Compile_Unit_2"17str_CU2_dir:18        .asciz "/home/test/CU2"19str_TU:20        .asciz "Type_Unit"21str_TU_type:22        .asciz "MyStruct"23str_Subprogram:24        .asciz "MyFunc"25str_Variable1:26        .asciz "MyVar1"27str_Variable2:28        .asciz "MyVar2"29str_Variable3:30        .asciz "MyVar3"31 32	.section	__DWARF,__debug_str_offs,regular,debug33Ldebug_str_offsets:34        .long Ldebug_str_offsets_segment0_end-Ldebug_str_offsets_base0+435        .short 5    # DWARF version36        .short 0    # Padding37Ldebug_str_offsets_base0:38        .long str_producer39        .long str_CU140        .long str_CU1_dir41        .long str_Subprogram42        .long str_Variable143        .long str_Variable244        .long str_Variable345Ldebug_str_offsets_segment0_end:46# A 4-byte gap.47        .long 048# CU2's contribution (DWARF64 format)49        .long 0xffffffff50        .quad Ldebug_str_offsets_segment1_end-Ldebug_str_offsets_base1+451        .short 5    # DWARF version52        .short 0    # Padding53Ldebug_str_offsets_base1:54        .quad str_producer55        .quad str_CU256        .quad str_CU2_dir57Ldebug_str_offsets_segment1_end:58# The TU's contribution59        .long Ldebug_str_offsets_segment2_end-Ldebug_str_offsets_base2+460        .short 5    # DWARF version61        .short 0    # Padding62Ldebug_str_offsets_base2:63        .long str_TU64        .long str_TU_type65Ldebug_str_offsets_segment2_end:66 67	.section	__DWARF,__debug_abbrev,regular,debug68Lsection_abbrev:69        .byte 0x01  # Abbrev code70        .byte 0x11  # DW_TAG_compile_unit71        .byte 0x01  # DW_CHILDREN_yes72        .byte 0x25  # DW_AT_producer73        .byte 0x1a  # DW_FORM_strx74        .byte 0x03  # DW_AT_name75        .byte 0x1a  # DW_FORM_strx76        .byte 0x72  # DW_AT_str_offsets_base77        .byte 0x17  # DW_FORM_sec_offset78        .byte 0x1b  # DW_AT_comp_dir79        .byte 0x1a  # DW_FORM_strx80        .byte 0x00  # EOM(1)81        .byte 0x00  # EOM(2)82        .byte 0x02  # Abbrev code83        .byte 0x41  # DW_TAG_type_unit84        .byte 0x01  # DW_CHILDREN_yes85        .byte 0x03  # DW_AT_name86        .byte 0x1a  # DW_FORM_strx87        .byte 0x72  # DW_AT_str_offsets_base88        .byte 0x17  # DW_FORM_sec_offset89        .byte 0x00  # EOM(1)90        .byte 0x00  # EOM(2)91        .byte 0x03  # Abbrev code92        .byte 0x13  # DW_TAG_structure_type93        .byte 0x00  # DW_CHILDREN_no (no members)94        .byte 0x03  # DW_AT_name95        .byte 0x1a  # DW_FORM_strx96        .byte 0x00  # EOM(1)97        .byte 0x00  # EOM(2)98        .byte 0x04  # Abbrev code99        .byte 0x2e  # DW_TAG_subprogram100        .byte 0x01  # DW_CHILDREN_yes101        .byte 0x03  # DW_AT_name102        .byte 0x25  # DW_FORM_strx1103        .byte 0x00  # EOM(1)104        .byte 0x00  # EOM(2)105        .byte 0x05  # Abbrev code106        .byte 0x34  # DW_TAG_variable107        .byte 0x00  # DW_CHILDREN_no108        .byte 0x03  # DW_AT_name109        .byte 0x26  # DW_FORM_strx2110        .byte 0x00  # EOM(1)111        .byte 0x00  # EOM(2)112        .byte 0x06  # Abbrev code113        .byte 0x34  # DW_TAG_variable114        .byte 0x00  # DW_CHILDREN_no115        .byte 0x03  # DW_AT_name116        .byte 0x27  # DW_FORM_strx3117        .byte 0x00  # EOM(1)118        .byte 0x00  # EOM(2)119        .byte 0x07  # Abbrev code120        .byte 0x34  # DW_TAG_variable121        .byte 0x00  # DW_CHILDREN_no122        .byte 0x03  # DW_AT_name123        .byte 0x28  # DW_FORM_strx4124        .byte 0x00  # EOM(1)125        .byte 0x00  # EOM(2)126        .byte 0x00  # EOM(3)127 128	.section	__DWARF,__debug_info,regular,debug129Lsection_info:130# DWARF v5 CU header.131        .long  CU1_5_end-CU1_5_version  # Length of Unit132CU1_5_version:133        .short 5               # DWARF version number134        .byte 1                # DWARF Unit Type135        .byte 8                # Address Size (in bytes)136        .long 0                # Offset Into Abbrev. Section137# The compile-unit DIE, which has a DW_AT_producer, DW_AT_name,138# DW_AT_str_offsets and DW_AT_compdir.139        .byte 1                # Abbreviation code140        .byte 0                # The index of the producer string141        .byte 1                # The index of the CU name string142        .long Ldebug_str_offsets_base0-Ldebug_str_offsets143        .byte 2                # The index of the comp dir string144# A subprogram DIE with DW_AT_name, using DW_FORM_strx1.145        .byte 4                # Abbreviation code146        .byte 3                # Subprogram name string (DW_FORM_strx1)147# A variable DIE with DW_AT_name, using DW_FORM_strx2.148        .byte 5                # Abbreviation code149        .short 0x0004          # Subprogram name string (DW_FORM_strx2)150# A variable DIE with DW_AT_name, using DW_FORM_strx3.151        .byte 6                # Abbreviation code152        .byte 5                # Subprogram name string (DW_FORM_strx3)153        .short 0               # Subprogram name string (DW_FORM_strx3)154# A variable DIE with DW_AT_name, using DW_FORM_strx4.155        .byte 7                # Abbreviation code156        .quad 0x00000006       # Subprogram name string (DW_FORM_strx4)157        .byte 0 # NULL158        .byte 0 # NULL159        .byte 0 # NULL160CU1_5_end:161 162# DWARF v5 CU header163        .long  0xffffffff164        .quad  CU2_5_end-CU2_5_version  # Length of Unit165CU2_5_version:166        .short 5               # DWARF version number167        .byte 1                # DWARF Unit Type168        .byte 8                # Address Size (in bytes)169        .quad 0                # Offset Into Abbrev. Section170# The compile-unit DIE, which has a DW_AT_producer, DW_AT_name,171# DW_AT_str_offsets and DW_AT_compdir.172        .byte 1                # Abbreviation code173        .byte 0                # The index of the producer string174        .byte 1                # The index of the CU name string175        .quad Ldebug_str_offsets_base1-Ldebug_str_offsets176        .byte 2                # The index of the comp dir string177        .byte 0 # NULL178CU2_5_end:179 180	.section	__DWARF,__debug_types,regular,debug181# DWARF v5 Type unit header.182TU_5_start:183        .long  TU_5_end-TU_5_version  # Length of Unit184TU_5_version:185        .short 5               # DWARF version number186        .byte 2                # DWARF Unit Type187        .byte 8                # Address Size (in bytes)188        .long 0                # Offset Into Abbrev. Section189        .quad 0x0011223344556677 # Type Signature190        .long TU_5_type-TU_5_start # Type offset191# The type-unit DIE, which has a name.192        .byte 2                # Abbreviation code193        .byte 0                # Index of the unit type name string194        .long Ldebug_str_offsets_base2-Ldebug_str_offsets  # offset into the str_offsets section195# The type DIE, which has a name.196TU_5_type:197        .byte 3                # Abbreviation code198        .byte 1                # Index of the type name string199        .byte 0 # NULL200        .byte 0 # NULL201TU_5_end:202 203 204.subsections_via_symbols205 206# We are using a hand-constructed object file and are interest in the correct207# diplay of the DW_str_offsetsbase attribute and the correct display of strings.208#209# Abbreviation for DW_AT_str_offsets_base210# COMMON:      .debug_abbrev contents:211# COMMON-NOT:  contents:212# COMMON:      DW_TAG_compile_unit213# COMMON-NOT:  DW_TAG214# COMMON:      DW_AT_str_offsets_base DW_FORM_sec_offset215# 216# Verify that strings are displayed correctly as indexed strings217# COMMON:      .debug_info contents:218# COMMON-NOT:  contents:     219# COMMON:      DW_TAG_compile_unit220# COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")221# COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_1")222# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)223# COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU1")224# COMMON-NOT:  NULL225# COMMON:      DW_TAG_subprogram226# COMMON-NEXT: DW_AT_name [DW_FORM_strx1] (indexed (00000003) string = "MyFunc")227# COMMON-NOT:  NULL228# COMMON:      DW_TAG_variable229# COMMON-NEXT: DW_AT_name [DW_FORM_strx2] (indexed (00000004) string = "MyVar1")230# COMMON-NOT:  NULL231# COMMON:      DW_TAG_variable232# COMMON-NEXT: DW_AT_name [DW_FORM_strx3] (indexed (00000005) string = "MyVar2")233# COMMON-NOT:  NULL234# COMMON:      DW_TAG_variable235# COMMON-NEXT: DW_AT_name [DW_FORM_strx4] (indexed (00000006) string = "MyVar3")236# 237# Second compile unit (b.cpp)238# COMMON:      DW_TAG_compile_unit239# COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")240# COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_2")241# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000000000000038)242# COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU2")243# 244# The type unit245# COMMON:      .debug_types contents:246# COMMON:      DW_TAG_type_unit247# COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000000) string = "Type_Unit")248# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset]       (0x00000058)249# COMMON:      DW_TAG_structure_type250# COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "MyStruct")251# 252# The .debug_str_offsets section253# COMMON:      .debug_str_offsets contents:254# COMMON-NEXT: 0x00000000: Contribution size = 32, Format = DWARF32, Version = 5255# COMMON-NEXT: 0x00000008: 00000000 "Handmade DWARF producer"256# COMMON-NEXT: 0x0000000c: 00000018 "Compile_Unit_1"257# COMMON-NEXT: 0x00000010: 00000027 "/home/test/CU1"258# COMMON-NEXT: 0x00000014: 00000067 "MyFunc"259# COMMON-NEXT: 0x00000018: 0000006e "MyVar1"260# COMMON-NEXT: 0x0000001c: 00000075 "MyVar2"261# COMMON-NEXT: 0x00000020: 0000007c "MyVar3"262# COMMON-NEXT: 0x00000024: Gap, length = 4263# COMMON-NEXT: 0x00000028: Contribution size = 28, Format = DWARF64, Version = 5264# COMMON-NEXT: 0x00000038: 0000000000000000 "Handmade DWARF producer"265# COMMON-NEXT: 0x00000040: 0000000000000036 "Compile_Unit_2"266# COMMON-NEXT: 0x00000048: 0000000000000045 "/home/test/CU2"267# COMMON-NEXT: 0x00000050: Contribution size = 12, Format = DWARF32, Version = 5268# COMMON-NEXT: 0x00000058: 00000054 "Type_Unit"269# COMMON-NEXT: 0x0000005c: 0000005e "MyStruct"270