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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id B97BDBC57 for ; Mon, 1 Mar 2010 16:19:47 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkQCAKdmi0smachzmWdsb2JhbACbDxUBAQEBAQYNCgcTIrpIhHsEjjc X-IronPort-AV: E=Sophos;i="4.49,560,1262559600"; d="scan'208";a="45759166" Received: from mx2.janestreet.com ([38.105.200.115]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 01 Mar 2010 16:19:46 +0100 Received: from nyc-qsv-mail1.delacy.com ([172.25.22.57]) by mx2.janestreet.com with esmtp (Exim 4.71) (envelope-from ) id 1Nm7PL-0000HA-Ir for caml-list@yquem.inria.fr; Mon, 01 Mar 2010 10:19:43 -0500 Received: from nyc-qsv-004.delacy.com ([172.25.22.194] helo=qsmtp.delacy.com) by nyc-qsv-mail1.delacy.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.71) (envelope-from ) id 1Nm7PL-0000Nz-II; Mon, 01 Mar 2010 10:19:43 -0500 Received: from lon-qws-r01.delacy.com ([172.30.3.51] helo=lon-qws-r01) by qsmtp.delacy.com with smtp (Exim 4.71) (envelope-from ) id 1Nm7PK-0005jr-6I; Mon, 01 Mar 2010 10:19:43 -0500 Received: by lon-qws-r01 (sSMTP sendmail emulation); Mon, 1 Mar 2010 15:19:41 +0000 From: "Mark Shinwell" Date: Mon, 1 Mar 2010 15:19:41 +0000 To: Jianzhou Zhao Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Debugging C and OCaml Message-ID: <20100301151940.GD26002@janestreet.com> References: <9dfe358d1003010710r69799c1duae37c42a3725b899@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9dfe358d1003010710r69799c1duae37c42a3725b899@mail.gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam: no; 0.00; shinwell:01 ocaml:01 ocaml:01 compilation:01 gdb:01 bindings:01 compiler:01 gdb:01 resembling:01 backtrace:01 zhao:98 wrote:01 caml-list:01 functions:01 functions:01 On Mon, Mar 01, 2010 at 10:10:44AM -0500, Jianzhou Zhao wrote: > My main program is C++. It uses C functions to call > OCaml functions, and these OCaml functions also call > C functions and wrapped C++ functions sometimes. > > I can debug from C++, but it stops when it meets > an OCaml binding. Does anyone know an efficient > solution about how to debug across different languages? Is this native code compilation? If so, you should be able to use gdb to debug into the Caml bindings at the assembly level -- does that work? Unfortunately at the moment there is no Caml compiler support for emitting the debug info required by gdb to debug at the language level. That said, ocamlopt-compiled assembly code is fairly easy to read, and you should be able to get something resembling a backtrace using "where". Mark