Hot answers tagged

4

You can get low-level bytecode source of .beam file with beam_disasm:file(module_name) It's not easy to read it and takes time to figure it out. But it's much verbose and easier to comprehend than any real hardware assembly code. You can give it a try. For example, if you have a .beam file called "my_module.beam", open erl and type file:write_file("/tmp/...


3

Have you tried using recon:source/1? I think it does exactly what you need. If you don't want to use it, at least you can get inspiration from its source code: -spec source(module()) -> iolist(). source(Module) -> Path = code:which(Module), {ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(Path, [abstract_code]), erl_prettypr:format(...


Only top voted, non community-wiki answers of a minimum length are eligible