1 ; This checks that .debug_names can be generated in the DWARF64 format.
3 ; RUN: llc -mtriple=x86_64 -dwarf64 -accel-tables=Dwarf -dwarf-version=5 -filetype=obj %s -o %t
4 ; RUN: llvm-dwarfdump -debug-info -debug-names %t | FileCheck %s
5 ; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
7 ; CHECK: .debug_info contents:
8 ; CHECK-NEXT: 0x00000000: Compile Unit: {{.+}}, format = DWARF64,
9 ; CHECK: [[VARDIE:.+]]: DW_TAG_variable
10 ; CHECK-NEXT: DW_AT_name ("foo")
11 ; CHECK: [[TYPEDIE:.+]]: DW_TAG_base_type
12 ; CHECK-NEXT: DW_AT_name ("int")
14 ; CHECK: .debug_names contents:
15 ; CHECK-NEXT: Name Index @ 0x0 {
16 ; CHECK-NEXT: Header {
17 ; CHECK: Format: DWARF64
18 ; CHECK-NEXT: Version: 5
19 ; CHECK-NEXT: CU count: 1
20 ; CHECK-NEXT: Local TU count: 0
21 ; CHECK-NEXT: Foreign TU count: 0
22 ; CHECK-NEXT: Bucket count: 2
23 ; CHECK-NEXT: Name count: 2
25 ; CHECK-NEXT: Compilation Unit offsets [
26 ; CHECK-NEXT: CU[0]: 0x00000000
28 ; CHECK-NEXT: Abbreviations [
29 ; CHECK-NEXT: Abbreviation 0x34 {
30 ; CHECK-NEXT: Tag: DW_TAG_variable
31 ; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
33 ; CHECK-NEXT: Abbreviation 0x24 {
34 ; CHECK-NEXT: Tag: DW_TAG_base_type
35 ; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
38 ; CHECK-NEXT: Bucket 0 [
39 ; CHECK-NEXT: Name 1 {
40 ; CHECK-NEXT: Hash: 0xB888030
41 ; CHECK-NEXT: String: {{.+}} "int"
42 ; CHECK-NEXT: Entry @ {{.+}} {
43 ; CHECK-NEXT: Abbrev: 0x24
44 ; CHECK-NEXT: Tag: DW_TAG_base_type
45 ; CHECK-NEXT: DW_IDX_die_offset: [[TYPEDIE]]
49 ; CHECK-NEXT: Bucket 1 [
50 ; CHECK-NEXT: Name 2 {
51 ; CHECK-NEXT: Hash: 0xB887389
52 ; CHECK-NEXT: String: {{.+}} "foo"
53 ; CHECK-NEXT: Entry @ {{.+}} {
54 ; CHECK-NEXT: Abbrev: 0x34
55 ; CHECK-NEXT: Tag: DW_TAG_variable
56 ; CHECK-NEXT: DW_IDX_die_offset: [[VARDIE]]
64 ; IR generated and reduced from:
67 ; $ clang -g -gpubnames -S -emit-llvm foo.c -o foo.ll
69 target triple = "x86_64-unknown-linux-gnu"
71 @foo = dso_local global i32 0, align 4, !dbg !0
74 !llvm.module.flags = !{!7, !8, !9}
77 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
78 !1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
79 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false)
80 !3 = !DIFile(filename: "foo.c", directory: "/tmp")
83 !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
84 !7 = !{i32 7, !"Dwarf Version", i32 4}
85 !8 = !{i32 2, !"Debug Info Version", i32 3}
86 !9 = !{i32 1, !"wchar_size", i32 4}
87 !10 = !{!"clang version 12.0.0"}