Beam file format questions.

Happi happi@REDACTED
Mon Aug 26 18:04:33 CEST 2002

The exported functions you can get by:
> test:module_info(exports).

If you want more info from the beam file you might want to look into

> beam_disasm:file(test).

or if you have a hipe system and whant to see the beam code prettyprinted:

> hipe:c(test,[pp_beam,no_load]).
  label 1:
  label 2:

  label 3:
  label 4:

  label 5:
  label 6:

  label 7:
  label 8:

Good luck,
Erik Stenman

I'm Happi, you should be happy.
Praeterea censeo "0xCA" scribere Erlang posse.

----- Original Message -----
From: "Eric Merritt" <cyberlync@REDACTED>
To: <erlang-questions@REDACTED>
Sent: Monday, August 26, 2002 5:46 PM
Subject: Beam file format questions.

> Hello all,
>  I am attempting to parse the beam files generated by
> the erlang 8-2 compiler. My purpose here is to extract
> a list of exported functions from the beam file. It is
> proving a bit interesting, overall. I looked at the
> information provided by Mr. Gustavsson here ->
>  I figured it should be pretty easy to parse, but I
> ran into some difficulties.
> First, the 'Atom' and 'Code' chunks seem to have an
> extra two null bytes padded onto the end of thier
> chunks (beyond the length specified in the chunk
> header). The other chunks seem to obey the format
> specified in the above document. It could very well be
> that I am just a bit off in the head and missing
> something. Hopefully, one of you will confirm.
> Second, the 'ExpT' chunks doesn't seem too useful to
> me at all. I am exporting two functions in my test
> code, so accoring to the spec there  should be a total
> of 24 bytes (12 bytes per exported function '3*4') of
> information after the chunk header, in mine there are
> 52 bytes. I hope one of you with a little more insight
> and experience can explain where I am screwing up.
> Following is some code I am using to generate the beam
> file I am testing with, it doesn't do anything at all
> really except produce a beam file.
> -----------------------------------------------------
> -module(test).
> -export([test/0, this_is_a_test/1]).
> test() ->
> {ok, this_is_a_test, 'google'}.
> this_is_a_test(Ok) ->
> ok.
> -----------------------------------------------------
> Thanks,
> Eric
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes

More information about the erlang-questions mailing list