__asm int 3;

유용한 디버깅 기술 하나

 

1 __asm int 3;

 

Visual C에서  코드래벨에서 break point를 거는 코드입니다.

DLL에서 디버깅시 loading이 되기 전이면 tool에서 break point를 잡기가 까다롭습니다.

 

이럴때 break point를 원하는 코드에 "__asm int 3;" 이렇게 입력을 해놓으면,

실행시 이 시점에서 break point가 걸리게됩니다.

 

이와 비슷하게 Intel에서 정의해놓은 exception용 interrupt 코드들이 있어 추가합니다.

출처는 당근 MSDN이구요.

 

Intel-Defined Exceptions and Interrupts

Code Definition
00 Divide error
01 Debug exception (single-step and hardware debugging)
02 NMI interrupt
03 Breakpoint
04 INTO detected overflow
05 BOUND range exceeded
06 Invalid opcode
07 Coprocessor device not available
08 Double fault
0A Invalid Task State Segment (TSS)
0B Segment not present
0C Stack fault
0D General protection fault (GPF)
0E Page fault


출저:  http://spikez.tistory.com/72   

이 글을 공유하기

댓글

Designed by JB FACTORY