When compiling with debugging information enabled (option -g ), the bytecode transfers the so-called "event structure", for example, a function record and a return point, which provide information about the location and input of information.
As a proof of concept for checking this information, I created a small branch ocamlpp (a small Benoรฎt Vaugon utility for checking bytecode files) that prints this debugging information along with the bytecode instructions.
I have no idea if js_of_ocaml is js_of_ocaml necessary steps to save this location information during compilation. You should probably contact your companion, Jer Vouillon, for more information.
source share