caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques GARRIGUE <garrigue@math.nagoya-u.ac.jp>
To: carette@mcmaster.ca
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Debugging the compiler
Date: Sat, 03 Jan 2009 18:04:46 +0900 (JST)	[thread overview]
Message-ID: <20090103.180446.68544033.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <495648C4.8080403@mcmaster.ca>

From: Jacques Carette <carette@mcmaster.ca>
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


      reply	other threads:[~2009-01-03  9:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-27 15:24 Jacques Carette
2009-01-03  9:04 ` Jacques GARRIGUE [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090103.180446.68544033.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=carette@mcmaster.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).