2016-12-20 10:09:43 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-apple-darwin %s -o - -filetype=obj | \
|
2017-09-12 07:05:20 +08:00
|
|
|
; RUN: llvm-dwarfdump -v --debug-info - | FileCheck %s
|
2016-12-20 10:09:43 +08:00
|
|
|
;
|
|
|
|
; Test emitting debug info for fragmented global values.
|
|
|
|
; This is a handcrafted example of an SROAed global variable.
|
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
target triple = "x86_64-apple-macosx10.12.0"
|
|
|
|
|
|
|
|
%struct.anon = type { i32, i32 }
|
|
|
|
|
|
|
|
; CHECK: DW_TAG_variable
|
|
|
|
; CHECK-NEXT: DW_AT_name {{.*}}"point"
|
|
|
|
; CHECK-NOT: DW_TAG
|
[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 0x4, DW_OP_piece 0x4, DW_OP_addr 0x0, DW_OP_piece 0x4)
|
2016-12-20 10:09:43 +08:00
|
|
|
; CHECK-NOT: DW_TAG
|
|
|
|
; CHECK: DW_TAG
|
|
|
|
; CHECK: DW_TAG_variable
|
|
|
|
; CHECK-NEXT: DW_AT_name {{.*}}"part_const"
|
|
|
|
; CHECK-NOT: DW_TAG
|
2018-09-05 18:18:36 +08:00
|
|
|
; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x8, DW_OP_piece 0x4, DW_OP_lit2, DW_OP_stack_value, DW_OP_piece 0x4)
|
2016-12-20 10:09:43 +08:00
|
|
|
; [0x0000000000000008], piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004
|
|
|
|
; CHECK-NOT: DW_TAG
|
|
|
|
; CHECK: DW_TAG_variable
|
|
|
|
; CHECK-NEXT: DW_AT_name {{.*}}"full_const"
|
|
|
|
; CHECK-NOT: DW_TAG
|
2018-09-05 18:18:36 +08:00
|
|
|
; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_lit1, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_lit2, DW_OP_stack_value, DW_OP_piece 0x4)
|
2016-12-20 10:09:43 +08:00
|
|
|
; CHECK-NOT: DW_TAG
|
|
|
|
@point.y = global i32 2, align 4, !dbg !13
|
|
|
|
@point.x = global i32 1, align 4, !dbg !12
|
|
|
|
|
2017-03-24 07:35:00 +08:00
|
|
|
@part_const.x = global i32 1, align 4, !dbg !14
|
2016-12-20 10:09:43 +08:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!1}
|
|
|
|
!llvm.module.flags = !{!10, !11}
|
|
|
|
|
|
|
|
!0 = distinct !DIGlobalVariable(name: "point", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true)
|
|
|
|
!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4)
|
|
|
|
!2 = !DIFile(filename: "g.c", directory: "/")
|
|
|
|
!3 = !{}
|
2017-08-19 09:15:06 +08:00
|
|
|
!4 = !{!12, !13, !14, !15, !17, !18, !20}
|
2016-12-20 10:09:43 +08:00
|
|
|
!5 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !2, line: 1, size: 64, elements: !6)
|
|
|
|
!6 = !{!7, !9}
|
|
|
|
!7 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !5, file: !2, line: 1, baseType: !8, size: 32)
|
|
|
|
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
|
|
!9 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !5, file: !2, line: 1, baseType: !8, size: 32, offset: 32)
|
|
|
|
!10 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!11 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!12 = !DIGlobalVariableExpression(var: !0, expr: !DIExpression(DW_OP_LLVM_fragment, 0, 32))
|
|
|
|
!13 = !DIGlobalVariableExpression(var: !0, expr: !DIExpression(DW_OP_LLVM_fragment, 32, 32))
|
|
|
|
!14 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression(DW_OP_LLVM_fragment, 0, 32))
|
|
|
|
!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression(DW_OP_constu, 2,
|
|
|
|
DW_OP_stack_value, DW_OP_LLVM_fragment, 32, 32))
|
|
|
|
!16 = distinct !DIGlobalVariable(name: "part_const", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true)
|
|
|
|
!17 = !DIGlobalVariableExpression(var: !19, expr: !DIExpression(DW_OP_constu, 1,
|
|
|
|
DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32))
|
|
|
|
!18 = !DIGlobalVariableExpression(var: !19, expr: !DIExpression(DW_OP_constu, 2,
|
|
|
|
DW_OP_stack_value, DW_OP_LLVM_fragment, 32, 32))
|
|
|
|
!19 = distinct !DIGlobalVariable(name: "full_const", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true)
|
2017-08-31 02:06:51 +08:00
|
|
|
!20 = !DIGlobalVariableExpression(var: !0, expr: !DIExpression())
|