I have finally found why mtdbg sometimes seems to lose control over the debugged program!

r3675 has broken single-stepping and everything that depends on it.
And, of course, commit message for r3675 has nothing to do with changes in r3675.

git-svn-id: svn://kolibrios.org@4443 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2014-01-13 11:13:05 +00:00
parent 85b2b4bfbe
commit 9820d9190e

View File

@ -882,24 +882,30 @@ CtrlF8:
; Step execution event ; Step execution event
;Here we get [<number>] argument at do step <number> times ;Here we get [<number>] argument at do step <number> times
OnStep: OnStepMultiple:
cmp [bSuspended], 0 cmp [bSuspended], 0
jz .running jz OnStep.running
cmp [step_num], 0 mov [step_num], 1
jg .stepone
mov esi, [curarg] mov esi, [curarg]
cmp esi, 0 test esi, esi
jz .stepone jz .do
cmp byte [esi], 0 cmp byte [esi], 0
jz .stepone jz .do
call get_hex_number call get_hex_number
jc .ret jc .ret
cmp eax, 0 ; check if lesser or equal than 0 cmp eax, 0 ; check if lesser or equal than 0
jle .ret jle .ret
mov [step_num], eax mov [step_num], eax
mov [curarg], 0 .do:
call OnStep
dec [step_num]
jnz .do
.ret:
ret
.stepone: OnStep:
cmp [bSuspended], 0
jz .running
call get_context call get_context
or byte [_eflags+1], 1 ; set TF or byte [_eflags+1], 1 ; set TF
call set_context call set_context
@ -941,15 +947,6 @@ OnStep:
mov [bAfterGo], 2 mov [bAfterGo], 2
@@: @@:
mov eax, [step_num]
dec eax
cmp eax, 0
jle .ret
mov [step_num], eax
jmp .stepone
.ret:
mov [step_num], 0
ret ret
; return address is [ebp-4] ; return address is [ebp-4]
@ -1018,7 +1015,7 @@ OnProceed:
@@: @@:
call get_byte_nobreak call get_byte_nobreak
jc OnStep.stepone jc OnStep
inc esi inc esi
; skip prefixes ; skip prefixes
call is_prefix call is_prefix
@ -1054,14 +1051,14 @@ OnProceed:
; FF /2 = call ; FF /2 = call
.noloop: .noloop:
cmp al, 0xFF cmp al, 0xFF
jnz OnStep.stepone jnz OnStep
call get_byte_nobreak call get_byte_nobreak
jc OnStep.stepone jc OnStep
inc esi inc esi
mov cl, al mov cl, al
and al, 00111000b and al, 00111000b
cmp al, 00010000b cmp al, 00010000b
jnz OnStep.stepone jnz OnStep
; skip instruction ; skip instruction
mov al, cl mov al, cl
and eax, 7 and eax, 7
@ -1085,7 +1082,7 @@ OnProceed:
cmp al, 4 cmp al, 4
jnz @f jnz @f
call get_byte_nobreak call get_byte_nobreak
jc OnStep.stepone jc OnStep
inc esi inc esi
and al, 7 and al, 7
@ -1097,7 +1094,7 @@ OnProceed:
.doit: .doit:
; insert one-shot breakpoint at esi and resume ; insert one-shot breakpoint at esi and resume
call get_byte_nobreak call get_byte_nobreak
jc OnStep.stepone jc OnStep
mov eax, esi mov eax, esi
call find_enabled_breakpoint call find_enabled_breakpoint
jz @f jz @f
@ -2401,7 +2398,7 @@ commands:
db 9 db 9
dd aResume, OnResume, ResumeSyntax, ResumeHelp dd aResume, OnResume, ResumeSyntax, ResumeHelp
db 0Bh db 0Bh
dd aStep, OnStep, StepSyntax, StepHelp dd aStep, OnStepMultiple, StepSyntax, StepHelp
db 0Bh db 0Bh
dd aProceed, OnProceed, ProceedSyntax, ProceedHelp dd aProceed, OnProceed, ProceedSyntax, ProceedHelp
db 0Bh db 0Bh