This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

| Program-Triggered Breakpoints Submitted by

The other day when I read the Conditional Breakpoints TOTD I remembered something I'd read somewhere regarding interrupt 3. I'm not sure about other OS's, but certainly all Windows debuggers utilise it (unless you have a BIOS setting disabling it or something similar). The difference between this an the other TOTD is that this one appears to work on _all_ compilers, not just MSVC.
Basically, you insert a piece of code, like so, into your program where you want a breakpoint:

    // check for validity
    if (x  24)
    {
      // breakpoint
      _asm
      {
        int 3
      }
    }

Note that this only works if you're running with a debugger and your program was compiled in a "debug mode" (if availible), or else some other int 3 might be called.
Try it out...
Kieren Johnstone

The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.