Skip to content

Commit 263efb0

Browse files
[lli] Revisit Orc debug output tests (#76822)
Integrate in-memory debug-info dumps into the `--orc-lazy-debug` command-line option instead of exposing built-in functions to be called from JITed code. This reduces overall amount of code (removing `ExecutionUtils.cpp`) and seems cleaner anyway. All existing items of `OrcDumpKind` work on IR level and run in the IR-transform step of the JIT. The newly added `DumpDebugDescriptor` and `DumpDebugObjects` must run after debug-registration and thus are deferred to the Object-transform step of the JIT. This separation is the major side-effect of the patch.
1 parent 02a28ee commit 263efb0

File tree

7 files changed

+170
-322
lines changed

7 files changed

+170
-322
lines changed

llvm/test/ExecutionEngine/OrcLazy/debug-descriptor-elf-minimal.ll renamed to llvm/test/ExecutionEngine/OrcLazy/debug-descriptor.ll

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
1-
; REQUIRES: native && x86_64-linux
1+
; REQUIRES: native && target-x86_64
22

3-
; RUN: lli --jit-linker=rtdyld \
4-
; RUN: --generate=__dump_jit_debug_descriptor %s | FileCheck %s
3+
; RUN: lli --jit-linker=rtdyld --orc-lazy-debug=jit-debug-descriptor %s 2>&1 | FileCheck %s
4+
; RUN: lli --jit-linker=jitlink --orc-lazy-debug=jit-debug-descriptor %s 2>&1 | FileCheck %s
55
;
6-
; RUN: lli --jit-linker=jitlink \
7-
; RUN: --generate=__dump_jit_debug_descriptor %s | FileCheck %s
6+
; Initial entry should be empty:
7+
; CHECK: jit_debug_descriptor 0x0000000000000000
88
;
9-
; CHECK: Reading __jit_debug_descriptor at 0x{{.*}}
10-
; CHECK: Version: 1
11-
; CHECK: Action: JIT_REGISTER_FN
12-
; CHECK: Entry Symbol File Size Previous Entry
13-
; CHECK: [ 0] 0x{{.*}} 0x{{.*}} {{.*}} 0x0000000000000000
14-
15-
target triple = "x86_64-unknown-unknown-elf"
16-
17-
; Built-in symbol provided by the JIT
18-
declare void @__dump_jit_debug_descriptor(ptr)
19-
20-
; Host-process symbol from the GDB JIT interface
21-
@__jit_debug_descriptor = external global i8, align 1
9+
; After adding the module it must not be empty anymore:
10+
; CHECK: jit_debug_descriptor 0x
11+
; CHECK-NOT: 000000000000000
12+
; CHECK-SAME: {{[048c]}}
2213

2314
define i32 @main() !dbg !9 {
24-
%1 = alloca i32, align 4
25-
store i32 0, ptr %1, align 4
26-
call void @__dump_jit_debug_descriptor(ptr @__jit_debug_descriptor), !dbg !13
2715
ret i32 0, !dbg !14
2816
}
2917

llvm/test/ExecutionEngine/OrcLazy/debug-objects-elf-minimal.ll

Lines changed: 0 additions & 82 deletions
This file was deleted.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
; REQUIRES: native && x86_64-linux
2+
3+
; In-memory debug-objects contain DWARF
4+
;
5+
; RUN: lli --jit-linker=rtdyld --orc-lazy-debug=jit-debug-objects %s | llvm-dwarfdump --diff - | FileCheck %s
6+
; RUN: lli --jit-linker=jitlink --orc-lazy-debug=jit-debug-objects %s | llvm-dwarfdump --diff - | FileCheck %s
7+
;
8+
; CHECK: -: file format elf64-x86-64
9+
; TODO: Synthesized Mach-O objects error out with:
10+
; truncated or malformed object (offset field of section 8 in
11+
; LC_SEGMENT_64 command 0 extends past the end of the file)
12+
;
13+
; CHECK: .debug_info contents:
14+
; CHECK: format = DWARF32
15+
; CHECK: DW_TAG_compile_unit
16+
; CHECK: DW_AT_producer ("clang version 18.0.0git")
17+
; CHECK: DW_AT_language (DW_LANG_C11)
18+
; CHECK: DW_AT_name ("source-file.c")
19+
; CHECK: DW_AT_comp_dir ("/workspace")
20+
; CHECK: DW_TAG_subprogram
21+
; CHECK: DW_AT_frame_base (DW_OP_reg7 RSP)
22+
; CHECK: DW_AT_name ("main")
23+
; CHECK: DW_AT_decl_file ("/workspace/source-file.c")
24+
; CHECK: DW_AT_decl_line (1)
25+
; CHECK: DW_AT_type ("int")
26+
; CHECK: DW_AT_external (true)
27+
; CHECK: DW_TAG_base_type
28+
; CHECK: DW_AT_name ("int")
29+
; CHECK: DW_AT_encoding (DW_ATE_signed)
30+
; CHECK: DW_AT_byte_size (0x04)
31+
; CHECK: NULL
32+
33+
; Text section of the in-memory debug-objects have non-null load-address
34+
;
35+
; RUN: lli --jit-linker=rtdyld --orc-lazy-debug=jit-debug-objects %s | \
36+
; RUN: llvm-objdump --section-headers - | \
37+
; RUN: FileCheck --check-prefix=CHECK_LOAD_ADDR %s
38+
; RUN: lli --jit-linker=jitlink --orc-lazy-debug=jit-debug-objects %s | \
39+
; RUN: llvm-objdump --section-headers - | \
40+
; RUN: FileCheck --check-prefix=CHECK_LOAD_ADDR %s
41+
;
42+
; CHECK_LOAD_ADDR: .text
43+
; CHECK_LOAD_ADDR-NOT: 0000000000000000
44+
; CHECK_LOAD_ADDR-SAME: TEXT
45+
46+
define i32 @main() !dbg !3 {
47+
entry:
48+
ret i32 0, !dbg !8
49+
}
50+
51+
!llvm.module.flags = !{!0}
52+
!llvm.dbg.cu = !{!2}
53+
54+
!0 = !{i32 2, !"Debug Info Version", i32 3}
55+
!1 = !DIFile(filename: "source-file.c", directory: "/workspace")
56+
!2 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 18.0.0git", emissionKind: FullDebug)
57+
!3 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !4, scopeLine: 1, unit: !2, retainedNodes: !7)
58+
!4 = !DISubroutineType(types: !5)
59+
!5 = !{!6}
60+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
61+
!7 = !{}
62+
!8 = !DILocation(line: 1, column: 14, scope: !3)

llvm/tools/lli/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ endif( LLVM_USE_PERF )
5353

5454
add_llvm_tool(lli
5555
lli.cpp
56-
ExecutionUtils.cpp
5756

5857
DEPENDS
5958
intrinsics_gen

llvm/tools/lli/ExecutionUtils.cpp

Lines changed: 0 additions & 122 deletions
This file was deleted.

llvm/tools/lli/ExecutionUtils.h

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)