xref: /llvm-project/llvm/test/DebugInfo/X86/debug_addr.ll (revision a73d354024f668b30dc828366a40c50dab8b4159)
1; RUN: llc -split-dwarf-file=test.dwo -dwarf-version=4 %s -mtriple=i386-unknown-linux-gnu -filetype=obj -o - -minimize-addr-in-v5=Disabled | \
2; RUN: llvm-dwarfdump -v - | FileCheck %s -check-prefix=DWARF4
3
4; RUN: llc -split-dwarf-file=test.dwo -dwarf-version=5 %s -mtriple=i386-unknown-linux-gnu -filetype=obj -o - -minimize-addr-in-v5=Disabled | \
5; RUN: llvm-dwarfdump -v - | FileCheck %s -check-prefix=DWARF5
6
7; Source:
8; void foo() {
9; }
10;
11; void bar() {
12;   foo();
13; }
14
15; DWARF4: .debug_info contents:
16; DWARF4: Compile Unit:{{.*}}version = 0x0004
17; DWARF4-NOT: Compile Unit
18; DWARF4: DW_TAG_compile_unit
19; DWARF4-NOT: DW_TAG_{{.*}}
20; DWARF4: DW_AT_GNU_dwo_name{{.*}}test.dwo
21; DWARF4: DW_AT_GNU_addr_base{{.*}}0x00000000
22; DWARF4: DW_TAG_GNU_call_site
23; DWARF4:   DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000002) address = 0x00000018 ".text")
24; DWARF4: .debug_addr contents:
25; DWARF4-NEXT: Addrs: [
26; DWARF4-NEXT: 0x00000000
27; DWARF4-NEXT: 0x00000010
28; DWARF4-NEXT: 0x00000018
29; DWARF4-NEXT: ]
30
31; DWARF5: .debug_info contents:
32; DWARF5: Compile Unit:{{.*}}version = 0x0005
33; DWARF5-NOT: Compile Unit
34; DWARF5: DW_TAG_skeleton_unit
35; DWARF5-NOT: DW_TAG_{{.*}}
36; DWARF5: DW_AT_dwo_name{{.*}}test.dwo
37; DWARF5: DW_AT_addr_base{{.*}}0x00000008
38; DWARF5: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x00000000 ".text")
39; DWARF5: DW_AT_call_return_pc [DW_FORM_addrx] (indexed (00000002) address = 0x00000018 ".text")
40; DWARF5: .debug_addr contents:
41; DWARF5-NEXT: 0x00000000: Address table header: length = 0x00000010, format = DWARF32, version = 0x0005, addr_size = 0x04, seg_size = 0x00
42; DWARF5-NEXT: Addrs: [
43; DWARF5-NEXT: 0x00000000
44; DWARF5-NEXT: 0x00000010
45; DWARF5-NEXT: 0x00000018
46; DWARF5-NEXT: ]
47
48; ModuleID = './test.c'
49source_filename = "./test.c"
50target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
51target triple = "i386-unknown-linux-gnu"
52
53; Function Attrs: noinline nounwind optnone
54define void @foo() #0 !dbg !8 {
55entry:
56  ret void, !dbg !12
57}
58
59; Function Attrs: noinline nounwind optnone
60define void @bar() #0 !dbg !13 {
61entry:
62  call void @foo(), !dbg !14
63  ret void, !dbg !14
64}
65
66attributes #0 = { noinline nounwind optnone }
67
68!llvm.dbg.cu = !{!0}
69!llvm.module.flags = !{!3, !4, !5, !6}
70!llvm.ident = !{!7}
71
72!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.1", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
73!1 = !DIFile(filename: "test.c", directory: "/tmp")
74!2 = !{}
75!3 = !{i32 1, !"NumRegisterParameters", i32 0}
76!4 = !{i32 2, !"Dwarf Version", i32 5}
77!5 = !{i32 2, !"Debug Info Version", i32 3}
78!6 = !{i32 1, !"wchar_size", i32 4}
79!7 = !{!"clang version 6.0.1"}
80!8 = distinct !DISubprogram(name: "foo", scope: !9, file: !9, line: 1, type: !10, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0)
81!9 = !DIFile(filename: "./test.c", directory: "/tmp")
82!10 = !DISubroutineType(types: !11)
83!11 = !{null}
84!12 = !DILocation(line: 2, column: 3, scope: !8)
85!13 = distinct !DISubprogram(name: "bar", scope: !9, file: !9, line: 5, type: !10, isLocal: false, isDefinition: true, flags: DIFlagAllCallsDescribed, scopeLine: 5, isOptimized: false, unit: !0)
86!14 = !DILocation(line: 6, column: 3, scope: !13)
87