BeamFile (beam_file v0.1.0)
An interface to the BEAM file format.
This module is mainly a wrapper around Erlangs :beam_lib
.
Furthermore, different code representations can be generated from the file.
Link to this section Summary
Functions
Returns the :abstract_code
chunk.
Returns the byte code for the BEAM file.
Returns infos for the given chunk reference.
Returns chunk data for all chunks.
Returns chunk data for all chunk names.
Returns the Dbgi
/:debug_info
chunk.
Returns the :docs
chunk.
Returns elixir code recreated from the debug_info
chunk.
Returns the Erlang code for the BEAM file.
Returns a keyword list containing some information about a BEAM file.
Returns the binary for the given BEAM file.
Returns the absolute filename for the module
.
Link to this section Types
chunk()
Specs
chunk() :: chunk_id() | chunk_name()
chunk_id()
Specs
chunk_id() :: :abstract_code | :atoms | :attributes | :compile_info | :debug_info | :docs | :elixir_checker | :exports | :imports | :indexed_imports | :labeled_exports | :labeled_locals | :locals
chunk_name()
Specs
chunk_name() :: charlist()
info()
Specs
info() :: [ file: Path.t(), module: module(), chunks: [{charlist(), non_neg_integer(), non_neg_integer()}] ]
Link to this section Functions
abstract_code(input)
Specs
Returns the :abstract_code
chunk.
byte_code(input)
Specs
Returns the byte code for the BEAM file.
chunk(input, chunk)
Specs
Returns infos for the given chunk reference.
chunks(input)
Specs
Returns chunk data for all chunks.
chunks(input, atom)
Returns chunk data for all chunk names.
debug_info(module)
Specs
Returns the Dbgi
/:debug_info
chunk.
docs(input)
Specs
Returns the :docs
chunk.
elixir_code(input, opts \\ [])
Specs
Returns elixir code recreated from the debug_info
chunk.
The recreated code comes with resolved macros and references. For now, types and specs will not be recreated.
Options:
:docs
: With docs: false
the docs will not be created.
erl_code(input)
Specs
Returns the Erlang code for the BEAM file.
info(input)
Specs
Returns a keyword list containing some information about a BEAM file.
:file
: The name of the BEAM file, or the binary from which the information was extracted.:module
: The name of the module.:chunks
: For each chunk, the identifier and the position and size of the chunk data, in bytes.
read(input)
Specs
read(Path.t() | module()) :: {:ok, binary()} | {:error, File.posix()}
Returns the binary for the given BEAM file.
which(module)
Specs
Returns the absolute filename for the module
.
If the module cannot be found, {:error, :non_existing}
is returned.
If the module is preloaded, {:error, :preloaded}
is returned.
If the module is Cover-compiled, {:error, :cover_compiled}
is returned.