caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] disassembling cmo files
@ 2005-12-07  7:45 Jonathan Roewen
  2005-12-07  8:55 ` basile
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Roewen @ 2005-12-07  7:45 UTC (permalink / raw)
  To: caml-list

Hi,

How can I disassemble a .cmo into something useful? I think such a
tool would prove useful to me for understanding exactly how bytecode
works, esp wrt to interactions with the garbage collector.

Jonathan


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

* Re: [Caml-list] disassembling cmo files
  2005-12-07  7:45 [Caml-list] disassembling cmo files Jonathan Roewen
@ 2005-12-07  8:55 ` basile
  2005-12-07  9:52   ` David Baelde
  0 siblings, 1 reply; 5+ messages in thread
From: basile @ 2005-12-07  8:55 UTC (permalink / raw)
  To: Jonathan Roewen; +Cc: caml-list



> How can I disassemble a .cmo into something useful?

IIRC, the ocaml/tools directory (from Ocaml CVS)
contains a dumpobj.ml which should do it.

-- 
Basile Starynkevitch http://starynkevitch.net/Basile/


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

* Re: [Caml-list] disassembling cmo files
  2005-12-07  8:55 ` basile
@ 2005-12-07  9:52   ` David Baelde
  2005-12-07 10:02     ` Jonathan Roewen
  2005-12-07 10:11     ` Oliver Bandel
  0 siblings, 2 replies; 5+ messages in thread
From: David Baelde @ 2005-12-07  9:52 UTC (permalink / raw)
  To: basile; +Cc: Jonathan Roewen, caml-list

Hi,

A simple and interesting way to learn about the bytecode is the
-dinstr option of ocamlc and ocaml toplevel. It dumps a human-readable
version of the produced bytecode. Similarly, there is -dlambda.

--
David


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

* Re: [Caml-list] disassembling cmo files
  2005-12-07  9:52   ` David Baelde
@ 2005-12-07 10:02     ` Jonathan Roewen
  2005-12-07 10:11     ` Oliver Bandel
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Roewen @ 2005-12-07 10:02 UTC (permalink / raw)
  To: david.baelde; +Cc: caml-list

On 12/7/05, David Baelde <david.baelde@gmail.com> wrote:
> Hi,
>
> A simple and interesting way to learn about the bytecode is the
> -dinstr option of ocamlc and ocaml toplevel. It dumps a human-readable
> version of the produced bytecode. Similarly, there is -dlambda.

Yes, I've used that before, but those are pseudo instructions .. not
what actually goes into a bytecode file I believe.

> IIRC, the ocaml/tools directory (from Ocaml CVS)
> contains a dumpobj.ml which should do it.

I tried compiling, but it complains about an undefined field in
debug_event, line 391 (ocaml3.09.0).

Jonathan


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

* Re: [Caml-list] disassembling cmo files
  2005-12-07  9:52   ` David Baelde
  2005-12-07 10:02     ` Jonathan Roewen
@ 2005-12-07 10:11     ` Oliver Bandel
  1 sibling, 0 replies; 5+ messages in thread
From: Oliver Bandel @ 2005-12-07 10:11 UTC (permalink / raw)
  To: caml-list

On Wed, Dec 07, 2005 at 10:52:25AM +0100, David Baelde wrote:
> Hi,
> 
> A simple and interesting way to learn about the bytecode is the
> -dinstr option of ocamlc and ocaml toplevel. It dumps a human-readable
> version of the produced bytecode. Similarly, there is -dlambda.

Both are very nice features but are a) undocumented and b) work
on the ml-file, not the cmo-files.

To have access to a cmo-file... well... IMHO maybe could be used to
combine Ocaml-stuff with other languages... e.g. dynamically loading
*.cmo's into C-programs...
(...should be possible to do that?!)



Ciao,
   Oliver


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

end of thread, other threads:[~2005-12-07 10:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-07  7:45 [Caml-list] disassembling cmo files Jonathan Roewen
2005-12-07  8:55 ` basile
2005-12-07  9:52   ` David Baelde
2005-12-07 10:02     ` Jonathan Roewen
2005-12-07 10:11     ` Oliver Bandel

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