[mercury-users] Ever valground a mercury program?

Ondrej Bojar bojar at csse.unimelb.edu.au
Wed May 23 16:13:06 AEST 2007


Hi.

My rotd-2007-03-07 generates executables that make valgrind shout and shout and 
shout. In fact, the main(io,io) does not start in valgrind at all and the 
detstack overflows instead.

Have any of you ever used valgrind on Mercury programs? Are there any special 
caveats?

The reason I want to use valgrind is to debug some of my C code called from Mercury.

Thanks, Ondrej.


==27617== Memcheck, a memory error detector.
==27617== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==27617== Using LibVEX rev 1471, a library for dynamic binary translation.
==27617== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==27617== Using valgrind-3.1.0, a dynamic binary instrumentation framework.
==27617== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==27617== For more details, rerun with: -v
==27617==
==27617== Conditional jump or move depends on uninitialised value(s)
==27617==    at 0x5592C76: GC_push_all_eager (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x55900A8: GC_with_callee_saves_pushed (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x5591899: GC_push_roots (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x5594237: GC_mark_some (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x558CF21: GC_stopped_mark (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x558D169: GC_try_to_collect_inner (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x558FECB: GC_init_inner (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x545C3FB: MR_init_conservative_GC (mercury_wrapper.c:749)
==27617==    by 0x545E809: mercury_runtime_init (mercury_wrapper.c:524)
==27617==    by 0x4202A0: mercury_main (transl_init.c:3107)
==27617==    by 0x3EBF81C783: __libc_start_main (in /lib64/libc-2.4.so)
...
==27617== Conditional jump or move depends on uninitialised value(s)
==27617==    at 0x558DA2E: GC_reclaim_uninit (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x558DC34: GC_reclaim_generic (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x558DE96: GC_reclaim_small_nonempty_block (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x558E0C4: GC_continue_reclaim (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x558D812: GC_allocobj (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x5597404: GC_generic_malloc_inner (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x5597495: GC_generic_malloc (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x559767C: GC_malloc_atomic (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/libgc_prof.so)
==27617==    by 0x4BF0D0B: lexer_module74 (in 
/export/work/people/bojar/opt/mercury-compiler-rotd-2007-03-07-x64/lib/mercury/lib/asm_fast.gc.prof/libmer_std.so)
==27617==    by 0x5441598: MR_call_engine (mercury_engine.c:378)
==27617==    by 0x545BFF9: mercury_runtime_main (mercury_wrapper.c:2119)
==27617==    by 0x4202A5: mercury_main (transl_init.c:3108)

Mercury runtime: memory zone detstack#0 overflowed
This may have been caused by a stack overflow, due to unbounded recursion.
==27617==
==27617== ERROR SUMMARY: 10115 errors from 89 contexts (suppressed: 5 from 1)
==27617== malloc/free: in use at exit: 691,166 bytes in 18 blocks.
==27617== malloc/free: 36 allocs, 18 frees, 1,085,054 bytes allocated.
...



-- 
Ondrej Bojar (mailto:obo at cuni.cz / bojar at ufal.mff.cuni.cz)
http://www.cuni.cz/~obo
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list