Sha256: af9c33d0b2f87cf03be2fa3c82dc5f0430b2353ed529015f25843628452bf934

Contents?: true

Size: 1.69 KB

Versions: 4

Compression:

Stored size: 1.69 KB

Contents

ExeFormat
=========

This class is the parent of all executable format handlers.

It is defined in `metasm/exe_format/main.rb`.

It defines some standard shortcut functions, such as:

* `Exe.decode_file(filename)`
* `Exe.assemble(cpu,asm_source)`
* `Exe.compile_c(cpu,c_source)`
* `Exe#encode_file(filename)`

These methods will instanciate a new Exe, and call the corresponding
methods, *e.g.* `load` with the file content, and `decode`.

The handling of the different structures in the binary format should be
done using the <core/SerialStruct.txt> facility.

The subclasses are expected to implement various functions, depending on the
usage (refer to the ELF and COFF implementations for more details):

File decoding/disassembly
-------------------------

* `#decode_header`: parse the raw data in `#encoded` only to parse the file header
* `#decode`: parse all the raw data in `#encoded`
* `#cpu_from_headers`: return a <core/CPU.txt> instance according to the exe header information
* `#get_default_entrypoints`: the list of entrypoints (exported functions, etc)
* `#dump_section_header`: return a string that may be assembled to recreate the specified section
* `#section_info`: return a list of generic section informations for the disassembler


File encoding/source parsing
----------------------------

* `#tune_prepro`: define exe-specific macros for the preprocessor (optional)
* `#parse_init`: initialize the `@cursource` array to receive the parsed asm source
* `#parse_parser_instruction`: parse exe-specific instructions, eg `.text`, `.import`...
* `#assemble`: assemble the content of the @cursource into binary section contents
* `#encode`: assemble the various sections and a binary header into `@encoded`

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metasm-1.0.5 doc/core/ExeFormat.txt
metasm-1.0.4 doc/core/ExeFormat.txt
metasm-1.0.3 doc/core/ExeFormat.txt
metasm-1.0.2 doc/core/ExeFormat.txt