1; This checks that .debug_str_offsets.dwo can be generated in the DWARF64 format.
2
3; RUN: llc -mtriple=x86_64 -dwarf-version=5 -dwarf64 -split-dwarf-file=foo.dwo -filetype=obj %s -o %t
4; RUN: llvm-dwarfdump -debug-info -debug-str -debug-str-offsets -v %t | \
5; RUN:   FileCheck %s
6
7; CHECK:      .debug_info.dwo contents:
8; CHECK-NEXT: Compile Unit: {{.*}}, format = DWARF64,
9; CHECK:      DW_TAG_compile_unit [1] *
10; CHECK:        DW_AT_producer [DW_FORM_strx1] (indexed (00000002) string = "clang version 12.0.0")
11; CHECK:        DW_AT_name [DW_FORM_strx1] (indexed (00000003) string = "foo.c")
12; CHECK:        DW_AT_dwo_name [DW_FORM_strx1] (indexed (00000004) string = "foo.dwo")
13; CHECK:      DW_TAG_variable [2]
14; CHECK:        DW_AT_name [DW_FORM_strx1] (indexed (00000000) string = "foo")
15; CHECK:      DW_TAG_base_type [3]
16; CHECK:        DW_AT_name [DW_FORM_strx1] (indexed (00000001) string = "int")
17
18; CHECK:      .debug_str.dwo contents:
19; CHECK-NEXT: 0x00000000: "foo"
20; CHECK-NEXT: 0x00000004: "int"
21; CHECK-NEXT: 0x00000008: "clang version 12.0.0"
22; CHECK-NEXT: 0x0000001d: "foo.c"
23; CHECK-NEXT: 0x00000023: "foo.dwo"
24
25; CHECK:      .debug_str_offsets.dwo contents:
26; CHECK-NEXT: 0x00000000: Contribution size = 44, Format = DWARF64, Version = 5
27; CHECK-NEXT: 0x00000010: 0000000000000000 "foo"
28; CHECK-NEXT: 0x00000018: 0000000000000004 "int"
29; CHECK-NEXT: 0x00000020: 0000000000000008 "clang version 12.0.0"
30; CHECK-NEXT: 0x00000028: 000000000000001d "foo.c"
31; CHECK-NEXT: 0x00000030: 0000000000000023 "foo.dwo"
32
33; IR generated and reduced from:
34; $ cat foo.c
35; int foo;
36; $ clang -g -S -emit-llvm foo.c -o foo.ll
37
38target triple = "x86_64-unknown-linux-gnu"
39
40@foo = dso_local global i32 0, align 4, !dbg !0
41
42!llvm.dbg.cu = !{!2}
43!llvm.module.flags = !{!7, !8, !9}
44!llvm.ident = !{!10}
45
46!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
47!1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
48!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)
49!3 = !DIFile(filename: "foo.c", directory: "/tmp")
50!4 = !{}
51!5 = !{!0}
52!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
53!7 = !{i32 7, !"Dwarf Version", i32 4}
54!8 = !{i32 2, !"Debug Info Version", i32 3}
55!9 = !{i32 1, !"wchar_size", i32 4}
56!10 = !{!"clang version 12.0.0"}
57