[mercury-users] Debug prints get optimized away

Michael Day mikeday at yeslogic.com
Tue Feb 21 19:29:46 AEDT 2006


> Alternatively get friendly with the debugger :-).  We generally find
> the debugger is sufficient for finding most faults in Mercury code
> without the need for printf style debugging.  Features of the debugger
> you may want to look at are conditional breakpoints and the printing and
> term browsing facilities.

The other option is to make debug prints semidet and place them in if
tests, like this:

    ( if dbg("message") then MyVar = 0 else error("blah") ),

where dbg always succeeds and thus the else is never called. It's a bit
verbose though; it's easier to add them if you already have lots of if
tests and you can add them to existing conditions.

Michael

-- 
Print XML with Prince!
http://www.princexml.com
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list