Hello everyone, how do you disassemble the beam? I’ve tried with beam_disasm but the results I get can’t be compiled again into beam. can anyone help?
Beam File: https://github.com/henwrite/decompile/blob/master/adm.beam?raw=true
Disasm: https://raw.githubusercontent.com/henwrite/decompile/master/adm.S
I’m pretty sure the output is not designed to be recompiled, primarily for clarity of that intermediate step, but would need to wait for someone else to answer for sure.
I’m more curious in why wanting to recompile a decompilation? What are you actually trying to accomplish with this?
I want to change an existing function. because there are some functions that I don’t think work as they should.
But why not just fork the source?
Yes.
The beam_disasm
module was introduced at the same time that HiPE was added to Erlang/OTP. The HiPE application used it as the first part of translating a BEAM file to native code.
Since HiPE was retired in OTP 24, there is not really any need to still keep beam_disasm
around. We probably will keep it, though, because it can occasionally be useful when debugging the compiler and runtime system.
i try to decompiler adm.beam ues:eUtils/src/compile/utBeamToSrc.erl at master · ErlGameWorld/eUtils · GitHub
Blockquote
utBeamToSrc:genSrc(adm, “./xxx.erl”).
code_gen_erl_file error, reason:{key_missing_or_invalid, “./aaGitClone/eUtils/adm.beam”,abstract_code}
what key are you compiling with
with GitHub - sg2342/beam_disassemble: BEAM file dis-assembler i was able to disassemble, change and recompile code for OTP19. I am sure it can be changed to support newer versions as well.