xref: /llvm-project/llvm/test/DebugInfo/X86/debug-macro-dwarf64.ll (revision 7e1e4e81cbcac6156005a31d90b604714c92298c)
1*7e1e4e81SIgor Kudrin; This checks that .debug_macro[.dwo] can be generated in the DWARF64 format.
2*7e1e4e81SIgor Kudrin
3*7e1e4e81SIgor Kudrin; RUN: llc -mtriple=x86_64 -dwarf-version=4 -dwarf64 -use-gnu-debug-macro -filetype=obj %s -o %t
4*7e1e4e81SIgor Kudrin; RUN: llvm-dwarfdump -debug-macro %t | FileCheck %s --check-prefix=DWARF4
5*7e1e4e81SIgor Kudrin
6*7e1e4e81SIgor Kudrin; RUN: llc -mtriple=x86_64 -dwarf-version=5 -dwarf64 -filetype=obj %s -o %t
7*7e1e4e81SIgor Kudrin; RUN: llvm-dwarfdump -debug-macro %t | FileCheck %s --check-prefix=DWARF5
8*7e1e4e81SIgor Kudrin
9*7e1e4e81SIgor Kudrin; RUN: llc -mtriple=x86_64 -dwarf-version=5 -dwarf64 -split-dwarf-file=foo.dwo -filetype=obj %s -o %t
10*7e1e4e81SIgor Kudrin; RUN: llvm-dwarfdump -debug-macro %t | FileCheck %s --check-prefixes=DWARF5,DWO
11*7e1e4e81SIgor Kudrin
12*7e1e4e81SIgor Kudrin; DWARF4:      .debug_macro contents:
13*7e1e4e81SIgor Kudrin; DWARF4-NEXT: 0x00000000:
14*7e1e4e81SIgor Kudrin; DWARF4-NEXT: macro header: version = 0x0004, flags = 0x03, format = DWARF64, debug_line_offset = 0x0000000000000000
15*7e1e4e81SIgor Kudrin; DWARF4-NEXT: DW_MACRO_GNU_start_file - lineno: 0 filenum: 1
16*7e1e4e81SIgor Kudrin; DWARF4-NEXT:  DW_MACRO_GNU_define_indirect - lineno: 1 macro: FOO 1
17*7e1e4e81SIgor Kudrin; DWARF4-NEXT:  DW_MACRO_GNU_undef_indirect - lineno: 2 macro: BAR
18*7e1e4e81SIgor Kudrin; DWARF4-NEXT: DW_MACRO_GNU_end_file
19*7e1e4e81SIgor Kudrin
20*7e1e4e81SIgor Kudrin; DWARF5:      .debug_macro contents:
21*7e1e4e81SIgor Kudrin; DWO:         .debug_macro.dwo contents:
22*7e1e4e81SIgor Kudrin; DWARF5-NEXT: 0x00000000:
23*7e1e4e81SIgor Kudrin; DWARF5-NEXT: macro header: version = 0x0005, flags = 0x03, format = DWARF64, debug_line_offset = 0x0000000000000000
24*7e1e4e81SIgor Kudrin; DWARF5-NEXT: DW_MACRO_start_file - lineno: 0 filenum: 0
25*7e1e4e81SIgor Kudrin; DWARF5-NEXT:  DW_MACRO_define_strx - lineno: 1 macro: FOO 1
26*7e1e4e81SIgor Kudrin; DWARF5-NEXT:  DW_MACRO_undef_strx - lineno: 2 macro: BAR
27*7e1e4e81SIgor Kudrin; DWARF5-NEXT: DW_MACRO_end_file
28*7e1e4e81SIgor Kudrin
29*7e1e4e81SIgor Kudrin; IR generated and reduced from:
30*7e1e4e81SIgor Kudrin; $ cat foo.c
31*7e1e4e81SIgor Kudrin; #define FOO 1
32*7e1e4e81SIgor Kudrin; #undef BAR
33*7e1e4e81SIgor Kudrin; $ clang -g -S -emit-llvm -fdebug-macro foo.c -o foo.ll
34*7e1e4e81SIgor Kudrin
35*7e1e4e81SIgor Kudrintarget triple = "x86_64-unknown-linux-gnu"
36*7e1e4e81SIgor Kudrin
37*7e1e4e81SIgor Kudrin!llvm.dbg.cu = !{!0}
38*7e1e4e81SIgor Kudrin!llvm.module.flags = !{!348, !349, !350}
39*7e1e4e81SIgor Kudrin!llvm.ident = !{!351}
40*7e1e4e81SIgor Kudrin
41*7e1e4e81SIgor Kudrin!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, macros: !3, splitDebugInlining: false, nameTableKind: None)
42*7e1e4e81SIgor Kudrin!1 = !DIFile(filename: "foo.c", directory: "/tmp")
43*7e1e4e81SIgor Kudrin!2 = !{}
44*7e1e4e81SIgor Kudrin!3 = !{!4}
45*7e1e4e81SIgor Kudrin!4 = !DIMacroFile(file: !1, nodes: !5)
46*7e1e4e81SIgor Kudrin!5 = !{!6, !7}
47*7e1e4e81SIgor Kudrin!6 = !DIMacro(type: DW_MACINFO_define, line: 1, name: "FOO", value: "1")
48*7e1e4e81SIgor Kudrin!7 = !DIMacro(type: DW_MACINFO_undef, line: 2, name: "BAR")
49*7e1e4e81SIgor Kudrin!348 = !{i32 7, !"Dwarf Version", i32 4}
50*7e1e4e81SIgor Kudrin!349 = !{i32 2, !"Debug Info Version", i32 3}
51*7e1e4e81SIgor Kudrin!350 = !{i32 1, !"wchar_size", i32 4}
52*7e1e4e81SIgor Kudrin!351 = !{!"clang version 12.0.0"}
53