MaeBPF.Disasm (maebpf v0.1.0)

Copy Markdown View Source

Pure-Elixir eBPF ISA v3 disassembler for raw instruction binaries, compiled ELF64 (EM_BPF) objects, and use MaeBPF modules.

Decodes 8-byte eBPF instructions and 16-byte LD_IMM64 pairs into clean, readable disassembly output for IEx and test diagnostics.

Summary

Functions

Decodes a raw little-endian eBPF instruction binary into a list of instruction maps %{pc: int, opcode: byte, bytes: binary, text: string}.

Disassembles a raw eBPF instruction binary, an ELF64 (EM_BPF) object binary, a compilation result map containing :elf, or a use MaeBPF module atom into a formatted disassembly string.

Extracts executable program symbol slices from an ELF64 (EM_BPF) binary.

Functions

decode(code_bin)

Decodes a raw little-endian eBPF instruction binary into a list of instruction maps %{pc: int, opcode: byte, bytes: binary, text: string}.

disasm(input, opts \\ [])

Disassembles a raw eBPF instruction binary, an ELF64 (EM_BPF) object binary, a compilation result map containing :elf, or a use MaeBPF module atom into a formatted disassembly string.

Options:

  • :program - filter ELF disassembly to a specific program name (string or atom)
  • :source_map - optional instruction source map for inline comments

extract_elf_programs(elf)

Extracts executable program symbol slices from an ELF64 (EM_BPF) binary.