[mercury-users] Debug prints get optimized away

Ondrej Bojar obo at cuni.cz
Tue Feb 21 20:07:27 AEDT 2006


Thanks for your tips.

I'll probably use the verbose if version suggested by Michael.
The use of debugger is not imaginable for the problems I'm dealing with 
and I also do not like removing all optimizations from the code.

Doing some experiments in computational linguistics I need to process 
and collect quite big amounts of data. I usually debug the code on a 
tiny sample (in fact there is always very little to debug once the code 
compiles, thanks to Mercury). Tiny data samples work just fine, but then 
suddenly some unexpected crashes come after half an hour or hours 
processing the bigger data.

I also need multithreading to get my results in reasonable time. (I 
tried forking for master-slave processing but this would require wise 
data splitting as the overhead of passing bigger data from master to 
slave and back again almost wastes all the gain from parallel processing.)

For instance an experiment I started yesterday evening 'finished' with 
just this:

/bin/sh: line 1:  4176 Segmentation fault      `pwd`/cooctool 
--corpus=syn2000d --samples=syn2000d.samples.html --min-obs=1 
 >syn2000d.prehled.html

Note that my program was checked and delivered all the expected data on 
a smaller sample. The memory was also (most probably) not exhausted, as 
the machine has 10GB of RAM and as I already succeeded with this 
particular run before, using 0.12.2+asm_fast.gc (compiled 32bit run 
emulated on this 64bit machine) and not the current rots+hlc.gc.par, 
compiled 64bit.

I'm probably pushing mercury to its limits and it takes a *lot* of time 
to eliminate the problems... :-(

O.

Ian MacLarty wrote:
> On Mon, Feb 20, 2006 at 05:03:55PM +0100, Ondrej Bojar wrote:
> 
>>Hi.
>>
>>Is there a way to produce (impure) debugging prints so that the call is 
>>not optimized away?
>>
> 
> 
> Try compiling your program without optimisations (pass "-O0" or "-O-1"
> to mmc).
> 
> 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.
> 
> Ian.
> --------------------------------------------------------------------------
> 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
> --------------------------------------------------------------------------
> 

-- 
Ondrej Bojar (mailto:obo at cuni.cz)
http://www.cuni.cz/~obo
--------------------------------------------------------------------------
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