Beam file format questions.

Eric Merritt <>
Mon Aug 26 17:46:04 CEST 2002


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

http://www.ericsson.com/cslab/~bjorn/beam_file_format.html

 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
http://finance.yahoo.com



More information about the erlang-questions mailing list