exporting record_info (RE: Child modules draft feedback wanted)

Ulf Wiger (AL/EAB) <>
Fri Apr 7 09:08:41 CEST 2006


Richard O'Keefe wrote:
>
> I was under the misapprehension that the record_info 
> information was there in the Beam files, just not exported in 
> the usual way.  What a drongo!  Sorry.

Well, they are... or can be, at least.

erlc +debug_info hashdb.erl

erl
1> beam_lib:chunks("hashdb.beam",[abstract_code]).
{ok,{hashdb,[{abstract_code,{raw_abstract_v1,
                                [{attribute,1,file,{"./hashdb.erl",1}}, 
...
2> {ok,{_,[{abstract_code,{_, Forms}}]}} = v(1).
{ok,{hashdb,[{abstract_code,{raw_abstract_v1,
...
3> [A || {attribute,_,record,_} =A <- Forms].
[{attribute,58,
            record,
            {hashdb,[{record_field,58,{atom,58,name}},
                     {record_field,59,{atom,59,size},{integer,59,0}},
                     {record_field,60,{atom,60,type},{atom,60,set}},
                     {record_field,61,{atom,61,keypos},{integer,61,1}},
                     {record_field,62,{atom,62,fix},{atom,62,false}},
                     {record_field,63,{atom,63,n},{integer,63,16}},
                     {record_field,64,{atom,64,maxn},{integer,64,16}},
                     {record_field,65,
                                   {atom,65,bso},
                                   {op,65,
                                       'div',
                                       {integer,65,16},
                                       {integer,65|...}}},
                     {record_field,66,
                                   {atom,66,exp_size},
                                   {op,66,
                                       '*',
                                       {integer,66|...},
                                       {integer|...}}},
                     {record_field,67,
                                   {atom,67,con_size},
 
{op,67,'*',{integer,67|...},{integer|...}}},
                     {record_field,68,
                                   {atom,68,segs},
                                   {call,68,{atom,68|...},[{...}]}}]}}]
4> 


BR,
Ulf W



More information about the erlang-questions mailing list