1;; This test checks JSON output for FRAME. 2 3; REQUIRES: aarch64-registered-target 4 5;; Show how library errors are reported in the output. 6; RUN: llvm-symbolizer "FRAME %t-no-file.o 0" --output-style=JSON | \ 7; RUN: FileCheck %s -DMSG=%errc_ENOENT --check-prefix=NO-FILE --strict-whitespace --match-full-lines --implicit-check-not={{.}} 8; NO-FILE:[{"Address":"0x0","Error":{"Message":"[[MSG]]"},"ModuleName":"{{.*}}no-file.o"}] 9 10;; Handle invalid argument. 11; RUN: llvm-symbolizer "FRAME tmp.o Z" --output-style=JSON | \ 12; RUN: FileCheck %s -DMSG=%errc_ENOENT --check-prefix=INVARG --strict-whitespace --match-full-lines --implicit-check-not={{.}} 13; INVARG:[{"Error":{"Message":"[[MSG]]"},"ModuleName":"tmp.o","SymName":"Z"}] 14 15; RUN: llc -filetype=obj -o %t.o %s 16 17;; Resolve out of range address. Expected an empty array. 18; RUN: llvm-symbolizer "FRAME %t.o 0x10000000" --output-style=JSON | \ 19; RUN: FileCheck %s --check-prefix=NOT-FOUND --strict-whitespace --match-full-lines --implicit-check-not={{.}} 20; NOT-FOUND:[{"Address":"0x10000000","Frame":[],"ModuleName":"{{.*}}.o"}] 21 22;; Resolve valid address. Note we check 0, non-zero and missing TagOffset cases. 23; RUN: llvm-symbolizer "FRAME %t.o 0" --output-style=JSON | \ 24; RUN: FileCheck %s --strict-whitespace --match-full-lines --implicit-check-not={{.}} 25; CHECK:[{"Address":"0x0","Frame":[{"DeclFile":"/x.c","DeclLine":2,"FrameOffset":24,"FunctionName":"f","Name":"a","Size":"0x8","TagOffset":"0x0"},{"DeclFile":"/x.c","DeclLine":3,"FrameOffset":16,"FunctionName":"f","Name":"b","Size":"0x8","TagOffset":"0x1"},{"DeclFile":"/x.c","DeclLine":4,"FrameOffset":12,"FunctionName":"f","Name":"c","Size":"0x4","TagOffset":""}],"ModuleName":"{{.*}}.o"}] 26 27target triple="aarch64--" 28 29define void @f() !dbg !6 { 30entry: 31 %a = alloca ptr 32 %b = alloca ptr 33 %c = alloca i32 ; To check a variable with a different size. 34 ; Note: The following 2 lines declares the tag offsets we are checking in this test. 35 ; The tag offset for the 3rd variable is missing for purpose. 36 call void @llvm.dbg.declare(metadata ptr %a, metadata !12, metadata !DIExpression(DW_OP_LLVM_tag_offset, 0)), !dbg !15 37 call void @llvm.dbg.declare(metadata ptr %b, metadata !13, metadata !DIExpression(DW_OP_LLVM_tag_offset, 1)), !dbg !16 38 call void @llvm.dbg.declare(metadata ptr %c, metadata !14, metadata !DIExpression()), !dbg !17 39 ret void, !dbg !18 40} 41 42declare void @llvm.dbg.declare(metadata, metadata, metadata) 43 44!llvm.dbg.cu = !{!0} 45!llvm.module.flags = !{!3, !4} 46!llvm.ident = !{!5} 47 48!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 49!1 = !DIFile(filename: "x.c", directory: "/") 50!2 = !{} 51!3 = !{i32 2, !"Dwarf Version", i32 4} 52!4 = !{i32 2, !"Debug Info Version", i32 3} 53!5 = !{!"clang"} 54!6 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: 55DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 56!7 = !DISubroutineType(types: !8) 57!8 = !{null, !9} 58!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64) 59!10 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !11) 60!11 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 61!19 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 62!12 = !DILocalVariable(name: "a", scope: !6, file: !1, line: 2, type: !9) 63!13 = !DILocalVariable(name: "b", scope: !6, file: !1, line: 3, type: !9) 64!14 = !DILocalVariable(name: "c", scope: !6, file: !1, line: 4, type: !19) 65!15 = !DILocation(line: 2, column: 10, scope: !6) 66!16 = !DILocation(line: 3, column: 11, scope: !6) 67!17 = !DILocation(line: 4, column: 12, scope: !6) 68!18 = !DILocation(line: 5, column: 13, scope: !6) 69