xref: /llvm-project/llvm/test/DebugInfo/X86/debug-addr-dwarf64.ll (revision 00ce54689d30fd65c49ebc87a21841e834f2d086)
1*00ce5468SIgor Kudrin; This checks that .debug_addr can be generated in the DWARF64 format.
2*00ce5468SIgor Kudrin
3*00ce5468SIgor Kudrin; RUN: llc -mtriple=x86_64 -dwarf-version=5 -dwarf64 -filetype=obj %s -o %t
4*00ce5468SIgor Kudrin; RUN: llvm-dwarfdump -debug-info -debug-addr %t | FileCheck %s
5*00ce5468SIgor Kudrin
6*00ce5468SIgor Kudrin; CHECK:      .debug_info contents:
7*00ce5468SIgor Kudrin; CHECK:      DW_TAG_compile_unit
8*00ce5468SIgor Kudrin; CHECK:        DW_AT_addr_base (0x0000000000000010)
9*00ce5468SIgor Kudrin
10*00ce5468SIgor Kudrin; CHECK:      .debug_addr contents:
11*00ce5468SIgor Kudrin; CHECK-NEXT: Address table header: length = 0x0000000000000014, format = DWARF64, version = 0x0005, addr_size = 0x08, seg_size = 0x00
12*00ce5468SIgor Kudrin; CHECK-NEXT: Addrs: [
13*00ce5468SIgor Kudrin; CHECK-NEXT: 0x0000000000000000
14*00ce5468SIgor Kudrin; CHECK-NEXT: 0x0000000000000004
15*00ce5468SIgor Kudrin; CHECK-NEXT: ]
16*00ce5468SIgor Kudrin
17*00ce5468SIgor Kudrin; IR generated and reduced from:
18*00ce5468SIgor Kudrin; $ cat foo.c
19*00ce5468SIgor Kudrin; int foo;
20*00ce5468SIgor Kudrin; int bar;
21*00ce5468SIgor Kudrin; $ clang -g -S -emit-llvm foo.c -o foo.ll
22*00ce5468SIgor Kudrin
23*00ce5468SIgor Kudrintarget triple = "x86_64-unknown-linux-gnu"
24*00ce5468SIgor Kudrin
25*00ce5468SIgor Kudrin@foo = dso_local global i32 0, align 4, !dbg !0
26*00ce5468SIgor Kudrin@bar = dso_local global i32 0, align 4, !dbg !6
27*00ce5468SIgor Kudrin
28*00ce5468SIgor Kudrin!llvm.dbg.cu = !{!2}
29*00ce5468SIgor Kudrin!llvm.module.flags = !{!9, !10, !11}
30*00ce5468SIgor Kudrin!llvm.ident = !{!12}
31*00ce5468SIgor Kudrin
32*00ce5468SIgor Kudrin!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
33*00ce5468SIgor Kudrin!1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 1, type: !8, isLocal: false, isDefinition: true)
34*00ce5468SIgor Kudrin!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, nameTableKind: None)
35*00ce5468SIgor Kudrin!3 = !DIFile(filename: "foo.c", directory: "/tmp")
36*00ce5468SIgor Kudrin!4 = !{}
37*00ce5468SIgor Kudrin!5 = !{!0, !6}
38*00ce5468SIgor Kudrin!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
39*00ce5468SIgor Kudrin!7 = distinct !DIGlobalVariable(name: "bar", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: true)
40*00ce5468SIgor Kudrin!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
41*00ce5468SIgor Kudrin!9 = !{i32 7, !"Dwarf Version", i32 4}
42*00ce5468SIgor Kudrin!10 = !{i32 2, !"Debug Info Version", i32 3}
43*00ce5468SIgor Kudrin!11 = !{i32 1, !"wchar_size", i32 4}
44*00ce5468SIgor Kudrin!12 = !{!"clang version 12.0.0"}
45