2017-09-12 06:59:45 +08:00
|
|
|
; RUN: llc -arm-global-merge -global-merge-group-by-use=false -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s
|
2011-08-03 09:25:46 +08:00
|
|
|
|
DebugInfo: Fix a bunch of tests that, owing to their compile_unit metadata not including a 13th field, had some subtle behavior.
Without the 13th field, the "emission kind" field defaults to 0 (which
is not equal to either of the values of the emission kind enum (1 ==
full debug info, 2 == line tables only)).
In this particular instance, the comparison with "FullDebugInfo" was
done when adding elements to the ranges list - so for these test cases
no values were added to the ranges list.
This got weirder when emitting debug_loc entries as the addresses should
be relative to the range of the CU if the CU has only one range (the
reasonable assumption is that if we're emitting debug_loc lists for a CU
that CU has at least one range - but due to the above situation, it has
zero) so the ranges were emitted relative to the start of the section
rather than relative to the start of the CU's singular range.
Fix these tests by accounting for the difference in the description of
debug_loc entries (in some cases making the test ignorant to these
differences, in others adding the extra label difference expression,
etc) or the presence/absence of high/low_pc on the CU, and add the 13th
field to their CUs to enable proper "full debug info" emission here.
In a future commit I'll fix up a bunch of other test cases that are not
so rigorously depending on this behavior, but still doing similarly
weird things due to the missing 13th field.
llvm-svn: 214937
2014-08-06 07:57:31 +08:00
|
|
|
; CHECK: DW_TAG_variable
|
|
|
|
; CHECK-NOT: DW_TAG
|
|
|
|
; CHECK: DW_AT_name {{.*}} "x1"
|
|
|
|
; CHECK-NOT: {{DW_TAG|NULL}}
|
[dwarfdump] Pretty print location expressions and location lists
Summary:
Based on Fred's patch here: https://reviews.llvm.org/D6771
I can't seem to commandeer the old review, so I'm creating a new one.
With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:
DW_AT_location [DW_FORM_data4] (0x00000000
0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3
0x000000000000000b - 0x0000000000000012: DW_OP_consts +7
0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4
0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0)
And like this for debug_loc.dwo entries:
DW_AT_location [DW_FORM_sec_offset] (0x00000000
Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value
Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4)
Simple locations without ranges are printed inline:
DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0)
The debug_loc(.dwo) dumping in changed accordingly to factor the code.
Reviewers: dblaikie, aprantl, friss
Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D37123
llvm-svn: 312042
2017-08-30 05:41:21 +08:00
|
|
|
; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR:0x[0-9a-fA-F]+]])
|
DebugInfo: Fix a bunch of tests that, owing to their compile_unit metadata not including a 13th field, had some subtle behavior.
Without the 13th field, the "emission kind" field defaults to 0 (which
is not equal to either of the values of the emission kind enum (1 ==
full debug info, 2 == line tables only)).
In this particular instance, the comparison with "FullDebugInfo" was
done when adding elements to the ranges list - so for these test cases
no values were added to the ranges list.
This got weirder when emitting debug_loc entries as the addresses should
be relative to the range of the CU if the CU has only one range (the
reasonable assumption is that if we're emitting debug_loc lists for a CU
that CU has at least one range - but due to the above situation, it has
zero) so the ranges were emitted relative to the start of the section
rather than relative to the start of the CU's singular range.
Fix these tests by accounting for the difference in the description of
debug_loc entries (in some cases making the test ignorant to these
differences, in others adding the extra label difference expression,
etc) or the presence/absence of high/low_pc on the CU, and add the 13th
field to their CUs to enable proper "full debug info" emission here.
In a future commit I'll fix up a bunch of other test cases that are not
so rigorously depending on this behavior, but still doing similarly
weird things due to the missing 13th field.
llvm-svn: 214937
2014-08-06 07:57:31 +08:00
|
|
|
; CHECK: DW_TAG_variable
|
|
|
|
; CHECK-NOT: DW_TAG
|
|
|
|
; CHECK: DW_AT_name {{.*}} "x2"
|
|
|
|
; CHECK-NOT: {{DW_TAG|NULL}}
|
[dwarfdump] Pretty print location expressions and location lists
Summary:
Based on Fred's patch here: https://reviews.llvm.org/D6771
I can't seem to commandeer the old review, so I'm creating a new one.
With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:
DW_AT_location [DW_FORM_data4] (0x00000000
0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3
0x000000000000000b - 0x0000000000000012: DW_OP_consts +7
0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4
0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0)
And like this for debug_loc.dwo entries:
DW_AT_location [DW_FORM_sec_offset] (0x00000000
Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value
Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4)
Simple locations without ranges are printed inline:
DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0)
The debug_loc(.dwo) dumping in changed accordingly to factor the code.
Reviewers: dblaikie, aprantl, friss
Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D37123
llvm-svn: 312042
2017-08-30 05:41:21 +08:00
|
|
|
; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR]], DW_OP_plus_uconst 0x4)
|
2011-08-03 09:25:46 +08:00
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
source_filename = "test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll"
|
2011-08-03 09:25:46 +08:00
|
|
|
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"
|
|
|
|
target triple = "thumbv7-apple-macosx10.7.0"
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
@x1 = internal unnamed_addr global i32 1, align 4, !dbg !0
|
|
|
|
@x2 = internal unnamed_addr global i32 2, align 4, !dbg !6
|
2011-08-03 09:25:46 +08:00
|
|
|
@x3 = internal unnamed_addr global i32 3, align 4
|
|
|
|
@x4 = internal unnamed_addr global i32 4, align 4
|
|
|
|
@x5 = global i32 0, align 4
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind optsize ssp
|
|
|
|
define i32 @get1(i32 %a) #0 !dbg !10 {
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %a, metadata !14, metadata !17), !dbg !18
|
2016-12-22 08:45:21 +08:00
|
|
|
%1 = load i32, i32* @x1, align 4, !dbg !19
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %1, metadata !15, metadata !17), !dbg !19
|
2016-12-22 08:45:21 +08:00
|
|
|
store i32 %a, i32* @x1, align 4, !dbg !19
|
|
|
|
ret i32 %1, !dbg !19
|
2011-08-03 09:25:46 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind optsize ssp
|
|
|
|
|
|
|
|
define i32 @get2(i32 %a) #0 !dbg !20 {
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %a, metadata !22, metadata !17), !dbg !25
|
2016-12-22 08:45:21 +08:00
|
|
|
%1 = load i32, i32* @x2, align 4, !dbg !26
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %1, metadata !23, metadata !17), !dbg !26
|
2016-12-22 08:45:21 +08:00
|
|
|
store i32 %a, i32* @x2, align 4, !dbg !26
|
|
|
|
ret i32 %1, !dbg !26
|
2011-08-03 09:25:46 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind optsize ssp
|
|
|
|
|
|
|
|
define i32 @get3(i32 %a) #0 !dbg !27 {
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %a, metadata !29, metadata !17), !dbg !32
|
2016-12-22 08:45:21 +08:00
|
|
|
%1 = load i32, i32* @x3, align 4, !dbg !33
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %1, metadata !30, metadata !17), !dbg !33
|
2016-12-22 08:45:21 +08:00
|
|
|
store i32 %a, i32* @x3, align 4, !dbg !33
|
|
|
|
ret i32 %1, !dbg !33
|
2011-08-03 09:25:46 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind optsize ssp
|
|
|
|
|
|
|
|
define i32 @get4(i32 %a) #0 !dbg !34 {
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %a, metadata !36, metadata !17), !dbg !39
|
2016-12-22 08:45:21 +08:00
|
|
|
%1 = load i32, i32* @x4, align 4, !dbg !40
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %1, metadata !37, metadata !17), !dbg !40
|
2016-12-22 08:45:21 +08:00
|
|
|
store i32 %a, i32* @x4, align 4, !dbg !40
|
|
|
|
ret i32 %1, !dbg !40
|
2011-08-03 09:25:46 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind optsize ssp
|
|
|
|
|
|
|
|
define i32 @get5(i32 %a) #0 !dbg !41 {
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %a, metadata !43, metadata !17), !dbg !46
|
2016-12-22 08:45:21 +08:00
|
|
|
%1 = load i32, i32* @x5, align 4, !dbg !47
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %1, metadata !44, metadata !17), !dbg !47
|
2016-12-22 08:45:21 +08:00
|
|
|
store i32 %a, i32* @x5, align 4, !dbg !47
|
|
|
|
ret i32 %1, !dbg !47
|
2011-08-03 09:25:46 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
; Function Attrs: nounwind readnone
|
|
|
|
|
2017-07-29 04:21:02 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
|
2016-12-22 08:45:21 +08:00
|
|
|
|
|
|
|
attributes #0 = { nounwind optsize ssp }
|
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!2}
|
|
|
|
!llvm.module.flags = !{!9}
|
|
|
|
|
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: "x1", scope: !2, file: !3, line: 4, type: !8, isLocal: true, isDefinition: true)
|
|
|
|
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !5, imports: !4)
|
|
|
|
!3 = !DIFile(filename: "ss3.c", directory: "/private/tmp")
|
|
|
|
!4 = !{}
|
|
|
|
!5 = !{!0, !6}
|
2017-08-31 02:06:51 +08:00
|
|
|
!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
|
2016-12-22 08:45:21 +08:00
|
|
|
!7 = !DIGlobalVariable(name: "x2", scope: !2, file: !3, line: 7, type: !8, isLocal: true, isDefinition: true)
|
|
|
|
!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
|
|
!9 = !{i32 1, !"Debug Info Version", i32 3}
|
|
|
|
!10 = distinct !DISubprogram(name: "get1", scope: !3, file: !3, line: 5, type: !11, isLocal: false, isDefinition: true, scopeLine: 5, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !13)
|
|
|
|
!11 = !DISubroutineType(types: !12)
|
|
|
|
!12 = !{!8}
|
|
|
|
!13 = !{!14, !15}
|
|
|
|
!14 = !DILocalVariable(name: "a", arg: 1, scope: !10, file: !3, line: 5, type: !8)
|
|
|
|
!15 = !DILocalVariable(name: "b", scope: !16, file: !3, line: 5, type: !8)
|
|
|
|
!16 = distinct !DILexicalBlock(scope: !10, file: !3, line: 5, column: 19)
|
|
|
|
!17 = !DIExpression()
|
|
|
|
!18 = !DILocation(line: 5, column: 16, scope: !10)
|
|
|
|
!19 = !DILocation(line: 5, column: 32, scope: !16)
|
|
|
|
!20 = distinct !DISubprogram(name: "get2", scope: !3, file: !3, line: 8, type: !11, isLocal: false, isDefinition: true, scopeLine: 8, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !21)
|
|
|
|
!21 = !{!22, !23}
|
|
|
|
!22 = !DILocalVariable(name: "a", arg: 1, scope: !20, file: !3, line: 8, type: !8)
|
|
|
|
!23 = !DILocalVariable(name: "b", scope: !24, file: !3, line: 8, type: !8)
|
|
|
|
!24 = distinct !DILexicalBlock(scope: !20, file: !3, line: 8, column: 17)
|
|
|
|
!25 = !DILocation(line: 8, column: 14, scope: !20)
|
|
|
|
!26 = !DILocation(line: 8, column: 29, scope: !24)
|
|
|
|
!27 = distinct !DISubprogram(name: "get3", scope: !3, file: !3, line: 11, type: !11, isLocal: false, isDefinition: true, scopeLine: 11, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !28)
|
|
|
|
!28 = !{!29, !30}
|
|
|
|
!29 = !DILocalVariable(name: "a", arg: 1, scope: !27, file: !3, line: 11, type: !8)
|
|
|
|
!30 = !DILocalVariable(name: "b", scope: !31, file: !3, line: 11, type: !8)
|
|
|
|
!31 = distinct !DILexicalBlock(scope: !27, file: !3, line: 11, column: 19)
|
|
|
|
!32 = !DILocation(line: 11, column: 16, scope: !27)
|
|
|
|
!33 = !DILocation(line: 11, column: 32, scope: !31)
|
|
|
|
!34 = distinct !DISubprogram(name: "get4", scope: !3, file: !3, line: 14, type: !11, isLocal: false, isDefinition: true, scopeLine: 14, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !35)
|
|
|
|
!35 = !{!36, !37}
|
|
|
|
!36 = !DILocalVariable(name: "a", arg: 1, scope: !34, file: !3, line: 14, type: !8)
|
|
|
|
!37 = !DILocalVariable(name: "b", scope: !38, file: !3, line: 14, type: !8)
|
|
|
|
!38 = distinct !DILexicalBlock(scope: !34, file: !3, line: 14, column: 19)
|
|
|
|
!39 = !DILocation(line: 14, column: 16, scope: !34)
|
|
|
|
!40 = !DILocation(line: 14, column: 32, scope: !38)
|
|
|
|
!41 = distinct !DISubprogram(name: "get5", scope: !3, file: !3, line: 17, type: !11, isLocal: false, isDefinition: true, scopeLine: 17, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !42)
|
|
|
|
!42 = !{!43, !44}
|
|
|
|
!43 = !DILocalVariable(name: "a", arg: 1, scope: !41, file: !3, line: 17, type: !8)
|
|
|
|
!44 = !DILocalVariable(name: "b", scope: !45, file: !3, line: 17, type: !8)
|
|
|
|
!45 = distinct !DILexicalBlock(scope: !41, file: !3, line: 17, column: 19)
|
|
|
|
!46 = !DILocation(line: 17, column: 16, scope: !41)
|
|
|
|
!47 = !DILocation(line: 17, column: 32, scope: !45)
|
|
|
|
|