2013-08-20 05:07:38 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t.o < %s
|
2017-09-12 06:59:45 +08:00
|
|
|
; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck --check-prefix=LINUX %s
|
2013-08-20 05:07:38 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -o %t.o < %s
|
2017-09-12 06:59:45 +08:00
|
|
|
; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck --check-prefix=NOPUB %s
|
2015-03-05 08:08:27 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-scei-ps4 -filetype=obj -o %t.o < %s
|
2017-09-12 06:59:45 +08:00
|
|
|
; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck --check-prefix=NOPUB %s
|
2013-08-20 05:07:38 +08:00
|
|
|
; ModuleID = 'dwarf-public-names.cpp'
|
|
|
|
;
|
|
|
|
; Generated from:
|
|
|
|
;
|
|
|
|
; struct C {
|
|
|
|
; void member_function();
|
|
|
|
; static int static_member_function();
|
|
|
|
; static int static_member_variable;
|
|
|
|
; };
|
|
|
|
;
|
|
|
|
; int C::static_member_variable = 0;
|
|
|
|
;
|
|
|
|
; void C::member_function() {
|
|
|
|
; static_member_variable = 0;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; int C::static_member_function() {
|
|
|
|
; return static_member_variable;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; C global_variable;
|
|
|
|
;
|
|
|
|
; int global_function() {
|
|
|
|
; return -1;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; namespace ns {
|
|
|
|
; void global_namespace_function() {
|
|
|
|
; global_variable.member_function();
|
|
|
|
; }
|
|
|
|
; int global_namespace_variable = 1;
|
|
|
|
; }
|
|
|
|
|
2015-03-05 08:08:27 +08:00
|
|
|
; Darwin and PS4 shouldn't be generating the section by default
|
|
|
|
; NOPUB: debug_pubnames
|
2015-06-26 03:37:13 +08:00
|
|
|
; NOPUB-NEXT: {{^$}}
|
2013-08-20 05:07:38 +08:00
|
|
|
|
|
|
|
; Skip the output to the header of the pubnames section.
|
|
|
|
; LINUX: debug_pubnames
|
2017-04-29 06:25:46 +08:00
|
|
|
; LINUX-NEXT: unit_size = 0x00000128
|
2013-08-20 05:07:38 +08:00
|
|
|
|
|
|
|
; Check for each name in the output.
|
2014-06-07 06:16:56 +08:00
|
|
|
; LINUX-DAG: "ns"
|
2014-06-07 06:29:05 +08:00
|
|
|
; LINUX-DAG: "C::static_member_function"
|
2014-06-07 06:16:56 +08:00
|
|
|
; LINUX-DAG: "global_variable"
|
|
|
|
; LINUX-DAG: "ns::global_namespace_variable"
|
|
|
|
; LINUX-DAG: "ns::global_namespace_function"
|
|
|
|
; LINUX-DAG: "global_function"
|
|
|
|
; LINUX-DAG: "C::static_member_variable"
|
2014-06-07 06:29:05 +08:00
|
|
|
; LINUX-DAG: "C::member_function"
|
2013-08-20 05:07:38 +08:00
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
source_filename = "test/DebugInfo/X86/dwarf-public-names.ll"
|
|
|
|
|
2013-08-20 05:07:38 +08:00
|
|
|
%struct.C = type { i8 }
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !0
|
|
|
|
@global_variable = global %struct.C zeroinitializer, align 1, !dbg !15
|
|
|
|
@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !17
|
2013-08-20 05:07:38 +08:00
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
define void @_ZN1C15member_functionEv(%struct.C* %this) #0 align 2 !dbg !23 {
|
2013-08-20 05:07:38 +08:00
|
|
|
entry:
|
|
|
|
%this.addr = alloca %struct.C*, align 8
|
|
|
|
store %struct.C* %this, %struct.C** %this.addr, align 8
|
2016-12-22 08:45:21 +08:00
|
|
|
call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !24, metadata !26), !dbg !27
|
2015-02-28 05:17:42 +08:00
|
|
|
%this1 = load %struct.C*, %struct.C** %this.addr
|
2016-12-22 08:45:21 +08:00
|
|
|
store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !28
|
|
|
|
ret void, !dbg !29
|
2013-08-20 05:07:38 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind readnone
|
|
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
2013-08-20 05:07:38 +08:00
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
define i32 @_ZN1C22static_member_functionEv() #0 align 2 !dbg !30 {
|
2013-08-20 05:07:38 +08:00
|
|
|
entry:
|
2016-12-22 08:45:21 +08:00
|
|
|
%0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31
|
|
|
|
ret i32 %0, !dbg !31
|
2013-08-20 05:07:38 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
define i32 @_Z15global_functionv() #0 !dbg !32 {
|
2013-08-20 05:07:38 +08:00
|
|
|
entry:
|
2016-12-22 08:45:21 +08:00
|
|
|
ret i32 -1, !dbg !33
|
2013-08-20 05:07:38 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
define void @_ZN2ns25global_namespace_functionEv() #0 !dbg !34 {
|
2013-08-20 05:07:38 +08:00
|
|
|
entry:
|
2016-12-22 08:45:21 +08:00
|
|
|
call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !37
|
|
|
|
ret void, !dbg !38
|
2013-08-20 05:07:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
attributes #0 = { nounwind uwtable }
|
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
!llvm.dbg.cu = !{!20}
|
|
|
|
!llvm.module.flags = !{!22}
|
|
|
|
|
2017-08-31 02:06:51 +08:00
|
|
|
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
|
2016-12-22 08:45:21 +08:00
|
|
|
!1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, declaration: !5)
|
|
|
|
!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, elements: !4)
|
|
|
|
!3 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
|
|
|
|
!4 = !{!5, !7, !12}
|
|
|
|
!5 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember)
|
|
|
|
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
[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
|
|
|
!7 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11)
|
2016-12-22 08:45:21 +08:00
|
|
|
!8 = !DISubroutineType(types: !9)
|
|
|
|
!9 = !{null, !10}
|
|
|
|
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
|
|
|
|
!11 = !{}
|
[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
|
|
|
!12 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: !2, file: !3, line: 3, type: !13, isLocal: false, isDefinition: false, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11)
|
2016-12-22 08:45:21 +08:00
|
|
|
!13 = !DISubroutineType(types: !14)
|
|
|
|
!14 = !{!6}
|
2017-08-31 02:06:51 +08:00
|
|
|
!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression())
|
2016-12-22 08:45:21 +08:00
|
|
|
!16 = !DIGlobalVariable(name: "global_variable", scope: null, file: !3, line: 17, type: !2, isLocal: false, isDefinition: true) ; previously: invalid DW_TAG_base_type
|
2017-08-31 02:06:51 +08:00
|
|
|
!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression())
|
2016-12-22 08:45:21 +08:00
|
|
|
!18 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !19, file: !3, line: 27, type: !6, isLocal: false, isDefinition: true)
|
2017-04-29 06:25:46 +08:00
|
|
|
!19 = !DINamespace(name: "ns", scope: null)
|
2019-01-16 00:18:52 +08:00
|
|
|
!20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !21, imports: !11) ; previously: invalid DW_TAG_base_type
|
2016-12-22 08:45:21 +08:00
|
|
|
!21 = !{!0, !15, !17}
|
|
|
|
!22 = !{i32 1, !"Debug Info Version", i32 3}
|
[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
|
|
|
!23 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: null, file: !3, line: 9, type: !8, isLocal: false, isDefinition: true, scopeLine: 9, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !7, retainedNodes: !11)
|
2016-12-22 08:45:21 +08:00
|
|
|
!24 = !DILocalVariable(name: "this", arg: 1, scope: !23, file: !3, line: 9, type: !25, flags: DIFlagArtificial | DIFlagObjectPointer)
|
|
|
|
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64)
|
|
|
|
!26 = !DIExpression()
|
|
|
|
!27 = !DILocation(line: 9, scope: !23)
|
|
|
|
!28 = !DILocation(line: 10, scope: !23)
|
|
|
|
!29 = !DILocation(line: 11, scope: !23)
|
[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
|
|
|
!30 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: null, file: !3, line: 13, type: !13, isLocal: false, isDefinition: true, scopeLine: 13, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !12, retainedNodes: !11)
|
2016-12-22 08:45:21 +08:00
|
|
|
!31 = !DILocation(line: 14, scope: !30)
|
[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
|
|
|
!32 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", scope: !3, file: !3, line: 19, type: !13, isLocal: false, isDefinition: true, scopeLine: 19, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11)
|
2016-12-22 08:45:21 +08:00
|
|
|
!33 = !DILocation(line: 20, scope: !32)
|
[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
|
|
|
!34 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", scope: !19, file: !3, line: 24, type: !35, isLocal: false, isDefinition: true, scopeLine: 24, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11)
|
2016-12-22 08:45:21 +08:00
|
|
|
!35 = !DISubroutineType(types: !36)
|
|
|
|
!36 = !{null}
|
|
|
|
!37 = !DILocation(line: 25, scope: !34)
|
|
|
|
!38 = !DILocation(line: 26, scope: !34)
|
2013-08-20 05:07:38 +08:00
|
|
|
|