2017-09-12 07:05:20 +08:00
; RUN: llc -mtriple=x86_64-linux -O0 -o - -filetype=obj < %s | llvm-dwarfdump -v -debug-info -| FileCheck %s
; RUN: llc -mtriple=x86_64-linux -dwarf-version=2 -O0 -o - -filetype=obj < %s | llvm-dwarfdump -v -debug-info -| FileCheck -check-prefix=DWARF2 %s
2013-11-02 02:25:55 +08:00
; Generated from Clang with the following source:
;
; struct foo {
; char c;
; int i;
; };
;
; foo f;
; CHECK: DW_AT_name {{.*}} "c"
2013-11-02 04:59:53 +08:00
; CHECK-NOT: DW_TAG
2014-01-03 09:30:05 +08:00
; CHECK: DW_AT_data_member_location {{.*}} (0x00)
2013-11-02 02:25:55 +08:00
; CHECK: DW_AT_name {{.*}} "i"
2013-11-02 04:59:53 +08:00
; CHECK-NOT: DW_TAG
2014-01-03 09:30:05 +08:00
; CHECK: DW_AT_data_member_location {{.*}} (0x04)
; DWARF2: DW_AT_name {{.*}} "c"
; DWARF2-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
; DWARF2: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
2014-01-03 09:30:05 +08:00
; DWARF2: DW_AT_name {{.*}} "i"
; DWARF2-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
; DWARF2: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4)
2013-11-02 02:25:55 +08:00
2016-12-22 08:45:21 +08:00
source_filename = "test/DebugInfo/X86/data_member_location.ll"
2013-11-02 02:25:55 +08:00
%struct.foo = type { i8 , i32 }
2016-12-22 08:45:21 +08:00
@f = global %struct.foo zeroinitializer , align 4 , !dbg !0
!llvm.dbg.cu = ! { !9 }
!llvm.module.flags = ! { !13 , !14 }
!llvm.ident = ! { !15 }
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: "f" , scope: null , file: !2 , line: 6 , type: !3 , isLocal: false , isDefinition: true )
!2 = !DIFile ( filename: "data_member_location.cpp" , directory: "/tmp/dbginfo" )
!3 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "foo" , file: !2 , line: 1 , size: 64 , align: 32 , elements: !4 , identifier: "_ZTS3foo" )
!4 = ! { !5 , !7 }
!5 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "c" , scope: !3 , file: !2 , line: 2 , baseType: !6 , size: 8 , align: 8 )
!6 = !DIBasicType ( name: "char" , size: 8 , align: 8 , encoding: D W _ A T E _ s i g n e d _ c h a r )
!7 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "i" , scope: !3 , file: !2 , line: 3 , baseType: !8 , size: 32 , align: 32 , offset: 32 )
!8 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!9 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , file: !2 , producer: "clang version 3.4 " , isOptimized: false , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !10 , retainedTypes: !11 , globals: !12 , imports: !10 )
!10 = ! { }
!11 = ! { !3 }
!12 = ! { !0 }
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!13 = ! { i32 2 , !"Dwarf Version" , i32 4 }
2016-12-22 08:45:21 +08:00
!14 = ! { i32 1 , !"Debug Info Version" , i32 3 }
!15 = ! { !"clang version 3.4 " }
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00