assertions and debuggers

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Fri Sep 21 15:48:22 AEST 1990


In article <10835 at rama.UUCP> lvw at rama.UUCP (Lyndon VanWagner) writes:
> On the VAX, we have been able to redefine the assert macro to place
> us into the VMS debugger at the point of error, rather than just 
> exiting the program.
  [ and in UNIX? ]

Why not just change the exit() to an abort()? Or, if you really want to
hard-code dumping the user into the debugger: switch(fork()) { case -1:
send some intelligent error message and die; case 0: abort(); default:
wait((int *) 0); execlp("dbx","dbx",argv[0],(char *) 0); die horribly; }
You should put this into a function so that the code isn't replicated at
each assert().

(Side note: I typed that in without having to think about it. How long
did your VMS solution take? Followups to alt.religion.computers.)

---Dan



More information about the Comp.lang.c mailing list