caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Debugging the compiler
@ 2008-12-27 15:24 Jacques Carette
  2009-01-03  9:04 ` [Caml-list] " Jacques GARRIGUE
  0 siblings, 1 reply; 2+ messages in thread
From: Jacques Carette @ 2008-12-27 15:24 UTC (permalink / raw)
  To: caml-list

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.

Jacques


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Debugging the compiler
  2008-12-27 15:24 Debugging the compiler Jacques Carette
@ 2009-01-03  9:04 ` Jacques GARRIGUE
  0 siblings, 0 replies; 2+ messages in thread
From: Jacques GARRIGUE @ 2009-01-03  9:04 UTC (permalink / raw)
  To: carette; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-03  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-27 15:24 Debugging the compiler Jacques Carette
2009-01-03  9:04 ` [Caml-list] " Jacques GARRIGUE

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).