Home | History | Annotate | Download | only in ARM
      1 ; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - | FileCheck %s
      2 ;
      3 ; Checks that we're creating two ranges, one that terminates immediately
      4 ; and one that spans the rest of the function. This isn't necessarily the
      5 ; best thing to do here (and also not necessarily correct, since the first
      6 ; one has a bit_piece), but it is what is currently being emitted, any
      7 ; change here needs to be intentional, so the test is very specific.
      8 ;
      9 ; CHECK: .debug_loc contents:
     10 ; CHECK: 0x00000000: Beginning address offset: 0x0000000000000004
     11 ; CHECK:                Ending address offset: 0x0000000000000004
     12 ; CHECK:                 Location description: 10 00 9f
     13 ; CHECK:             Beginning address offset: 0x0000000000000004
     14 ; CHECK:                Ending address offset: 0x0000000000000014
     15 ; CHECK:                 Location description: 10 00 9f
     16 
     17 ; Created form the following test case (PR26163) with
     18 ; clang -cc1 -triple armv4t--freebsd11.0-gnueabi -emit-obj -debug-info-kind=standalone -O2 -x c test.c
     19 ;
     20 ; typedef	unsigned int	size_t;
     21 ; struct timeval {
     22 ; 	long long tv_sec;
     23 ; 	int tv_usec;
     24 ; };
     25 ; 
     26 ; void *memset(void *, int, size_t);
     27 ; void foo(void);
     28 ; 
     29 ; static void
     30 ; bar(int value)
     31 ; {
     32 ; 	struct timeval lifetime;
     33 ; 
     34 ; 	memset(&lifetime, 0, sizeof(struct timeval));
     35 ; 	lifetime.tv_sec = value;
     36 ; 
     37 ; 	foo();
     38 ; }
     39 ; 
     40 ; int
     41 ; parse_config_file(void)
     42 ; {
     43 ; 	int value;
     44 ; 
     45 ; 	bar(value);
     46 ; 	return (0);
     47 ; }
     48 
     49 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
     50 target triple = "armv4t--freebsd11.0-gnueabi"
     51 
     52 %struct.timeval = type { i64, i32 }
     53 
     54 declare void @llvm.dbg.declare(metadata, metadata, metadata)
     55 declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
     56 
     57 declare void @foo()
     58 
     59 define i32 @parse_config_file() !dbg !4 {
     60 entry:
     61   tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !15, metadata !26), !dbg !27
     62   tail call void @llvm.dbg.declare(metadata %struct.timeval* undef, metadata !16, metadata !26), !dbg !29
     63   tail call void @llvm.dbg.value(metadata i64 0, i64 0, metadata !16, metadata !30), !dbg !29
     64   tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !16, metadata !31), !dbg !29
     65   tail call void @foo() #3, !dbg !32
     66   ret i32 0, !dbg !33
     67 }
     68 
     69 
     70 !llvm.dbg.cu = !{!0}
     71 !llvm.module.flags = !{!22, !23, !24}
     72 !llvm.ident = !{!25}
     73 
     74 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (https://github.com/llvm-mirror/clang 89dda3855cda574f355e6defa1d77bdae5053994) (llvm/trunk 257891)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
     75 !1 = !DIFile(filename: "<stdin>", directory: "/home/ubuntu/bugs")
     76 !2 = !{}
     77 !4 = distinct !DISubprogram(name: "parse_config_file", scope: !5, file: !5, line: 22, type: !6, isLocal: false, isDefinition: true, scopeLine: 23, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !9)
     78 !5 = !DIFile(filename: "test.c", directory: "/home/ubuntu/bugs")
     79 !6 = !DISubroutineType(types: !7)
     80 !7 = !{!8}
     81 !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
     82 !9 = !{!10}
     83 !10 = !DILocalVariable(name: "value", scope: !4, file: !5, line: 24, type: !8)
     84 !11 = distinct !DISubprogram(name: "bar", scope: !5, file: !5, line: 11, type: !12, isLocal: true, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !14)
     85 !12 = !DISubroutineType(types: !13)
     86 !13 = !{null, !8}
     87 !14 = !{!15, !16}
     88 !15 = !DILocalVariable(name: "value", arg: 1, scope: !11, file: !5, line: 11, type: !8)
     89 !16 = !DILocalVariable(name: "lifetime", scope: !11, file: !5, line: 13, type: !17)
     90 !17 = !DICompositeType(tag: DW_TAG_structure_type, name: "timeval", file: !5, line: 2, size: 128, align: 64, elements: !18)
     91 !18 = !{!19, !21}
     92 !19 = !DIDerivedType(tag: DW_TAG_member, name: "tv_sec", scope: !17, file: !5, line: 3, baseType: !20, size: 64, align: 64)
     93 !20 = !DIBasicType(name: "long long int", size: 64, align: 64, encoding: DW_ATE_signed)
     94 !21 = !DIDerivedType(tag: DW_TAG_member, name: "tv_usec", scope: !17, file: !5, line: 4, baseType: !8, size: 32, align: 32, offset: 64)
     95 !22 = !{i32 2, !"Debug Info Version", i32 3}
     96 !23 = !{i32 1, !"wchar_size", i32 4}
     97 !24 = !{i32 1, !"min_enum_size", i32 4}
     98 !25 = !{!"clang version 3.9.0 (https://github.com/llvm-mirror/clang 89dda3855cda574f355e6defa1d77bdae5053994) (llvm/trunk 257891)"}
     99 !26 = !DIExpression()
    100 !27 = !DILocation(line: 11, scope: !11, inlinedAt: !28)
    101 !28 = distinct !DILocation(line: 26, scope: !4)
    102 !29 = !DILocation(line: 13, scope: !11, inlinedAt: !28)
    103 !30 = !DIExpression(DW_OP_bit_piece, 0, 64)
    104 !31 = !DIExpression(DW_OP_bit_piece, 0, 32)
    105 !32 = !DILocation(line: 18, scope: !11, inlinedAt: !28)
    106 !33 = !DILocation(line: 27, scope: !4)
    107