mercredi 25 mars 2015

My favorite 'interruption' ...

Today, I made by mistake an interesting commit ! In fact, I'm working on a simple command line program and that program is design to process data read from the standard input and for my own convenience I added at the beginning of the main a piece of code that some of my teammate didn't know! So let me introduce to you the well known 'interruption 3'.....

#if defined(WIN32) || defined(WIN64)
  __asm int 3;
#endif


int is the asm instruction you use to generate a software interruption. Under windows the interruption 3 execution will trigger a breakpoint and from the outside you will have the usual popup saying:


click "debug" and select debugger you want use :)

It's a trick I often use when I want to also stop at start-up  or at a fixed code point during a dev phase.