Hello guys, I would like to ask a question about ocaml error handling. Actually many questions that I've never dared asking on the official mailing list. I've had a few problems sparsely with OCaml bytecode programs throwing a core dump. When analyzing these core dumps, gdb says it's a "Segmentation fault". Here is an example of this: This GDB was configured as "i386-marcel-freebsd"...(no debugging symbols found)... Core was generated by `ocamlrun'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/libm.so.5...(no debugging symbols found)...done. Loaded symbols for /lib/libm.so.5 Reading symbols from /lib/libncurses.so.7...(no debugging symbols found)...done. Loaded symbols for /lib/libncurses.so.7 Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done. Loaded symbols for /lib/libc.so.7 Reading symbols from /usr/local/lib/ocaml/stublibs/dllunix.so...(no debugging symbols found)...done. Loaded symbols for /usr/local/lib/ocaml/stublibs/dllunix.so Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x080606de in caml_interprete () Not very informative. So here are my questions: - What is the best way to produce and analyze core dumps in ocaml? Should I compile in bytecode or native? Is there any special gdb "trick" that gives you more information? Is there any special "trick" while compiling the ocaml runtime to make it throw more information? - Then, my main question is actually: in bytecode, what can produce segfaults? My ocaml code is completely standard, excepted that I use the Marshal module. So my question is rather: outside the Marshal module, what can cause segfault? - Slightly unrelated question: I have been able to generate segfaults by running ocaml code that: 1) iterates recursively through a list reference 2) changes the reference while still iterating on it. For example, you just do a "List.iter myfun !myref", and within the function myfun, you do stuff like "myref := List.filter somefilterfunction !myref". It is not good to program like this, but for some reason I thought ocaml would not segfault on that. Is this expected behavior? If it's not, I'll be happy to provide some simple source code that illustrates it. (nevermind I have actually cleaned all my code base from these dirty uses of references) - About ocaml bytecode interpreter and ocaml native compiler: it seems to me, looking at the ocaml source tree, that these two parts are completely unrelated (I'm talking about the byterun and the asmrun/asmcomp directories), meaning that they don't share any source code. Is that correct? Anyway guys, thanks for reading this, if you did, don't know if this makes any sense to you.