From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 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 BB4C2BBAF for ; Sat, 3 Jan 2009 10:04:52 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.36,322,1228086000"; d="scan'208";a="20987818" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 03 Jan 2009 10:04:52 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id n0394pVe025514 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 3 Jan 2009 10:04:52 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAKO4XkmFBoIF/2dsb2JhbADKSwEE X-IronPort-AV: E=Sophos;i="4.36,322,1228086000"; d="scan'208";a="21930339" Received: from rabbit.math.nagoya-u.ac.jp (HELO mailhost.math.nagoya-u.ac.jp) ([133.6.130.5]) by mail1-smtp-roc.national.inria.fr with ESMTP; 03 Jan 2009 10:04:50 +0100 Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id 89F74B662; Sat, 3 Jan 2009 18:04:47 +0900 (JST) Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id 22B408884; Sat, 3 Jan 2009 18:04:47 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=math.nagoya-u.ac.jp; h= date:message-id:to:cc:subject:from:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=alpha; bh=lxuhi5LYjduW8+jM7emgJFucvgQ=; b=qa3UcEQ8nSJMufHG9KyzXkqB/udg g2ihnFZ6gn1nODbecnNAvZ0cTGTqcFPMCQY1R5+Vu56fE0RUaHlT9naIkQjsLwcy Ak7Nf8BUuabtUtN2FHDkcnKLMGEJaYPakXjpbhxRTc+jmi35fnjhSGEC6kjgjVZQ PSIgmh6aakBkTKY= DomainKey-Signature: a=rsa-sha1; h=Received:Date:Message-Id:To:Cc:Subject:From:In-Reply-To:References:X-Mailer:Mime-Version:Content-Type:Content-Transfer-Encoding; b=P11GYoaS08dz++qHuNCP6LHlQl+d6fqFCkyJTgntlBYTv/7u//AmunCK+oRdSYhl5m71hylSNwzbq8MdnHvCyPvTxFRBy6EIGAmGDJzoesSS17ZW07VmHOxIkMxPiHRuDDpq2wimh612lsBYQyn2frv+oZlAbrm7LeLTvZaGK5E=; c=nofws; d=math.nagoya-u.ac.jp; q=dns; s=alpha Received: from localhost (rabbit-172 [172.16.254.254]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id ED2EF8883; Sat, 3 Jan 2009 18:04:46 +0900 (JST) Date: Sat, 03 Jan 2009 18:04:46 +0900 (JST) Message-Id: <20090103.180446.68544033.garrigue@math.nagoya-u.ac.jp> To: carette@mcmaster.ca Cc: caml-list@inria.fr Subject: Re: [Caml-list] Debugging the compiler From: Jacques GARRIGUE In-Reply-To: <495648C4.8080403@mcmaster.ca> References: <495648C4.8080403@mcmaster.ca> X-Mailer: Mew version 4.2 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 495F2A33.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; compiler:01 compiler:01 bug:01 makefiles:01 ocamlrun:01 ocamlc:01 -nostdlib:01 ocamlc:01 makefile:01 ocamldebug:01 ocamldebug:01 util:01 bytecomp:01 debugger:01 typechecker:01 From: Jacques Carette Subject: [Caml-list] Debugging the compiler Date: Sat, 27 Dec 2008 10:24:52 -0500 > Nothing like the holidays for a little playing around with some ideas by > modifying a compiler... Having got the hang of bootstrapping the > compiler [with help from old caml-list postings], I managed to get quite > a few things working, but now I have a bug. I dug around the configure > scripts and the Makefiles, and did not see any ready-made way to compile > the compiler with debugging enabled - is this possible? I searched the > archives for help on this topic, but came up empty-handed. > > Any and all advice on 'debugging the compiler' would be most appreciated. The way I do it is make "CAMLC=boot/ocamlrun boot/ocamlc -nostdlib -I boot -g" ocamlc That is, just add -g to the definition in the main Makefile. (You can also add it there directly) Then you can run ocamlc with ocamldebug: ocamldebug -I util -I parsing -I typing -I bytecomp -I driver ocamlc -c test.ml Adding all these paths is useful once you get inside the debugger. For instance, if you want to debug the typechecker, you generally want to put a checkpoint on Error.report (in driver), and you can use Printtyp.raw_type_expr to print recursive types. Jacques