[Python-Dev] addressing distutils inability to track file dependencies

Jeff Epler jepler@unpythonic.net
Fri, 14 Jun 2002 11:01:22 -0500


On Fri, Jun 14, 2002 at 05:30:47PM +0200, Jack Jansen wrote:
> 
> On Friday, June 14, 2002, at 04:38 , Thomas Heller wrote:
> >I prefer to insert
> >#ifdef _DEBUG
> >    _asm int 3; /* breakpoint */
> >#endif
> >into the problematic sections of my code, and whoops,
> >the MSVC GUI debugger opens just when this code is executed,
> >even if it was started from the command line.
> 
> Ok, MSVC finally scored a point with me, this is nifty:-)

You can "set" a breakpoint this way in x86 Linux too.  Unfortunately,
when this is not run under the debugger, it simply sends a SIGTRAP to
the process.  In theory the standard library could handle SIGTRAP by
invoking the debugger, but 5 minutes fiddling around didn't produce a
very dependable way of doing so.

    (gdb) run
    Starting program: ./a.out 
    a

    Program received signal SIGTRAP, Trace/breakpoint trap.
    main () at bp.c:21
    21          printf("b\n");
    (gdb) cont
    Continuing.
    b

#include <stdio.h>

#define _DEBUG

#ifdef _DEBUG
#if defined(WIN32)
#define BREAKPOINT _asm int 3
#elif defined(__GNUC__) && defined(__i386__)
#define BREAKPOINT __asm__ __volatile__ ("int3")
#else
#warning "BREAKPOINT not defined for this OS / Compiler"
#define BREAKPOINT (void)0
#endif
#else
#define _DEBUG (void)0
#endif

main() {
    printf("a\n");
    BREAKPOINT;
    printf("b\n");
    return 0;
}