Re: Getting object code directly from code server

Dmytro Lytovchenko <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAOUb9CFt9FA_tKEqmNT8kHjEj8SrYaWWMR8Nj3eaQMB8jxPpcA@mail.gmail.com>
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 <[email protected]> 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 <[email protected]>
> 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
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.