[comp.unix.questions] assertions and debuggers

lvw@rama.UUCP (Lyndon VanWagner) (09/08/90)

We have recently started using assertions in our C code.
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.

My question is this.  Is it possible to do a similiar thing to Unix C
and dbx?  Any help in this area would be appreciated as we still have
the VMS die-hards telling us how terrible Unix is and how great VMS
is instead.  Also, it would just help in general code development.

Thanks.
-- 
-----------------------------------------------------------------------------
Lyndon C. VanWagner		UUCP:	lvw@sc.harris.com
Software Engineer		-or-	...!rochester!tropix!rama!lvw
Technical Support Group		PHONE:	(716) 924-9303 ext. 226
Harris Corporation, Scientific Calculations Division, Fishers, NY
-----------------------------------------------------------------------------
Cornfield's Law (paraphrased):
	Before anything can change, everyone must agree.
	By the time that happens its a different problem.
-----------------------------------------------------------------------------

gwyn@smoke.BRL.MIL (Doug Gwyn) (09/22/90)

In article <10834@rama.UUCP> lvw@rama.UUCP (Lyndon VanWagner) writes:
>We have recently started using assertions in our C code.
>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.
>My question is this.  Is it possible to do a similiar thing to Unix C
>and dbx?

In general, you would have to run the process from within dbx, due
to the hierarchical manner in which UNIX processes are interrelated.
Given that, it is easy enough to have the assert() macro invoke a
run-time function in which you can plant a breakpoint before starting
the process.  In fact, my public-domain implementation of assert()
would be suitable for that.

rhl@grendel.Princeton.EDU (Robert Lupton (the Good)) (09/23/90)

(I haven't used VMS for about 3 years, but this used to be true anyway...)

Perhaps the real point of this discussion has got lost. Under VMS you
don't do post-mortem debugging as there is no "core" file -- you get
straight into the debugger if you compiled and linked with it. You have
to make sure that you say run/nodebug or you'll satrt in the debugger,
and I'm not sure if this can be done with foreign commands. 

Under unix you call abort() (or whatever) and get a coredump; then you
start up the debugger and see where you were.

The functionality is similar (except that you can't attempt to clean up
and continue). 


				Robert

src@scuzzy.in-berlin.de (Heiko Blume) (09/26/90)

rhl@grendel.Princeton.EDU (Robert Lupton (the Good)) writes:

>(I haven't used VMS for about 3 years, but this used to be true anyway...)
[...]
>The functionality is similar (except that you can't attempt to clean up
>and continue). 

apart from the little difference that you can easily debug spawned 
programs (if cc -g'ed) because the debugger (or part of?) is linked into
the executable. i saw this on DEC windows or what its called - really neat!
lotsa debugger windows popping up and vanishing. try this with sdb.
-- 
Heiko Blume c/o Diakite   blume@scuzzy.in-berlin.de   FAX   (+49 30) 882 50 65
Kottbusser Damm 28        blume@scuzzy.mbx.sub.org    VOICE (+49 30) 691 88 93
D-1000 Berlin 61          blume@netmbx.de             TELEX 184174 intro d
scuzzy Any ACU,e 19200 6919520 ogin:--ogin: nuucp ssword: nuucp