From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA01172; Mon, 21 Oct 2002 11:11:10 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA01842 for ; Mon, 21 Oct 2002 11:11:09 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9L9B8529855; Mon, 21 Oct 2002 11:11:08 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA04856; Mon, 21 Oct 2002 11:11:07 +0200 (MET DST) Date: Mon, 21 Oct 2002 11:11:07 +0200 From: Xavier Leroy To: Lex Stein Cc: caml-list@inria.fr Subject: Re: [Caml-list] debugger losing contact with debuggee process Message-ID: <20021021111107.A2700@pauillac.inria.fr> References: <200210191216.47164.erayo@cs.bilkent.edu.tr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from stein@eecs.harvard.edu on Sat, Oct 19, 2002 at 06:15:15PM -0400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > A process I am debugging has a bus error and crashes. When it crashes, it > loses contact with ocaml_debug. The output looks something like this: > > calling db->put with db=3c8c0 txn=0 flags=0 > Invalid argument (error number 22) > BDB: aborting transaction To complement Pierre's reply: if you do the dichotomy trick that Pierre described, you'll probably find that the crash occurs in a C function (declared "external" in Caml). Thus, you'll have to run your program under a C debugger such as gdb. To make this easier, try to compile the C code with "-g", and link the Caml code with "ocamlc -o myprog -custom -ccopt -g". This way, you'll get a standalone executable named myprog, with debug information attached. Then, do "gdb myprog", and "run", until it crashes. gdb "bt" command will show you where the crash is located. If it's in a C function called directly or indirectly from OCaml's "interprete" function, you're lucky: the error is indeed inside C code, and can be tracked down just like you'd do for a C program. If the crash is in "interprete" or some other function of the OCaml runtime system, things will be harder: presumably, some C code returned an illegal Caml value, or messed up with the GC, causing a crash later in the OCaml runtime system. A good way to attack these problems is to conduct a careful code review of the C/OCaml stub code, questioning every single allocation and construction of OCaml values. > [ I posted this question to the ocaml_beginners list. After receiving no > replies on that list after 12hours, I conclude that the people on that > list don't have the experience with ocamldebug to answer the question and > am posting it to this list. ] Your post is on-topic for this list. However, your expectation that you should get answers within 12 hours is ridiculous. Even if you paid a hefty support contract for a commercial development tool, you would not get that. - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners