xref: /wasmtime-44.0.1/tests/disas/debug.wat (revision 9500c417)
1;;! target = "x86_64"
2;;! test = "compile"
3;;! flags = ["-Dguest-debug=yes"]
4;;! objdump = "--funcs all"
5
6(module
7  (func (export "main") (param i32 i32) (result i32)
8    local.get 0
9    local.get 1
10    i32.add))
11;; wasm[0]::function[0]:
12;;       pushq   %rbp
13;;       movq    %rsp, %rbp
14;;       subq    $0x30, %rsp
15;;       movq    %r12, 0x20(%rsp)
16;;       movl    %edx, 8(%rsp)
17;;       movl    %ecx, 0xc(%rsp)
18;;       movq    8(%rdi), %r11
19;;       movq    0x18(%r11), %r11
20;;       movq    %rsp, %rax
21;;       cmpq    %r11, %rax
22;;       jb      0x62
23;;   29: movq    %rdi, (%rsp)
24;;       nopl    (%rax, %rax)
25;;       ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x24, slot at FP-0x30, locals I32 @ slot+0x8, I32 @ slot+0xc, stack
26;;       ╰─╼ breakpoint patch: wasm PC 0x24, patch bytes [232, 184, 1, 0, 0]
27;;       movl    %edx, 0x10(%rsp)
28;;       nopl    (%rax, %rax)
29;;       ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x26, slot at FP-0x30, locals I32 @ slot+0x8, I32 @ slot+0xc, stack I32 @ slot+0x10
30;;       ╰─╼ breakpoint patch: wasm PC 0x26, patch bytes [232, 175, 1, 0, 0]
31;;       movl    %ecx, 0x14(%rsp)
32;;       nopl    (%rax, %rax)
33;;       ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x28, slot at FP-0x30, locals I32 @ slot+0x8, I32 @ slot+0xc, stack I32 @ slot+0x10, I32 @ slot+0x14
34;;       ╰─╼ breakpoint patch: wasm PC 0x28, patch bytes [232, 166, 1, 0, 0]
35;;       leal    (%rdx, %rcx), %eax
36;;       movl    %eax, 0x10(%rsp)
37;;       nopl    (%rax, %rax)
38;;       ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x29, slot at FP-0x30, locals I32 @ slot+0x8, I32 @ slot+0xc, stack I32 @ slot+0x10
39;;       ╰─╼ breakpoint patch: wasm PC 0x29, patch bytes [232, 154, 1, 0, 0]
40;;       movl    %eax, 0x10(%rsp)
41;;       movq    0x20(%rsp), %r12
42;;       addq    $0x30, %rsp
43;;       movq    %rbp, %rsp
44;;       popq    %rbp
45;;       retq
46;;   62: movq    %rdi, %r12
47;;   65: xorl    %esi, %esi
48;;   67: callq   0x18c
49;;   6c: movq    %r12, %rdi
50;;   6f: callq   0x1bd
51;;       ╰─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x23, slot at FP-0x30, locals I32 @ slot+0x8, I32 @ slot+0xc, stack
52;;   74: ud2
53;;
54;; wasm[0]::array_to_wasm_trampoline[0]:
55;;       pushq   %rbp
56;;       movq    %rsp, %rbp
57;;       subq    $0x40, %rsp
58;;       movq    %rbx, 0x10(%rsp)
59;;       movq    %r12, 0x18(%rsp)
60;;       movq    %r13, 0x20(%rsp)
61;;       movq    %r14, 0x28(%rsp)
62;;       movq    %r15, 0x30(%rsp)
63;;       movl    (%rdx), %eax
64;;       movl    0x10(%rdx), %ecx
65;;       movq    %rdx, (%rsp)
66;;       movq    8(%rdi), %r8
67;;       movq    %rbp, %r9
68;;       movq    %r9, 0x48(%r8)
69;;       movq    %rsp, %r9
70;;       movq    %r9, 0x40(%r8)
71;;       leaq    0x39(%rip), %r9
72;;       movq    %r9, 0x50(%r8)
73;;       movq    %rax, %rdx
74;;       callq   0
75;;       ├─╼ exception frame offset: SP = FP - 0x40
76;;       ╰─╼ exception handler: default handler, no dynamic context, handler=0xf2
77;;       movq    (%rsp), %rdx
78;;       movl    %eax, (%rdx)
79;;       movl    $1, %eax
80;;       movq    0x10(%rsp), %rbx
81;;       movq    0x18(%rsp), %r12
82;;       movq    0x20(%rsp), %r13
83;;       movq    0x28(%rsp), %r14
84;;       movq    0x30(%rsp), %r15
85;;       addq    $0x40, %rsp
86;;       movq    %rbp, %rsp
87;;       popq    %rbp
88;;       retq
89;;   f2: xorl    %eax, %eax
90;;   f4: movq    0x10(%rsp), %rbx
91;;   f9: movq    0x18(%rsp), %r12
92;;   fe: movq    0x20(%rsp), %r13
93;;  103: movq    0x28(%rsp), %r14
94;;  108: movq    0x30(%rsp), %r15
95;;  10d: addq    $0x40, %rsp
96;;  111: movq    %rbp, %rsp
97;;  114: popq    %rbp
98;;  115: retq
99;;
100;; signatures[0]::wasm_to_array_trampoline:
101;;       pushq   %rbp
102;;       movq    %rsp, %rbp
103;;       subq    $0x30, %rsp
104;;       movq    %rbx, 0x20(%rsp)
105;;       movq    %rdx, %r8
106;;       movq    8(%rsi), %rax
107;;       movq    %rbp, %rdx
108;;       movq    %rdx, 0x30(%rax)
109;;       movq    %rbp, %rdx
110;;       movq    8(%rdx), %rdx
111;;       movq    %rdx, 0x38(%rax)
112;;       leaq    (%rsp), %rdx
113;;       movq    %r8, %rax
114;;       movl    %eax, (%rsp)
115;;       movl    %ecx, 0x10(%rsp)
116;;       movq    8(%rdi), %rax
117;;       movl    $2, %ecx
118;;       movq    %rsi, %rbx
119;;       callq   *%rax
120;;       movq    8(%rbx), %rcx
121;;       addq    $1, 0x10(%rcx)
122;;       testb   %al, %al
123;;       je      0x17a
124;;  169: movl    (%rsp), %eax
125;;       movq    0x20(%rsp), %rbx
126;;       addq    $0x30, %rsp
127;;       movq    %rbp, %rsp
128;;       popq    %rbp
129;;       retq
130;;  17a: movq    0x10(%rbx), %rax
131;;  17e: movq    0x198(%rax), %rax
132;;  185: movq    %rbx, %rdi
133;;  188: callq   *%rax
134;;  18a: ud2
135;;
136;; wasmtime_builtin_trap:
137;;       pushq   %rbp
138;;       movq    %rsp, %rbp
139;;       movq    8(%rdi), %r9
140;;       movq    %rbp, %r10
141;;       movq    %r10, 0x30(%r9)
142;;       movq    %rbp, %r10
143;;       movq    8(%r10), %r11
144;;       movq    %r11, 0x38(%r9)
145;;       movq    0x10(%rdi), %r11
146;;       movq    0x190(%r11), %r11
147;;       movzbq  %sil, %rsi
148;;       callq   *%r11
149;;       movq    %rbp, %rsp
150;;       popq    %rbp
151;;       retq
152;;
153;; wasmtime_builtin_raise:
154;;       pushq   %rbp
155;;       movq    %rsp, %rbp
156;;       movq    8(%rdi), %r8
157;;       movq    %rbp, %r9
158;;       movq    %r9, 0x30(%r8)
159;;       movq    %rbp, %r9
160;;       movq    8(%r9), %r9
161;;       movq    %r9, 0x38(%r8)
162;;       movq    0x10(%rdi), %r9
163;;       movq    0x198(%r9), %r9
164;;       callq   *%r9
165;;       movq    %rbp, %rsp
166;;       popq    %rbp
167;;       retq
168;;
169;; wasmtime_patchable_builtin_breakpoint:
170;;       pushq   %rbp
171;;       movq    %rsp, %rbp
172;;       subq    $0x150, %rsp
173;;       movq    %rax, (%rsp)
174;;       movq    %rcx, 8(%rsp)
175;;       movq    %rdx, 0x10(%rsp)
176;;       movq    %rbx, 0x18(%rsp)
177;;       movq    %rsi, 0x20(%rsp)
178;;       movq    %rdi, 0x28(%rsp)
179;;       movq    %r8, 0x30(%rsp)
180;;       movq    %r9, 0x38(%rsp)
181;;       movq    %r10, 0x40(%rsp)
182;;       movq    %r11, 0x48(%rsp)
183;;       movdqu  %xmm0, 0x50(%rsp)
184;;       movdqu  %xmm1, 0x60(%rsp)
185;;       movdqu  %xmm2, 0x70(%rsp)
186;;       movdqu  %xmm3, 0x80(%rsp)
187;;       movdqu  %xmm4, 0x90(%rsp)
188;;       movdqu  %xmm5, 0xa0(%rsp)
189;;       movdqu  %xmm6, 0xb0(%rsp)
190;;       movdqu  %xmm7, 0xc0(%rsp)
191;;       movdqu  %xmm8, 0xd0(%rsp)
192;;       movdqu  %xmm9, 0xe0(%rsp)
193;;       movdqu  %xmm10, 0xf0(%rsp)
194;;       movdqu  %xmm11, 0x100(%rsp)
195;;       movdqu  %xmm12, 0x110(%rsp)
196;;       movdqu  %xmm13, 0x120(%rsp)
197;;       movdqu  %xmm14, 0x130(%rsp)
198;;       movdqu  %xmm15, 0x140(%rsp)
199;;       movq    8(%rdi), %r10
200;;       movq    %rbp, %r11
201;;       movq    %r11, 0x30(%r10)
202;;       movq    %rbp, %r11
203;;       movq    8(%r11), %rax
204;;       movq    %rax, 0x38(%r10)
205;;       movq    0x10(%rdi), %rax
206;;       movq    0x1c8(%rax), %rcx
207;;       movq    %rdi, %rbx
208;;       callq   *%rcx
209;;       testb   %al, %al
210;;       je      0x3af
211;;  2e3: movq    (%rsp), %rax
212;;       movq    8(%rsp), %rcx
213;;       movq    0x10(%rsp), %rdx
214;;       movq    0x18(%rsp), %rbx
215;;       movq    0x20(%rsp), %rsi
216;;       movq    0x28(%rsp), %rdi
217;;       movq    0x30(%rsp), %r8
218;;       movq    0x38(%rsp), %r9
219;;       movq    0x40(%rsp), %r10
220;;       movq    0x48(%rsp), %r11
221;;       movdqu  0x50(%rsp), %xmm0
222;;       movdqu  0x60(%rsp), %xmm1
223;;       movdqu  0x70(%rsp), %xmm2
224;;       movdqu  0x80(%rsp), %xmm3
225;;       movdqu  0x90(%rsp), %xmm4
226;;       movdqu  0xa0(%rsp), %xmm5
227;;       movdqu  0xb0(%rsp), %xmm6
228;;       movdqu  0xc0(%rsp), %xmm7
229;;       movdqu  0xd0(%rsp), %xmm8
230;;       movdqu  0xe0(%rsp), %xmm9
231;;       movdqu  0xf0(%rsp), %xmm10
232;;       movdqu  0x100(%rsp), %xmm11
233;;       movdqu  0x110(%rsp), %xmm12
234;;       movdqu  0x120(%rsp), %xmm13
235;;       movdqu  0x130(%rsp), %xmm14
236;;       movdqu  0x140(%rsp), %xmm15
237;;       addq    $0x150, %rsp
238;;       movq    %rbp, %rsp
239;;       popq    %rbp
240;;       retq
241;;  3af: movq    0x10(%rbx), %rax
242;;  3b3: movq    0x198(%rax), %rax
243;;  3ba: movq    %rbx, %rdi
244;;  3bd: callq   *%rax
245;;  3bf: ud2
246