2016-03-18 07:58:03 +08:00
|
|
|
; REQUIRES: object-emission
|
|
|
|
|
|
|
|
; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t
|
2017-09-12 07:05:20 +08:00
|
|
|
; RUN: llvm-dwarfdump -v %t | FileCheck %s
|
2016-03-18 07:58:03 +08:00
|
|
|
|
|
|
|
; Generated from the following C++ source code:
|
|
|
|
;
|
|
|
|
; struct A {
|
|
|
|
; virtual void f();
|
|
|
|
; virtual void g();
|
|
|
|
; };
|
|
|
|
;
|
|
|
|
; void A::f() {}
|
|
|
|
; void A::g() {}
|
|
|
|
;
|
|
|
|
; and manually edited to set virtualIndex attribute on the A::g subprogram to
|
|
|
|
; 4294967295.
|
|
|
|
|
|
|
|
; CHECK: DW_TAG_subprogram [
|
2019-03-01 06:26:00 +08:00
|
|
|
; CHECK: DW_AT_vtable_elem_location [DW_FORM_exprloc] (DW_OP_constu 0x0)
|
2016-03-18 07:58:03 +08:00
|
|
|
|
|
|
|
; CHECK: DW_TAG_subprogram [
|
|
|
|
; CHECK-NOT: DW_AT_vtable_elem_location
|
|
|
|
|
|
|
|
%struct.A = type { i32 (...)** }
|
|
|
|
|
|
|
|
@_ZTV1A = unnamed_addr constant [4 x i8*] [i8* null, i8* null, i8* bitcast (void (%struct.A*)* @_ZN1A1fEv to i8*), i8* bitcast (void (%struct.A*)* @_ZN1A1gEv to i8*)], align 8
|
|
|
|
|
|
|
|
define void @_ZN1A1fEv(%struct.A* %this) unnamed_addr !dbg !18 {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @_ZN1A1gEv(%struct.A* %this) unnamed_addr !dbg !19 {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
|
|
!llvm.module.flags = !{!20, !21}
|
|
|
|
!llvm.ident = !{!22}
|
|
|
|
|
2016-04-15 23:57:41 +08:00
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3)
|
2016-03-18 07:58:03 +08:00
|
|
|
!1 = !DIFile(filename: "x", directory: "x")
|
|
|
|
!2 = !{}
|
|
|
|
!3 = !{!4}
|
2016-04-24 05:08:00 +08:00
|
|
|
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !1, line: 1, size: 64, align: 64, elements: !5, vtableHolder: !4, identifier: "_ZTS1A")
|
2016-03-18 07:58:03 +08:00
|
|
|
!5 = !{!6, !12, !16}
|
|
|
|
!6 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", scope: !1, file: !1, baseType: !7, size: 64, flags: DIFlagArtificial)
|
|
|
|
!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64)
|
|
|
|
!8 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", baseType: !9, size: 64)
|
|
|
|
!9 = !DISubroutineType(types: !10)
|
|
|
|
!10 = !{!11}
|
|
|
|
!11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
2016-04-24 05:08:00 +08:00
|
|
|
!12 = !DISubprogram(name: "f", linkageName: "_ZN1A1fEv", scope: !4, file: !1, line: 2, type: !13, isLocal: false, isDefinition: false, scopeLine: 2, containingType: !4, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0, flags: DIFlagPrototyped, isOptimized: false)
|
2016-03-18 07:58:03 +08:00
|
|
|
!13 = !DISubroutineType(types: !14)
|
|
|
|
!14 = !{null, !15}
|
2016-04-24 05:08:00 +08:00
|
|
|
!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
|
|
|
|
!16 = !DISubprogram(name: "g", linkageName: "_ZN1A1gEv", scope: !4, file: !1, line: 3, type: !13, isLocal: false, isDefinition: false, scopeLine: 3, containingType: !4, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 4294967295, flags: DIFlagPrototyped, isOptimized: false)
|
[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
|
|
|
!18 = distinct !DISubprogram(name: "f", linkageName: "_ZN1A1fEv", scope: !4, file: !1, line: 6, type: !13, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !12, retainedNodes: !2)
|
|
|
|
!19 = distinct !DISubprogram(name: "g", linkageName: "_ZN1A1gEv", scope: !4, file: !1, line: 7, type: !13, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !16, retainedNodes: !2)
|
2016-03-18 07:58:03 +08:00
|
|
|
!20 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!21 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!22 = !{!"clang version 3.9.0 (trunk 263469) (llvm/trunk 263156)"}
|
|
|
|
!23 = !DILocalVariable(name: "this", arg: 1, scope: !18, type: !24, flags: DIFlagArtificial | DIFlagObjectPointer)
|
2016-04-24 05:08:00 +08:00
|
|
|
!24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, align: 64)
|
2016-03-18 07:58:03 +08:00
|
|
|
!25 = !DIExpression()
|
|
|
|
!26 = !DILocation(line: 0, scope: !18)
|
|
|
|
!27 = !DILocation(line: 6, column: 14, scope: !18)
|
|
|
|
!28 = !DILocalVariable(name: "this", arg: 1, scope: !19, type: !24, flags: DIFlagArtificial | DIFlagObjectPointer)
|
|
|
|
!29 = !DILocation(line: 0, scope: !19)
|
|
|
|
!30 = !DILocation(line: 7, column: 14, scope: !19)
|