2015-04-17 06:27:54 +08:00
|
|
|
; RUN: llc -filetype=obj -o %t.o %s
|
2017-09-12 07:05:20 +08:00
|
|
|
; RUN: llvm-dwarfdump -v %t.o | FileCheck %s
|
2015-04-17 06:27:54 +08:00
|
|
|
|
2015-04-17 08:18:46 +08:00
|
|
|
; Testcase generated using 'clang -g -O2 -S -emit-llvm' from the following:
|
2015-04-17 08:37:53 +08:00
|
|
|
;; void sink(void);
|
2015-04-17 08:18:46 +08:00
|
|
|
;; static __attribute__((always_inline)) void bar(int a) { sink(); }
|
2015-04-17 08:37:53 +08:00
|
|
|
;; void foo(void) {
|
2015-04-17 08:18:46 +08:00
|
|
|
;; bar(0);
|
|
|
|
;; bar(0);
|
2015-04-17 06:27:54 +08:00
|
|
|
;; }
|
|
|
|
|
2015-04-17 08:18:46 +08:00
|
|
|
; Check that we have formal parameters for 'a' in both inlined subroutines.
|
2017-06-17 06:40:04 +08:00
|
|
|
; CHECK: .debug_info
|
2015-04-17 08:18:46 +08:00
|
|
|
; CHECK: DW_TAG_inlined_subroutine
|
|
|
|
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar"
|
|
|
|
; CHECK: DW_TAG_formal_parameter
|
|
|
|
; CHECK-NEXT: DW_AT_const_value
|
|
|
|
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a"
|
2015-04-17 06:27:54 +08:00
|
|
|
; CHECK: DW_TAG_inlined_subroutine
|
2015-04-17 08:18:46 +08:00
|
|
|
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar"
|
2015-04-17 06:27:54 +08:00
|
|
|
; CHECK: DW_TAG_formal_parameter
|
[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-NEXT: DW_AT_location [DW_FORM_data4] (
|
|
|
|
; CHECK-NEXT: {{.*}} - {{.*}}: DW_OP_consts +0)
|
2015-04-17 06:27:54 +08:00
|
|
|
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a"
|
[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
|
|
|
|
2015-04-17 06:27:54 +08:00
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
target triple = "x86_64-apple-darwin"
|
|
|
|
|
|
|
|
; Function Attrs: nounwind ssp uwtable
|
2015-11-06 06:03:56 +08:00
|
|
|
define void @foo() #0 !dbg !4 {
|
2015-04-17 06:27:54 +08:00
|
|
|
entry:
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !17) #3, !dbg !18
|
2015-04-17 08:37:53 +08:00
|
|
|
tail call void @sink() #3, !dbg !20
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !17) #3, !dbg !21
|
2015-04-17 08:37:53 +08:00
|
|
|
tail call void @sink() #3, !dbg !23
|
2015-04-17 08:18:46 +08:00
|
|
|
ret void, !dbg !24
|
2015-04-17 06:27:54 +08:00
|
|
|
}
|
|
|
|
|
2017-06-17 06:40:04 +08:00
|
|
|
declare void @sink()
|
2015-04-17 06:27:54 +08:00
|
|
|
|
2015-04-17 08:18:46 +08:00
|
|
|
; Function Attrs: nounwind readnone
|
2017-07-29 04:21:02 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
|
2015-04-17 06:27:54 +08:00
|
|
|
|
2017-06-17 06:40:04 +08:00
|
|
|
attributes #0 = { nounwind ssp uwtable }
|
2015-04-17 08:18:46 +08:00
|
|
|
attributes #2 = { nounwind readnone }
|
|
|
|
attributes #3 = { nounwind }
|
2015-04-17 06:27:54 +08:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2015-04-17 08:18:46 +08:00
|
|
|
!llvm.module.flags = !{!13, !14, !15}
|
|
|
|
!llvm.ident = !{!16}
|
2015-04-17 06:27:54 +08:00
|
|
|
|
2016-04-15 23:57:41 +08:00
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
|
2015-04-30 00:38:44 +08:00
|
|
|
!1 = !DIFile(filename: "t.c", directory: "/path/to/dir")
|
2015-04-17 06:27:54 +08:00
|
|
|
!2 = !{}
|
2016-04-15 23:57:41 +08:00
|
|
|
!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
|
2015-04-30 00:38:44 +08:00
|
|
|
!5 = !DISubroutineType(types: !6)
|
2015-04-17 08:18:46 +08:00
|
|
|
!6 = !{null}
|
2016-04-15 23:57:41 +08:00
|
|
|
!7 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 2, type: !8, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !11)
|
2015-04-30 00:38:44 +08:00
|
|
|
!8 = !DISubroutineType(types: !9)
|
2015-04-17 08:18:46 +08:00
|
|
|
!9 = !{null, !10}
|
2015-04-30 00:38:44 +08:00
|
|
|
!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
2015-04-17 08:18:46 +08:00
|
|
|
!11 = !{!12}
|
2015-08-01 02:58:39 +08:00
|
|
|
!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
|
2015-04-17 08:18:46 +08:00
|
|
|
!13 = !{i32 2, !"Dwarf Version", i32 2}
|
|
|
|
!14 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!15 = !{i32 1, !"PIC Level", i32 2}
|
|
|
|
!16 = !{!"clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)"}
|
2015-04-30 00:38:44 +08:00
|
|
|
!17 = !DIExpression()
|
|
|
|
!18 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !19)
|
|
|
|
!19 = distinct !DILocation(line: 4, column: 3, scope: !4)
|
|
|
|
!20 = !DILocation(line: 2, column: 57, scope: !7, inlinedAt: !19)
|
|
|
|
!21 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !22)
|
|
|
|
!22 = distinct !DILocation(line: 5, column: 3, scope: !4)
|
|
|
|
!23 = !DILocation(line: 2, column: 57, scope: !7, inlinedAt: !22)
|
|
|
|
!24 = !DILocation(line: 6, column: 1, scope: !4)
|