[Teaching] Backtraces in toplevel

Yann Salmon yann.salmon at prepas.org
Tue May 12 09:48:23 BST 2015


Hello,

I have recently started using Arthur Charguéraud's experimental OCaml
compiler and top-level with improved type error messages. This is great
and the students are now able to gain better autonomy in programming. I
modified the OCaml source code to enable easy-type-errors by default.

However, Arthur's patch cannot improve runtime error messages, like the
frequent Out-of-bound access exception. For this, I would like the OCaml
toplevel to automatically print a backtrace.

I understand that I should do two things :
 1. compile the toplevel with -g
 2. run the toplevel with OCAMLRUNPARAM set to B.

I do not understand however what I should change in the makefiles to
pass the -g option correctly (my attempts were not successful), and I am
not sure what parts of the OCaml source code I should change to get de
backtrace printing behaviour enabled by default.

Can somebody help ?

-- 
Cordialement,
Yann Salmon

Informatique
MPSI, PCSI, MP*, PC*
Descartes - Tours

<http://pro.yannsalmon.fr/>


More information about the Teaching mailing list