Programming

(C++) __asm int 3;

steloflute 2012. 6. 23. 09:56

http://spikez.tistory.com/72


유용한 디버깅 기술 하나

 

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

CodeDefinition
00Divide error
01Debug exception (single-step and hardware debugging)
02NMI interrupt
03Breakpoint
04INTO detected overflow
05BOUND range exceeded
06Invalid opcode
07Coprocessor device not available
08Double fault
0AInvalid Task State Segment (TSS)
0BSegment not present
0CStack fault
0DGeneral protection fault (GPF)
0EPage fault


'Programming' 카테고리의 다른 글

Original 1964 Dartmouth BASIC Manual (PDF)  (0) 2012.06.25
Win32 API help file  (0) 2012.06.23
(JVM) Scala vs. Groovy vs. Clojure  (0) 2012.06.21
Introduction to JavaScript  (0) 2012.06.20
C preprocessor tricks  (0) 2012.06.20