Eric Christopher | 420569b | 2014-02-20 02:50:45 +0000 | [diff] [blame^] | 1 | ; RUN: llc -split-dwarf=Enable -generate-cu-hash -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t |
Eli Bendersky | e6abe83 | 2013-01-25 21:44:53 +0000 | [diff] [blame] | 2 | ; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s |
Eric Christopher | 55863be | 2013-04-07 03:43:09 +0000 | [diff] [blame] | 3 | ; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=OBJ %s |
Eric Christopher | 9c2ecd9 | 2012-11-30 23:59:06 +0000 | [diff] [blame] | 4 | |
| 5 | @a = common global i32 0, align 4 |
| 6 | |
| 7 | !llvm.dbg.cu = !{!0} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 8 | !llvm.module.flags = !{!9} |
Eric Christopher | 9c2ecd9 | 2012-11-30 23:59:06 +0000 | [diff] [blame] | 9 | |
David Blaikie | 5e390e4 | 2014-02-04 01:23:52 +0000 | [diff] [blame] | 10 | !0 = metadata !{i32 786449, metadata !8, i32 12, metadata !"clang version 3.3 (trunk 169021) (llvm/trunk 169020)", i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !1, metadata !3, metadata !1, metadata !"baz.dwo"} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/tmp/baz.c] [DW_LANG_C99] |
| 11 | !1 = metadata !{} |
David Blaikie | 33111df | 2013-02-02 05:56:24 +0000 | [diff] [blame] | 12 | !3 = metadata !{metadata !5} |
David Blaikie | 47922fb | 2013-03-11 22:37:40 +0000 | [diff] [blame] | 13 | !5 = metadata !{i32 786484, i32 0, null, metadata !"a", metadata !"a", metadata !"", metadata !6, i32 1, metadata !7, i32 0, i32 1, i32* @a, null} ; [ DW_TAG_variable ] [a] [line 1] [def] |
David Blaikie | 5692e72 | 2013-03-28 02:44:59 +0000 | [diff] [blame] | 14 | !6 = metadata !{i32 786473, metadata !8} ; [ DW_TAG_file_type ] |
| 15 | !7 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] |
David Blaikie | 8fb8224 | 2013-03-17 21:13:55 +0000 | [diff] [blame] | 16 | !8 = metadata !{metadata !"baz.c", metadata !"/usr/local/google/home/echristo/tmp"} |
Eric Christopher | 9c2ecd9 | 2012-11-30 23:59:06 +0000 | [diff] [blame] | 17 | |
| 18 | ; Check that the skeleton compile unit contains the proper attributes: |
| 19 | ; This DIE has the following attributes: DW_AT_comp_dir, DW_AT_stmt_list, |
| 20 | ; DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges, DW_AT_dwo_name, DW_AT_dwo_id, |
| 21 | ; DW_AT_ranges_base, DW_AT_addr_base. |
| 22 | |
Eric Christopher | 6a421a9 | 2013-02-05 07:32:00 +0000 | [diff] [blame] | 23 | ; CHECK: .debug_abbrev contents: |
| 24 | ; CHECK: Abbrev table for offset: 0x00000000 |
| 25 | ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_no |
David Blaikie | 38fe634 | 2014-01-09 04:28:46 +0000 | [diff] [blame] | 26 | ; CHECK: DW_AT_stmt_list DW_FORM_sec_offset |
Eric Christopher | 6a421a9 | 2013-02-05 07:32:00 +0000 | [diff] [blame] | 27 | ; CHECK: DW_AT_GNU_dwo_name DW_FORM_strp |
Eric Christopher | 6a421a9 | 2013-02-05 07:32:00 +0000 | [diff] [blame] | 28 | ; CHECK: DW_AT_GNU_addr_base DW_FORM_sec_offset |
Eric Christopher | 6a421a9 | 2013-02-05 07:32:00 +0000 | [diff] [blame] | 29 | ; CHECK: DW_AT_comp_dir DW_FORM_strp |
Eric Christopher | 60eb769 | 2013-08-12 20:27:48 +0000 | [diff] [blame] | 30 | ; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8 |
Eric Christopher | d866720 | 2013-12-30 17:22:27 +0000 | [diff] [blame] | 31 | ; CHECK: DW_AT_low_pc DW_FORM_addr |
Eric Christopher | 6a421a9 | 2013-02-05 07:32:00 +0000 | [diff] [blame] | 32 | |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 33 | ; Check that we're using the right forms. |
| 34 | ; CHECK: .debug_abbrev.dwo contents: |
| 35 | ; CHECK: Abbrev table for offset: 0x00000000 |
| 36 | ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_yes |
| 37 | ; CHECK: DW_AT_producer DW_FORM_GNU_str_index |
| 38 | ; CHECK: DW_AT_language DW_FORM_data2 |
| 39 | ; CHECK: DW_AT_name DW_FORM_GNU_str_index |
Eric Christopher | 52ce718 | 2013-04-09 19:23:15 +0000 | [diff] [blame] | 40 | ; CHECK-NOT: DW_AT_low_pc |
| 41 | ; CHECK-NOT: DW_AT_stmt_list |
| 42 | ; CHECK-NOT: DW_AT_comp_dir |
Eric Christopher | 7a2cdf7 | 2013-02-05 07:31:55 +0000 | [diff] [blame] | 43 | ; CHECK: DW_AT_GNU_dwo_id DW_FORM_data8 |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 44 | |
Manman Ren | f6b936b | 2013-10-29 05:49:41 +0000 | [diff] [blame] | 45 | ; CHECK: [2] DW_TAG_variable DW_CHILDREN_no |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 46 | ; CHECK: DW_AT_name DW_FORM_GNU_str_index |
| 47 | ; CHECK: DW_AT_type DW_FORM_ref4 |
| 48 | ; CHECK: DW_AT_external DW_FORM_flag_present |
| 49 | ; CHECK: DW_AT_decl_file DW_FORM_data1 |
| 50 | ; CHECK: DW_AT_decl_line DW_FORM_data1 |
Eric Christopher | 4a74104 | 2014-02-16 08:46:55 +0000 | [diff] [blame] | 51 | ; CHECK: DW_AT_location DW_FORM_exprloc |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 52 | |
Manman Ren | f6b936b | 2013-10-29 05:49:41 +0000 | [diff] [blame] | 53 | ; CHECK: [3] DW_TAG_base_type DW_CHILDREN_no |
| 54 | ; CHECK: DW_AT_name DW_FORM_GNU_str_index |
| 55 | ; CHECK: DW_AT_encoding DW_FORM_data1 |
| 56 | ; CHECK: DW_AT_byte_size DW_FORM_data1 |
| 57 | |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 58 | ; CHECK: .debug_info contents: |
| 59 | ; CHECK: DW_TAG_compile_unit |
David Blaikie | 38fe634 | 2014-01-09 04:28:46 +0000 | [diff] [blame] | 60 | ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000) |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 61 | ; CHECK: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo") |
| 62 | ; CHECK: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000000) |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 63 | ; CHECK: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000008] = "/usr/local/google/home/echristo/tmp") |
Eric Christopher | 420569b | 2014-02-20 02:50:45 +0000 | [diff] [blame^] | 64 | ; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x1f1f859683d49324) |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 65 | ; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) |
| 66 | |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 67 | ; Check that the rest of the compile units have information. |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 68 | ; CHECK: .debug_info.dwo contents: |
| 69 | ; CHECK: DW_TAG_compile_unit |
Eric Christopher | 2cbd576 | 2013-01-07 19:32:41 +0000 | [diff] [blame] | 70 | ; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000000) string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)") |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 71 | ; CHECK: DW_AT_language [DW_FORM_data2] (0x000c) |
Eric Christopher | 2cbd576 | 2013-01-07 19:32:41 +0000 | [diff] [blame] | 72 | ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000001) string = "baz.c") |
Eric Christopher | 52ce718 | 2013-04-09 19:23:15 +0000 | [diff] [blame] | 73 | ; CHECK-NOT: DW_AT_low_pc |
| 74 | ; CHECK-NOT: DW_AT_stmt_list |
| 75 | ; CHECK-NOT: DW_AT_comp_dir |
Eric Christopher | 420569b | 2014-02-20 02:50:45 +0000 | [diff] [blame^] | 76 | ; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x1f1f859683d49324) |
Eric Christopher | da4b219 | 2013-01-02 23:52:13 +0000 | [diff] [blame] | 77 | ; CHECK: DW_TAG_variable |
Eric Christopher | 52ce718 | 2013-04-09 19:23:15 +0000 | [diff] [blame] | 78 | ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000002) string = "a") |
Manman Ren | f6b936b | 2013-10-29 05:49:41 +0000 | [diff] [blame] | 79 | ; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[TYPE:0x[0-9a-f]*]]}) |
Eric Christopher | e9ec245 | 2013-01-18 22:11:33 +0000 | [diff] [blame] | 80 | ; CHECK: DW_AT_external [DW_FORM_flag_present] (true) |
| 81 | ; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01) |
| 82 | ; CHECK: DW_AT_decl_line [DW_FORM_data1] (0x01) |
Eric Christopher | 4a74104 | 2014-02-16 08:46:55 +0000 | [diff] [blame] | 83 | ; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x2> fb 00 ) |
Manman Ren | f6b936b | 2013-10-29 05:49:41 +0000 | [diff] [blame] | 84 | ; CHECK: [[TYPE]]: DW_TAG_base_type |
| 85 | ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000003) string = "int") |
Eric Christopher | e9ec245 | 2013-01-18 22:11:33 +0000 | [diff] [blame] | 86 | |
David Blaikie | 622dce4 | 2014-01-08 23:29:59 +0000 | [diff] [blame] | 87 | ; CHECK: .debug_str contents: |
| 88 | ; CHECK: 0x00000000: "baz.dwo" |
| 89 | ; CHECK: 0x00000008: "/usr/local/google/home/echristo/tmp" |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 90 | |
| 91 | ; CHECK: .debug_str.dwo contents: |
| 92 | ; CHECK: 0x00000000: "clang version 3.3 (trunk 169021) (llvm/trunk 169020)" |
| 93 | ; CHECK: 0x00000035: "baz.c" |
Eric Christopher | 52ce718 | 2013-04-09 19:23:15 +0000 | [diff] [blame] | 94 | ; CHECK: 0x0000003b: "a" |
| 95 | ; CHECK: 0x0000003d: "int" |
Eric Christopher | 962c908 | 2013-01-15 23:56:56 +0000 | [diff] [blame] | 96 | |
| 97 | ; CHECK: .debug_str_offsets.dwo contents: |
| 98 | ; CHECK: 0x00000000: 00000000 |
| 99 | ; CHECK: 0x00000004: 00000035 |
| 100 | ; CHECK: 0x00000008: 0000003b |
Eric Christopher | 52ce718 | 2013-04-09 19:23:15 +0000 | [diff] [blame] | 101 | ; CHECK: 0x0000000c: 0000003d |
Eric Christopher | 55863be | 2013-04-07 03:43:09 +0000 | [diff] [blame] | 102 | |
| 103 | ; Object file checks |
| 104 | ; For x86-64-linux we should have this set of relocations for the debug info section |
| 105 | ; |
| 106 | ; OBJ: .debug_info |
| 107 | ; OBJ-NEXT: R_X86_64_32 .debug_abbrev |
David Blaikie | 38fe634 | 2014-01-09 04:28:46 +0000 | [diff] [blame] | 108 | ; OBJ-NEXT: R_X86_64_32 .debug_line |
Eric Christopher | 55863be | 2013-04-07 03:43:09 +0000 | [diff] [blame] | 109 | ; OBJ-NEXT: R_X86_64_32 .debug_str |
| 110 | ; OBJ-NEXT: R_X86_64_32 .debug_addr |
Eric Christopher | 55863be | 2013-04-07 03:43:09 +0000 | [diff] [blame] | 111 | ; OBJ-NEXT: R_X86_64_32 .debug_str |
| 112 | ; OBJ-NEXT: } |
Eric Christopher | d866720 | 2013-12-30 17:22:27 +0000 | [diff] [blame] | 113 | |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 114 | !9 = metadata !{i32 1, metadata !"Debug Info Version", i32 1} |