From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 13939BB91 for ; Wed, 12 Jan 2005 17:57:17 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0CGvG5I019537 for ; Wed, 12 Jan 2005 17:57:16 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA28077 for ; Wed, 12 Jan 2005 17:57:16 +0100 (MET) Received: from [IPv6:::1] (yquem.inria.fr [128.93.8.37]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0CGvGBe019534 for ; Wed, 12 Jan 2005 17:57:16 +0100 Mime-Version: 1.0 (Apple Message framework v619) In-Reply-To: <20050110164053.L50586@bowser.eecs.harvard.edu> References: <20050110164053.L50586@bowser.eecs.harvard.edu> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <02D1F0C8-64BB-11D9-B72B-000D9345235C@inria.fr> Content-Transfer-Encoding: 7bit From: Damien Doligez Subject: Re: [Caml-list] Caml source line numbers in custom executable Date: Wed, 12 Jan 2005 17:57:15 +0100 To: caml users X-Mailer: Apple Mail (2.619) X-Miltered: at nez-perce with ID 41E556EC.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41E556EC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; damien:01 damien:01 caml-list:01 runtime:01 runtime:01 gcc:01 bug:01 pointer:01 stack:01 backtrace:01 asmrun:01 ocaml:01 libasmrun:01 bug:01 ocamldebug:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: > I am building a custom unstripped ELF executable that contains > the Caml runtime. The executable is segfaulting in runtime GC > routines. Can someone suggest how to cross reference these > routines with the corresponding file and line numbers of the Caml > source code so that gcc can tell me where the executable is > segfaulting? The GC routines are not in your Caml source code. And most of the time, a crash in the GC is caused by a bug somewhere else that destroys some pointer. If you really want to know where the crash occurs in your program, you should get a stack backtrace from the core dump, using normal Unix tools. If you want debug information (symbols) in a ocamlopt-compiled program, you can build libasmrund.a (in the asmrun directory of the Ocaml sources) and use it instead of libasmrun.a. Unfortunately, these techniques are usually not very useful in finding the bug. > ps: Damien, I have tried using ocamldebug. It looks like an > excellent tool. In particular, it's time travel features are > powerful. However, in this case, it's use is limited by its > disconnected socket-based implementation; the executable > segfaults and the debugger loses contact. Usually, that doesn't prevent the debugger from working: you can step back from a segfault. And then you can attach a gcc to the right process, and use it to debug at the C/assembly level. -- Damien