2017-09-12 06:59:45 +08:00
|
|
|
; RUN: %llc_dwarf -split-dwarf-file=foo.dwo %s -filetype=obj -o - | llvm-dwarfdump -debug-info - | FileCheck %s
|
2017-05-29 14:25:30 +08:00
|
|
|
|
|
|
|
; Created from:
|
|
|
|
; a.cpp:
|
|
|
|
; void f1();
|
|
|
|
; inline __attribute__((always_inline)) __attribute__((used)) void f2() { f1(); }
|
|
|
|
; b.cpp:
|
|
|
|
; void f2();
|
|
|
|
; void f3() {
|
|
|
|
; f2();
|
|
|
|
; }
|
|
|
|
; $ clang++ -fno-split-dwarf-inlining {a,b}.cpp -emit-llvm -S -g
|
|
|
|
; $ llvm-link {a,b}.ll -S -o ab.ll
|
|
|
|
; Then strip out the @llvm.used global, so no out of line definition of 'f2'
|
|
|
|
; will be emitted. This emulates something more like the available_externally
|
|
|
|
; import performed by ThinLTO.
|
|
|
|
|
2017-09-14 06:09:01 +08:00
|
|
|
; CHECK: .debug_info contents:
|
2017-05-29 14:25:30 +08:00
|
|
|
; CHECK: Compile Unit
|
|
|
|
; CHECK-NOT: Compile Unit
|
2017-09-14 06:09:01 +08:00
|
|
|
; CHECK: .debug_info.dwo contents:
|
2017-05-29 14:25:30 +08:00
|
|
|
|
|
|
|
target triple = "x86_64-pc-linux"
|
|
|
|
|
|
|
|
declare void @_Z2f1v()
|
|
|
|
|
|
|
|
; Function Attrs: noinline norecurse uwtable
|
|
|
|
define i32 @main() !dbg !9 {
|
|
|
|
entry:
|
|
|
|
call void @_Z2f1v(), !dbg !13
|
|
|
|
ret i32 0, !dbg !18
|
|
|
|
}
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0, !3}
|
|
|
|
!llvm.ident = !{!5, !5}
|
|
|
|
!llvm.module.flags = !{!6, !7, !8}
|
|
|
|
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 304054) (llvm/trunk 304080)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false)
|
|
|
|
!1 = !DIFile(filename: "a.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
|
|
|
|
!2 = !{}
|
|
|
|
!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !4, producer: "clang version 5.0.0 (trunk 304054) (llvm/trunk 304080)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false)
|
|
|
|
!4 = !DIFile(filename: "b.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
|
|
|
|
!5 = !{!"clang version 5.0.0 (trunk 304054) (llvm/trunk 304080)"}
|
|
|
|
!6 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!7 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!8 = !{i32 1, !"wchar_size", i32 4}
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!9 = distinct !DISubprogram(name: "main", scope: !4, file: !4, line: 2, type: !10, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !3, retainedNodes: !2)
|
2017-05-29 14:25:30 +08:00
|
|
|
!10 = !DISubroutineType(types: !11)
|
|
|
|
!11 = !{!12}
|
|
|
|
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
|
|
!13 = !DILocation(line: 2, column: 73, scope: !14, inlinedAt: !17)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!14 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !15, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
2017-05-29 14:25:30 +08:00
|
|
|
!15 = !DISubroutineType(types: !16)
|
|
|
|
!16 = !{null}
|
|
|
|
!17 = distinct !DILocation(line: 3, column: 3, scope: !9)
|
|
|
|
!18 = !DILocation(line: 4, column: 1, scope: !9)
|