From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 95735BC57 for ; Fri, 3 Dec 2010 16:43:42 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.59,294,1288566000"; d="scan'208";a="81250378" Received: from 250-120.msr-inria.inria.fr (HELO [10.0.1.2]) ([193.55.250.120]) by mail4-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA; 03 Dec 2010 16:43:42 +0100 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1082) Subject: Re: [Caml-list] Tips to find the cause of a seg fault From: Damien Doligez In-Reply-To: <1182061596.483210.1291158525016.JavaMail.root@zmbs1.inria.fr> Date: Fri, 3 Dec 2010 16:43:42 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <3474B264-1D16-4740-B935-995B6B38F0CE@inria.fr> References: <1182061596.483210.1291158525016.JavaMail.root@zmbs1.inria.fr> To: caml users X-Mailer: Apple Mail (2.1082) X-Spam: no; 0.00; damien:01 damien:01 lablgl:01 ocamlsdl:01 segfaults:01 gentoo:01 bytecode:01 marshaling:01 gdb:01 ocaml:01 runtime:01 ocamlrund:01 ocaml:01 bytecode:01 ocamlrund:01 On 2010-12-01, at 00:08, Philippe Veber wrote: > Short story (details below): I'm currently writing a program relying = on react, lablgl and ocamlsdl. This program segfaults on my laptop under = two linux distributions (ubuntu and gentoo) but doesn't on a PC under = ubuntu. The seg fault occurs with both bytecode and native executables. = I don't do any marshaling nor use any typing magic; stack overflow is = not likely. I humbly ask this list about means to improve valgrind or = gdb outputs, which don't report informative function names, or more = generally, any tip that could help me to locate the origin of the = problem. You should try to compile the OCaml runtime in debug mode: just "make = ocamlrund" in the ...ocaml/bytecode directory, then run your program with = ocamlrund. > Many thanks for the clarification. Maybe I could (partially) "unplug" = the GC by setting space_overhead to 100 ? That could give an indication = on the moment the problem occurs ? The default space_overhead is already 80. If you want the major GC to run very slowly, set the overhead to 1000 or 10000. But usually you want to do the opposite, so that the crash happens soon after the execution of the buggy code. You can try to pepper your code with calls to Gc.compact, for example. In your case, I would call it just before the pattern matching that crashes mysteriously. -- Damien