Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Erlang BEAM file decompile to .erl file
#!/usr/bin/env escript
% -*- mode: erlang -*-
main([BeamFile]) ->
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]),
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).
@andelf

This comment has been minimized.

Copy link
Owner Author

commented Mar 19, 2013

@dolambinhminh

This comment has been minimized.

Copy link

commented Dec 22, 2015

Hi! Tried your but i have exception [{abstract_code,no_abstract_code}]. I don't know what's happen? Please! Can you help me fix this error!
I'm running Erlang on Window.
Thankyou!

@jfacorro

This comment has been minimized.

Copy link

commented May 6, 2016

@dolambinhminh The problem is that for this piece of code to work the module has to be compiled with the debuf_info flag, otherwise the abstract code is not included in the binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.