1; This checks that .debug_pubnames and .debug_pubtypes can be generated in the DWARF64 format.
2
3; RUN: llc -mtriple=x86_64 -dwarf64 -filetype=obj %s -o %t
4; RUN: llvm-dwarfdump -debug-info -debug-pubnames -debug-pubtypes %t | FileCheck %s
5
6; CHECK:      .debug_info contents:
7; CHECK:      0x[[VAR:.+]]:    DW_TAG_variable
8; CHECK-NEXT:                    DW_AT_name ("foo")
9; CHECK:      0x[[STRUCT:.+]]: DW_TAG_structure_type
10; CHECK-NEXT:                    DW_AT_name ("Foo")
11; CHECK:      0x[[BASET:.+]]:  DW_TAG_base_type
12; CHECK-NEXT:                    DW_AT_name ("int")
13
14; CHECK:      .debug_pubnames contents:
15; CHECK-NEXT: length = 0x0000000000000026, format = DWARF64, version = 0x0002, unit_offset =
16; CHECK-NEXT: Offset     Name
17; CHECK-NEXT: 0x00000000[[VAR]] "foo"
18
19; CHECK:      .debug_pubtypes contents:
20; CHECK-NEXT: length = 0x0000000000000032, format = DWARF64, version = 0x0002, unit_offset =
21; CHECK-NEXT: Offset     Name
22; CHECK-NEXT: 0x00000000[[STRUCT]] "Foo"
23; CHECK-NEXT: 0x00000000[[BASET]] "int"
24
25; IR generated and reduced from:
26; $ cat foo.c
27; struct Foo { int bar; };
28; struct Foo foo;
29; $ clang -g -gpubnames -S -emit-llvm foo.c -o foo.ll
30
31target triple = "x86_64-unknown-linux-gnu"
32
33%struct.Foo = type { i32 }
34
35@foo = dso_local global %struct.Foo zeroinitializer, align 4, !dbg !0
36
37!llvm.dbg.cu = !{!2}
38!llvm.module.flags = !{!10, !11, !12}
39!llvm.ident = !{!13}
40
41!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
42!1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 2, type: !6, isLocal: false, isDefinition: true)
43!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)
44!3 = !DIFile(filename: "foo.c", directory: "/tmp")
45!4 = !{}
46!5 = !{!0}
47!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !3, line: 1, size: 32, elements: !7)
48!7 = !{!8}
49!8 = !DIDerivedType(tag: DW_TAG_member, name: "bar", scope: !6, file: !3, line: 1, baseType: !9, size: 32)
50!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
51!10 = !{i32 7, !"Dwarf Version", i32 4}
52!11 = !{i32 2, !"Debug Info Version", i32 3}
53!12 = !{i32 1, !"wchar_size", i32 4}
54!13 = !{!"clang version 12.0.0"}
55