15,10 → 15,10 |
|
;----------------------------------------------------------------------------- |
|
REG_MODE_CPU = 1 |
REG_MODE_MMX = 2 |
REG_MODE_SSE = 3 |
REG_MODE_AVX = 4 |
REG_MODE_CPU equ 1 |
REG_MODE_MMX equ 2 |
REG_MODE_SSE equ 3 |
REG_MODE_AVX equ 4 |
|
;----------------------------------------------------------------------------- |
|
200,9 → 200,16 |
|
; TODO: make it local |
do_reload: |
;push 18 |
;pop eax |
;push 7 |
;pop ebx |
mcall 18, 7 |
mov [dbgwnd], eax |
xchg ecx, eax |
;push 70 |
;pop eax |
;mov ebx, fn70_load_block |
mcall 70, fn70_load_block |
test eax, eax |
jns .load_ok |
229,7 → 236,9 |
.load_ok: |
mov [debuggee_pid], eax |
mov [bSuspended], 1 |
mcall 5, 20 |
mov eax, 5 |
mov ebx, 20 |
int 0x40 |
|
push ecx |
call get_context |
239,6 → 248,9 |
|
; activate debugger window |
pop ecx |
;mov bl, 3 |
;push 18 |
;pop eax |
mcall 18, 3 |
call redraw_title |
call draw_registers.redraw |
375,9 → 387,15 |
mov esi, aPacked2 |
call put_message |
call hide_cursor |
mcall 40, EVM_REDRAW or EVM_KEY or EVM_BUTTON |
;push 40 |
;pop eax |
;push 7 |
;pop ebx |
mcall 40, 7 |
|
.wait: |
;push 10 |
;pop eax |
mcall 10 |
dec eax |
jz .redraw |
392,7 → 410,8 |
jmp .wait |
|
.key: |
mcall 2 |
mov al, 2 |
mcall |
cmp ah, 'y' |
jz .yes |
cmp ah, 'Y' |
405,13 → 424,19 |
jnz .wait |
|
.no: |
mcall 40, EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_DEBUG |
;push 40 |
;pop eax |
;mov ebx, 0x107 |
mcall 40, 0x107 |
call draw_cursor |
mov esi, aN_str |
jmp put_message |
|
.yes: |
mcall 40, EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_DEBUG |
;push 40 |
;pop eax |
;mov ebx, 0x107 |
mcall 40, 0x107 |
call draw_cursor |
mov esi, aY_str |
call put_message |
512,6 → 537,11 |
; Terminate process event |
|
OnTerminate: |
;mov ecx, [debuggee_pid] |
;push 8 |
;pop ebx |
;push 69 |
;pop eax |
mcall 69, 8, [debuggee_pid] |
ret |
;----------------------------------------------------------------------------- |
528,6 → 558,11 |
ret |
|
OnSuspend: |
;mov ecx, [debuggee_pid] |
;push 4 |
;pop ebx |
;push 69 |
;pop eax |
mcall 69, 4, [debuggee_pid] |
call AfterSuspend |
mov esi, aSuspended |
537,6 → 572,11 |
; Resume process event |
|
DoResume: |
;mov ecx, [debuggee_pid] |
;push 5 |
;pop ebx |
;push 69 |
;pop eax |
mcall 69, 5, [debuggee_pid] |
mov [bSuspended], 0 |
ret |
748,9 → 788,9 |
.4: |
call get_dump |
pop eax |
; int3 command generates exception 0x0D, #GP |
; int3 command generates exception 0D, #GP |
push eax |
cmp al, 0x0D |
cmp al, 0Dh |
jnz .notdbg |
; check for 0xCC byte at eip |
push 0 |
896,6 → 936,15 |
|
@@: |
push 0 |
;push 69 |
;pop eax |
;push 6 |
;pop ebx |
;mov ecx, [debuggee_pid] |
;push 3 |
;pop edx |
;mov edi, esp |
;mov esi, [_eip] |
mcall 69, 6, [debuggee_pid], 3, [_eip], esp |
cmp eax, edx |
pop eax |
920,6 → 969,8 |
; return address is [ebp-4] |
.sysenter: |
push 0 |
;push 69 |
;pop eax |
inc edx ; read 4 bytes |
mov esi, [_ebp] |
sub esi, 4 |
1092,6 → 1143,11 |
ret |
|
.nobreak: |
;push 69 |
;pop eax |
;push 6 |
;pop ebx |
;mov ecx, [debuggee_pid] |
xor edx, edx |
push edx |
inc edx |
1342,9 → 1398,14 |
.l1: |
cmp [drx_break+ecx*4], 0 |
jnz .l2 |
;push 69 |
;pop eax |
push ecx |
mov dl, cl |
;mov ecx, [debuggee_pid] |
mov esi, ebp |
;push 9 |
;pop ebx |
mcall 69, 9, [debuggee_pid] |
test eax, eax |
jz .ok |
1614,6 → 1675,14 |
test byte [edi-1], 8 |
jnz .dr |
push esi |
;push 7 |
;pop ebx |
;push 69 |
;pop eax |
;mov ecx, [debuggee_pid] |
;xor edx, edx |
;inc edx |
;mov esi, [edi-5] |
mcall 69, 7, [debuggee_pid], 1, [edi-5] |
pop esi |
|
1624,6 → 1693,11 |
mov dl, [edi] |
shr dl, 6 |
mov dh, 80h |
;push 69 |
;pop eax |
;push 9 |
;pop ebx |
;mov ecx, [debuggee_pid] |
mcall 69, 9, [debuggee_pid] |
ret |
|
1643,9 → 1717,18 |
and byte [edi-1], not 2 |
test byte [edi-1], 8 |
jnz .dr |
;push 6 |
;pop ebx |
;push 69 |
;pop eax |
;mov esi, [edi-5] |
;mov ecx, [debuggee_pid] |
;xor edx, edx |
;inc edx |
mcall 69, 6, [debuggee_pid], 1, [edi-5] |
dec eax |
jnz .err |
;mov al, 69 |
push 0xCC |
mov edi, esp |
inc ebx |
1664,7 → 1747,12 |
ret |
|
.dr: |
;push 9 |
;pop ebx |
;push 69 |
;pop eax |
mov esi, [edi-5] |
;mov ecx, [debuggee_pid] |
mov dl, [edi] |
shr dl, 6 |
mov dh, [edi] |
1763,6 → 1851,8 |
pop esi |
|
@@: |
;push 69 |
;pop eax |
mcall 69 |
test eax, eax |
jz .breakok |
1775,6 → 1865,8 |
|
; now wait for event |
.wait: |
;push 10 |
;pop eax |
mcall 10 |
dec eax |
jz .redraw |
1804,6 → 1896,11 |
call put_message |
pop esi edx |
or dh, 80h |
;push 69 |
;pop eax |
;push 9 |
;pop ebx |
;mov ecx, [debuggee_pid] |
mcall 69, 9, [debuggee_pid] |
cmp esi, aUnpacked |
jnz OnSuspend |
1823,6 → 1920,11 |
call put_message |
pop edx |
or dh, 80h |
;push 69 |
;pop eax |
;push 9 |
;pop ebx |
;mov ecx, [debuggee_pid] |
mcall 69, 9, [debuggee_pid] |
jmp debugmsg |
|
1831,6 → 1933,14 |
push edx |
call get_context |
push eax |
;mov al, 69 |
;mov bl, 6 |
;mov ecx, [debuggee_pid] |
;mov edi, esp |
;push 4 |
;pop edx |
;push 0xC |
;pop esi |
mcall 69, 6, [debuggee_pid], 4, 0xC, esp |
pop eax |
pop edx |