2014-01-07 1 views
4

WinDbg를 사용하여 프로그램에서 액세스 위반을 디버깅하려고합니다. 디버거는 올바르게 액세스 위반을 잡는다 : 나는 (발신자의 데이터 구조를 검사하는 오류있는 기능에서, 예를 들어 단계) 디버깅을 계속할 수 있도록Windbg가 액세스 위반을 극복하기 위해 변경하는 레지스터를 무시합니다.

(2604.1e74): Access violation - code c0000005 (first chance) 
First chance exceptions are reported before any exception handling. 
This exception may be expected and handled. 
eax=0808e7fb ebx=007b39f8 ecx=000116e7 edx=7ead8618 esi=00000000 edi=00000000 
eip=006ed845 esp=0818ff24 ebp=0818ff30 iopl=0   nv up ei pl nz na pe nc 
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b    efl=00010206 
image00400000!t_control.is_focused+0x15: 
006ed845 8b8051070000 mov  eax,dword ptr [eax+751h] ds:002b:0808ef4c=???????? 

내가 액세스 위반 "건너 뛰기"할. 그래서 예를 현재의 코드를 읽을 수있는 메모리를 가리 키도록 나는 eax을 변경, 그래서 수행

0:025> r eax=eip 

이 다음 검증을 나타 내기 위해 보인다, 잘 작동하는 것 같다 :

0:025> r 
eax=006ed845 ebx=007b39f8 ecx=000116e7 edx=7ead8618 esi=00000000 edi=00000000 
eip=006ed845 esp=0818ff24 ebp=0818ff30 iopl=0   nv up ei pl nz na pe nc 
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b    efl=00010206 
image00400000!t_control.is_focused+0x15: 
006ed845 8b8051070000 mov  eax,dword ptr [eax+751h] ds:002b:006edf96=012c0000 

그러나, 최대한 빨리 프로그램을 단계 (또는 계속)하려고, 그것은 레지스터는 전혀 변경하지 않은 경우와 완전히 같은 방법으로 다시 고장 :

0:025> p 
(2604.1e74): Access violation - code c0000005 (first chance) 
First chance exceptions are reported before any exception handling. 
This exception may be expected and handled. 
eax=0808e7fb ebx=007b39f8 ecx=000116e7 edx=7ead8618 esi=00000000 edi=00000000 
eip=006ed845 esp=0818ff24 ebp=0818ff30 iopl=0   nv up ei pl nz na pe nc 
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b    efl=00010206 
image00400000!t_control.is_focused+0x15: 
006ed845 8b8051070000 mov  eax,dword ptr [eax+751h] ds:002b:0808ef4c=???????? 

내가 뭐하는 거지 WR 그거야? 합니다 (디버그 대상은 WinDbg는 X86에서 실행 델파이로 작성된 32 비트 프로그램은 64 비트의 Windows 7 어느 디버,도 WinDbg를가 상승 실행됩니다.)

답변

6

당신은

gh (Go with Exception Handled) 

을 사용해야합니다 eax 등록기를 조작 한 후에 계속하십시오

(2f14.1950): Access violation - code c0000005 (first chance) 
First chance exceptions are reported before any exception handling. 
This exception may be expected and handled. 
eax=00000000 ebx=7efde000 ecx=94a31deb edx=0f709488 esi=0033f99c edi=0033fa80 
eip=000d1a3f esp=0033f99c ebp=0033fa80 iopl=0   nv up ei pl zr na pe nc 
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b    efl=00010246 
SimpleCrash!wmain+0x3f: 
000d1a3f 8b08   mov  ecx,dword ptr [eax] ds:002b:00000000=???????? 

0:000> r @[email protected] 
0:000> gh 
eax=00000000 ebx=00000000 ecx=00000000 edx=00000000 esi=77882100 edi=778820c0 
eip=7779fcc2 esp=0033f9e8 ebp=0033fa04 iopl=0   nv up ei pl zr na pe nc 
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b    efl=00000246 
ntdll!NtTerminateProcess+0x12: 
7779fcc2 83c404   add  esp,4 
+0

와우! 믿을 수 없는; 나는 모든 것을 시도했다고 생각했고, 그것은 간단합니다! 감사. BTW, "이동"이 아닌 단일 단계로 계속 진행할 수있는 방법이 있습니까? 예를 들어 "예외 처리로 예외 표시"부분을 수행 한 다음 "p"를 계속 수행하는 방법이 있습니까? – Mormegil

+0

나는 스테핑 전에 gh에 의해 트리거되는 중단 점을 설정해야한다고 생각합니다. bp/1을 사용하여 "one-shot"중단 점을 만들 수 있습니다 –

관련 문제