[plt-scheme] valgrind advice / experience?
Hello,
I have a program that occasionally crashes with a SIGSEGV. The program
consists of Scheme code that calls into C code. The C code does not
allocate any memory. I've run valgrind on it, and I'm getting output
like that given at the end of the email.
The "Invalid read of size 4" is almost certainly a point data
structure, which consists of 2 doubles (hence, 4 words). Does anyone
have tips/tricks for turning a (to me, fairly useless) stack trace
from MzScheme's interpreter, as below, into useful tips for where to
look? At the moment I'm suspicious of the FFI. I'll try later to run
just the C code and see if valgrind finds anything there.
Thanks,
N.
valgrind --tool=memcheck --db-attach=yes
--vex-iropt-precise-memory-exns=yes --leak-check=full --num-cal
lers=40 mzscheme -e '(require "build-cache.ss")(make-log)'
==31425== Invalid read of size 4
==31425== at 0x5CFC437: ???
==31425== by 0x8085B46: scheme_do_eval (eval.c:8091)
==31425== by 0x8087531: _scheme_apply_from_native (schnapp.inc:71)
==31425== by 0x442FF8B: ???
==31425== by 0x8085B46: scheme_do_eval (eval.c:8091)
==31425== by 0x8085548: scheme_do_eval (eval.c:8731)
==31425== by 0x80868BB: eval_k (eval.c:8900)
==31425== by 0x80AB942: scheme_top_level_do_worker (fun.c:2078)
==31425== by 0x807C79E:
scheme_eval_linked_expr_multi_with_dynamic_state (eval.c:9030)
==31425== by 0x80E6B61: eval_exptime (module.c:4564)
==31425== by 0x80E71CB: expstart_module (module.c:3961)
==31425== by 0x80EFC83: start_module (module.c:4059)
==31425== by 0x80EF5F5: start_module (module.c:3719)
==31425== by 0x80EF5F5: start_module (module.c:3719)
==31425== by 0x80EF5F5: start_module (module.c:3719)
==31425== by 0x80F1CDC: do_prepare_compile_env (module.c:4107)
==31425== by 0x80F1D2F: scheme_prepare_compile_env (module.c:4126)
==31425== by 0x80931A8: do_local_expand (eval.c:9523)
==31425== by 0x8093EFE: local_transformer_expand_catch_lifts (eval.c:9800)
==31425== by 0x430F14D: ???
==31425== by 0x8085B46: scheme_do_eval (eval.c:8091)
==31425== by 0x80A228E: apply_k (fun.c:2239)
==31425== by 0x80AB942: scheme_top_level_do_worker (fun.c:2078)
==31425== by 0x80ABE7C: scheme_apply_macro (fun.c:2672)
==31425== by 0x80884E3: scheme_compile_expand_expr (eval.c:5362)
==31425== by 0x808A32E: expand_k (eval.c:9158)
==31425== by 0x80AB942: scheme_top_level_do_worker (fun.c:2078)
==31425== by 0x80AC1E7: scheme_top_level_do (fun.c:1986)
==31425== by 0x80935C4: do_local_expand (eval.c:9728)
==31425== by 0x8093FD8: local_expand (eval.c:9776)
==31425== by 0x430F14D: ???
==31425== by 0x8085B46: scheme_do_eval (eval.c:8091)
==31425== by 0x80A228E: apply_k (fun.c:2239)
==31425== by 0x80AB942: scheme_top_level_do_worker (fun.c:2078)
==31425== by 0x80ABE7C: scheme_apply_macro (fun.c:2672)
==31425== by 0x80884E3: scheme_compile_expand_expr (eval.c:5362)
==31425== by 0x80F8FB2: do_module_begin (module.c:6091)
==31425== by 0x80894AC: scheme_compile_expand_expr (eval.c:5764)
==31425== by 0x80FFE5C: do_module (module.c:5476)
==31425== by 0x80894AC: scheme_compile_expand_expr (eval.c:5764)
==31425== Address 0x100004 is not stack'd, malloc'd or (recently) free'd