Rev 5461 | Rev 7675 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5461 | Rev 6344 | ||
---|---|---|---|
1 | ;COLOR_THEME fix BLACK_ON_WHITE |
1 | ;COLOR_THEME fix BLACK_ON_WHITE |
2 | COLOR_THEME fix MOVIEOS |
2 | COLOR_THEME fix MOVIEOS |
3 | 3 | ||
4 | format binary as "" |
4 | format binary as "" |
5 | include '../../macros.inc' |
5 | include '../../macros.inc' |
6 | use32 |
6 | use32 |
7 | db 'MENUET01' |
7 | db 'MENUET01' |
8 | dd 1 |
8 | dd 1 |
9 | dd start |
9 | dd start |
10 | dd i_end |
10 | dd i_end |
11 | dd used_mem |
11 | dd used_mem |
12 | dd used_mem |
12 | dd used_mem |
13 | dd i_param |
13 | dd i_param |
14 | dd 0 |
14 | dd 0 |
15 | 15 | ||
16 | ;----------------------------------------------------------------------------- |
16 | ;----------------------------------------------------------------------------- |
17 | 17 | ||
18 | REG_MODE_CPU equ 1 |
18 | REG_MODE_CPU equ 1 |
19 | REG_MODE_MMX equ 2 |
19 | REG_MODE_MMX equ 2 |
20 | REG_MODE_SSE equ 3 |
20 | REG_MODE_SSE equ 3 |
21 | REG_MODE_AVX equ 4 |
21 | REG_MODE_AVX equ 4 |
22 | 22 | ||
23 | ;----------------------------------------------------------------------------- |
23 | ;----------------------------------------------------------------------------- |
24 | 24 | ||
25 | include 'gui.inc' ; GUI routines |
25 | include 'gui.inc' ; GUI routines |
26 | 26 | ||
27 | ;----------------------------------------------------------------------------- |
27 | ;----------------------------------------------------------------------------- |
28 | ; Find command in list |
28 | ; Find command in list |
29 | 29 | ||
30 | find_cmd: |
30 | find_cmd: |
31 | ; all commands are case-insensitive |
31 | ; all commands are case-insensitive |
32 | push edi |
32 | push edi |
33 | 33 | ||
34 | .x4: |
34 | .x4: |
35 | mov al, [edi] |
35 | mov al, [edi] |
36 | cmp al, 0 |
36 | cmp al, 0 |
37 | jz .x5 |
37 | jz .x5 |
38 | cmp al, 'A' |
38 | cmp al, 'A' |
39 | jb @f |
39 | jb @f |
40 | cmp al, 'Z' |
40 | cmp al, 'Z' |
41 | ja @f |
41 | ja @f |
42 | or al, 20h |
42 | or al, 20h |
43 | 43 | ||
44 | @@: |
44 | @@: |
45 | stosb |
45 | stosb |
46 | jmp .x4 |
46 | jmp .x4 |
47 | 47 | ||
48 | ; find command |
48 | ; find command |
49 | .x5: |
49 | .x5: |
50 | pop edi |
50 | pop edi |
51 | 51 | ||
52 | .x6: |
52 | .x6: |
53 | cmp dword [esi], 0 |
53 | cmp dword [esi], 0 |
54 | jz .x7 |
54 | jz .x7 |
55 | push esi |
55 | push esi |
56 | mov esi, [esi] |
56 | mov esi, [esi] |
57 | lodsb |
57 | lodsb |
58 | movzx ecx, al |
58 | movzx ecx, al |
59 | push edi |
59 | push edi |
60 | repz cmpsb |
60 | repz cmpsb |
61 | pop edi |
61 | pop edi |
62 | pop esi |
62 | pop esi |
63 | jz .x8 |
63 | jz .x8 |
64 | add esi, 17 |
64 | add esi, 17 |
65 | jmp .x6 |
65 | jmp .x6 |
66 | 66 | ||
67 | .x7: |
67 | .x7: |
68 | stc |
68 | stc |
69 | 69 | ||
70 | .x8: |
70 | .x8: |
71 | ret |
71 | ret |
72 | 72 | ||
73 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
73 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DEBUGGING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DEBUGGING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
75 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
75 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
76 | 76 | ||
77 | ;----------------------------------------------------------------------------- |
77 | ;----------------------------------------------------------------------------- |
78 | ; Help event |
78 | ; Help event |
79 | 79 | ||
80 | OnHelp: |
80 | OnHelp: |
81 | mov esi, help_msg |
81 | mov esi, help_msg |
82 | mov edi, [curarg] |
82 | mov edi, [curarg] |
83 | cmp byte [edi], 0 |
83 | cmp byte [edi], 0 |
84 | jz .x |
84 | jz .x |
85 | mov esi, help_groups |
85 | mov esi, help_groups |
86 | call find_cmd |
86 | call find_cmd |
87 | jc .nocmd |
87 | jc .nocmd |
88 | mov esi, [esi+12] |
88 | mov esi, [esi+12] |
89 | 89 | ||
90 | .x: |
90 | .x: |
91 | jmp put_message |
91 | jmp put_message |
92 | 92 | ||
93 | .nocmd: |
93 | .nocmd: |
94 | mov esi, aUnknownCommand |
94 | mov esi, aUnknownCommand |
95 | jmp .x |
95 | jmp .x |
96 | 96 | ||
97 | ;----------------------------------------------------------------------------- |
97 | ;----------------------------------------------------------------------------- |
98 | ; Quit event |
98 | ; Quit event |
99 | OnQuit: |
99 | OnQuit: |
100 | mcall -1 |
100 | mcall -1 |
101 | 101 | ||
102 | ;----------------------------------------------------------------------------- |
102 | ;----------------------------------------------------------------------------- |
103 | ; Working with debug context |
103 | ; Working with debug context |
104 | 104 | ||
105 | get_new_context: |
105 | get_new_context: |
106 | mov esi, context |
106 | mov esi, context |
107 | mov edi, oldcontext |
107 | mov edi, oldcontext |
108 | mov ecx, (ctx_end-context)/4 |
108 | mov ecx, (ctx_end-context)/4 |
109 | rep movsd |
109 | rep movsd |
110 | 110 | ||
111 | get_context: |
111 | get_context: |
112 | mcall 69, 1, [debuggee_pid], ctx_end-context, context |
112 | mcall 69, 1, [debuggee_pid], ctx_end-context, context |
113 | ret |
113 | ret |
114 | 114 | ||
115 | set_context: |
115 | set_context: |
116 | ;push 2 |
- | |
117 | ;pop ebx |
- | |
118 | ;push 69 |
- | |
119 | ;pop eax |
- | |
120 | ;mov ecx, [debuggee_pid] |
- | |
121 | ;mov esi, context |
- | |
122 | ;push 28h |
- | |
123 | ;pop edx |
- | |
124 | mcall 69, 2, [debuggee_pid], 28h, context |
116 | mcall 69, 2, [debuggee_pid], 28h, context |
125 | ret |
117 | ret |
126 | 118 | ||
127 | get_dump: |
119 | get_dump: |
128 | mov edi, dumpdata |
120 | mov edi, dumpdata |
129 | mov esi, [edi-4] |
121 | mov esi, [edi-4] |
130 | mov edx, dump_height*10h |
122 | mov edx, dump_height*10h |
131 | mov ecx, edx |
123 | mov ecx, edx |
132 | xor eax, eax |
124 | xor eax, eax |
133 | push edi |
125 | push edi |
134 | rep stosb |
126 | rep stosb |
135 | pop edi |
127 | pop edi |
136 | ;mov ecx, [debuggee_pid] |
- | |
137 | ;mov al, 69 |
- | |
138 | ;push 6 |
- | |
139 | ;pop ebx |
- | |
140 | mcall 69, 6, [debuggee_pid] |
128 | mcall 69, 6, [debuggee_pid] |
141 | cmp eax, -1 |
129 | cmp eax, -1 |
142 | jnz @f |
130 | jnz @f |
143 | mov esi, read_mem_err |
131 | mov esi, read_mem_err |
144 | call put_message |
132 | call put_message |
145 | xor eax, eax |
133 | xor eax, eax |
146 | 134 | ||
147 | @@: |
135 | @@: |
148 | mov [edi-8], eax |
136 | mov [edi-8], eax |
149 | ; call restore_from_breaks |
137 | ; call restore_from_breaks |
150 | ; ret |
138 | ; ret |
151 | 139 | ||
152 | ; in: edi=buffer,eax=size,esi=address |
140 | ; in: edi=buffer,eax=size,esi=address |
153 | restore_from_breaks: |
141 | restore_from_breaks: |
154 | mov ebx, breakpoints |
142 | mov ebx, breakpoints |
155 | 143 | ||
156 | @@: |
144 | @@: |
157 | test byte [ebx+4], 1 |
145 | test byte [ebx+4], 1 |
158 | jz .cont ; ignore invalid |
146 | jz .cont ; ignore invalid |
159 | test byte [ebx+4], 2 or 8 |
147 | test byte [ebx+4], 2 or 8 |
160 | jnz .cont ; ignore disabled and memory breaks |
148 | jnz .cont ; ignore disabled and memory breaks |
161 | mov ecx, [ebx] |
149 | mov ecx, [ebx] |
162 | sub ecx, esi |
150 | sub ecx, esi |
163 | cmp ecx, eax |
151 | cmp ecx, eax |
164 | jae .cont |
152 | jae .cont |
165 | mov dl, [ebx+5] |
153 | mov dl, [ebx+5] |
166 | mov [edi+ecx], dl |
154 | mov [edi+ecx], dl |
167 | 155 | ||
168 | .cont: |
156 | .cont: |
169 | add ebx, 6 |
157 | add ebx, 6 |
170 | cmp ebx, breakpoints+breakpoints_n*6 |
158 | cmp ebx, breakpoints+breakpoints_n*6 |
171 | jb @b |
159 | jb @b |
172 | ret |
160 | ret |
173 | 161 | ||
174 | ;----------------------------------------------------------------------------- |
162 | ;----------------------------------------------------------------------------- |
175 | ; Load executable event |
163 | ; Load executable event |
176 | 164 | ||
177 | OnLoad: |
165 | OnLoad: |
178 | mov esi, [curarg] |
166 | mov esi, [curarg] |
179 | 167 | ||
180 | OnLoadInit: |
168 | OnLoadInit: |
181 | mov edi, loadname |
169 | mov edi, loadname |
182 | or [prgname_len], -1 |
170 | or [prgname_len], -1 |
183 | mov [prgname_ptr], edi |
171 | mov [prgname_ptr], edi |
184 | 172 | ||
185 | .copyname: |
173 | .copyname: |
186 | lodsb |
174 | lodsb |
187 | stosb |
175 | stosb |
188 | inc [prgname_len] |
176 | inc [prgname_len] |
189 | cmp al, '/' |
177 | cmp al, '/' |
190 | jnz @f |
178 | jnz @f |
191 | or [prgname_len], -1 |
179 | or [prgname_len], -1 |
192 | mov [prgname_ptr], edi |
180 | mov [prgname_ptr], edi |
193 | 181 | ||
194 | @@: |
182 | @@: |
195 | cmp al, ' ' |
183 | cmp al, ' ' |
196 | ja .copyname |
184 | ja .copyname |
197 | mov byte [edi-1], 0 |
185 | mov byte [edi-1], 0 |
198 | and [load_params], 0 |
186 | and [load_params], 0 |
199 | dec esi |
187 | dec esi |
200 | call get_arg.skip_spaces |
188 | call get_arg.skip_spaces |
201 | cmp al, 0 |
189 | cmp al, 0 |
202 | jz @f |
190 | jz @f |
203 | mov [load_params], esi |
191 | mov [load_params], esi |
204 | 192 | ||
205 | @@: |
193 | @@: |
206 | and [dumppos], 0 |
194 | and [dumppos], 0 |
207 | mov ecx, [symbols] |
195 | mov ecx, [symbols] |
208 | jecxz do_reload |
196 | jecxz do_reload |
209 | mcall 68, 13 |
197 | mcall 68, 13 |
210 | and [symbols], 0 |
198 | and [symbols], 0 |
211 | and [num_symbols], 0 |
199 | and [num_symbols], 0 |
212 | 200 | ||
213 | ; TODO: make it local |
201 | ; TODO: make it local |
214 | do_reload: |
202 | do_reload: |
215 | ;push 18 |
203 | ;push 18 |
216 | ;pop eax |
204 | ;pop eax |
217 | ;push 7 |
205 | ;push 7 |
218 | ;pop ebx |
206 | ;pop ebx |
219 | mcall 18, 7 |
207 | mcall 18, 7 |
220 | mov [dbgwnd], eax |
208 | mov [dbgwnd], eax |
221 | xchg ecx, eax |
209 | xchg ecx, eax |
222 | ;push 70 |
210 | ;push 70 |
223 | ;pop eax |
211 | ;pop eax |
224 | ;mov ebx, fn70_load_block |
212 | ;mov ebx, fn70_load_block |
225 | mcall 70, fn70_load_block |
213 | mcall 70, fn70_load_block |
226 | test eax, eax |
214 | test eax, eax |
227 | jns .load_ok |
215 | jns .load_ok |
228 | 216 | ||
229 | .load_err: |
217 | .load_err: |
230 | push eax |
218 | push eax |
231 | mov esi, load_err_msg |
219 | mov esi, load_err_msg |
232 | call put_message |
220 | call put_message |
233 | pop eax |
221 | pop eax |
234 | not eax |
222 | not eax |
235 | cmp eax, 0x20 |
223 | cmp eax, 0x20 |
236 | jae .unk_err |
224 | jae .unk_err |
237 | mov esi, [load_err_msgs+eax*4] |
225 | mov esi, [load_err_msgs+eax*4] |
238 | test esi, esi |
226 | test esi, esi |
239 | jnz put_message |
227 | jnz put_message |
240 | 228 | ||
241 | .unk_err: |
229 | .unk_err: |
242 | mov esi, unk_err_msg |
230 | mov esi, unk_err_msg |
243 | inc eax |
231 | inc eax |
244 | push eax |
232 | push eax |
245 | call put_message_nodraw |
233 | call put_message_nodraw |
246 | jmp draw_messages |
234 | jmp draw_messages |
247 | 235 | ||
248 | .load_ok: |
236 | .load_ok: |
249 | mov [debuggee_pid], eax |
237 | mov [debuggee_pid], eax |
250 | mov [bSuspended], 1 |
238 | mov [bSuspended], 1 |
- | 239 | mov eax, 5 |
|
- | 240 | mov ebx, 20 |
|
- | 241 | int 0x40 |
|
- | 242 | ||
251 | push ecx |
243 | push ecx |
252 | call get_context |
244 | call get_context |
253 | mov edi, oldcontext |
245 | mov edi, oldcontext |
254 | mov ecx, (ctx_end-context)/4 |
246 | mov ecx, (ctx_end-context)/4 |
255 | rep movsd |
247 | rep movsd |
256 | 248 | ||
257 | ; activate debugger window |
249 | ; activate debugger window |
258 | pop ecx |
250 | pop ecx |
259 | ;mov bl, 3 |
251 | ;mov bl, 3 |
260 | ;push 18 |
252 | ;push 18 |
261 | ;pop eax |
253 | ;pop eax |
262 | mcall 18, 3 |
254 | mcall 18, 3 |
263 | call redraw_title |
255 | call redraw_title |
264 | call draw_registers.redraw |
256 | call draw_registers.redraw |
265 | ; read and draw dump of memory |
257 | ; read and draw dump of memory |
266 | call get_dump |
258 | call get_dump |
267 | call draw_dump.redraw |
259 | call draw_dump.redraw |
268 | call update_disasm_eip_force |
260 | call update_disasm_eip_force |
269 | mov esi, load_succ_msg |
261 | mov esi, load_succ_msg |
270 | push [debuggee_pid] |
262 | push [debuggee_pid] |
271 | call put_message_nodraw |
263 | call put_message_nodraw |
272 | call draw_messages |
264 | call draw_messages |
273 | ; try to load symbols |
265 | ; try to load symbols |
274 | mov esi, loadname |
266 | mov esi, loadname |
275 | mov edi, symbolsfile |
267 | mov edi, symbolsfile |
276 | push edi |
268 | push edi |
277 | 269 | ||
278 | @@: |
270 | @@: |
279 | lodsb |
271 | lodsb |
280 | stosb |
272 | stosb |
281 | test al, al |
273 | test al, al |
282 | jnz @b |
274 | jnz @b |
283 | lea ecx, [edi-1] |
275 | lea ecx, [edi-1] |
284 | 276 | ||
285 | @@: |
277 | @@: |
286 | dec edi |
278 | dec edi |
287 | cmp edi, symbolsfile |
279 | cmp edi, symbolsfile |
288 | jb @f |
280 | jb @f |
289 | cmp byte [edi], '/' |
281 | cmp byte [edi], '/' |
290 | jz @f |
282 | jz @f |
291 | cmp byte [edi], '.' |
283 | cmp byte [edi], '.' |
292 | jnz @b |
284 | jnz @b |
293 | mov ecx, edi |
285 | mov ecx, edi |
294 | 286 | ||
295 | @@: |
287 | @@: |
296 | mov dword[ecx], '.dbg' |
288 | mov dword[ecx], '.dbg' |
297 | mov byte[ecx+4], 0 |
289 | mov byte[ecx+4], 0 |
298 | pop esi |
290 | pop esi |
299 | mov ebp, esi |
291 | mov ebp, esi |
300 | push ecx esi |
292 | push ecx esi |
301 | call OnLoadSymbols.silent ; Try to load .dbg file |
293 | call OnLoadSymbols.silent ; Try to load .dbg file |
302 | pop esi ecx |
294 | pop esi ecx |
303 | xor eax, eax |
295 | xor eax, eax |
304 | cmp [num_symbols], eax |
296 | cmp [num_symbols], eax |
305 | jne @f |
297 | jne @f |
306 | mov dword[ecx], '.map' ; If failed, try .map file too |
298 | mov dword[ecx], '.map' ; If failed, try .map file too |
307 | call OnLoadSymbols.silent |
299 | call OnLoadSymbols.silent |
308 | @@: |
300 | @@: |
309 | 301 | ||
310 | ; now test for packed progs |
302 | ; now test for packed progs |
311 | cmp [disasm_buf_size], 100h |
303 | cmp [disasm_buf_size], 100h |
312 | jz @f |
304 | jz @f |
313 | ret |
305 | ret |
314 | 306 | ||
315 | @@: |
307 | @@: |
316 | mov esi, mxp_nrv_sig |
308 | mov esi, mxp_nrv_sig |
317 | mov ebp, disasm_buffer |
309 | mov ebp, disasm_buffer |
318 | mov edi, ebp |
310 | mov edi, ebp |
319 | push 3 |
311 | push 3 |
320 | pop ecx |
312 | pop ecx |
321 | repz cmpsb |
313 | repz cmpsb |
322 | jnz .not_mxp_nrv |
314 | jnz .not_mxp_nrv |
323 | cmpsb |
315 | cmpsb |
324 | mov cl, mxp_nrv_sig_size-4 |
316 | mov cl, mxp_nrv_sig_size-4 |
325 | repz cmpsb |
317 | repz cmpsb |
326 | mov esi, mxp_nrv_name |
318 | mov esi, mxp_nrv_name |
327 | jz .packed |
319 | jz .packed |
328 | 320 | ||
329 | .not_mxp_nrv: |
321 | .not_mxp_nrv: |
330 | mov esi, mxp_sig |
322 | mov esi, mxp_sig |
331 | mov edi, ebp |
323 | mov edi, ebp |
332 | mov cl, mxp_sig_size |
324 | mov cl, mxp_sig_size |
333 | repz cmpsb |
325 | repz cmpsb |
334 | mov esi, mxp_name |
326 | mov esi, mxp_name |
335 | jz .packed |
327 | jz .packed |
336 | 328 | ||
337 | .not_mxp: |
329 | .not_mxp: |
338 | mov esi, mxp_lzo_sig1 |
330 | mov esi, mxp_lzo_sig1 |
339 | mov edi, ebp |
331 | mov edi, ebp |
340 | mov cl, mxp_lzo_sig1_size |
332 | mov cl, mxp_lzo_sig1_size |
341 | repz cmpsb |
333 | repz cmpsb |
342 | mov esi, mxp_lzo_name |
334 | mov esi, mxp_lzo_name |
343 | jz .packed |
335 | jz .packed |
344 | mov esi, mxp_lzo_sig2 |
336 | mov esi, mxp_lzo_sig2 |
345 | mov edi, ebp |
337 | mov edi, ebp |
346 | mov cl, 8 |
338 | mov cl, 8 |
347 | repz cmpsb |
339 | repz cmpsb |
348 | jnz .not_mxp_lzo |
340 | jnz .not_mxp_lzo |
349 | cmpsb |
341 | cmpsb |
350 | mov cl, mxp_lzo_sig2_size - 9 |
342 | mov cl, mxp_lzo_sig2_size - 9 |
351 | repz cmpsb |
343 | repz cmpsb |
352 | mov esi, mxp_lzo_name |
344 | mov esi, mxp_lzo_name |
353 | jz .packed |
345 | jz .packed |
354 | 346 | ||
355 | .not_mxp_lzo: |
347 | .not_mxp_lzo: |
356 | mov esi, mtappack_name |
348 | mov esi, mtappack_name |
357 | cmp dword [ebp], 0xBF5E246A |
349 | cmp dword [ebp], 0xBF5E246A |
358 | jnz .not_mtappack |
350 | jnz .not_mtappack |
359 | cmp dword [ebp+8], 0xEC4E8B57 |
351 | cmp dword [ebp+8], 0xEC4E8B57 |
360 | jnz .not_mtappack1 |
352 | jnz .not_mtappack1 |
361 | cmp dword [ebp+12], 0x8D5EA4F3 |
353 | cmp dword [ebp+12], 0x8D5EA4F3 |
362 | jnz .not_mtappack1 |
354 | jnz .not_mtappack1 |
363 | cmp byte [ebp+12h], 0xE9 |
355 | cmp byte [ebp+12h], 0xE9 |
364 | jz .packed |
356 | jz .packed |
365 | 357 | ||
366 | .not_mtappack1: |
358 | .not_mtappack1: |
367 | cmp word [ebp+8], 0xB957 |
359 | cmp word [ebp+8], 0xB957 |
368 | jnz .not_mtappack |
360 | jnz .not_mtappack |
369 | cmp dword [ebp+14], 0x575EA4F3 |
361 | cmp dword [ebp+14], 0x575EA4F3 |
370 | jnz .not_mtappack2 |
362 | jnz .not_mtappack2 |
371 | cmp byte [ebp+17h], 0xE9 |
363 | cmp byte [ebp+17h], 0xE9 |
372 | jz .packed |
364 | jz .packed |
373 | 365 | ||
374 | .not_mtappack2: |
366 | .not_mtappack2: |
375 | cmp dword [ebp+14], 0x5F8DA4F3 |
367 | cmp dword [ebp+14], 0x5F8DA4F3 |
376 | jnz .not_mtappack3 |
368 | jnz .not_mtappack3 |
377 | cmp word [ebp+18], 0xE9FC |
369 | cmp word [ebp+18], 0xE9FC |
378 | jz .packed |
370 | jz .packed |
379 | 371 | ||
380 | .not_mtappack3: |
372 | .not_mtappack3: |
381 | cmp word [ebp+14], 0xA4F3 |
373 | cmp word [ebp+14], 0xA4F3 |
382 | jnz .not_mtappack |
374 | jnz .not_mtappack |
383 | cmp byte [ebp+15h], 0xE9 |
375 | cmp byte [ebp+15h], 0xE9 |
384 | jz .packed |
376 | jz .packed |
385 | 377 | ||
386 | .not_mtappack: |
378 | .not_mtappack: |
387 | ret |
379 | ret |
388 | 380 | ||
389 | .packed: |
381 | .packed: |
390 | push esi |
382 | push esi |
391 | mov esi, aPacked1 |
383 | mov esi, aPacked1 |
392 | call put_message_nodraw |
384 | call put_message_nodraw |
393 | pop esi |
385 | pop esi |
394 | call put_message_nodraw |
386 | call put_message_nodraw |
395 | mov esi, aPacked2 |
387 | mov esi, aPacked2 |
396 | call put_message |
388 | call put_message |
397 | call hide_cursor |
389 | call hide_cursor |
398 | ;push 40 |
390 | ;push 40 |
399 | ;pop eax |
391 | ;pop eax |
400 | ;push 7 |
392 | ;push 7 |
401 | ;pop ebx |
393 | ;pop ebx |
402 | mcall 40, 7 |
394 | mcall 40, 7 |
403 | 395 | ||
404 | .wait: |
396 | .wait: |
405 | ;push 10 |
397 | ;push 10 |
406 | ;pop eax |
398 | ;pop eax |
407 | mcall 10 |
399 | mcall 10 |
408 | dec eax |
400 | dec eax |
409 | jz .redraw |
401 | jz .redraw |
410 | dec eax |
402 | dec eax |
411 | jz .key |
403 | jz .key |
412 | or eax, -1 |
404 | or eax, -1 |
413 | mcall |
405 | mcall |
414 | 406 | ||
415 | .redraw: |
407 | .redraw: |
416 | call draw_window |
408 | call draw_window |
417 | call hide_cursor |
409 | call hide_cursor |
418 | jmp .wait |
410 | jmp .wait |
419 | 411 | ||
420 | .key: |
412 | .key: |
421 | mov al, 2 |
413 | mov al, 2 |
422 | mcall |
414 | mcall |
423 | cmp ah, 'y' |
415 | cmp ah, 'y' |
424 | jz .yes |
416 | jz .yes |
425 | cmp ah, 'Y' |
417 | cmp ah, 'Y' |
426 | jz .yes |
418 | jz .yes |
427 | cmp ah, 0xD |
419 | cmp ah, 0xD |
428 | jz .yes |
420 | jz .yes |
429 | cmp ah, 'n' |
421 | cmp ah, 'n' |
430 | jz .no |
422 | jz .no |
431 | cmp ah, 'N' |
423 | cmp ah, 'N' |
432 | jnz .wait |
424 | jnz .wait |
433 | 425 | ||
434 | .no: |
426 | .no: |
435 | ;push 40 |
427 | ;push 40 |
436 | ;pop eax |
428 | ;pop eax |
437 | ;mov ebx, 0x107 |
429 | ;mov ebx, 0x107 |
438 | mcall 40, 0x107 |
430 | mcall 40, 0x107 |
439 | call draw_cursor |
431 | call draw_cursor |
440 | mov esi, aN_str |
432 | mov esi, aN_str |
441 | jmp put_message |
433 | jmp put_message |
442 | 434 | ||
443 | .yes: |
435 | .yes: |
444 | ;push 40 |
436 | ;push 40 |
445 | ;pop eax |
437 | ;pop eax |
446 | ;mov ebx, 0x107 |
438 | ;mov ebx, 0x107 |
447 | mcall 40, 0x107 |
439 | mcall 40, 0x107 |
448 | call draw_cursor |
440 | call draw_cursor |
449 | mov esi, aY_str |
441 | mov esi, aY_str |
450 | call put_message |
442 | call put_message |
451 | call OnUnpack |
443 | call OnUnpack |
452 | ret |
444 | ret |
453 | 445 | ||
454 | ;----------------------------------------------------------------------------- |
446 | ;----------------------------------------------------------------------------- |
455 | ; Searching signatures |
447 | ; Searching signatures |
456 | 448 | ||
457 | mxp_nrv_sig: |
449 | mxp_nrv_sig: |
458 | xor eax, eax |
450 | xor eax, eax |
459 | mov ecx, 0x95 ; 0xA1 for programs with parameters |
451 | mov ecx, 0x95 ; 0xA1 for programs with parameters |
460 | mov [eax], ecx |
452 | mov [eax], ecx |
461 | add ecx, [eax+24h] |
453 | add ecx, [eax+24h] |
462 | push 40h |
454 | push 40h |
463 | pop esi |
455 | pop esi |
464 | mov edi, [eax+20h] |
456 | mov edi, [eax+20h] |
465 | push edi |
457 | push edi |
466 | rep movsb |
458 | rep movsb |
467 | jmp dword [esp] |
459 | jmp dword [esp] |
468 | pop esi |
460 | pop esi |
469 | add esi, [eax] |
461 | add esi, [eax] |
470 | xor edi, edi |
462 | xor edi, edi |
471 | 463 | ||
472 | mxp_nrv_sig_size = $ - mxp_nrv_sig |
464 | mxp_nrv_sig_size = $ - mxp_nrv_sig |
473 | 465 | ||
474 | mxp_sig: |
466 | mxp_sig: |
475 | mov ecx, 1CBh |
467 | mov ecx, 1CBh |
476 | push 46h |
468 | push 46h |
477 | pop esi |
469 | pop esi |
478 | mov edi, [20h] |
470 | mov edi, [20h] |
479 | rep movsb |
471 | rep movsb |
480 | mov ecx, [24h] |
472 | mov ecx, [24h] |
481 | rep movsb |
473 | rep movsb |
482 | jmp dword [20h] |
474 | jmp dword [20h] |
483 | mov eax, [20h] |
475 | mov eax, [20h] |
484 | add eax, 1CBh |
476 | add eax, 1CBh |
485 | push eax |
477 | push eax |
486 | push dword [24h] |
478 | push dword [24h] |
487 | push 0 |
479 | push 0 |
488 | push 8 |
480 | push 8 |
489 | call $+0x25 |
481 | call $+0x25 |
490 | 482 | ||
491 | mxp_sig_size = $ - mxp_sig |
483 | mxp_sig_size = $ - mxp_sig |
492 | 484 | ||
493 | mxp_lzo_sig1: |
485 | mxp_lzo_sig1: |
494 | xor eax, eax |
486 | xor eax, eax |
495 | mov ebp, 0FFh |
487 | mov ebp, 0FFh |
496 | mov ecx, 175h |
488 | mov ecx, 175h |
497 | mov [eax], ecx |
489 | mov [eax], ecx |
498 | add ecx, [eax+24h] |
490 | add ecx, [eax+24h] |
499 | push 45h |
491 | push 45h |
500 | pop esi |
492 | pop esi |
501 | mov edi, [eax+20h] |
493 | mov edi, [eax+20h] |
502 | push edi |
494 | push edi |
503 | rep movsb |
495 | rep movsb |
504 | jmp dword [esp] |
496 | jmp dword [esp] |
505 | pop ebx |
497 | pop ebx |
506 | add ebx, [eax] |
498 | add ebx, [eax] |
507 | xor edi, edi |
499 | xor edi, edi |
508 | cmp byte [ebx], 11h |
500 | cmp byte [ebx], 11h |
509 | jbe $+0x1A |
501 | jbe $+0x1A |
510 | 502 | ||
511 | mxp_lzo_sig1_size = $ - mxp_lzo_sig1 |
503 | mxp_lzo_sig1_size = $ - mxp_lzo_sig1 |
512 | 504 | ||
513 | mxp_lzo_sig2: |
505 | mxp_lzo_sig2: |
514 | xor eax, eax |
506 | xor eax, eax |
515 | mov ebp, 0FFh |
507 | mov ebp, 0FFh |
516 | mov ecx, 188h ; or 177h |
508 | mov ecx, 188h ; or 177h |
517 | mov [eax], ecx |
509 | mov [eax], ecx |
518 | add ecx, [eax+24h] |
510 | add ecx, [eax+24h] |
519 | push 44h |
511 | push 44h |
520 | pop esi |
512 | pop esi |
521 | mov edi, [eax+20h] |
513 | mov edi, [eax+20h] |
522 | rep movsb |
514 | rep movsb |
523 | jmp dword [eax+20h] |
515 | jmp dword [eax+20h] |
524 | mov ebx, [eax+20h] |
516 | mov ebx, [eax+20h] |
525 | add ebx, [eax] |
517 | add ebx, [eax] |
526 | 518 | ||
527 | mxp_lzo_sig2_size = $ - mxp_lzo_sig2 |
519 | mxp_lzo_sig2_size = $ - mxp_lzo_sig2 |
528 | 520 | ||
529 | ;----------------------------------------------------------------------------- |
521 | ;----------------------------------------------------------------------------- |
530 | ; Reload executable event |
522 | ; Reload executable event |
531 | 523 | ||
532 | OnReload: |
524 | OnReload: |
533 | cmp [debuggee_pid], 0 |
525 | cmp [debuggee_pid], 0 |
534 | jnz terminate_reload |
526 | jnz terminate_reload |
535 | mov esi, need_debuggee |
527 | mov esi, need_debuggee |
536 | cmp byte [loadname], 0 |
528 | cmp byte [loadname], 0 |
537 | jnz do_reload |
529 | jnz do_reload |
538 | jz put_message |
530 | jz put_message |
539 | 531 | ||
540 | ; TODO: make it local |
532 | ; TODO: make it local |
541 | terminate_reload: |
533 | terminate_reload: |
542 | mov [bReload], 1 |
534 | mov [bReload], 1 |
543 | 535 | ||
544 | ;----------------------------------------------------------------------------- |
536 | ;----------------------------------------------------------------------------- |
545 | ; Terminate process event |
537 | ; Terminate process event |
546 | 538 | ||
547 | OnTerminate: |
539 | OnTerminate: |
548 | ;mov ecx, [debuggee_pid] |
540 | ;mov ecx, [debuggee_pid] |
549 | ;push 8 |
541 | ;push 8 |
550 | ;pop ebx |
542 | ;pop ebx |
551 | ;push 69 |
543 | ;push 69 |
552 | ;pop eax |
544 | ;pop eax |
553 | mcall 69, 8, [debuggee_pid] |
545 | mcall 69, 8, [debuggee_pid] |
554 | ret |
546 | ret |
555 | ;----------------------------------------------------------------------------- |
547 | ;----------------------------------------------------------------------------- |
556 | ; Suspend process event |
548 | ; Suspend process event |
557 | 549 | ||
558 | AfterSuspend: |
550 | AfterSuspend: |
559 | mov [bSuspended], 1 |
551 | mov [bSuspended], 1 |
560 | call get_new_context |
552 | call get_new_context |
561 | call get_dump |
553 | call get_dump |
562 | call redraw_title |
554 | call redraw_title |
563 | call draw_registers.redraw |
555 | call draw_registers.redraw |
564 | call draw_dump.redraw |
556 | call draw_dump.redraw |
565 | call update_disasm_eip |
557 | call update_disasm_eip |
566 | ret |
558 | ret |
567 | 559 | ||
568 | OnSuspend: |
560 | OnSuspend: |
569 | ;mov ecx, [debuggee_pid] |
561 | ;mov ecx, [debuggee_pid] |
570 | ;push 4 |
562 | ;push 4 |
571 | ;pop ebx |
563 | ;pop ebx |
572 | ;push 69 |
564 | ;push 69 |
573 | ;pop eax |
565 | ;pop eax |
574 | mcall 69, 4, [debuggee_pid] |
566 | mcall 69, 4, [debuggee_pid] |
575 | call AfterSuspend |
567 | call AfterSuspend |
576 | mov esi, aSuspended |
568 | mov esi, aSuspended |
577 | jmp put_message |
569 | jmp put_message |
578 | 570 | ||
579 | ;----------------------------------------------------------------------------- |
571 | ;----------------------------------------------------------------------------- |
580 | ; Resume process event |
572 | ; Resume process event |
581 | 573 | ||
582 | DoResume: |
574 | DoResume: |
583 | ;mov ecx, [debuggee_pid] |
575 | ;mov ecx, [debuggee_pid] |
584 | ;push 5 |
576 | ;push 5 |
585 | ;pop ebx |
577 | ;pop ebx |
586 | ;push 69 |
578 | ;push 69 |
587 | ;pop eax |
579 | ;pop eax |
588 | mcall 69, 5, [debuggee_pid] |
580 | mcall 69, 5, [debuggee_pid] |
589 | mov [bSuspended], 0 |
581 | mov [bSuspended], 0 |
590 | ret |
582 | ret |
591 | 583 | ||
592 | OnResume: |
584 | OnResume: |
593 | mov esi, [curarg] |
585 | mov esi, [curarg] |
594 | cmp byte [esi], 0 |
586 | cmp byte [esi], 0 |
595 | jz GoOn |
587 | jz GoOn |
596 | call calc_expression |
588 | call calc_expression |
597 | jc .ret |
589 | jc .ret |
598 | mov eax, ebp |
590 | mov eax, ebp |
599 | push eax |
591 | push eax |
600 | call find_enabled_breakpoint |
592 | call find_enabled_breakpoint |
601 | pop eax |
593 | pop eax |
602 | jz GoOn |
594 | jz GoOn |
603 | mov bl, 5 ; valid enabled one-shot |
595 | mov bl, 5 ; valid enabled one-shot |
604 | call add_breakpoint |
596 | call add_breakpoint |
605 | jnc GoOn |
597 | jnc GoOn |
606 | mov esi, aBreakpointLimitExceeded |
598 | mov esi, aBreakpointLimitExceeded |
607 | call put_message |
599 | call put_message |
608 | 600 | ||
609 | .ret: |
601 | .ret: |
610 | ret |
602 | ret |
611 | 603 | ||
612 | GoOn: |
604 | GoOn: |
613 | ; test for enabled breakpoint at eip |
605 | ; test for enabled breakpoint at eip |
614 | mov eax, [_eip] |
606 | mov eax, [_eip] |
615 | call find_enabled_breakpoint |
607 | call find_enabled_breakpoint |
616 | jnz .nobreak |
608 | jnz .nobreak |
617 | ; temporarily disable breakpoint, make step, enable breakpoint, continue |
609 | ; temporarily disable breakpoint, make step, enable breakpoint, continue |
618 | inc eax |
610 | inc eax |
619 | mov [temp_break], eax |
611 | mov [temp_break], eax |
620 | mov [bAfterGo], 1 |
612 | mov [bAfterGo], 1 |
621 | dec eax |
613 | dec eax |
622 | call disable_breakpoint |
614 | call disable_breakpoint |
623 | call get_context |
615 | call get_context |
624 | or byte [_eflags+1], 1 ; set TF |
616 | or byte [_eflags+1], 1 ; set TF |
625 | call set_context |
617 | call set_context |
626 | and byte [_eflags+1], not 1 |
618 | and byte [_eflags+1], not 1 |
627 | call DoResume |
619 | call DoResume |
628 | ret |
620 | ret |
629 | 621 | ||
630 | .nobreak: |
622 | .nobreak: |
631 | call DoResume |
623 | call DoResume |
632 | call redraw_title |
624 | call redraw_title |
633 | call draw_registers.redraw |
625 | call draw_registers.redraw |
634 | call draw_dump.redraw |
626 | call draw_dump.redraw |
635 | ret |
627 | ret |
636 | 628 | ||
637 | ;----------------------------------------------------------------------------- |
629 | ;----------------------------------------------------------------------------- |
638 | ; Detach process event |
630 | ; Detach process event |
639 | 631 | ||
640 | OnDetach: |
632 | OnDetach: |
641 | ;mov ecx, [debuggee_pid] |
633 | ;mov ecx, [debuggee_pid] |
642 | ;push 3 |
634 | ;push 3 |
643 | ;pop ebx |
635 | ;pop ebx |
644 | ;push 69 |
636 | ;push 69 |
645 | ;pop eax |
637 | ;pop eax |
646 | mcall 69, 3, [debuggee_pid] |
638 | mcall 69, 3, [debuggee_pid] |
647 | and [debuggee_pid], 0 |
639 | and [debuggee_pid], 0 |
648 | call redraw_title |
640 | call redraw_title |
649 | call draw_registers.redraw |
641 | call draw_registers.redraw |
650 | call draw_dump.redraw |
642 | call draw_dump.redraw |
651 | call free_symbols |
643 | call free_symbols |
652 | mov esi, aContinued |
644 | mov esi, aContinued |
653 | jmp put_message |
645 | jmp put_message |
654 | 646 | ||
655 | after_go_exception: |
647 | after_go_exception: |
656 | push eax |
648 | push eax |
657 | mov eax, [temp_break] |
649 | mov eax, [temp_break] |
658 | dec eax |
650 | dec eax |
659 | push esi |
651 | push esi |
660 | call enable_breakpoint |
652 | call enable_breakpoint |
661 | ; in any case, clear TF and RF |
653 | ; in any case, clear TF and RF |
662 | call get_new_context |
654 | call get_new_context |
663 | and [_eflags], not 10100h ; clear TF,RF |
655 | and [_eflags], not 10100h ; clear TF,RF |
664 | call set_context |
656 | call set_context |
665 | xor edx, edx |
657 | xor edx, edx |
666 | mov [temp_break], edx |
658 | mov [temp_break], edx |
667 | xchg dl, [bAfterGo] |
659 | xchg dl, [bAfterGo] |
668 | pop esi |
660 | pop esi |
669 | pop eax |
661 | pop eax |
670 | cmp dl, 2 |
662 | cmp dl, 2 |
671 | jnz @f |
663 | jnz @f |
672 | lodsd |
664 | lodsd |
673 | push esi |
665 | push esi |
674 | call get_dump |
666 | call get_dump |
675 | jmp exception.done |
667 | jmp exception.done |
676 | 668 | ||
677 | @@: |
669 | @@: |
678 | test eax, eax |
670 | test eax, eax |
679 | jz .notint1 |
671 | jz .notint1 |
680 | ; if exception is result of single step, simply ignore it and continue |
672 | ; if exception is result of single step, simply ignore it and continue |
681 | test dword [esi], 0xF |
673 | test dword [esi], 0xF |
682 | jnz dbgmsgstart.5 |
674 | jnz dbgmsgstart.5 |
683 | lodsd |
675 | lodsd |
684 | push esi |
676 | push esi |
685 | mov esi, oldcontext |
677 | mov esi, oldcontext |
686 | mov edi, context |
678 | mov edi, context |
687 | mov ecx, 28h/4 |
679 | mov ecx, 28h/4 |
688 | rep movsd |
680 | rep movsd |
689 | call DoResume |
681 | call DoResume |
690 | jmp dbgmsgend |
682 | jmp dbgmsgend |
691 | 683 | ||
692 | .notint1: |
684 | .notint1: |
693 | ; in other case, work as without temp_break |
685 | ; in other case, work as without temp_break |
694 | lodsd |
686 | lodsd |
695 | push esi |
687 | push esi |
696 | push eax |
688 | push eax |
697 | jmp exception.4 |
689 | jmp exception.4 |
698 | 690 | ||
699 | .notour: |
691 | .notour: |
700 | 692 | ||
701 | ; TODO: split it out |
693 | ; TODO: split it out |
702 | debugmsg: |
694 | debugmsg: |
703 | neg [dbgbufsize] |
695 | neg [dbgbufsize] |
704 | mov esi, dbgbuf |
696 | mov esi, dbgbuf |
705 | 697 | ||
706 | ; TODO: make it local |
698 | ; TODO: make it local |
707 | dbgmsgstart: |
699 | dbgmsgstart: |
708 | lodsd |
700 | lodsd |
709 | ; push eax esi |
701 | ; push eax esi |
710 | ; push dword [esi] |
702 | ; push dword [esi] |
711 | ; mov esi, dbgmsg_str |
703 | ; mov esi, dbgmsg_str |
712 | ; call put_message_nodraw |
704 | ; call put_message_nodraw |
713 | ; pop esi eax |
705 | ; pop esi eax |
714 | add esi, 4 |
706 | add esi, 4 |
715 | dec eax |
707 | dec eax |
716 | jz exception |
708 | jz exception |
717 | dec eax |
709 | dec eax |
718 | jz terminated |
710 | jz terminated |
- | 711 | dec eax |
|
- | 712 | jnz dbg_notify |
|
- | 713 | ||
719 | mov [bSuspended], 1 |
714 | mov [bSuspended], 1 |
720 | cmp [bAfterGo], 0 |
715 | cmp [bAfterGo], 0 |
721 | jnz after_go_exception |
716 | jnz after_go_exception |
722 | push esi |
717 | push esi |
723 | call get_new_context |
718 | call get_new_context |
724 | and [_eflags], not 10100h ; clear TF,RF |
719 | and [_eflags], not 10100h ; clear TF,RF |
725 | call set_context |
720 | call set_context |
726 | pop esi |
721 | pop esi |
727 | 722 | ||
728 | ; TODO: WTF? Need for meaning label names |
723 | ; TODO: WTF? Need for meaning label names |
729 | .5: |
724 | .5: |
730 | push esi |
725 | push esi |
731 | call get_dump |
726 | call get_dump |
732 | pop esi |
727 | pop esi |
733 | lodsd |
728 | lodsd |
734 | xor ecx, ecx |
729 | xor ecx, ecx |
735 | 730 | ||
736 | .6: |
731 | .6: |
737 | bt eax, ecx |
732 | bt eax, ecx |
738 | jnc .7 |
733 | jnc .7 |
739 | mov ebx, [drx_break+ecx*4] |
734 | mov ebx, [drx_break+ecx*4] |
740 | test ebx, ebx |
735 | test ebx, ebx |
741 | jz .7 |
736 | jz .7 |
742 | pushad |
737 | pushad |
743 | dec ebx |
738 | dec ebx |
744 | push ebx |
739 | push ebx |
745 | mov esi, aBreakStop |
740 | mov esi, aBreakStop |
746 | call put_message_nodraw |
741 | call put_message_nodraw |
747 | popad |
742 | popad |
748 | 743 | ||
749 | .7: |
744 | .7: |
750 | inc ecx |
745 | inc ecx |
751 | cmp cl, 4 |
746 | cmp cl, 4 |
752 | jb .6 |
747 | jb .6 |
753 | push esi |
748 | push esi |
754 | jmp exception.done_draw |
749 | jmp exception.done_draw |
- | 750 | ||
- | 751 | dbg_notify: |
|
- | 752 | int3 |
|
- | 753 | add esi, 32 |
|
- | 754 | push esi |
|
- | 755 | jmp dbgmsgend |
|
- | 756 | ||
755 | 757 | ||
756 | ; TODO: make it local |
758 | ; TODO: make it local |
757 | terminated: |
759 | terminated: |
758 | push esi |
760 | push esi |
759 | mov esi, terminated_msg |
761 | mov esi, terminated_msg |
760 | call put_message |
762 | call put_message |
761 | and [debuggee_pid], 0 |
763 | and [debuggee_pid], 0 |
762 | and [temp_break], 0 |
764 | and [temp_break], 0 |
763 | mov [bAfterGo], 0 |
765 | mov [bAfterGo], 0 |
764 | xor eax, eax |
766 | xor eax, eax |
765 | mov ecx, breakpoints_n*6/4+4 |
767 | mov ecx, breakpoints_n*6/4+4 |
766 | mov edi, breakpoints |
768 | mov edi, breakpoints |
767 | rep stosd |
769 | rep stosd |
768 | cmp [bReload], 1 |
770 | cmp [bReload], 1 |
769 | sbb [bReload], -1 |
771 | sbb [bReload], -1 |
770 | jnz exception.done |
772 | jnz exception.done |
771 | call free_symbols |
773 | call free_symbols |
772 | jmp exception.done |
774 | jmp exception.done |
773 | 775 | ||
774 | exception: |
776 | exception: |
775 | mov [bSuspended], 1 |
777 | mov [bSuspended], 1 |
776 | cmp [bAfterGo], 0 |
778 | cmp [bAfterGo], 0 |
777 | jnz after_go_exception |
779 | jnz after_go_exception |
778 | lodsd |
780 | lodsd |
779 | push esi |
781 | push esi |
780 | push eax |
782 | push eax |
781 | call get_new_context |
783 | call get_new_context |
782 | and [_eflags], not 10100h ; clear TF,RF |
784 | and [_eflags], not 10100h ; clear TF,RF |
783 | call set_context |
785 | call set_context |
784 | 786 | ||
785 | ; TODO: fix for useful name |
787 | ; TODO: fix for useful name |
786 | .4: |
788 | .4: |
787 | call get_dump |
789 | call get_dump |
788 | pop eax |
790 | pop eax |
789 | ; int3 command generates exception 0D, #GP |
791 | ; int3 command generates exception 0D, #GP |
790 | push eax |
792 | push eax |
791 | cmp al, 0Dh |
793 | cmp al, 0Dh |
792 | jnz .notdbg |
794 | jnz .notdbg |
793 | ; check for 0xCC byte at eip |
795 | ; check for 0xCC byte at eip |
794 | push 0 |
796 | push 0 |
795 | mcall 69, 6, [debuggee_pid], 1, [_eip], esp |
797 | mcall 69, 6, [debuggee_pid], 1, [_eip], esp |
796 | pop eax |
798 | pop eax |
797 | cmp al, 0xCC |
799 | cmp al, 0xCC |
798 | je .int3 |
800 | je .int3 |
799 | ; check for 0xCD03 word at eip |
801 | ; check for 0xCD03 word at eip |
800 | push 0 |
802 | push 0 |
801 | inc edx |
803 | inc edx |
802 | mcall 69;, 6, [debuggee_pid], 2, [_eip], esp |
804 | mcall 69;, 6, [debuggee_pid], 2, [_eip], esp |
803 | pop eax |
805 | pop eax |
804 | cmp ax, 0x03CD |
806 | cmp ax, 0x03CD |
805 | jne .notdbg |
807 | jne .notdbg |
806 | mov eax, [_eip] |
808 | mov eax, [_eip] |
807 | inc [_eip] |
809 | inc [_eip] |
808 | inc [_eip] |
810 | inc [_eip] |
809 | jmp .user_int3_ |
811 | jmp .user_int3_ |
810 | .int3: |
812 | .int3: |
811 | ; this is either dbg breakpoint or int3 cmd in debuggee |
813 | ; this is either dbg breakpoint or int3 cmd in debuggee |
812 | mov eax, [_eip] |
814 | mov eax, [_eip] |
813 | call find_enabled_breakpoint |
815 | call find_enabled_breakpoint |
814 | jnz .user_int3 |
816 | jnz .user_int3 |
815 | ; dbg breakpoint; clear if one-shot |
817 | ; dbg breakpoint; clear if one-shot |
816 | pop ecx |
818 | pop ecx |
817 | push eax |
819 | push eax |
818 | mov esi, aBreakStop |
820 | mov esi, aBreakStop |
819 | test byte [edi+4], 4 |
821 | test byte [edi+4], 4 |
820 | jz .put_msg_eax |
822 | jz .put_msg_eax |
821 | pop ecx |
823 | pop ecx |
822 | call clear_breakpoint |
824 | call clear_breakpoint |
823 | jmp .done |
825 | jmp .done |
824 | 826 | ||
825 | .user_int3: |
827 | .user_int3: |
826 | mov eax, [_eip] |
828 | mov eax, [_eip] |
827 | inc [_eip] |
829 | inc [_eip] |
828 | .user_int3_: |
830 | .user_int3_: |
829 | pop ecx |
831 | pop ecx |
830 | push eax |
832 | push eax |
831 | call set_context |
833 | call set_context |
832 | mov esi, aUserBreak |
834 | mov esi, aUserBreak |
833 | jmp .put_msg_eax |
835 | jmp .put_msg_eax |
834 | 836 | ||
835 | .notdbg: |
837 | .notdbg: |
836 | pop eax |
838 | pop eax |
837 | push eax |
839 | push eax |
838 | push eax |
840 | push eax |
839 | mov esi, aException |
841 | mov esi, aException |
840 | call put_message_nodraw |
842 | call put_message_nodraw |
841 | pop eax |
843 | pop eax |
842 | 844 | ||
843 | cmp al, 16 |
845 | cmp al, 16 |
844 | ja .suspended |
846 | ja .suspended |
845 | mov esi, [msg_fault_sel + eax*4] |
847 | mov esi, [msg_fault_sel + eax*4] |
846 | call put_message_nodraw |
848 | call put_message_nodraw |
847 | 849 | ||
848 | .suspended: |
850 | .suspended: |
849 | mov esi, aSuspended |
851 | mov esi, aSuspended |
850 | 852 | ||
851 | .put_msg_eax: |
853 | .put_msg_eax: |
852 | call put_message_nodraw |
854 | call put_message_nodraw |
853 | 855 | ||
854 | .done_draw: |
856 | .done_draw: |
855 | call draw_messages |
857 | call draw_messages |
856 | 858 | ||
857 | .done: |
859 | .done: |
858 | mcall 18, 3, [dbgwnd] ; activate dbg window |
860 | mcall 18, 3, [dbgwnd] ; activate dbg window |
859 | call redraw_title |
861 | call redraw_title |
860 | call draw_registers.redraw |
862 | call draw_registers.redraw |
861 | call draw_dump.redraw |
863 | call draw_dump.redraw |
862 | call update_disasm_eip |
864 | call update_disasm_eip |
863 | 865 | ||
864 | dbgmsgend: |
866 | dbgmsgend: |
865 | pop esi |
867 | pop esi |
866 | mov ecx, [dbgbuflen] |
868 | mov ecx, [dbgbuflen] |
867 | add ecx, dbgbuf |
869 | add ecx, dbgbuf |
868 | cmp esi, ecx |
870 | cmp esi, ecx |
869 | jnz dbgmsgstart |
871 | jnz dbgmsgstart |
870 | and [dbgbuflen], 0 |
872 | and [dbgbuflen], 0 |
871 | neg [dbgbufsize] |
873 | neg [dbgbufsize] |
872 | cmp [bReload], 2 |
874 | cmp [bReload], 2 |
873 | jnz @f |
875 | jnz @f |
874 | mov [bReload], 0 |
876 | mov [bReload], 0 |
875 | call do_reload |
877 | call do_reload |
876 | 878 | ||
877 | @@: |
879 | @@: |
878 | jmp waitevent |
880 | jmp waitevent |
879 | 881 | ||
880 | ; TODO: make it local |
882 | ; TODO: make it local |
881 | F7: |
883 | F7: |
882 | cmp [debuggee_pid], 0 |
884 | cmp [debuggee_pid], 0 |
883 | jz .no |
885 | jz .no |
884 | call OnStep |
886 | call OnStep |
885 | 887 | ||
886 | .no: |
888 | .no: |
887 | jmp waitevent |
889 | jmp waitevent |
888 | 890 | ||
889 | ; TODO: make it local |
891 | ; TODO: make it local |
890 | F8: |
892 | F8: |
891 | cmp [debuggee_pid], 0 |
893 | cmp [debuggee_pid], 0 |
892 | jz F7.no |
894 | jz F7.no |
893 | call OnProceed |
895 | call OnProceed |
894 | jmp F7.no |
896 | jmp F7.no |
895 | 897 | ||
896 | ;----------------------------------------------------------------------------- |
898 | ;----------------------------------------------------------------------------- |
897 | ; Step execution event |
899 | ; Step execution event |
898 | 900 | ||
899 | ;Here we get [ |
901 | ;Here we get [ |
900 | OnStepMultiple: |
902 | OnStepMultiple: |
901 | cmp [bSuspended], 0 |
903 | cmp [bSuspended], 0 |
902 | jz OnStep.running |
904 | jz OnStep.running |
903 | mov [step_num], 1 |
905 | mov [step_num], 1 |
904 | mov esi, [curarg] |
906 | mov esi, [curarg] |
905 | test esi, esi |
907 | test esi, esi |
906 | jz .do |
908 | jz .do |
907 | cmp byte [esi], 0 |
909 | cmp byte [esi], 0 |
908 | jz .do |
910 | jz .do |
909 | call get_hex_number |
911 | call get_hex_number |
910 | jc .ret |
912 | jc .ret |
911 | cmp eax, 0 ; check if lesser or equal than 0 |
913 | cmp eax, 0 ; check if lesser or equal than 0 |
912 | jle .ret |
914 | jle .ret |
913 | mov [step_num], eax |
915 | mov [step_num], eax |
914 | .do: |
916 | .do: |
915 | call OnStep |
917 | call OnStep |
916 | dec [step_num] |
918 | dec [step_num] |
917 | jnz .do |
919 | jnz .do |
918 | .ret: |
920 | .ret: |
919 | ret |
921 | ret |
920 | 922 | ||
921 | OnStep: |
923 | OnStep: |
922 | cmp [bSuspended], 0 |
924 | cmp [bSuspended], 0 |
923 | jz .running |
925 | jz .running |
924 | call get_context |
926 | call get_context |
925 | or byte [_eflags+1], 1 ; set TF |
927 | or byte [_eflags+1], 1 ; set TF |
926 | call set_context |
928 | call set_context |
927 | and byte [_eflags+1], not 1 |
929 | and byte [_eflags+1], not 1 |
928 | ; if instruction at eip is "int xx", set one-shot breakpoint immediately after |
930 | ; if instruction at eip is "int xx", set one-shot breakpoint immediately after |
929 | mov eax, [_eip] |
931 | mov eax, [_eip] |
930 | call find_enabled_breakpoint |
932 | call find_enabled_breakpoint |
931 | jnz @f |
933 | jnz @f |
932 | cmp byte [edi+5], 0xCD |
934 | cmp byte [edi+5], 0xCD |
933 | jz .int |
935 | jz .int |
934 | 936 | ||
935 | @@: |
937 | @@: |
936 | push 0 |
938 | push 0 |
937 | ;push 69 |
939 | ;push 69 |
938 | ;pop eax |
940 | ;pop eax |
939 | ;push 6 |
941 | ;push 6 |
940 | ;pop ebx |
942 | ;pop ebx |
941 | ;mov ecx, [debuggee_pid] |
943 | ;mov ecx, [debuggee_pid] |
942 | ;push 3 |
944 | ;push 3 |
943 | ;pop edx |
945 | ;pop edx |
944 | ;mov edi, esp |
946 | ;mov edi, esp |
945 | ;mov esi, [_eip] |
947 | ;mov esi, [_eip] |
946 | mcall 69, 6, [debuggee_pid], 3, [_eip], esp |
948 | mcall 69, 6, [debuggee_pid], 3, [_eip], esp |
947 | cmp eax, edx |
949 | cmp eax, edx |
948 | pop eax |
950 | pop eax |
949 | jnz .doit |
951 | jnz .doit |
950 | cmp al, 0xCD |
952 | cmp al, 0xCD |
951 | jz .int |
953 | jz .int |
952 | cmp ax, 0x050F |
954 | cmp ax, 0x050F |
953 | jz .syscall |
955 | jz .syscall |
954 | cmp ax, 0x340F |
956 | cmp ax, 0x340F |
955 | jz .sysenter |
957 | jz .sysenter |
956 | 958 | ||
957 | ; resume process |
959 | ; resume process |
958 | .doit: |
960 | .doit: |
959 | call GoOn |
961 | call GoOn |
960 | cmp [bAfterGo], 0 |
962 | cmp [bAfterGo], 0 |
961 | jz @f |
963 | jz @f |
962 | mov [bAfterGo], 2 |
964 | mov [bAfterGo], 2 |
963 | 965 | ||
964 | @@: |
966 | @@: |
965 | ret |
967 | ret |
966 | 968 | ||
967 | ; return address is [ebp-4] |
969 | ; return address is [ebp-4] |
968 | .sysenter: |
970 | .sysenter: |
969 | push 0 |
971 | push 0 |
970 | ;push 69 |
972 | ;push 69 |
971 | ;pop eax |
973 | ;pop eax |
972 | inc edx ; read 4 bytes |
974 | inc edx ; read 4 bytes |
973 | mov esi, [_ebp] |
975 | mov esi, [_ebp] |
974 | sub esi, 4 |
976 | sub esi, 4 |
975 | mcall 69 |
977 | mcall 69 |
976 | cmp eax, edx |
978 | cmp eax, edx |
977 | pop eax |
979 | pop eax |
978 | jnz .syscall |
980 | jnz .syscall |
979 | push eax |
981 | push eax |
980 | and byte [_eflags+1], not 1 |
982 | and byte [_eflags+1], not 1 |
981 | call set_context |
983 | call set_context |
982 | pop eax |
984 | pop eax |
983 | jmp @f |
985 | jmp @f |
984 | 986 | ||
985 | .syscall: |
987 | .syscall: |
986 | and byte [_eflags+1], not 1 ; clear TF - avoid system halt (!) |
988 | and byte [_eflags+1], not 1 ; clear TF - avoid system halt (!) |
987 | call set_context |
989 | call set_context |
988 | 990 | ||
989 | .int: |
991 | .int: |
990 | mov eax, [_eip] |
992 | mov eax, [_eip] |
991 | inc eax |
993 | inc eax |
992 | inc eax |
994 | inc eax |
993 | 995 | ||
994 | @@: |
996 | @@: |
995 | push eax |
997 | push eax |
996 | call find_enabled_breakpoint |
998 | call find_enabled_breakpoint |
997 | pop eax |
999 | pop eax |
998 | jz .doit |
1000 | jz .doit |
999 | ; there is no enabled breakpoint yet; set temporary breakpoint |
1001 | ; there is no enabled breakpoint yet; set temporary breakpoint |
1000 | mov bl, 5 |
1002 | mov bl, 5 |
1001 | call add_breakpoint |
1003 | call add_breakpoint |
1002 | jmp .doit |
1004 | jmp .doit |
1003 | 1005 | ||
1004 | .running: |
1006 | .running: |
1005 | mov esi, aRunningErr |
1007 | mov esi, aRunningErr |
1006 | jmp put_message |
1008 | jmp put_message |
1007 | 1009 | ||
1008 | ;----------------------------------------------------------------------------- |
1010 | ;----------------------------------------------------------------------------- |
1009 | ; Proceed process event |
1011 | ; Proceed process event |
1010 | ;Here we get [ |
1012 | ;Here we get [ |
1011 | OnProceedMultiple: |
1013 | OnProceedMultiple: |
1012 | cmp [bSuspended], 0 |
1014 | cmp [bSuspended], 0 |
1013 | jz OnStep.running |
1015 | jz OnStep.running |
1014 | mov [proc_num], 1 |
1016 | mov [proc_num], 1 |
1015 | mov esi, [curarg] |
1017 | mov esi, [curarg] |
1016 | test esi, esi |
1018 | test esi, esi |
1017 | jz .do |
1019 | jz .do |
1018 | cmp byte [esi], 0 |
1020 | cmp byte [esi], 0 |
1019 | jz .do |
1021 | jz .do |
1020 | call get_hex_number |
1022 | call get_hex_number |
1021 | jc .ret |
1023 | jc .ret |
1022 | cmp eax, 0 ; check if lesser or equal than 0 |
1024 | cmp eax, 0 ; check if lesser or equal than 0 |
1023 | jle .ret |
1025 | jle .ret |
1024 | mov [proc_num], eax |
1026 | mov [proc_num], eax |
1025 | mov [curarg], 0 |
1027 | mov [curarg], 0 |
1026 | .do: |
1028 | .do: |
1027 | call OnProceed |
1029 | call OnProceed |
1028 | dec [proc_num] |
1030 | dec [proc_num] |
1029 | jnz .do |
1031 | jnz .do |
1030 | .ret: |
1032 | .ret: |
1031 | ret |
1033 | ret |
1032 | 1034 | ||
1033 | 1035 | ||
1034 | OnProceed: |
1036 | OnProceed: |
1035 | cmp [bSuspended], 0 |
1037 | cmp [bSuspended], 0 |
1036 | jz OnStep.running |
1038 | jz OnStep.running |
1037 | mov esi, [_eip] |
1039 | mov esi, [_eip] |
1038 | 1040 | ||
1039 | @@: |
1041 | @@: |
1040 | call get_byte_nobreak |
1042 | call get_byte_nobreak |
1041 | jc OnStep |
1043 | jc OnStep |
1042 | inc esi |
1044 | inc esi |
1043 | ; skip prefixes |
1045 | ; skip prefixes |
1044 | call is_prefix |
1046 | call is_prefix |
1045 | jz @b |
1047 | jz @b |
1046 | cmp al, 0xE8 ; call |
1048 | cmp al, 0xE8 ; call |
1047 | jnz @f |
1049 | jnz @f |
1048 | add esi, 4 |
1050 | add esi, 4 |
1049 | jmp .doit |
1051 | jmp .doit |
1050 | 1052 | ||
1051 | ; A4,A5 = movs; A6,A7 = cmps |
1053 | ; A4,A5 = movs; A6,A7 = cmps |
1052 | @@: |
1054 | @@: |
1053 | cmp al, 0xA4 |
1055 | cmp al, 0xA4 |
1054 | jb @f |
1056 | jb @f |
1055 | cmp al, 0xA8 |
1057 | cmp al, 0xA8 |
1056 | jb .doit |
1058 | jb .doit |
1057 | 1059 | ||
1058 | ; AA,AB = stos; AC,AD = lods; AE,AF = scas |
1060 | ; AA,AB = stos; AC,AD = lods; AE,AF = scas |
1059 | @@: |
1061 | @@: |
1060 | cmp al, 0xAA |
1062 | cmp al, 0xAA |
1061 | jb @f |
1063 | jb @f |
1062 | cmp al, 0xB0 |
1064 | cmp al, 0xB0 |
1063 | jb .doit |
1065 | jb .doit |
1064 | 1066 | ||
1065 | ; E0 = loopnz; E1 = loopz; E2 = loop |
1067 | ; E0 = loopnz; E1 = loopz; E2 = loop |
1066 | @@: |
1068 | @@: |
1067 | cmp al, 0xE0 |
1069 | cmp al, 0xE0 |
1068 | jb .noloop |
1070 | jb .noloop |
1069 | cmp al, 0xE2 |
1071 | cmp al, 0xE2 |
1070 | ja .noloop |
1072 | ja .noloop |
1071 | inc esi |
1073 | inc esi |
1072 | jmp .doit |
1074 | jmp .doit |
1073 | 1075 | ||
1074 | ; FF /2 = call |
1076 | ; FF /2 = call |
1075 | .noloop: |
1077 | .noloop: |
1076 | cmp al, 0xFF |
1078 | cmp al, 0xFF |
1077 | jnz OnStep |
1079 | jnz OnStep |
1078 | call get_byte_nobreak |
1080 | call get_byte_nobreak |
1079 | jc OnStep |
1081 | jc OnStep |
1080 | inc esi |
1082 | inc esi |
1081 | mov cl, al |
1083 | mov cl, al |
1082 | and al, 00111000b |
1084 | and al, 00111000b |
1083 | cmp al, 00010000b |
1085 | cmp al, 00010000b |
1084 | jnz OnStep |
1086 | jnz OnStep |
1085 | ; skip instruction |
1087 | ; skip instruction |
1086 | mov al, cl |
1088 | mov al, cl |
1087 | and eax, 7 |
1089 | and eax, 7 |
1088 | shr cl, 6 |
1090 | shr cl, 6 |
1089 | jz .mod0 |
1091 | jz .mod0 |
1090 | jp .doit |
1092 | jp .doit |
1091 | cmp al, 4 |
1093 | cmp al, 4 |
1092 | jnz @f |
1094 | jnz @f |
1093 | inc esi |
1095 | inc esi |
1094 | 1096 | ||
1095 | @@: |
1097 | @@: |
1096 | inc esi |
1098 | inc esi |
1097 | dec cl |
1099 | dec cl |
1098 | jz @f |
1100 | jz @f |
1099 | add esi, 3 |
1101 | add esi, 3 |
1100 | 1102 | ||
1101 | @@: |
1103 | @@: |
1102 | jmp .doit |
1104 | jmp .doit |
1103 | 1105 | ||
1104 | .mod0: |
1106 | .mod0: |
1105 | cmp al, 4 |
1107 | cmp al, 4 |
1106 | jnz @f |
1108 | jnz @f |
1107 | call get_byte_nobreak |
1109 | call get_byte_nobreak |
1108 | jc OnStep |
1110 | jc OnStep |
1109 | inc esi |
1111 | inc esi |
1110 | and al, 7 |
1112 | and al, 7 |
1111 | 1113 | ||
1112 | @@: |
1114 | @@: |
1113 | cmp al, 5 |
1115 | cmp al, 5 |
1114 | jnz .doit |
1116 | jnz .doit |
1115 | add esi, 4 |
1117 | add esi, 4 |
1116 | 1118 | ||
1117 | .doit: |
1119 | .doit: |
1118 | ; insert one-shot breakpoint at esi and resume |
1120 | ; insert one-shot breakpoint at esi and resume |
1119 | call get_byte_nobreak |
1121 | call get_byte_nobreak |
1120 | jc OnStep |
1122 | jc OnStep |
1121 | mov eax, esi |
1123 | mov eax, esi |
1122 | call find_enabled_breakpoint |
1124 | call find_enabled_breakpoint |
1123 | jz @f |
1125 | jz @f |
1124 | mov eax, esi |
1126 | mov eax, esi |
1125 | mov bl, 5 |
1127 | mov bl, 5 |
1126 | call add_breakpoint |
1128 | call add_breakpoint |
1127 | jmp OnStep.doit |
1129 | jmp OnStep.doit |
1128 | 1130 | ||
1129 | @@: |
1131 | @@: |
1130 | ret |
1132 | ret |
1131 | 1133 | ||
1132 | ;----------------------------------------------------------------------------- |
1134 | ;----------------------------------------------------------------------------- |
1133 | ; Read next byte of machine code |
1135 | ; Read next byte of machine code |
1134 | 1136 | ||
1135 | get_byte_nobreak: |
1137 | get_byte_nobreak: |
1136 | mov eax, esi |
1138 | mov eax, esi |
1137 | call find_enabled_breakpoint |
1139 | call find_enabled_breakpoint |
1138 | jnz .nobreak |
1140 | jnz .nobreak |
1139 | mov al, [edi+5] |
1141 | mov al, [edi+5] |
1140 | clc |
1142 | clc |
1141 | ret |
1143 | ret |
1142 | 1144 | ||
1143 | .nobreak: |
1145 | .nobreak: |
1144 | ;push 69 |
1146 | ;push 69 |
1145 | ;pop eax |
1147 | ;pop eax |
1146 | ;push 6 |
1148 | ;push 6 |
1147 | ;pop ebx |
1149 | ;pop ebx |
1148 | ;mov ecx, [debuggee_pid] |
1150 | ;mov ecx, [debuggee_pid] |
1149 | xor edx, edx |
1151 | xor edx, edx |
1150 | push edx |
1152 | push edx |
1151 | inc edx |
1153 | inc edx |
1152 | mov edi, esp |
1154 | mov edi, esp |
1153 | mcall 69, 6, [debuggee_pid] |
1155 | mcall 69, 6, [debuggee_pid] |
1154 | dec eax |
1156 | dec eax |
1155 | clc |
1157 | clc |
1156 | jz @f |
1158 | jz @f |
1157 | stc |
1159 | stc |
1158 | 1160 | ||
1159 | @@: |
1161 | @@: |
1160 | pop eax |
1162 | pop eax |
1161 | ret |
1163 | ret |
1162 | 1164 | ||
1163 | include 'parser.inc' |
1165 | include 'parser.inc' |
1164 | 1166 | ||
1165 | ;----------------------------------------------------------------------------- |
1167 | ;----------------------------------------------------------------------------- |
1166 | ; Calculate expression event |
1168 | ; Calculate expression event |
1167 | 1169 | ||
1168 | OnCalc: |
1170 | OnCalc: |
1169 | mov esi, [curarg] |
1171 | mov esi, [curarg] |
1170 | call calc_expression |
1172 | call calc_expression |
1171 | jc .ret |
1173 | jc .ret |
1172 | push ebp |
1174 | push ebp |
1173 | mov esi, calc_string |
1175 | mov esi, calc_string |
1174 | call put_message_nodraw |
1176 | call put_message_nodraw |
1175 | jmp draw_messages |
1177 | jmp draw_messages |
1176 | 1178 | ||
1177 | .ret: |
1179 | .ret: |
1178 | ret |
1180 | ret |
1179 | 1181 | ||
1180 | ;----------------------------------------------------------------------------- |
1182 | ;----------------------------------------------------------------------------- |
1181 | ; Dump memory event |
1183 | ; Dump memory event |
1182 | 1184 | ||
1183 | OnDump: |
1185 | OnDump: |
1184 | mov esi, [curarg] |
1186 | mov esi, [curarg] |
1185 | cmp byte [esi], 0 |
1187 | cmp byte [esi], 0 |
1186 | jnz .param |
1188 | jnz .param |
1187 | add [dumppos], dump_height*10h |
1189 | add [dumppos], dump_height*10h |
1188 | jmp .doit |
1190 | jmp .doit |
1189 | 1191 | ||
1190 | .param: |
1192 | .param: |
1191 | call calc_expression |
1193 | call calc_expression |
1192 | jc .ret |
1194 | jc .ret |
1193 | mov [dumppos], ebp |
1195 | mov [dumppos], ebp |
1194 | 1196 | ||
1195 | .doit: |
1197 | .doit: |
1196 | call get_dump |
1198 | call get_dump |
1197 | call draw_dump.redraw |
1199 | call draw_dump.redraw |
1198 | 1200 | ||
1199 | .ret: |
1201 | .ret: |
1200 | ret |
1202 | ret |
1201 | 1203 | ||
1202 | ;----------------------------------------------------------------------------- |
1204 | ;----------------------------------------------------------------------------- |
1203 | ; Dissassemble block of executable event |
1205 | ; Dissassemble block of executable event |
1204 | 1206 | ||
1205 | OnUnassemble: |
1207 | OnUnassemble: |
1206 | mov esi, [curarg] |
1208 | mov esi, [curarg] |
1207 | cmp byte [esi], 0 |
1209 | cmp byte [esi], 0 |
1208 | jnz .param |
1210 | jnz .param |
1209 | mov eax, [disasm_start_pos] |
1211 | mov eax, [disasm_start_pos] |
1210 | mov ecx, [disasm_height_dd] |
1212 | mov ecx, [disasm_height_dd] |
1211 | mov [disasm_cur_pos], eax |
1213 | mov [disasm_cur_pos], eax |
1212 | 1214 | ||
1213 | .l: |
1215 | .l: |
1214 | mov eax, [disasm_cur_pos] |
1216 | mov eax, [disasm_cur_pos] |
1215 | call find_symbol |
1217 | call find_symbol |
1216 | jc @f |
1218 | jc @f |
1217 | dec ecx |
1219 | dec ecx |
1218 | jz .m |
1220 | jz .m |
1219 | 1221 | ||
1220 | @@: |
1222 | @@: |
1221 | push ecx |
1223 | push ecx |
1222 | call disasm_instr |
1224 | call disasm_instr |
1223 | pop ecx |
1225 | pop ecx |
1224 | jc .err |
1226 | jc .err |
1225 | loop .l |
1227 | loop .l |
1226 | 1228 | ||
1227 | .m: |
1229 | .m: |
1228 | mov eax, [disasm_cur_pos] |
1230 | mov eax, [disasm_cur_pos] |
1229 | jmp .doit |
1231 | jmp .doit |
1230 | 1232 | ||
1231 | .param: |
1233 | .param: |
1232 | call calc_expression |
1234 | call calc_expression |
1233 | jc .ret |
1235 | jc .ret |
1234 | mov eax, ebp |
1236 | mov eax, ebp |
1235 | 1237 | ||
1236 | .doit: |
1238 | .doit: |
1237 | push eax |
1239 | push eax |
1238 | push [disasm_start_pos] |
1240 | push [disasm_start_pos] |
1239 | mov [disasm_start_pos], eax |
1241 | mov [disasm_start_pos], eax |
1240 | call update_disasm |
1242 | call update_disasm |
1241 | pop [disasm_start_pos] |
1243 | pop [disasm_start_pos] |
1242 | pop eax |
1244 | pop eax |
1243 | cmp [disasm_cur_str], 0 |
1245 | cmp [disasm_cur_str], 0 |
1244 | jz @f |
1246 | jz @f |
1245 | mov [disasm_start_pos], eax |
1247 | mov [disasm_start_pos], eax |
1246 | 1248 | ||
1247 | .ret: |
1249 | .ret: |
1248 | ret |
1250 | ret |
1249 | 1251 | ||
1250 | @@: |
1252 | @@: |
1251 | call update_disasm |
1253 | call update_disasm |
1252 | 1254 | ||
1253 | .err: |
1255 | .err: |
1254 | mov esi, aInvAddr |
1256 | mov esi, aInvAddr |
1255 | jmp put_message |
1257 | jmp put_message |
1256 | 1258 | ||
1257 | ;----------------------------------------------------------------------------- |
1259 | ;----------------------------------------------------------------------------- |
1258 | ; Access to register value event |
1260 | ; Access to register value event |
1259 | 1261 | ||
1260 | OnReg: |
1262 | OnReg: |
1261 | mov esi, [curarg] |
1263 | mov esi, [curarg] |
1262 | call get_arg.skip_spaces |
1264 | call get_arg.skip_spaces |
1263 | call find_reg |
1265 | call find_reg |
1264 | jnc @f |
1266 | jnc @f |
1265 | 1267 | ||
1266 | .err: |
1268 | .err: |
1267 | mov esi, RSyntax |
1269 | mov esi, RSyntax |
1268 | jmp put_message |
1270 | jmp put_message |
1269 | 1271 | ||
1270 | @@: |
1272 | @@: |
1271 | call get_arg.skip_spaces |
1273 | call get_arg.skip_spaces |
1272 | test al, al |
1274 | test al, al |
1273 | jz .err |
1275 | jz .err |
1274 | cmp al, '=' |
1276 | cmp al, '=' |
1275 | jnz @f |
1277 | jnz @f |
1276 | inc esi |
1278 | inc esi |
1277 | call get_arg.skip_spaces |
1279 | call get_arg.skip_spaces |
1278 | test al, al |
1280 | test al, al |
1279 | jz .err |
1281 | jz .err |
1280 | 1282 | ||
1281 | @@: |
1283 | @@: |
1282 | push edi |
1284 | push edi |
1283 | call calc_expression |
1285 | call calc_expression |
1284 | pop edi |
1286 | pop edi |
1285 | jc .ret |
1287 | jc .ret |
1286 | ; now edi=register id, ebp=value |
1288 | ; now edi=register id, ebp=value |
1287 | cmp [bSuspended], 0 |
1289 | cmp [bSuspended], 0 |
1288 | mov esi, aRunningErr |
1290 | mov esi, aRunningErr |
1289 | jz put_message |
1291 | jz put_message |
1290 | xchg eax, ebp |
1292 | xchg eax, ebp |
1291 | cmp edi, 24 |
1293 | cmp edi, 24 |
1292 | jz .eip |
1294 | jz .eip |
1293 | sub edi, 4 |
1295 | sub edi, 4 |
1294 | jb .8lo |
1296 | jb .8lo |
1295 | sub edi, 4 |
1297 | sub edi, 4 |
1296 | jb .8hi |
1298 | jb .8hi |
1297 | sub edi, 8 |
1299 | sub edi, 8 |
1298 | jb .16 |
1300 | jb .16 |
1299 | mov [_eax+edi*4], eax |
1301 | mov [_eax+edi*4], eax |
1300 | jmp .ret |
1302 | jmp .ret |
1301 | 1303 | ||
1302 | .16: |
1304 | .16: |
1303 | mov word [_eax+(edi+8)*4], ax |
1305 | mov word [_eax+(edi+8)*4], ax |
1304 | jmp .ret |
1306 | jmp .ret |
1305 | 1307 | ||
1306 | .8lo: |
1308 | .8lo: |
1307 | mov byte [_eax+(edi+4)*4], al |
1309 | mov byte [_eax+(edi+4)*4], al |
1308 | jmp .ret |
1310 | jmp .ret |
1309 | 1311 | ||
1310 | .8hi: |
1312 | .8hi: |
1311 | mov byte [_eax+(edi+4)*4+1], al |
1313 | mov byte [_eax+(edi+4)*4+1], al |
1312 | jmp .ret |
1314 | jmp .ret |
1313 | 1315 | ||
1314 | .eip: |
1316 | .eip: |
1315 | mov [_eip], eax |
1317 | mov [_eip], eax |
1316 | call update_disasm_eip |
1318 | call update_disasm_eip |
1317 | 1319 | ||
1318 | .ret: |
1320 | .ret: |
1319 | call set_context |
1321 | call set_context |
1320 | jmp draw_registers.redraw |
1322 | jmp draw_registers.redraw |
1321 | 1323 | ||
1322 | ;----------------------------------------------------------------------------- |
1324 | ;----------------------------------------------------------------------------- |
1323 | ; Breakpoints manipulation |
1325 | ; Breakpoints manipulation |
1324 | OnBp: |
1326 | OnBp: |
1325 | mov esi, [curarg] |
1327 | mov esi, [curarg] |
1326 | call calc_expression |
1328 | call calc_expression |
1327 | jc .ret |
1329 | jc .ret |
1328 | xchg eax, ebp |
1330 | xchg eax, ebp |
1329 | push eax |
1331 | push eax |
1330 | call find_breakpoint |
1332 | call find_breakpoint |
1331 | inc eax |
1333 | inc eax |
1332 | pop eax |
1334 | pop eax |
1333 | jz .notfound |
1335 | jz .notfound |
1334 | mov esi, aDuplicateBreakpoint |
1336 | mov esi, aDuplicateBreakpoint |
1335 | jmp .sayerr |
1337 | jmp .sayerr |
1336 | 1338 | ||
1337 | .notfound: |
1339 | .notfound: |
1338 | mov bl, 1 |
1340 | mov bl, 1 |
1339 | call add_breakpoint |
1341 | call add_breakpoint |
1340 | jnc .ret |
1342 | jnc .ret |
1341 | mov esi, aBreakpointLimitExceeded |
1343 | mov esi, aBreakpointLimitExceeded |
1342 | 1344 | ||
1343 | .sayerr: |
1345 | .sayerr: |
1344 | call put_message |
1346 | call put_message |
1345 | 1347 | ||
1346 | .ret: |
1348 | .ret: |
1347 | jmp draw_disasm |
1349 | jmp draw_disasm |
1348 | 1350 | ||
1349 | OnBpmb: |
1351 | OnBpmb: |
1350 | mov dh, 0011b |
1352 | mov dh, 0011b |
1351 | jmp DoBpm |
1353 | jmp DoBpm |
1352 | 1354 | ||
1353 | OnBpmw: |
1355 | OnBpmw: |
1354 | mov dh, 0111b |
1356 | mov dh, 0111b |
1355 | jmp DoBpm |
1357 | jmp DoBpm |
1356 | 1358 | ||
1357 | OnBpmd: |
1359 | OnBpmd: |
1358 | mov dh, 1111b |
1360 | mov dh, 1111b |
1359 | 1361 | ||
1360 | DoBpm: |
1362 | DoBpm: |
1361 | mov esi, [curarg] |
1363 | mov esi, [curarg] |
1362 | cmp byte [esi], 'w' |
1364 | cmp byte [esi], 'w' |
1363 | jnz @f |
1365 | jnz @f |
1364 | and dh, not 2 |
1366 | and dh, not 2 |
1365 | inc esi |
1367 | inc esi |
1366 | 1368 | ||
1367 | @@: |
1369 | @@: |
1368 | push edx |
1370 | push edx |
1369 | call calc_expression |
1371 | call calc_expression |
1370 | pop edx |
1372 | pop edx |
1371 | jnc @f |
1373 | jnc @f |
1372 | ret |
1374 | ret |
1373 | 1375 | ||
1374 | ; ebp = expression, dh = flags |
1376 | ; ebp = expression, dh = flags |
1375 | @@: |
1377 | @@: |
1376 | movzx eax, dh |
1378 | movzx eax, dh |
1377 | shr eax, 2 |
1379 | shr eax, 2 |
1378 | test ebp, eax |
1380 | test ebp, eax |
1379 | jz @f |
1381 | jz @f |
1380 | mov esi, aUnaligned |
1382 | mov esi, aUnaligned |
1381 | jmp put_message |
1383 | jmp put_message |
1382 | 1384 | ||
1383 | @@: |
1385 | @@: |
1384 | mov eax, ebp |
1386 | mov eax, ebp |
1385 | mov bl, 0Bh |
1387 | mov bl, 0Bh |
1386 | call add_breakpoint |
1388 | call add_breakpoint |
1387 | jnc @f |
1389 | jnc @f |
1388 | mov esi, aBreakpointLimitExceeded |
1390 | mov esi, aBreakpointLimitExceeded |
1389 | jmp put_message |
1391 | jmp put_message |
1390 | 1392 | ||
1391 | ; now find index |
1393 | ; now find index |
1392 | @@: |
1394 | @@: |
1393 | push eax |
1395 | push eax |
1394 | xor ecx, ecx |
1396 | xor ecx, ecx |
1395 | 1397 | ||
1396 | .l1: |
1398 | .l1: |
1397 | cmp [drx_break+ecx*4], 0 |
1399 | cmp [drx_break+ecx*4], 0 |
1398 | jnz .l2 |
1400 | jnz .l2 |
1399 | ;push 69 |
1401 | ;push 69 |
1400 | ;pop eax |
1402 | ;pop eax |
1401 | push ecx |
1403 | push ecx |
1402 | mov dl, cl |
1404 | mov dl, cl |
1403 | ;mov ecx, [debuggee_pid] |
1405 | ;mov ecx, [debuggee_pid] |
1404 | mov esi, ebp |
1406 | mov esi, ebp |
1405 | ;push 9 |
1407 | ;push 9 |
1406 | ;pop ebx |
1408 | ;pop ebx |
1407 | mcall 69, 9, [debuggee_pid] |
1409 | mcall 69, 9, [debuggee_pid] |
1408 | test eax, eax |
1410 | test eax, eax |
1409 | jz .ok |
1411 | jz .ok |
1410 | pop ecx |
1412 | pop ecx |
1411 | 1413 | ||
1412 | .l2: |
1414 | .l2: |
1413 | inc ecx |
1415 | inc ecx |
1414 | cmp ecx, 4 |
1416 | cmp ecx, 4 |
1415 | jb .l1 |
1417 | jb .l1 |
1416 | pop eax |
1418 | pop eax |
1417 | call clear_breakpoint |
1419 | call clear_breakpoint |
1418 | mov esi, aBreakpointLimitExceeded |
1420 | mov esi, aBreakpointLimitExceeded |
1419 | jmp put_message |
1421 | jmp put_message |
1420 | 1422 | ||
1421 | .ok: |
1423 | .ok: |
1422 | pop ecx |
1424 | pop ecx |
1423 | pop eax |
1425 | pop eax |
1424 | and byte [edi], not 2 ; breakpoint is enabled |
1426 | and byte [edi], not 2 ; breakpoint is enabled |
1425 | shl dl, 6 |
1427 | shl dl, 6 |
1426 | or dl, dh |
1428 | or dl, dh |
1427 | mov byte [edi+1], dl |
1429 | mov byte [edi+1], dl |
1428 | inc eax |
1430 | inc eax |
1429 | mov [drx_break+ecx*4], eax |
1431 | mov [drx_break+ecx*4], eax |
1430 | ret |
1432 | ret |
1431 | 1433 | ||
1432 | OnBc: |
1434 | OnBc: |
1433 | mov esi, [curarg] |
1435 | mov esi, [curarg] |
1434 | 1436 | ||
1435 | @@: |
1437 | @@: |
1436 | call get_hex_number |
1438 | call get_hex_number |
1437 | jc OnBp.ret |
1439 | jc OnBp.ret |
1438 | call clear_breakpoint |
1440 | call clear_breakpoint |
1439 | jmp @b |
1441 | jmp @b |
1440 | 1442 | ||
1441 | OnBd: |
1443 | OnBd: |
1442 | mov esi, [curarg] |
1444 | mov esi, [curarg] |
1443 | 1445 | ||
1444 | @@: |
1446 | @@: |
1445 | call get_hex_number |
1447 | call get_hex_number |
1446 | jc OnBp.ret |
1448 | jc OnBp.ret |
1447 | call disable_breakpoint |
1449 | call disable_breakpoint |
1448 | jmp @b |
1450 | jmp @b |
1449 | 1451 | ||
1450 | OnBe: |
1452 | OnBe: |
1451 | mov esi, [curarg] |
1453 | mov esi, [curarg] |
1452 | 1454 | ||
1453 | @@: |
1455 | @@: |
1454 | call get_hex_number |
1456 | call get_hex_number |
1455 | jc OnBp.ret |
1457 | jc OnBp.ret |
1456 | push eax |
1458 | push eax |
1457 | call find_enabled_breakpoint |
1459 | call find_enabled_breakpoint |
1458 | pop eax |
1460 | pop eax |
1459 | jz .err |
1461 | jz .err |
1460 | call enable_breakpoint |
1462 | call enable_breakpoint |
1461 | jmp @b |
1463 | jmp @b |
1462 | 1464 | ||
1463 | .err: |
1465 | .err: |
1464 | mov esi, OnBeErrMsg |
1466 | mov esi, OnBeErrMsg |
1465 | jmp put_message |
1467 | jmp put_message |
1466 | 1468 | ||
1467 | ; TODO: split it out in parser.inc |
1469 | ; TODO: split it out in parser.inc |
1468 | get_hex_number: |
1470 | get_hex_number: |
1469 | call get_arg.skip_spaces |
1471 | call get_arg.skip_spaces |
1470 | xor ecx, ecx |
1472 | xor ecx, ecx |
1471 | xor edx, edx |
1473 | xor edx, edx |
1472 | 1474 | ||
1473 | @@: |
1475 | @@: |
1474 | lodsb |
1476 | lodsb |
1475 | call is_hex_digit |
1477 | call is_hex_digit |
1476 | jc .ret |
1478 | jc .ret |
1477 | shl edx, 4 |
1479 | shl edx, 4 |
1478 | or dl, al |
1480 | or dl, al |
1479 | inc ecx |
1481 | inc ecx |
1480 | jmp @b |
1482 | jmp @b |
1481 | 1483 | ||
1482 | .ret: |
1484 | .ret: |
1483 | dec esi |
1485 | dec esi |
1484 | cmp ecx, 1 |
1486 | cmp ecx, 1 |
1485 | xchg eax, edx |
1487 | xchg eax, edx |
1486 | ret |
1488 | ret |
1487 | 1489 | ||
1488 | ;----------------------------------------------------------------------------- |
1490 | ;----------------------------------------------------------------------------- |
1489 | ; Breakpoints list event |
1491 | ; Breakpoints list event |
1490 | 1492 | ||
1491 | OnBl: |
1493 | OnBl: |
1492 | mov esi, [curarg] |
1494 | mov esi, [curarg] |
1493 | cmp byte [esi], 0 |
1495 | cmp byte [esi], 0 |
1494 | jz .listall |
1496 | jz .listall |
1495 | call get_hex_number |
1497 | call get_hex_number |
1496 | jc .ret |
1498 | jc .ret |
1497 | cmp eax, breakpoints_n |
1499 | cmp eax, breakpoints_n |
1498 | jae .err |
1500 | jae .err |
1499 | push eax |
1501 | push eax |
1500 | add eax, eax |
1502 | add eax, eax |
1501 | lea edi, [breakpoints + eax + eax*2] |
1503 | lea edi, [breakpoints + eax + eax*2] |
1502 | pop eax |
1504 | pop eax |
1503 | test byte [edi+4], 1 |
1505 | test byte [edi+4], 1 |
1504 | jz .err |
1506 | jz .err |
1505 | call show_break_info |
1507 | call show_break_info |
1506 | 1508 | ||
1507 | .ret: |
1509 | .ret: |
1508 | ret |
1510 | ret |
1509 | 1511 | ||
1510 | .err: |
1512 | .err: |
1511 | mov esi, aInvalidBreak |
1513 | mov esi, aInvalidBreak |
1512 | jmp put_message |
1514 | jmp put_message |
1513 | 1515 | ||
1514 | .listall: |
1516 | .listall: |
1515 | mov edi, breakpoints |
1517 | mov edi, breakpoints |
1516 | xor eax, eax |
1518 | xor eax, eax |
1517 | 1519 | ||
1518 | @@: |
1520 | @@: |
1519 | test byte [edi+4], 1 |
1521 | test byte [edi+4], 1 |
1520 | jz .cont |
1522 | jz .cont |
1521 | push edi eax |
1523 | push edi eax |
1522 | call show_break_info |
1524 | call show_break_info |
1523 | pop eax edi |
1525 | pop eax edi |
1524 | 1526 | ||
1525 | .cont: |
1527 | .cont: |
1526 | add edi, 6 |
1528 | add edi, 6 |
1527 | inc eax |
1529 | inc eax |
1528 | cmp eax, breakpoints_n |
1530 | cmp eax, breakpoints_n |
1529 | jb @b |
1531 | jb @b |
1530 | ret |
1532 | ret |
1531 | 1533 | ||
1532 | ;----------------------------------------------------------------------------- |
1534 | ;----------------------------------------------------------------------------- |
1533 | 1535 | ||
1534 | show_break_info: |
1536 | show_break_info: |
1535 | push edi |
1537 | push edi |
1536 | test byte [edi+4], 8 |
1538 | test byte [edi+4], 8 |
1537 | jnz .dr |
1539 | jnz .dr |
1538 | push dword [edi] |
1540 | push dword [edi] |
1539 | push eax |
1541 | push eax |
1540 | mov esi, aBreakNum |
1542 | mov esi, aBreakNum |
1541 | call put_message_nodraw |
1543 | call put_message_nodraw |
1542 | jmp .cmn |
1544 | jmp .cmn |
1543 | 1545 | ||
1544 | .dr: |
1546 | .dr: |
1545 | push eax |
1547 | push eax |
1546 | mov esi, aMemBreak1 |
1548 | mov esi, aMemBreak1 |
1547 | call put_message_nodraw |
1549 | call put_message_nodraw |
1548 | pop edi |
1550 | pop edi |
1549 | push edi |
1551 | push edi |
1550 | mov esi, aMemBreak2 |
1552 | mov esi, aMemBreak2 |
1551 | test byte [edi+5], 2 |
1553 | test byte [edi+5], 2 |
1552 | jz @f |
1554 | jz @f |
1553 | mov esi, aMemBreak3 |
1555 | mov esi, aMemBreak3 |
1554 | 1556 | ||
1555 | @@: |
1557 | @@: |
1556 | call put_message_nodraw |
1558 | call put_message_nodraw |
1557 | pop edi |
1559 | pop edi |
1558 | push edi |
1560 | push edi |
1559 | mov esi, aMemBreak6 |
1561 | mov esi, aMemBreak6 |
1560 | test byte [edi+5], 8 |
1562 | test byte [edi+5], 8 |
1561 | jnz @f |
1563 | jnz @f |
1562 | mov esi, aMemBreak5 |
1564 | mov esi, aMemBreak5 |
1563 | test byte [edi+5], 4 |
1565 | test byte [edi+5], 4 |
1564 | jnz @f |
1566 | jnz @f |
1565 | mov esi, aMemBreak4 |
1567 | mov esi, aMemBreak4 |
1566 | 1568 | ||
1567 | @@: |
1569 | @@: |
1568 | call put_message_nodraw |
1570 | call put_message_nodraw |
1569 | pop edi |
1571 | pop edi |
1570 | push edi |
1572 | push edi |
1571 | push dword [edi] |
1573 | push dword [edi] |
1572 | mov esi, aMemBreak7 |
1574 | mov esi, aMemBreak7 |
1573 | call put_message_nodraw |
1575 | call put_message_nodraw |
1574 | 1576 | ||
1575 | .cmn: |
1577 | .cmn: |
1576 | pop edi |
1578 | pop edi |
1577 | test byte [edi+4], 2 |
1579 | test byte [edi+4], 2 |
1578 | jz @f |
1580 | jz @f |
1579 | push edi |
1581 | push edi |
1580 | mov esi, aDisabled |
1582 | mov esi, aDisabled |
1581 | call put_message_nodraw |
1583 | call put_message_nodraw |
1582 | pop edi |
1584 | pop edi |
1583 | 1585 | ||
1584 | @@: |
1586 | @@: |
1585 | test byte [edi+4], 4 |
1587 | test byte [edi+4], 4 |
1586 | jz @f |
1588 | jz @f |
1587 | mov esi, aOneShot |
1589 | mov esi, aOneShot |
1588 | call put_message_nodraw |
1590 | call put_message_nodraw |
1589 | 1591 | ||
1590 | @@: |
1592 | @@: |
1591 | mov esi, newline |
1593 | mov esi, newline |
1592 | jmp put_message |
1594 | jmp put_message |
1593 | 1595 | ||
1594 | ;----------------------------------------------------------------------------- |
1596 | ;----------------------------------------------------------------------------- |
1595 | ; Add breakpoint |
1597 | ; Add breakpoint |
1596 | ; in: EAX = address; BL = flags |
1598 | ; in: EAX = address; BL = flags |
1597 | ; out: CF = 1 => error |
1599 | ; out: CF = 1 => error |
1598 | ; CF = 0 and EAX = breakpoint number |
1600 | ; CF = 0 and EAX = breakpoint number |
1599 | 1601 | ||
1600 | add_breakpoint: |
1602 | add_breakpoint: |
1601 | xor ecx, ecx |
1603 | xor ecx, ecx |
1602 | mov edi, breakpoints |
1604 | mov edi, breakpoints |
1603 | 1605 | ||
1604 | @@: |
1606 | @@: |
1605 | test byte [edi+4], 1 |
1607 | test byte [edi+4], 1 |
1606 | jz .found |
1608 | jz .found |
1607 | add edi, 6 |
1609 | add edi, 6 |
1608 | inc ecx |
1610 | inc ecx |
1609 | cmp ecx, breakpoints_n |
1611 | cmp ecx, breakpoints_n |
1610 | jb @b |
1612 | jb @b |
1611 | stc |
1613 | stc |
1612 | ret |
1614 | ret |
1613 | 1615 | ||
1614 | .found: |
1616 | .found: |
1615 | stosd |
1617 | stosd |
1616 | xchg eax, ecx |
1618 | xchg eax, ecx |
1617 | mov [edi], bl |
1619 | mov [edi], bl |
1618 | test bl, 2 |
1620 | test bl, 2 |
1619 | jnz @f |
1621 | jnz @f |
1620 | or byte [edi], 2 |
1622 | or byte [edi], 2 |
1621 | push eax |
1623 | push eax |
1622 | call enable_breakpoint |
1624 | call enable_breakpoint |
1623 | pop eax |
1625 | pop eax |
1624 | 1626 | ||
1625 | @@: |
1627 | @@: |
1626 | clc |
1628 | clc |
1627 | ret |
1629 | ret |
1628 | 1630 | ||
1629 | ;----------------------------------------------------------------------------- |
1631 | ;----------------------------------------------------------------------------- |
1630 | ; Remove breakpoint |
1632 | ; Remove breakpoint |
1631 | 1633 | ||
1632 | clear_breakpoint: |
1634 | clear_breakpoint: |
1633 | cmp eax, breakpoints_n |
1635 | cmp eax, breakpoints_n |
1634 | jae .ret |
1636 | jae .ret |
1635 | mov ecx, 4 |
1637 | mov ecx, 4 |
1636 | inc eax |
1638 | inc eax |
1637 | 1639 | ||
1638 | .1: |
1640 | .1: |
1639 | cmp [drx_break-4+ecx*4], eax |
1641 | cmp [drx_break-4+ecx*4], eax |
1640 | jnz @f |
1642 | jnz @f |
1641 | and [drx_break-4+ecx*4], 0 |
1643 | and [drx_break-4+ecx*4], 0 |
1642 | 1644 | ||
1643 | @@: |
1645 | @@: |
1644 | loop .1 |
1646 | loop .1 |
1645 | dec eax |
1647 | dec eax |
1646 | push eax |
1648 | push eax |
1647 | add eax, eax |
1649 | add eax, eax |
1648 | lea edi, [breakpoints + eax + eax*2 + 4] |
1650 | lea edi, [breakpoints + eax + eax*2 + 4] |
1649 | test byte [edi], 1 |
1651 | test byte [edi], 1 |
1650 | pop eax |
1652 | pop eax |
1651 | jz .ret |
1653 | jz .ret |
1652 | push edi |
1654 | push edi |
1653 | call disable_breakpoint |
1655 | call disable_breakpoint |
1654 | pop edi |
1656 | pop edi |
1655 | mov byte [edi], 0 |
1657 | mov byte [edi], 0 |
1656 | 1658 | ||
1657 | .ret: |
1659 | .ret: |
1658 | ret |
1660 | ret |
1659 | 1661 | ||
1660 | ;----------------------------------------------------------------------------- |
1662 | ;----------------------------------------------------------------------------- |
1661 | ; Disable breakpoint |
1663 | ; Disable breakpoint |
1662 | 1664 | ||
1663 | disable_breakpoint: |
1665 | disable_breakpoint: |
1664 | cmp eax, breakpoints_n |
1666 | cmp eax, breakpoints_n |
1665 | jae .ret |
1667 | jae .ret |
1666 | add eax, eax |
1668 | add eax, eax |
1667 | lea edi, [breakpoints + eax + eax*2 + 5] |
1669 | lea edi, [breakpoints + eax + eax*2 + 5] |
1668 | test byte [edi-1], 1 |
1670 | test byte [edi-1], 1 |
1669 | jz .ret |
1671 | jz .ret |
1670 | test byte [edi-1], 2 |
1672 | test byte [edi-1], 2 |
1671 | jnz .ret |
1673 | jnz .ret |
1672 | or byte [edi-1], 2 |
1674 | or byte [edi-1], 2 |
1673 | test byte [edi-1], 8 |
1675 | test byte [edi-1], 8 |
1674 | jnz .dr |
1676 | jnz .dr |
1675 | push esi |
1677 | push esi |
1676 | ;push 7 |
1678 | ;push 7 |
1677 | ;pop ebx |
1679 | ;pop ebx |
1678 | ;push 69 |
1680 | ;push 69 |
1679 | ;pop eax |
1681 | ;pop eax |
1680 | ;mov ecx, [debuggee_pid] |
1682 | ;mov ecx, [debuggee_pid] |
1681 | ;xor edx, edx |
1683 | ;xor edx, edx |
1682 | ;inc edx |
1684 | ;inc edx |
1683 | ;mov esi, [edi-5] |
1685 | ;mov esi, [edi-5] |
1684 | mcall 69, 7, [debuggee_pid], 1, [edi-5] |
1686 | mcall 69, 7, [debuggee_pid], 1, [edi-5] |
1685 | pop esi |
1687 | pop esi |
1686 | 1688 | ||
1687 | .ret: |
1689 | .ret: |
1688 | ret |
1690 | ret |
1689 | 1691 | ||
1690 | .dr: |
1692 | .dr: |
1691 | mov dl, [edi] |
1693 | mov dl, [edi] |
1692 | shr dl, 6 |
1694 | shr dl, 6 |
1693 | mov dh, 80h |
1695 | mov dh, 80h |
1694 | ;push 69 |
1696 | ;push 69 |
1695 | ;pop eax |
1697 | ;pop eax |
1696 | ;push 9 |
1698 | ;push 9 |
1697 | ;pop ebx |
1699 | ;pop ebx |
1698 | ;mov ecx, [debuggee_pid] |
1700 | ;mov ecx, [debuggee_pid] |
1699 | mcall 69, 9, [debuggee_pid] |
1701 | mcall 69, 9, [debuggee_pid] |
1700 | ret |
1702 | ret |
1701 | 1703 | ||
1702 | ;----------------------------------------------------------------------------- |
1704 | ;----------------------------------------------------------------------------- |
1703 | ; Enable breakpoint |
1705 | ; Enable breakpoint |
1704 | 1706 | ||
1705 | enable_breakpoint: |
1707 | enable_breakpoint: |
1706 | push esi |
1708 | push esi |
1707 | cmp eax, breakpoints_n |
1709 | cmp eax, breakpoints_n |
1708 | jae .ret |
1710 | jae .ret |
1709 | add eax, eax |
1711 | add eax, eax |
1710 | lea edi, [breakpoints + eax + eax*2 + 5] |
1712 | lea edi, [breakpoints + eax + eax*2 + 5] |
1711 | test byte [edi-1], 1 |
1713 | test byte [edi-1], 1 |
1712 | jz .ret |
1714 | jz .ret |
1713 | test byte [edi-1], 2 |
1715 | test byte [edi-1], 2 |
1714 | jz .ret |
1716 | jz .ret |
1715 | and byte [edi-1], not 2 |
1717 | and byte [edi-1], not 2 |
1716 | test byte [edi-1], 8 |
1718 | test byte [edi-1], 8 |
1717 | jnz .dr |
1719 | jnz .dr |
1718 | ;push 6 |
1720 | ;push 6 |
1719 | ;pop ebx |
1721 | ;pop ebx |
1720 | ;push 69 |
1722 | ;push 69 |
1721 | ;pop eax |
1723 | ;pop eax |
1722 | ;mov esi, [edi-5] |
1724 | ;mov esi, [edi-5] |
1723 | ;mov ecx, [debuggee_pid] |
1725 | ;mov ecx, [debuggee_pid] |
1724 | ;xor edx, edx |
1726 | ;xor edx, edx |
1725 | ;inc edx |
1727 | ;inc edx |
1726 | mcall 69, 6, [debuggee_pid], 1, [edi-5] |
1728 | mcall 69, 6, [debuggee_pid], 1, [edi-5] |
1727 | dec eax |
1729 | dec eax |
1728 | jnz .err |
1730 | jnz .err |
1729 | ;mov al, 69 |
1731 | ;mov al, 69 |
1730 | push 0xCC |
1732 | push 0xCC |
1731 | mov edi, esp |
1733 | mov edi, esp |
1732 | inc ebx |
1734 | inc ebx |
1733 | mcall 69 |
1735 | mcall 69 |
1734 | pop eax |
1736 | pop eax |
1735 | 1737 | ||
1736 | .ret: |
1738 | .ret: |
1737 | pop esi |
1739 | pop esi |
1738 | ret |
1740 | ret |
1739 | 1741 | ||
1740 | .err: |
1742 | .err: |
1741 | or byte [edi-1], 2 |
1743 | or byte [edi-1], 2 |
1742 | mov esi, aBreakErr |
1744 | mov esi, aBreakErr |
1743 | call put_message |
1745 | call put_message |
1744 | pop esi |
1746 | pop esi |
1745 | ret |
1747 | ret |
1746 | 1748 | ||
1747 | .dr: |
1749 | .dr: |
1748 | ;push 9 |
1750 | ;push 9 |
1749 | ;pop ebx |
1751 | ;pop ebx |
1750 | ;push 69 |
1752 | ;push 69 |
1751 | ;pop eax |
1753 | ;pop eax |
1752 | mov esi, [edi-5] |
1754 | mov esi, [edi-5] |
1753 | ;mov ecx, [debuggee_pid] |
1755 | ;mov ecx, [debuggee_pid] |
1754 | mov dl, [edi] |
1756 | mov dl, [edi] |
1755 | shr dl, 6 |
1757 | shr dl, 6 |
1756 | mov dh, [edi] |
1758 | mov dh, [edi] |
1757 | and dh, 0xF |
1759 | and dh, 0xF |
1758 | mcall 69, 9, [debuggee_pid] |
1760 | mcall 69, 9, [debuggee_pid] |
1759 | test eax, eax |
1761 | test eax, eax |
1760 | jnz .err |
1762 | jnz .err |
1761 | pop esi |
1763 | pop esi |
1762 | ret |
1764 | ret |
1763 | 1765 | ||
1764 | ;----------------------------------------------------------------------------- |
1766 | ;----------------------------------------------------------------------------- |
1765 | ; Find breakpoint |
1767 | ; Find breakpoint |
1766 | 1768 | ||
1767 | find_breakpoint: |
1769 | find_breakpoint: |
1768 | xor ecx, ecx |
1770 | xor ecx, ecx |
1769 | xchg eax, ecx |
1771 | xchg eax, ecx |
1770 | mov edi, breakpoints |
1772 | mov edi, breakpoints |
1771 | 1773 | ||
1772 | @@: |
1774 | @@: |
1773 | test byte [edi+4], 1 |
1775 | test byte [edi+4], 1 |
1774 | jz .cont |
1776 | jz .cont |
1775 | test byte [edi+4], 8 |
1777 | test byte [edi+4], 8 |
1776 | jnz .cont |
1778 | jnz .cont |
1777 | cmp [edi], ecx |
1779 | cmp [edi], ecx |
1778 | jz .found |
1780 | jz .found |
1779 | 1781 | ||
1780 | .cont: |
1782 | .cont: |
1781 | add edi, 6 |
1783 | add edi, 6 |
1782 | inc eax |
1784 | inc eax |
1783 | cmp eax, breakpoints_n |
1785 | cmp eax, breakpoints_n |
1784 | jb @b |
1786 | jb @b |
1785 | or eax, -1 |
1787 | or eax, -1 |
1786 | 1788 | ||
1787 | .found: |
1789 | .found: |
1788 | ret |
1790 | ret |
1789 | 1791 | ||
1790 | ;----------------------------------------------------------------------------- |
1792 | ;----------------------------------------------------------------------------- |
1791 | ; |
1793 | ; |
1792 | 1794 | ||
1793 | find_enabled_breakpoint: |
1795 | find_enabled_breakpoint: |
1794 | xor ecx, ecx |
1796 | xor ecx, ecx |
1795 | xchg eax, ecx |
1797 | xchg eax, ecx |
1796 | mov edi, breakpoints |
1798 | mov edi, breakpoints |
1797 | 1799 | ||
1798 | @@: |
1800 | @@: |
1799 | test byte [edi+4], 1 |
1801 | test byte [edi+4], 1 |
1800 | jz .cont |
1802 | jz .cont |
1801 | test byte [edi+4], 2 or 8 |
1803 | test byte [edi+4], 2 or 8 |
1802 | jnz .cont |
1804 | jnz .cont |
1803 | cmp [edi], ecx |
1805 | cmp [edi], ecx |
1804 | jz .found |
1806 | jz .found |
1805 | 1807 | ||
1806 | .cont: |
1808 | .cont: |
1807 | add edi, 6 |
1809 | add edi, 6 |
1808 | inc eax |
1810 | inc eax |
1809 | cmp eax, breakpoints_n |
1811 | cmp eax, breakpoints_n |
1810 | jb @b |
1812 | jb @b |
1811 | or eax, -1 |
1813 | or eax, -1 |
1812 | 1814 | ||
1813 | .found: |
1815 | .found: |
1814 | ret |
1816 | ret |
1815 | 1817 | ||
1816 | ; TODO: add find_disabled_breakpoint |
1818 | ; TODO: add find_disabled_breakpoint |
1817 | 1819 | ||
1818 | ;----------------------------------------------------------------------------- |
1820 | ;----------------------------------------------------------------------------- |
1819 | ; Unpack executable event |
1821 | ; Unpack executable event |
1820 | 1822 | ||
1821 | OnUnpack: |
1823 | OnUnpack: |
1822 | ; program must be loaded - checked when command was parsed |
1824 | ; program must be loaded - checked when command was parsed |
1823 | ; program must be stopped |
1825 | ; program must be stopped |
1824 | mov esi, aRunningErr |
1826 | mov esi, aRunningErr |
1825 | cmp [bSuspended], 0 |
1827 | cmp [bSuspended], 0 |
1826 | jz put_message |
1828 | jz put_message |
1827 | ; all breakpoints must be disabled |
1829 | ; all breakpoints must be disabled |
1828 | mov edi, breakpoints |
1830 | mov edi, breakpoints |
1829 | 1831 | ||
1830 | @@: |
1832 | @@: |
1831 | test byte [edi+4], 1 |
1833 | test byte [edi+4], 1 |
1832 | jz .cont |
1834 | jz .cont |
1833 | test byte [edi+4], 2 |
1835 | test byte [edi+4], 2 |
1834 | jnz .cont |
1836 | jnz .cont |
1835 | mov esi, aEnabledBreakErr |
1837 | mov esi, aEnabledBreakErr |
1836 | jmp put_message |
1838 | jmp put_message |
1837 | 1839 | ||
1838 | .cont: |
1840 | .cont: |
1839 | add edi, 6 |
1841 | add edi, 6 |
1840 | cmp edi, breakpoints+breakpoints_n*6 |
1842 | cmp edi, breakpoints+breakpoints_n*6 |
1841 | jb @b |
1843 | jb @b |
1842 | ; ok, now do it |
1844 | ; ok, now do it |
1843 | ; set breakpoint on 0xC dword access |
1845 | ; set breakpoint on 0xC dword access |
1844 | push 9 |
1846 | push 9 |
1845 | pop ebx |
1847 | pop ebx |
1846 | mov ecx, [debuggee_pid] |
1848 | mov ecx, [debuggee_pid] |
1847 | mov dx, 1111b*256 |
1849 | mov dx, 1111b*256 |
1848 | push 0xC |
1850 | push 0xC |
1849 | pop esi |
1851 | pop esi |
1850 | 1852 | ||
1851 | @@: |
1853 | @@: |
1852 | ;push 69 |
1854 | ;push 69 |
1853 | ;pop eax |
1855 | ;pop eax |
1854 | mcall 69 |
1856 | mcall 69 |
1855 | test eax, eax |
1857 | test eax, eax |
1856 | jz .breakok |
1858 | jz .breakok |
1857 | inc edx |
1859 | inc edx |
1858 | cmp dl, 4 |
1860 | cmp dl, 4 |
1859 | jb @b |
1861 | jb @b |
1860 | 1862 | ||
1861 | .breakok: |
1863 | .breakok: |
1862 | call GoOn |
1864 | call GoOn |
1863 | 1865 | ||
1864 | ; now wait for event |
1866 | ; now wait for event |
1865 | .wait: |
1867 | .wait: |
1866 | ;push 10 |
1868 | ;push 10 |
1867 | ;pop eax |
1869 | ;pop eax |
1868 | mcall 10 |
1870 | mcall 10 |
1869 | dec eax |
1871 | dec eax |
1870 | jz .redraw |
1872 | jz .redraw |
1871 | dec eax |
1873 | dec eax |
1872 | jz .key |
1874 | jz .key |
1873 | dec eax |
1875 | dec eax |
1874 | jnz .debug |
1876 | jnz .debug |
1875 | ; button; we have only one button, close |
1877 | ; button; we have only one button, close |
1876 | or eax, -1 |
1878 | or eax, -1 |
1877 | mcall |
1879 | mcall |
1878 | 1880 | ||
1879 | .redraw: |
1881 | .redraw: |
1880 | call draw_window |
1882 | call draw_window |
1881 | jmp .wait |
1883 | jmp .wait |
1882 | 1884 | ||
1883 | .key: |
1885 | .key: |
1884 | mov al, 2 |
1886 | mov al, 2 |
1885 | mcall |
1887 | mcall |
1886 | cmp ah, 3 ; Ctrl+C |
1888 | cmp ah, 3 ; Ctrl+C |
1887 | jnz .wait |
1889 | jnz .wait |
1888 | 1890 | ||
1889 | .userbreak: |
1891 | .userbreak: |
1890 | mov esi, aInterrupted |
1892 | mov esi, aInterrupted |
1891 | 1893 | ||
1892 | .x1: |
1894 | .x1: |
1893 | push edx esi |
1895 | push edx esi |
1894 | call put_message |
1896 | call put_message |
1895 | pop esi edx |
1897 | pop esi edx |
1896 | or dh, 80h |
1898 | or dh, 80h |
1897 | ;push 69 |
1899 | ;push 69 |
1898 | ;pop eax |
1900 | ;pop eax |
1899 | ;push 9 |
1901 | ;push 9 |
1900 | ;pop ebx |
1902 | ;pop ebx |
1901 | ;mov ecx, [debuggee_pid] |
1903 | ;mov ecx, [debuggee_pid] |
1902 | mcall 69, 9, [debuggee_pid] |
1904 | mcall 69, 9, [debuggee_pid] |
1903 | cmp esi, aUnpacked |
1905 | cmp esi, aUnpacked |
1904 | jnz OnSuspend |
1906 | jnz OnSuspend |
1905 | jmp AfterSuspend |
1907 | jmp AfterSuspend |
1906 | 1908 | ||
1907 | .debug: |
1909 | .debug: |
1908 | cmp [dbgbuflen], 4*3 |
1910 | cmp [dbgbuflen], 4*3 |
1909 | jnz .notour |
1911 | jnz .notour |
1910 | cmp dword [dbgbuf], 3 |
1912 | cmp dword [dbgbuf], 3 |
1911 | jnz .notour |
1913 | jnz .notour |
1912 | test byte [dbgbuf+8], 1 |
1914 | test byte [dbgbuf+8], 1 |
1913 | jnz .our |
1915 | jnz .our |
1914 | 1916 | ||
1915 | .notour: |
1917 | .notour: |
1916 | mov esi, aInterrupted |
1918 | mov esi, aInterrupted |
1917 | push edx |
1919 | push edx |
1918 | call put_message |
1920 | call put_message |
1919 | pop edx |
1921 | pop edx |
1920 | or dh, 80h |
1922 | or dh, 80h |
1921 | ;push 69 |
1923 | ;push 69 |
1922 | ;pop eax |
1924 | ;pop eax |
1923 | ;push 9 |
1925 | ;push 9 |
1924 | ;pop ebx |
1926 | ;pop ebx |
1925 | ;mov ecx, [debuggee_pid] |
1927 | ;mov ecx, [debuggee_pid] |
1926 | mcall 69, 9, [debuggee_pid] |
1928 | mcall 69, 9, [debuggee_pid] |
1927 | jmp debugmsg |
1929 | jmp debugmsg |
1928 | 1930 | ||
1929 | .our: |
1931 | .our: |
1930 | and [dbgbuflen], 0 |
1932 | and [dbgbuflen], 0 |
1931 | push edx |
1933 | push edx |
1932 | call get_context |
1934 | call get_context |
1933 | push eax |
1935 | push eax |
1934 | ;mov al, 69 |
1936 | ;mov al, 69 |
1935 | ;mov bl, 6 |
1937 | ;mov bl, 6 |
1936 | ;mov ecx, [debuggee_pid] |
1938 | ;mov ecx, [debuggee_pid] |
1937 | ;mov edi, esp |
1939 | ;mov edi, esp |
1938 | ;push 4 |
1940 | ;push 4 |
1939 | ;pop edx |
1941 | ;pop edx |
1940 | ;push 0xC |
1942 | ;push 0xC |
1941 | ;pop esi |
1943 | ;pop esi |
1942 | mcall 69, 6, [debuggee_pid], 4, 0xC, esp |
1944 | mcall 69, 6, [debuggee_pid], 4, 0xC, esp |
1943 | pop eax |
1945 | pop eax |
1944 | pop edx |
1946 | pop edx |
1945 | cmp eax, [_eip] |
1947 | cmp eax, [_eip] |
1946 | jz .done |
1948 | jz .done |
1947 | call DoResume |
1949 | call DoResume |
1948 | jmp .wait |
1950 | jmp .wait |
1949 | 1951 | ||
1950 | .done: |
1952 | .done: |
1951 | mov esi, aUnpacked |
1953 | mov esi, aUnpacked |
1952 | jmp .x1 |
1954 | jmp .x1 |
1953 | 1955 | ||
1954 | ;----------------------------------------------------------------------------- |
1956 | ;----------------------------------------------------------------------------- |
1955 | ; Include Symbol parser |
1957 | ; Include Symbol parser |
1956 | 1958 | ||
1957 | include 'symbols.inc' |
1959 | include 'symbols.inc' |
1958 | 1960 | ||
1959 | ;----------------------------------------------------------------------------- |
1961 | ;----------------------------------------------------------------------------- |
1960 | ; Include disassembler engine |
1962 | ; Include disassembler engine |
1961 | 1963 | ||
1962 | include 'disasm.inc' |
1964 | include 'disasm.inc' |
1963 | 1965 | ||
1964 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1966 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1965 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1967 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1966 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1968 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1967 | 1969 | ||
1968 | caption_str db 'Kolibri Debugger',0 |
1970 | caption_str db 'Kolibri Debugger',0 |
1969 | 1971 | ||
1970 | begin_str db 'Kolibri Debugger, version 0.35',10 |
1972 | begin_str db 'Kolibri Debugger, version 0.35',10 |
1971 | db 'Hint: type "help" for help, "quit" to quit' |
1973 | db 'Hint: type "help" for help, "quit" to quit' |
1972 | newline db 10,0 |
1974 | newline db 10,0 |
1973 | prompt db '> ',0 |
1975 | prompt db '> ',0 |
1974 | 1976 | ||
1975 | help_groups: |
1977 | help_groups: |
1976 | dd aControl, 0, 0, help_control_msg |
1978 | dd aControl, 0, 0, help_control_msg |
1977 | db 0 |
1979 | db 0 |
1978 | dd aData, 0, 0, help_data_msg |
1980 | dd aData, 0, 0, help_data_msg |
1979 | db 0 |
1981 | db 0 |
1980 | dd aBreakpoints, 0, 0, help_breaks_msg |
1982 | dd aBreakpoints, 0, 0, help_breaks_msg |
1981 | db 0 |
1983 | db 0 |
1982 | 1984 | ||
1983 | ;----------------------------------------------------------------------------- |
1985 | ;----------------------------------------------------------------------------- |
1984 | ; Commands format definitions |
1986 | ; Commands format definitions |
1985 | 1987 | ||
1986 | ; TODO: make it with macros |
1988 | ; TODO: make it with macros |
1987 | 1989 | ||
1988 | ; flags field: |
1990 | ; flags field: |
1989 | ; &1: command may be called without parameters |
1991 | ; &1: command may be called without parameters |
1990 | ; &2: command may be called with parameters |
1992 | ; &2: command may be called with parameters |
1991 | ; &4: command may be called without loaded program |
1993 | ; &4: command may be called without loaded program |
1992 | ; &8: command may be called with loaded program |
1994 | ; &8: command may be called with loaded program |
1993 | commands: |
1995 | commands: |
1994 | dd _aH, OnHelp, HelpSyntax, HelpHelp |
1996 | dd _aH, OnHelp, HelpSyntax, HelpHelp |
1995 | db 0Fh |
1997 | db 0Fh |
1996 | dd aHelp, OnHelp, HelpSyntax, HelpHelp |
1998 | dd aHelp, OnHelp, HelpSyntax, HelpHelp |
1997 | db 0Fh |
1999 | db 0Fh |
1998 | dd aQuit, OnQuit, QuitSyntax, QuitHelp |
2000 | dd aQuit, OnQuit, QuitSyntax, QuitHelp |
1999 | db 0Dh |
2001 | db 0Dh |
2000 | dd aLoad, OnLoad, LoadSyntax, LoadHelp |
2002 | dd aLoad, OnLoad, LoadSyntax, LoadHelp |
2001 | db 6 |
2003 | db 6 |
2002 | dd aReload, OnReload, ReloadSyntax, ReloadHelp |
2004 | dd aReload, OnReload, ReloadSyntax, ReloadHelp |
2003 | db 0Dh |
2005 | db 0Dh |
2004 | dd aTerminate, OnTerminate, TerminateSyntax, TerminateHelp |
2006 | dd aTerminate, OnTerminate, TerminateSyntax, TerminateHelp |
2005 | db 9 |
2007 | db 9 |
2006 | dd aDetach, OnDetach, DetachSyntax, DetachHelp |
2008 | dd aDetach, OnDetach, DetachSyntax, DetachHelp |
2007 | db 9 |
2009 | db 9 |
2008 | dd aSuspend, OnSuspend, SuspendSyntax, SuspendHelp |
2010 | dd aSuspend, OnSuspend, SuspendSyntax, SuspendHelp |
2009 | db 9 |
2011 | db 9 |
2010 | dd aResume, OnResume, ResumeSyntax, ResumeHelp |
2012 | dd aResume, OnResume, ResumeSyntax, ResumeHelp |
2011 | db 0Bh |
2013 | db 0Bh |
2012 | dd aStep, OnStepMultiple, StepSyntax, StepHelp |
2014 | dd aStep, OnStepMultiple, StepSyntax, StepHelp |
2013 | db 0Bh |
2015 | db 0Bh |
2014 | dd aProceed, OnProceedMultiple, ProceedSyntax, ProceedHelp |
2016 | dd aProceed, OnProceedMultiple, ProceedSyntax, ProceedHelp |
2015 | db 0Bh |
2017 | db 0Bh |
2016 | dd aCalc, OnCalc, CalcSyntax, CalcHelp |
2018 | dd aCalc, OnCalc, CalcSyntax, CalcHelp |
2017 | db 0Eh |
2019 | db 0Eh |
2018 | dd aDump, OnDump, DumpSyntax, DumpHelp |
2020 | dd aDump, OnDump, DumpSyntax, DumpHelp |
2019 | db 0Bh |
2021 | db 0Bh |
2020 | dd aUnassemble, OnUnassemble, UnassembleSyntax, UnassembleHelp |
2022 | dd aUnassemble, OnUnassemble, UnassembleSyntax, UnassembleHelp |
2021 | db 0Bh |
2023 | db 0Bh |
2022 | dd aBp, OnBp, BpSyntax, BpHelp |
2024 | dd aBp, OnBp, BpSyntax, BpHelp |
2023 | db 0Ah |
2025 | db 0Ah |
2024 | dd aBpm, OnBpmb, BpmSyntax, BpmHelp |
2026 | dd aBpm, OnBpmb, BpmSyntax, BpmHelp |
2025 | db 0Ah |
2027 | db 0Ah |
2026 | dd aBpmb, OnBpmb, BpmSyntax, BpmHelp |
2028 | dd aBpmb, OnBpmb, BpmSyntax, BpmHelp |
2027 | db 0Ah |
2029 | db 0Ah |
2028 | dd aBpmw, OnBpmw, BpmSyntax, BpmHelp |
2030 | dd aBpmw, OnBpmw, BpmSyntax, BpmHelp |
2029 | db 0Ah |
2031 | db 0Ah |
2030 | dd aBpmd, OnBpmd, BpmSyntax, BpmHelp |
2032 | dd aBpmd, OnBpmd, BpmSyntax, BpmHelp |
2031 | db 0Ah |
2033 | db 0Ah |
2032 | dd aBl, OnBl, BlSyntax, BlHelp |
2034 | dd aBl, OnBl, BlSyntax, BlHelp |
2033 | db 0Bh |
2035 | db 0Bh |
2034 | dd aBc, OnBc, BcSyntax, BcHelp |
2036 | dd aBc, OnBc, BcSyntax, BcHelp |
2035 | db 0Ah |
2037 | db 0Ah |
2036 | dd aBd, OnBd, BdSyntax, BdHelp |
2038 | dd aBd, OnBd, BdSyntax, BdHelp |
2037 | db 0Ah |
2039 | db 0Ah |
2038 | dd aBe, OnBe, BeSyntax, BeHelp |
2040 | dd aBe, OnBe, BeSyntax, BeHelp |
2039 | db 0Ah |
2041 | db 0Ah |
2040 | dd aReg, OnReg, RSyntax, RHelp |
2042 | dd aReg, OnReg, RSyntax, RHelp |
2041 | db 0Ah |
2043 | db 0Ah |
2042 | dd aUnpack, OnUnpack, UnpackSyntax, UnpackHelp |
2044 | dd aUnpack, OnUnpack, UnpackSyntax, UnpackHelp |
2043 | db 9 |
2045 | db 9 |
2044 | dd aLoadSymbols, OnLoadSymbols, LoadSymbolsSyntax, LoadSymbolsHelp |
2046 | dd aLoadSymbols, OnLoadSymbols, LoadSymbolsSyntax, LoadSymbolsHelp |
2045 | db 0Ah |
2047 | db 0Ah |
2046 | dd 0 |
2048 | dd 0 |
2047 | 2049 | ||
2048 | ;----------------------------------------------------------------------------- |
2050 | ;----------------------------------------------------------------------------- |
2049 | ; Help messages for commands groups |
2051 | ; Help messages for commands groups |
2050 | 2052 | ||
2051 | aHelp db 5,'help',0 |
2053 | aHelp db 5,'help',0 |
2052 | _aH db 2,'h',0 |
2054 | _aH db 2,'h',0 |
2053 | HelpHelp db 'Help on specified function',10 |
2055 | HelpHelp db 'Help on specified function',10 |
2054 | HelpSyntax db 'Usage: h or help [group | command]',10,0 |
2056 | HelpSyntax db 'Usage: h or help [group | command]',10,0 |
2055 | 2057 | ||
2056 | help_msg db 'List of known command groups:',10 |
2058 | help_msg db 'List of known command groups:',10 |
2057 | db '"help control" - display list of control commands',10 |
2059 | db '"help control" - display list of control commands',10 |
2058 | db '"help data" - display list of commands concerning data',10 |
2060 | db '"help data" - display list of commands concerning data',10 |
2059 | db '"help breakpoints" - display list of commands concerning breakpoints',10,0 |
2061 | db '"help breakpoints" - display list of commands concerning breakpoints',10,0 |
2060 | 2062 | ||
2061 | ; Control commands group |
2063 | ; Control commands group |
2062 | 2064 | ||
2063 | aControl db 8,'control',0 |
2065 | aControl db 8,'control',0 |
2064 | help_control_msg db 'List of control commands:',10 |
2066 | help_control_msg db 'List of control commands:',10 |
2065 | db 'h = help - help',10 |
2067 | db 'h = help - help',10 |
2066 | db 'quit - exit from debugger',10 |
2068 | db 'quit - exit from debugger',10 |
2067 | db 'load |
2069 | db 'load |
2068 | db 'reload - reload debugging program',10 |
2070 | db 'reload - reload debugging program',10 |
2069 | db 'load-symbols |
2071 | db 'load-symbols |
2070 | db 'terminate - terminate loaded program',10 |
2072 | db 'terminate - terminate loaded program',10 |
2071 | db 'detach - detach from debugging program',10 |
2073 | db 'detach - detach from debugging program',10 |
2072 | db 'stop - suspend execution of debugging program',10 |
2074 | db 'stop - suspend execution of debugging program',10 |
2073 | db 'g [ |
2075 | db 'g [ |
2074 | db 's [ |
2076 | db 's [ |
2075 | db 'p [ |
2077 | db 'p [ |
2076 | db 'unpack - try to bypass unpacker code (heuristic)',10,0 |
2078 | db 'unpack - try to bypass unpacker code (heuristic)',10,0 |
2077 | 2079 | ||
2078 | ; Data commands group |
2080 | ; Data commands group |
2079 | 2081 | ||
2080 | aData db 5,'data',0 |
2082 | aData db 5,'data',0 |
2081 | help_data_msg db 'List of data commands:',10 |
2083 | help_data_msg db 'List of data commands:',10 |
2082 | db '? |
2084 | db '? |
2083 | db 'd [ |
2085 | db 'd [ |
2084 | db 'u [ |
2086 | db 'u [ |
2085 | db 'r |
2087 | db 'r |
2086 | db 'r |
2088 | db 'r |
2087 | 2089 | ||
2088 | ; Breakpoints commands group |
2090 | ; Breakpoints commands group |
2089 | 2091 | ||
2090 | aBreakpoints db 12,'breakpoints',0 |
2092 | aBreakpoints db 12,'breakpoints',0 |
2091 | help_breaks_msg db 'List of breakpoints commands:',10 |
2093 | help_breaks_msg db 'List of breakpoints commands:',10 |
2092 | db 'bp |
2094 | db 'bp |
2093 | db 'bpm[b|w|d] |
2095 | db 'bpm[b|w|d] |
2094 | db 'bl [ |
2096 | db 'bl [ |
2095 | db 'bc |
2097 | db 'bc |
2096 | db 'bd |
2098 | db 'bd |
2097 | db 'be |
2099 | db 'be |
2098 | 2100 | ||
2099 | ;----------------------------------------------------------------------------- |
2101 | ;----------------------------------------------------------------------------- |
2100 | ; Individual command help messages |
2102 | ; Individual command help messages |
2101 | 2103 | ||
2102 | aQuit db 5,'quit',0 |
2104 | aQuit db 5,'quit',0 |
2103 | QuitHelp db 'Quit from debugger',10 |
2105 | QuitHelp db 'Quit from debugger',10 |
2104 | QuitSyntax db 'Usage: quit',10,0 |
2106 | QuitSyntax db 'Usage: quit',10,0 |
2105 | 2107 | ||
2106 | aLoad db 5,'load',0 |
2108 | aLoad db 5,'load',0 |
2107 | LoadHelp db 'Load program for debugging',10 |
2109 | LoadHelp db 'Load program for debugging',10 |
2108 | LoadSyntax db 'Usage: load |
2110 | LoadSyntax db 'Usage: load |
2109 | 2111 | ||
2110 | aReload db 7,'reload',0 |
2112 | aReload db 7,'reload',0 |
2111 | ReloadHelp db 'Reload debugging program (restart debug session)',10 |
2113 | ReloadHelp db 'Reload debugging program (restart debug session)',10 |
2112 | ReloadSyntax db 'Usage: reload',10,0 |
2114 | ReloadSyntax db 'Usage: reload',10,0 |
2113 | 2115 | ||
2114 | aTerminate db 10,'terminate',0 |
2116 | aTerminate db 10,'terminate',0 |
2115 | TerminateHelp db 'Terminate debugged program',10 |
2117 | TerminateHelp db 'Terminate debugged program',10 |
2116 | TerminateSyntax db 'Usage: terminate',10,0 |
2118 | TerminateSyntax db 'Usage: terminate',10,0 |
2117 | 2119 | ||
2118 | aDetach db 7,'detach',0 |
2120 | aDetach db 7,'detach',0 |
2119 | DetachHelp db 'Detach from debugged program',10 |
2121 | DetachHelp db 'Detach from debugged program',10 |
2120 | DetachSyntax db 'Usage: detach',10,0 |
2122 | DetachSyntax db 'Usage: detach',10,0 |
2121 | 2123 | ||
2122 | aSuspend db 5,'stop',0 |
2124 | aSuspend db 5,'stop',0 |
2123 | SuspendHelp db 'Suspend execution of debugged program',10 |
2125 | SuspendHelp db 'Suspend execution of debugged program',10 |
2124 | SuspendSyntax db 'Usage: stop',10,0 |
2126 | SuspendSyntax db 'Usage: stop',10,0 |
2125 | 2127 | ||
2126 | aResume db 2,'g',0 |
2128 | aResume db 2,'g',0 |
2127 | ResumeHelp db 'Go (resume execution of debugged program)',10 |
2129 | ResumeHelp db 'Go (resume execution of debugged program)',10 |
2128 | ResumeSyntax db 'Usage: g',10 |
2130 | ResumeSyntax db 'Usage: g',10 |
2129 | db ' or: g |
2131 | db ' or: g |
2130 | 2132 | ||
2131 | aStep db 2,'s',0 |
2133 | aStep db 2,'s',0 |
2132 | StepHelp db 'Make step in debugged program',10 |
2134 | StepHelp db 'Make step in debugged program',10 |
2133 | StepSyntax db 'Usage: s [ |
2135 | StepSyntax db 'Usage: s [ |
2134 | 2136 | ||
2135 | aProceed db 2,'p',0 |
2137 | aProceed db 2,'p',0 |
2136 | ProceedHelp db 'Make wide step in debugged program (step over CALL, REPxx, LOOP)',10 |
2138 | ProceedHelp db 'Make wide step in debugged program (step over CALL, REPxx, LOOP)',10 |
2137 | ProceedSyntax db 'Usage: p [ |
2139 | ProceedSyntax db 'Usage: p [ |
2138 | 2140 | ||
2139 | aDump db 2,'d',0 |
2141 | aDump db 2,'d',0 |
2140 | DumpHelp db 'Dump data of debugged program',10 |
2142 | DumpHelp db 'Dump data of debugged program',10 |
2141 | DumpSyntax db 'Usage: d |
2143 | DumpSyntax db 'Usage: d |
2142 | db ' or: d - continue current dump',10,0 |
2144 | db ' or: d - continue current dump',10,0 |
2143 | 2145 | ||
2144 | aCalc db 2,'?',0 |
2146 | aCalc db 2,'?',0 |
2145 | CalcHelp db 'Calculate value of expression',10 |
2147 | CalcHelp db 'Calculate value of expression',10 |
2146 | CalcSyntax db 'Usage: ? |
2148 | CalcSyntax db 'Usage: ? |
2147 | 2149 | ||
2148 | aUnassemble db 2,'u',0 |
2150 | aUnassemble db 2,'u',0 |
2149 | UnassembleHelp db 'Unassemble',10 |
2151 | UnassembleHelp db 'Unassemble',10 |
2150 | UnassembleSyntax db 'Usage: u |
2152 | UnassembleSyntax db 'Usage: u |
2151 | db ' or: u - continue current unassemble screen',10,0 |
2153 | db ' or: u - continue current unassemble screen',10,0 |
2152 | 2154 | ||
2153 | aReg db 2,'r',0 |
2155 | aReg db 2,'r',0 |
2154 | RHelp db 'Set register value',10 |
2156 | RHelp db 'Set register value',10 |
2155 | RSyntax db 'Usage: r |
2157 | RSyntax db 'Usage: r |
2156 | db ' or: r |
2158 | db ' or: r |
2157 | 2159 | ||
2158 | aBp db 3,'bp',0 |
2160 | aBp db 3,'bp',0 |
2159 | BpHelp db 'set BreakPoint on execution',10 |
2161 | BpHelp db 'set BreakPoint on execution',10 |
2160 | BpSyntax db 'Usage: bp |
2162 | BpSyntax db 'Usage: bp |
2161 | 2163 | ||
2162 | aBpm db 4,'bpm',0 |
2164 | aBpm db 4,'bpm',0 |
2163 | aBpmb db 5,'bpmb',0 |
2165 | aBpmb db 5,'bpmb',0 |
2164 | aBpmw db 5,'bpmw',0 |
2166 | aBpmw db 5,'bpmw',0 |
2165 | aBpmd db 5,'bpmd',0 |
2167 | aBpmd db 5,'bpmd',0 |
2166 | BpmHelp db 'set BreakPoint on Memory access',10 |
2168 | BpmHelp db 'set BreakPoint on Memory access',10 |
2167 | db 'Maximum 4 breakpoints of this type are allowed',10 |
2169 | db 'Maximum 4 breakpoints of this type are allowed',10 |
2168 | db 'Note that for this breaks debugger is activated after access',10 |
2170 | db 'Note that for this breaks debugger is activated after access',10 |
2169 | BpmSyntax db 'Usage: bpmb [w] |
2171 | BpmSyntax db 'Usage: bpmb [w] |
2170 | db ' bpmw [w] |
2172 | db ' bpmw [w] |
2171 | db ' bpmd [w] |
2173 | db ' bpmd [w] |
2172 | db ' bpm is synonym for bpmd',10 |
2174 | db ' bpm is synonym for bpmd',10 |
2173 | db '"w" means break only on writes (default is on read/write)',10,0 |
2175 | db '"w" means break only on writes (default is on read/write)',10,0 |
2174 | 2176 | ||
2175 | aBl db 3,'bl',0 |
2177 | aBl db 3,'bl',0 |
2176 | BlHelp db 'Breakpoint List',10 |
2178 | BlHelp db 'Breakpoint List',10 |
2177 | BlSyntax db 'Usage: bl - list all breakpoints',10 |
2179 | BlSyntax db 'Usage: bl - list all breakpoints',10 |
2178 | db ' bl |
2180 | db ' bl |
2179 | 2181 | ||
2180 | aBc db 3,'bc',0 |
2182 | aBc db 3,'bc',0 |
2181 | BcHelp db 'Breakpoint Clear',10 |
2183 | BcHelp db 'Breakpoint Clear',10 |
2182 | BcSyntax db 'Usage: bc |
2184 | BcSyntax db 'Usage: bc |
2183 | db 'Examples: bc 2',10 |
2185 | db 'Examples: bc 2',10 |
2184 | db ' bc 1 3 4 A',10,0 |
2186 | db ' bc 1 3 4 A',10,0 |
2185 | 2187 | ||
2186 | aBd db 3,'bd',0 |
2188 | aBd db 3,'bd',0 |
2187 | BdHelp db 'Breakpoint Disable',10 |
2189 | BdHelp db 'Breakpoint Disable',10 |
2188 | BdSyntax db 'Usage: bd |
2190 | BdSyntax db 'Usage: bd |
2189 | db 'Examples: bd 2',10 |
2191 | db 'Examples: bd 2',10 |
2190 | db ' bd 1 3 4 A',10,0 |
2192 | db ' bd 1 3 4 A',10,0 |
2191 | 2193 | ||
2192 | aBe db 3,'be',0 |
2194 | aBe db 3,'be',0 |
2193 | BeHelp db 'Breakpoint Enable',10 |
2195 | BeHelp db 'Breakpoint Enable',10 |
2194 | BeSyntax db 'Usage: be |
2196 | BeSyntax db 'Usage: be |
2195 | db 'Examples: be 2',10 |
2197 | db 'Examples: be 2',10 |
2196 | db ' be 1 3 4 A',10,0 |
2198 | db ' be 1 3 4 A',10,0 |
2197 | 2199 | ||
2198 | aUnpack db 7,'unpack',0 |
2200 | aUnpack db 7,'unpack',0 |
2199 | UnpackHelp db 'Try to bypass unpacker code',10 |
2201 | UnpackHelp db 'Try to bypass unpacker code',10 |
2200 | UnpackSyntax db 'Usage: unpack',10,0 |
2202 | UnpackSyntax db 'Usage: unpack',10,0 |
2201 | 2203 | ||
2202 | aLoadSymbols db 13,'load-symbols',0 |
2204 | aLoadSymbols db 13,'load-symbols',0 |
2203 | LoadSymbolsHelp db 'Load symbolic information for executable',10 |
2205 | LoadSymbolsHelp db 'Load symbolic information for executable',10 |
2204 | LoadSymbolsSyntax db 'Usage: load-symbols |
2206 | LoadSymbolsSyntax db 'Usage: load-symbols |
2205 | 2207 | ||
2206 | aUnknownCommand db 'Unknown command',10,0 |
2208 | aUnknownCommand db 'Unknown command',10,0 |
2207 | 2209 | ||
2208 | ;----------------------------------------------------------------------------- |
2210 | ;----------------------------------------------------------------------------- |
2209 | ; Error messages |
2211 | ; Error messages |
2210 | 2212 | ||
2211 | load_err_msg db 'Cannot load program. ',0 |
2213 | load_err_msg db 'Cannot load program. ',0 |
2212 | unk_err_msg db 'Unknown error code -%4X',10,0 |
2214 | unk_err_msg db 'Unknown error code -%4X',10,0 |
2213 | aCannotLoadFile db 'Cannot load file. ',0 |
2215 | aCannotLoadFile db 'Cannot load file. ',0 |
2214 | unk_err_msg2 db 'Unknown error code %4X.',10,0 |
2216 | unk_err_msg2 db 'Unknown error code %4X.',10,0 |
2215 | load_err_msgs: |
2217 | load_err_msgs: |
2216 | dd .1, 0, .3, 0, .5, .6, 0, 0, .9, .A, 0, 0, 0, 0, 0, 0 |
2218 | dd .1, 0, .3, 0, .5, .6, 0, 0, .9, .A, 0, 0, 0, 0, 0, 0 |
2217 | dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, .1E, .1F, .20 |
2219 | dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, .1E, .1F, .20 |
2218 | .1 db 'HD undefined.',10,0 |
2220 | .1 db 'HD undefined.',10,0 |
2219 | .3 db 'Unknown FS.',10,0 |
2221 | .3 db 'Unknown FS.',10,0 |
2220 | .5 db 'File not found.',10,0 |
2222 | .5 db 'File not found.',10,0 |
2221 | .6 db 'Unexpected EOF.',10,0 |
2223 | .6 db 'Unexpected EOF.',10,0 |
2222 | .9 db 'FAT table corrupted.',10,0 |
2224 | .9 db 'FAT table corrupted.',10,0 |
2223 | .A db 'Access denied.',10,0 |
2225 | .A db 'Access denied.',10,0 |
2224 | .1E db 'No memory.',10,0 |
2226 | .1E db 'No memory.',10,0 |
2225 | .1F db 'Not Menuet/Kolibri executable.',10,0 |
2227 | .1F db 'Not Menuet/Kolibri executable.',10,0 |
2226 | .20 db 'Too many processes.',10,0 |
2228 | .20 db 'Too many processes.',10,0 |
2227 | load_succ_msg db 'Program loaded successfully! PID=%4X. Use "g" to run.',10,0 |
2229 | load_succ_msg db 'Program loaded successfully! PID=%4X. Use "g" to run.',10,0 |
2228 | need_debuggee db 'No program loaded. Use "load" command.',10,0 |
2230 | need_debuggee db 'No program loaded. Use "load" command.',10,0 |
2229 | aAlreadyLoaded db 'Program is already loaded. Use "terminate" or "detach" commands',10,0 |
2231 | aAlreadyLoaded db 'Program is already loaded. Use "terminate" or "detach" commands',10,0 |
2230 | terminated_msg db 'Program terminated.',10,0 |
2232 | terminated_msg db 'Program terminated.',10,0 |
2231 | aException db 'Debugged program caused an exception %2X. ', 0 |
2233 | aException db 'Debugged program caused an exception %2X. ', 0 |
2232 | msg_fault_sel dd aDivide, aDebug, aNonMask, aUndefined, aOverflow |
2234 | msg_fault_sel dd aDivide, aDebug, aNonMask, aUndefined, aOverflow |
2233 | dd aBounds, aInvalid, aCoProcessorNA, aDoubleFault |
2235 | dd aBounds, aInvalid, aCoProcessorNA, aDoubleFault |
2234 | dd aUndefined, aInvalidTSS, aSegment, aStack |
2236 | dd aUndefined, aInvalidTSS, aSegment, aStack |
2235 | dd aProtection, aPageFault, aUndefined, aCoProcessor |
2237 | dd aProtection, aPageFault, aUndefined, aCoProcessor |
2236 | aDivide db '(Divide error)',10,0 |
2238 | aDivide db '(Divide error)',10,0 |
2237 | aDebug db '(Single-step/debug exception)',10,0 |
2239 | aDebug db '(Single-step/debug exception)',10,0 |
2238 | aNonMask db '(Nonmaskable interrupt)',10,0 |
2240 | aNonMask db '(Nonmaskable interrupt)',10,0 |
2239 | aOverflow db '(Overflow)',10,0 |
2241 | aOverflow db '(Overflow)',10,0 |
2240 | aBounds db '(Bounds check)',10,0 |
2242 | aBounds db '(Bounds check)',10,0 |
2241 | aInvalid db '(Invalid opcode)',10,0 |
2243 | aInvalid db '(Invalid opcode)',10,0 |
2242 | aCoProcessorNA db '(Coprocessor not available)',10,0 |
2244 | aCoProcessorNA db '(Coprocessor not available)',10,0 |
2243 | aDoubleFault db '(Double fault)',10,0 |
2245 | aDoubleFault db '(Double fault)',10,0 |
2244 | aUndefined db '(Undefined fault)',10,0 |
2246 | aUndefined db '(Undefined fault)',10,0 |
2245 | aInvalidTSS db '(Invalid TSS)',10,0 |
2247 | aInvalidTSS db '(Invalid TSS)',10,0 |
2246 | aSegment db '(Segment not present)',10,0 |
2248 | aSegment db '(Segment not present)',10,0 |
2247 | aStack db '(Stack fault)',10,0 |
2249 | aStack db '(Stack fault)',10,0 |
2248 | aProtection db '(General protection fault)',10,0 |
2250 | aProtection db '(General protection fault)',10,0 |
2249 | aPageFault db '(Page fault)',10,0 |
2251 | aPageFault db '(Page fault)',10,0 |
2250 | aCoProcessor db '(Coprocessor error)',10,0 |
2252 | aCoProcessor db '(Coprocessor error)',10,0 |
2251 | aSuspended db 'Suspended',10,0 |
2253 | aSuspended db 'Suspended',10,0 |
2252 | aContinued db 'Continuing',10,0 |
2254 | aContinued db 'Continuing',10,0 |
2253 | aRunningErr db 'Program is running',10,0 |
2255 | aRunningErr db 'Program is running',10,0 |
2254 | read_mem_err db 'ERROR: cannot read process memory!!!',10,0 |
2256 | read_mem_err db 'ERROR: cannot read process memory!!!',10,0 |
2255 | aBreakpointLimitExceeded db 'Breakpoint limit exceeded',10,0 |
2257 | aBreakpointLimitExceeded db 'Breakpoint limit exceeded',10,0 |
2256 | aBreakErr db 'Cannot activate breakpoint, it will be disabled',10,0 |
2258 | aBreakErr db 'Cannot activate breakpoint, it will be disabled',10,0 |
2257 | aDuplicateBreakpoint db 'Duplicate breakpoint',10,0 |
2259 | aDuplicateBreakpoint db 'Duplicate breakpoint',10,0 |
2258 | aInvalidBreak db 'Invalid breakpoint number',10,0 |
2260 | aInvalidBreak db 'Invalid breakpoint number',10,0 |
2259 | OnBeErrMsg db 'There is already enabled breakpoint on this address',10,0 |
2261 | OnBeErrMsg db 'There is already enabled breakpoint on this address',10,0 |
2260 | aBreakNum db '%2X: at %8X',0 |
2262 | aBreakNum db '%2X: at %8X',0 |
2261 | aMemBreak1 db '%2X: on ',0 |
2263 | aMemBreak1 db '%2X: on ',0 |
2262 | aMemBreak2 db 'read from ',0 |
2264 | aMemBreak2 db 'read from ',0 |
2263 | aMemBreak3 db 'access of ',0 |
2265 | aMemBreak3 db 'access of ',0 |
2264 | aMemBreak4 db 'byte',0 |
2266 | aMemBreak4 db 'byte',0 |
2265 | aMemBreak5 db 'word',0 |
2267 | aMemBreak5 db 'word',0 |
2266 | aMemBreak6 db 'dword',0 |
2268 | aMemBreak6 db 'dword',0 |
2267 | aMemBreak7 db ' at %8X',0 |
2269 | aMemBreak7 db ' at %8X',0 |
2268 | aOneShot db ', one-shot',0 |
2270 | aOneShot db ', one-shot',0 |
2269 | aDisabled db ', disabled',0 |
2271 | aDisabled db ', disabled',0 |
2270 | aBreakStop db 'Breakpoint #%2X',10,0 |
2272 | aBreakStop db 'Breakpoint #%2X',10,0 |
2271 | aUserBreak db 'int3 command at %8X',10,0 |
2273 | aUserBreak db 'int3 command at %8X',10,0 |
2272 | ;dbgmsg_str db 'Debug message for process %4X.',10,0 |
2274 | ;dbgmsg_str db 'Debug message for process %4X.',10,0 |
2273 | aInvAddr db 'Invalid address',10,0 |
2275 | aInvAddr db 'Invalid address',10,0 |
2274 | NoPrgLoaded_str db 'No program loaded' |
2276 | NoPrgLoaded_str db 'No program loaded' |
2275 | NoPrgLoaded_len = $ - NoPrgLoaded_str |
2277 | NoPrgLoaded_len = $ - NoPrgLoaded_str |
2276 | aRunning db 'Running' |
2278 | aRunning db 'Running' |
2277 | aPaused db 'Paused' |
2279 | aPaused db 'Paused' |
2278 | 2280 | ||
2279 | aFPU db '[ FPU ]' |
2281 | aFPU db '[ FPU ]' |
2280 | aMMX db '[ MMX ]' |
2282 | aMMX db '[ MMX ]' |
2281 | aSSE db '[SSE32]' |
2283 | aSSE db '[SSE32]' |
2282 | aSSE2 db '[SSE64]' |
2284 | aSSE2 db '[SSE64]' |
2283 | aMMX128 db '[MMX128]' |
2285 | aMMX128 db '[MMX128]' |
2284 | 2286 | ||
2285 | aAVX db '[ AVX ]' |
2287 | aAVX db '[ AVX ]' |
2286 | aMSR db '[ MSR ]' |
2288 | aMSR db '[ MSR ]' |
2287 | aPoint db 0x1C |
2289 | aPoint db 0x1C |
2288 | aMinus db '-' |
2290 | aMinus db '-' |
2289 | aColon db ':' |
2291 | aColon db ':' |
2290 | aSpace db ' ' |
2292 | aSpace db ' ' |
2291 | aQuests db '??' |
2293 | aQuests db '??' |
2292 | aDots db '...' |
2294 | aDots db '...' |
2293 | aParseError db 'Parse error',10,0 |
2295 | aParseError db 'Parse error',10,0 |
2294 | aDivByZero db 'Division by 0',10,0 |
2296 | aDivByZero db 'Division by 0',10,0 |
2295 | calc_string db '%8X',10,0 |
2297 | calc_string db '%8X',10,0 |
2296 | aNoMemory db 'No memory',10,0 |
2298 | aNoMemory db 'No memory',10,0 |
2297 | aSymbolsLoaded db 'Symbols loaded',10,0 |
2299 | aSymbolsLoaded db 'Symbols loaded',10,0 |
2298 | aUnaligned db 'Unaligned address',10,0 |
2300 | aUnaligned db 'Unaligned address',10,0 |
2299 | aEnabledBreakErr db 'Enabled breakpoints are not allowed',10,0 |
2301 | aEnabledBreakErr db 'Enabled breakpoints are not allowed',10,0 |
2300 | aInterrupted db 'Interrupted',10,0 |
2302 | aInterrupted db 'Interrupted',10,0 |
2301 | aUnpacked db 'Unpacked successful!',10,0 |
2303 | aUnpacked db 'Unpacked successful!',10,0 |
2302 | aPacked1 db 'Program is probably packed with ',0 |
2304 | aPacked1 db 'Program is probably packed with ',0 |
2303 | aPacked2 db '.',10,'Try to unpack automatically? [y/n]: ',0 |
2305 | aPacked2 db '.',10,'Try to unpack automatically? [y/n]: ',0 |
2304 | aY_str db 'y',10,0 |
2306 | aY_str db 'y',10,0 |
2305 | aN_str db 'n',10,0 |
2307 | aN_str db 'n',10,0 |
2306 | mxp_nrv_name db 'mxp_nrv',0 |
2308 | mxp_nrv_name db 'mxp_nrv',0 |
2307 | mxp_name db 'mxp',0 |
2309 | mxp_name db 'mxp',0 |
2308 | mxp_lzo_name db 'mxp_lzo',0 |
2310 | mxp_lzo_name db 'mxp_lzo',0 |
2309 | mtappack_name db 'mtappack',0 |
2311 | mtappack_name db 'mtappack',0 |
2310 | flags db 'CPAZSDO' |
2312 | flags db 'CPAZSDO' |
2311 | flags_bits db 0,2,4,6,7,10,11 |
2313 | flags_bits db 0,2,4,6,7,10,11 |
2312 | 2314 | ||
2313 | ;----------------------------------------------------------------------------- |
2315 | ;----------------------------------------------------------------------------- |
2314 | ; Registers strings |
2316 | ; Registers strings |
2315 | 2317 | ||
2316 | regs_strs: |
2318 | regs_strs: |
2317 | db 'EAX=' |
2319 | db 'EAX=' |
2318 | db 'EBX=' |
2320 | db 'EBX=' |
2319 | db 'ECX=' |
2321 | db 'ECX=' |
2320 | db 'EDX=' |
2322 | db 'EDX=' |
2321 | db 'ESI=' |
2323 | db 'ESI=' |
2322 | db 'EDI=' |
2324 | db 'EDI=' |
2323 | db 'EBP=' |
2325 | db 'EBP=' |
2324 | db 'ESP=' |
2326 | db 'ESP=' |
2325 | db 'EIP=' |
2327 | db 'EIP=' |
2326 | db 'EFLAGS=' |
2328 | db 'EFLAGS=' |
2327 | 2329 | ||
2328 | sse_strs: |
2330 | sse_strs: |
2329 | db '-XMM0-' |
2331 | db '-XMM0-' |
2330 | db '-XMM1-' |
2332 | db '-XMM1-' |
2331 | db '-XMM2-' |
2333 | db '-XMM2-' |
2332 | db '-XMM3-' |
2334 | db '-XMM3-' |
2333 | db '-XMM4-' |
2335 | db '-XMM4-' |
2334 | db '-XMM5-' |
2336 | db '-XMM5-' |
2335 | db '-XMM6-' |
2337 | db '-XMM6-' |
2336 | db '-XMM7-' |
2338 | db '-XMM7-' |
2337 | avx_strs: |
2339 | avx_strs: |
2338 | db '-YMM0-' |
2340 | db '-YMM0-' |
2339 | db '-YMM1-' |
2341 | db '-YMM1-' |
2340 | db '-YMM2-' |
2342 | db '-YMM2-' |
2341 | db '-YMM3-' |
2343 | db '-YMM3-' |
2342 | db '-YMM4-' |
2344 | db '-YMM4-' |
2343 | db '-YMM5-' |
2345 | db '-YMM5-' |
2344 | db '-YMM6-' |
2346 | db '-YMM6-' |
2345 | db '-YMM7-' |
2347 | db '-YMM7-' |
2346 | 2348 | ||
2347 | align 4 |
2349 | align 4 |
2348 | n_digits dd 10000000 |
2350 | n_digits dd 10000000 |
2349 | 2351 | ||
2350 | btn2_tab dd aFPU |
2352 | btn2_tab dd aFPU |
2351 | dd aMMX |
2353 | dd aMMX |
2352 | btn3_tab dd aSSE2 |
2354 | btn3_tab dd aSSE2 |
2353 | dd aMMX128 |
2355 | dd aMMX128 |
2354 | dd aSSE |
2356 | dd aSSE |
2355 | 2357 | ||
2356 | reg_mode db 1 |
2358 | reg_mode db 1 |
2357 | 2359 | ||
2358 | 2360 | ||
2359 | include 'disasm_tbl.inc' |
2361 | include 'disasm_tbl.inc' |
2360 | 2362 | ||
2361 | reg_table: |
2363 | reg_table: |
2362 | db 2,'al',0 |
2364 | db 2,'al',0 |
2363 | db 2,'cl',1 |
2365 | db 2,'cl',1 |
2364 | db 2,'dl',2 |
2366 | db 2,'dl',2 |
2365 | db 2,'bl',3 |
2367 | db 2,'bl',3 |
2366 | db 2,'ah',4 |
2368 | db 2,'ah',4 |
2367 | db 2,'ch',5 |
2369 | db 2,'ch',5 |
2368 | db 2,'dh',6 |
2370 | db 2,'dh',6 |
2369 | db 2,'bh',7 |
2371 | db 2,'bh',7 |
2370 | db 2,'ax',8 |
2372 | db 2,'ax',8 |
2371 | db 2,'cx',9 |
2373 | db 2,'cx',9 |
2372 | db 2,'dx',10 |
2374 | db 2,'dx',10 |
2373 | db 2,'bx',11 |
2375 | db 2,'bx',11 |
2374 | db 2,'sp',12 |
2376 | db 2,'sp',12 |
2375 | db 2,'bp',13 |
2377 | db 2,'bp',13 |
2376 | db 2,'si',14 |
2378 | db 2,'si',14 |
2377 | db 2,'di',15 |
2379 | db 2,'di',15 |
2378 | db 3,'eax',16 |
2380 | db 3,'eax',16 |
2379 | db 3,'ecx',17 |
2381 | db 3,'ecx',17 |
2380 | db 3,'edx',18 |
2382 | db 3,'edx',18 |
2381 | db 3,'ebx',19 |
2383 | db 3,'ebx',19 |
2382 | db 3,'esp',20 |
2384 | db 3,'esp',20 |
2383 | db 3,'ebp',21 |
2385 | db 3,'ebp',21 |
2384 | db 3,'esi',22 |
2386 | db 3,'esi',22 |
2385 | db 3,'edi',23 |
2387 | db 3,'edi',23 |
2386 | db 3,'eip',24 |
2388 | db 3,'eip',24 |
2387 | db 0 |
2389 | db 0 |
2388 | 2390 | ||
2389 | IncludeIGlobals |
2391 | IncludeIGlobals |
2390 | 2392 | ||
2391 | fn70_read_block: |
2393 | fn70_read_block: |
2392 | dd 0 |
2394 | dd 0 |
2393 | dq 0 |
2395 | dq 0 |
2394 | dd ? |
2396 | dd ? |
2395 | dd ? |
2397 | dd ? |
2396 | db 0 |
2398 | db 0 |
2397 | dd ? |
2399 | dd ? |
2398 | 2400 | ||
2399 | fn70_attr_block: |
2401 | fn70_attr_block: |
2400 | dd 5 |
2402 | dd 5 |
2401 | dd 0,0,0 |
2403 | dd 0,0,0 |
2402 | dd fileattr |
2404 | dd fileattr |
2403 | db 0 |
2405 | db 0 |
2404 | dd ? |
2406 | dd ? |
2405 | 2407 | ||
2406 | fn70_load_block: |
2408 | fn70_load_block: |
2407 | dd 7 |
2409 | dd 7 |
2408 | dd 1 |
2410 | dd 1 |
2409 | load_params dd 0 |
2411 | load_params dd 0 |
2410 | dd 0 |
2412 | dd 0 |
2411 | dd 0 |
2413 | dd 0 |
2412 | i_end: |
2414 | i_end: |
2413 | loadname: |
2415 | loadname: |
2414 | db 0 |
2416 | db 0 |
2415 | rb 255 |
2417 | rb 255 |
2416 | 2418 | ||
2417 | symbolsfile rb 260 |
2419 | symbolsfile rb 260 |
2418 | 2420 | ||
2419 | prgname_ptr dd ? |
2421 | prgname_ptr dd ? |
2420 | prgname_len dd ? |
2422 | prgname_len dd ? |
2421 | 2423 | ||
2422 | IncludeUGlobals |
2424 | IncludeUGlobals |
2423 | 2425 | ||
2424 | align 4 |
2426 | align 4 |
2425 | debuggee_pid dd ? |
2427 | debuggee_pid dd ? |
2426 | dbgwnd dd ? |
2428 | dbgwnd dd ? |
2427 | temp_break dd ? |
2429 | temp_break dd ? |
2428 | 2430 | ||
2429 | 2431 | ||
2430 | fpu_mode db ? |
2432 | fpu_mode db ? |
2431 | sse_mode db ? |
2433 | sse_mode db ? |
2432 | bSuspended db ? |
2434 | bSuspended db ? |
2433 | bAfterGo db ? |
2435 | bAfterGo db ? |
2434 | 2436 | ||
2435 | 2437 | ||
2436 | messages_pos dd ? |
2438 | messages_pos dd ? |
2437 | messages rb messages_height*messages_width |
2439 | messages rb messages_height*messages_width |
2438 | 2440 | ||
2439 | cmdline rb cmdline_width+1 |
2441 | cmdline rb cmdline_width+1 |
2440 | cmdline_len dd ? |
2442 | cmdline_len dd ? |
2441 | cmdline_pos dd ? |
2443 | cmdline_pos dd ? |
2442 | curarg dd ? |
2444 | curarg dd ? |
2443 | 2445 | ||
2444 | cmdline_prev rb cmdline_width+1 |
2446 | cmdline_prev rb cmdline_width+1 |
2445 | 2447 | ||
2446 | was_temp_break db ? |
2448 | was_temp_break db ? |
2447 | symbol_section db ? |
2449 | symbol_section db ? |
2448 | 2450 | ||
2449 | dbgbufsize dd ? |
2451 | dbgbufsize dd ? |
2450 | dbgbuflen dd ? |
2452 | dbgbuflen dd ? |
2451 | dbgbuf rb 256 |
2453 | dbgbuf rb 256 |
2452 | 2454 | ||
2453 | fileattr rb 40 |
2455 | fileattr rb 40 |
2454 | 2456 | ||
2455 | ;keep aligned !!! |
2457 | ;keep aligned !!! |
2456 | ;do not change layout !!! |
2458 | ;do not change layout !!! |
2457 | 2459 | ||
2458 | align 16 |
2460 | align 16 |
2459 | needzerostart: |
2461 | needzerostart: |
2460 | context: |
2462 | context: |
2461 | _eip dd ? |
2463 | _eip dd ? |
2462 | _eflags dd ? |
2464 | _eflags dd ? |
2463 | _eax dd ? |
2465 | _eax dd ? |
2464 | _ecx dd ? |
2466 | _ecx dd ? |
2465 | _edx dd ? |
2467 | _edx dd ? |
2466 | _ebx dd ? |
2468 | _ebx dd ? |
2467 | _esp dd ? |
2469 | _esp dd ? |
2468 | _ebp dd ? |
2470 | _ebp dd ? |
2469 | _esi dd ? |
2471 | _esi dd ? |
2470 | _edi dd ? |
2472 | _edi dd ? |
2471 | 2473 | ||
2472 | _ctx_flags: |
2474 | _ctx_flags: |
2473 | dd ? |
2475 | dd ? |
2474 | dd ? |
2476 | dd ? |
2475 | 2477 | ||
2476 | _sse_flags: |
2478 | _sse_flags: |
2477 | 2479 | ||
2478 | 2480 | ||
2479 | _fcw dw ? |
2481 | _fcw dw ? |
2480 | _fsw dw ? |
2482 | _fsw dw ? |
2481 | _ftw db ? |
2483 | _ftw db ? |
2482 | db ? |
2484 | db ? |
2483 | _fop dw ? |
2485 | _fop dw ? |
2484 | _fpu_ip dd ? |
2486 | _fpu_ip dd ? |
2485 | dw ? |
2487 | dw ? |
2486 | dw ? |
2488 | dw ? |
2487 | 2489 | ||
2488 | dq ? |
2490 | dq ? |
2489 | dq ? |
2491 | dq ? |
2490 | 2492 | ||
2491 | fpu_context: |
2493 | fpu_context: |
2492 | mmx_context: |
2494 | mmx_context: |
2493 | _st0: |
2495 | _st0: |
2494 | _mm0: rq 2 |
2496 | _mm0: rq 2 |
2495 | _st1: |
2497 | _st1: |
2496 | _mm1: rq 2 |
2498 | _mm1: rq 2 |
2497 | _st2: |
2499 | _st2: |
2498 | _mm2: rq 2 |
2500 | _mm2: rq 2 |
2499 | _st3: |
2501 | _st3: |
2500 | _mm3: rq 2 |
2502 | _mm3: rq 2 |
2501 | _st4: |
2503 | _st4: |
2502 | _mm4: rq 2 |
2504 | _mm4: rq 2 |
2503 | _st5: |
2505 | _st5: |
2504 | _mm5: rq 2 |
2506 | _mm5: rq 2 |
2505 | _st6: |
2507 | _st6: |
2506 | _mm6: rq 2 |
2508 | _mm6: rq 2 |
2507 | _st7: |
2509 | _st7: |
2508 | _mm7: rq 2 |
2510 | _mm7: rq 2 |
2509 | 2511 | ||
2510 | sse_context: |
2512 | sse_context: |
2511 | _xmm0 rq 2 |
2513 | _xmm0 rq 2 |
2512 | _xmm1 rq 2 |
2514 | _xmm1 rq 2 |
2513 | _xmm2 rq 2 |
2515 | _xmm2 rq 2 |
2514 | _xmm3 rq 2 |
2516 | _xmm3 rq 2 |
2515 | _xmm4 rq 2 |
2517 | _xmm4 rq 2 |
2516 | _xmm5 rq 2 |
2518 | _xmm5 rq 2 |
2517 | _xmm6 rq 2 |
2519 | _xmm6 rq 2 |
2518 | _xmm7 rq 2 |
2520 | _xmm7 rq 2 |
2519 | ctx_end: |
2521 | ctx_end: |
2520 | 2522 | ||
2521 | oldcontext rb _ctx_flags-context |
2523 | oldcontext rb _ctx_flags-context |
2522 | rb 32 |
2524 | rb 32 |
2523 | 2525 | ||
2524 | oldfpucontext: |
2526 | oldfpucontext: |
2525 | oldmmxcontext: rb sse_context-fpu_context |
2527 | oldmmxcontext: rb sse_context-fpu_context |
2526 | oldssecontext: rb ctx_end-sse_context |
2528 | oldssecontext: rb ctx_end-sse_context |
2527 | 2529 | ||
2528 | if 0 |
2530 | if 0 |
2529 | avx_context: |
2531 | avx_context: |
2530 | _ymm0 dq 4 dup ? |
2532 | _ymm0 dq 4 dup ? |
2531 | _ymm1 dq 4 dup ? |
2533 | _ymm1 dq 4 dup ? |
2532 | _ymm2 dq 4 dup ? |
2534 | _ymm2 dq 4 dup ? |
2533 | _ymm3 dq 4 dup ? |
2535 | _ymm3 dq 4 dup ? |
2534 | _ymm4 dq 4 dup ? |
2536 | _ymm4 dq 4 dup ? |
2535 | _ymm5 dq 4 dup ? |
2537 | _ymm5 dq 4 dup ? |
2536 | _ymm6 dq 4 dup ? |
2538 | _ymm6 dq 4 dup ? |
2537 | _ymm7 dq 4 dup ? |
2539 | _ymm7 dq 4 dup ? |
2538 | oldavxcontext rb $-avx_context |
2540 | oldavxcontext rb $-avx_context |
2539 | end if |
2541 | end if |
2540 | 2542 | ||
2541 | 2543 | ||
2542 | step_num dd ? |
2544 | step_num dd ? |
2543 | proc_num dd ? |
2545 | proc_num dd ? |
2544 | dumpread dd ? |
2546 | dumpread dd ? |
2545 | dumppos dd ? |
2547 | dumppos dd ? |
2546 | dumpdata rb dump_height*10h |
2548 | dumpdata rb dump_height*10h |
2547 | 2549 | ||
2548 | ; breakpoint structure: |
2550 | ; breakpoint structure: |
2549 | ; dword +0: address |
2551 | ; dword +0: address |
2550 | ; byte +4: flags |
2552 | ; byte +4: flags |
2551 | ; bit 0: 1 <=> breakpoint valid |
2553 | ; bit 0: 1 <=> breakpoint valid |
2552 | ; bit 1: 1 <=> breakpoint disabled |
2554 | ; bit 1: 1 <=> breakpoint disabled |
2553 | ; bit 2: 1 <=> one-shot breakpoint |
2555 | ; bit 2: 1 <=> one-shot breakpoint |
2554 | ; bit 3: 1 <=> DRx breakpoint |
2556 | ; bit 3: 1 <=> DRx breakpoint |
2555 | ; byte +5: overwritten byte |
2557 | ; byte +5: overwritten byte |
2556 | ; for DRx breaks: flags + (index shl 6) |
2558 | ; for DRx breaks: flags + (index shl 6) |
2557 | breakpoints_n = 256 |
2559 | breakpoints_n = 256 |
2558 | breakpoints rb breakpoints_n*6 |
2560 | breakpoints rb breakpoints_n*6 |
2559 | drx_break rd 4 |
2561 | drx_break rd 4 |
2560 | 2562 | ||
2561 | disasm_buf_size dd ? |
2563 | disasm_buf_size dd ? |
2562 | 2564 | ||
2563 | symbols dd ? |
2565 | symbols dd ? |
2564 | num_symbols dd ? |
2566 | num_symbols dd ? |
2565 | 2567 | ||
2566 | bReload db ? |
2568 | bReload db ? |
2567 | 2569 | ||
2568 | needzeroend: |
2570 | needzeroend: |
2569 | 2571 | ||
2570 | disasm_buffer rb 256 |
2572 | disasm_buffer rb 256 |
2571 | disasm_start_pos dd ? |
2573 | disasm_start_pos dd ? |
2572 | disasm_cur_pos dd ? |
2574 | disasm_cur_pos dd ? |
2573 | disasm_cur_str dd ? |
2575 | disasm_cur_str dd ? |
2574 | disasm_string rb 256 |
2576 | disasm_string rb 256 |
2575 | 2577 | ||
2576 | thread_info process_information |
2578 | thread_info process_information |
2577 | 2579 | ||
2578 | ;----------------------------------------------------------------------------- |
2580 | ;----------------------------------------------------------------------------- |
2579 | ; Coordinates and sizes for GUI |
2581 | ; Coordinates and sizes for GUI |
2580 | 2582 | ||
2581 | data_x_size_dd dd ?, ? |
2583 | data_x_size_dd dd ?, ? |
2582 | messages_x_size_dd dd ?, ? |
2584 | messages_x_size_dd dd ?, ? |
2583 | registers_x_pos_dd dd ?, ? |
2585 | registers_x_pos_dd dd ?, ? |
2584 | 2586 | ||
2585 | disasm_height_dd dd ? |
2587 | disasm_height_dd dd ? |
2586 | disasm_y_size_dd dd ?, ? |
2588 | disasm_y_size_dd dd ?, ? |
2587 | messages_y_pos_dd dd ?, ? |
2589 | messages_y_pos_dd dd ?, ? |
2588 | cmdline_y_pos_dd dd ?, ? |
2590 | cmdline_y_pos_dd dd ?, ? |
2589 | registers_y_size_dd dd ?, ? |
2591 | registers_y_size_dd dd ?, ? |
2590 | 2592 | ||
2591 | i_param rb 256 |
2593 | i_param rb 256 |
2592 | 2594 | ||
2593 | ; stack |
2595 | ; stack |
2594 | align 400h |
2596 | align 400h |
2595 | rb 400h |
2597 | rb 400h |
2596 | used_mem: |
2598 | used_mem: |
2597 | 2599 | ||
2598 | ; vim: ft=fasm tabstop=4=>=>=>=> |
2600 | ; vim: ft=fasm tabstop=4=>=>=>=> |