103 lines · plain
1; RUN: llc -dwarf-version=4 \2; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-windows-msvc < %s \3; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SINGLE-44 5; RUN: llc -split-dwarf-file=foo.dwo -split-dwarf-output=%t.dwo \6; RUN: -dwarf-version=4 \7; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-windows-msvc < %s \8; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=O-49; RUN: llvm-dwarfdump -v %t.dwo | FileCheck %s --check-prefix=DWO-410 11; This test is derived from test/CodeGen/X86/dwarf-headers.ll12 13; Looking for DWARF headers to be generated correctly.14; There are 8 variants with 5 formats: v4 CU, v4 TU, v5 normal/partial CU,15; v5 skeleton/split CU, v5 normal/split TU. Some v5 variants differ only16; in the unit_type code, and the skeleton/split CU differs from normal/partial17; by having one extra field (dwo_id).18; (v2 thru v4 CUs are all the same, and TUs were invented in v4,19; so we don't bother checking older versions.)20 21; Test case built from:22;struct S {23; int s1;24;};25;26;S s;27 28; Verify the v4 non-split headers.29; Note that we check the exact offset of the DIEs because that tells us30; the length of the header.31;32; SINGLE-4: .debug_info contents:33; SINGLE-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004, abbr_offset34; SINGLE-4: 0x0000000b: DW_TAG_compile_unit35 36; Verify the v4 split headers.37;38; O-4: .debug_info contents:39; O-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004, abbr_offset40; O-4: 0x0000000b: DW_TAG_compile_unit41;42; DWO-4: .debug_info.dwo contents:43; DWO-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004, abbr_offset44; DWO-4: 0x0000000b: DW_TAG_compile_unit45 46; Check that basic CodeView compiler info is emitted even when the DWARF debug format is used.47; RUN: llc -dwarf-version=4 \48; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-windows-msvc < %s \49; RUN: | llvm-readobj --codeview - | FileCheck %s --check-prefix=CODEVIEW50; CODEVIEW: CodeViewDebugInfo [51; CODEVIEW-NEXT: Section: .debug$S (4)52; CODEVIEW-NEXT: Magic: 0x453; CODEVIEW-NEXT: Subsection [54; CODEVIEW-NEXT: SubSectionType: Symbols (0xF1)55; CODEVIEW-NEXT: SubSectionSize: 0x9056; CODEVIEW-NEXT: ObjNameSym {57; CODEVIEW-NEXT: Kind: S_OBJNAME (0x1101)58; CODEVIEW-NEXT: Signature: 0x059; CODEVIEW-NEXT: ObjectName:60; CODEVIEW-NEXT: }61; CODEVIEW-NEXT: Compile3Sym {62; CODEVIEW-NEXT: Kind: S_COMPILE3 (0x113C)63; CODEVIEW-NEXT: Language: Cpp (0x1)64; CODEVIEW-NEXT: Flags [ (0x0)65; CODEVIEW-NEXT: ]66; CODEVIEW-NEXT: Machine: X64 (0xD0)67; CODEVIEW-NEXT: FrontendVersion: 17.0.0.068; CODEVIEW-NEXT: BackendVersion:69; CODEVIEW-NEXT: VersionName: clang version 17.0.070; CODEVIEW-NEXT: }71; CODEVIEW-NEXT: ]72; CODEVIEW-NEXT: ]73 74; ModuleID = 't.cpp'75source_filename = "t.cpp"76target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"77target triple = "x86_64-unknown-windows-msvc"78 79%struct.S = type { i32 }80 81@"?s@@3US@@A" = dso_local global %struct.S zeroinitializer, align 4, !dbg !082 83!llvm.dbg.cu = !{!2}84!llvm.module.flags = !{!9, !10, !11, !12, !13, !14}85!llvm.ident = !{!15}86 87!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())88!1 = distinct !DIGlobalVariable(name: "s", linkageName: "?s@@3US@@A", scope: !2, file: !3, line: 5, type: !5, isLocal: false, isDefinition: true)89!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 17.0.0 (https://github.com/llvm/llvm-project.git f1106ef6c9d14d5b516ec352279aeee8f9d12818)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)90!3 = !DIFile(filename: "t.cpp", directory: "e:\\llvm-project\\foo")91!4 = !{!0}92!5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !3, line: 1, size: 32, flags: DIFlagTypePassByValue, elements: !6, identifier: ".?AUS@@")93!6 = !{!7}94!7 = !DIDerivedType(tag: DW_TAG_member, name: "s1", scope: !5, file: !3, line: 2, baseType: !8, size: 32)95!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)96!9 = !{i32 7, !"Dwarf Version", i32 4}97!10 = !{i32 2, !"Debug Info Version", i32 3}98!11 = !{i32 1, !"wchar_size", i32 2}99!12 = !{i32 8, !"PIC Level", i32 2}100!13 = !{i32 7, !"uwtable", i32 2}101!14 = !{i32 1, !"MaxTLSAlign", i32 65536}102!15 = !{!"clang version 17.0.0 (https://github.com/llvm/llvm-project.git f1106ef6c9d14d5b516ec352279aeee8f9d12818)"}103