Getting object code directly from code server
Dmytro Lytovchenko
dmytro.lytovchenko@REDACTED
Wed Sep 1 11:28:08 CEST 2021
You can find the BEAM file path and load it yourself, i think that's
available from MODULE:module_info() reply.
You can parse BEAM file sections using beam_lib standard library
If you for some reason you want to go deep into the code down to
instruction level, or want to write the parser yourself, or you have
non-Erlang code which cannot access beam_lib, here's what's inside a BEAM
file
http://beam-wisdoms.clau.se/en/latest/indepth-beam-file.html
On Wed, 1 Sept 2021 at 09:18, Lukas Larsson <lukas@REDACTED> wrote:
> Hello!
>
> No, it is not possible because after the beam code is loaded it is not
> kept in memory, and it is not possible to re-create the original beam code
> from the loaded code.
>
> So if you need to keep track of dynamically created code, you need to
> build something yourself that does that.
>
> Lukas
>
> On Wed, Sep 1, 2021 at 8:57 AM Devon Estes <devon.c.estes@REDACTED>
> wrote:
>
>> Hello all,
>>
>> Is it at all possible to get the current object code for a module
>> directly from the code server? `code:get_object_code/1` returns information
>> from the beam files in the code path and not from the code server itself,
>> and so if there are modules that are dynamically compiled and loaded with
>> `code:load_binary/3` that doesn't work.
>>
>> Cheers,
>> Devon
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210901/89eff801/attachment.htm>
More information about the erlang-questions
mailing list