pub fn format_instruction(
instruction: &DisassemblyInstruction,
show_pc: bool,
) -> StringExpand description
Format a disassembly instruction as a human-readable string
This function creates a formatted string representation of an instruction, similar to what you’d see in a standard disassembler.
§Arguments
instruction- The instruction to formatshow_pc- Whether to include the program counter in the output
§Returns
A formatted string representation of the instruction
§Examples
use edb_engine::utils::disasm::{DisassemblyInstruction, format_instruction};
use revm::bytecode::opcode::OpCode;
let push_inst = DisassemblyInstruction::with_push_data(
10,
unsafe { OpCode::new_unchecked(0x61) }, // PUSH2
vec![0x12, 0x34]
);
let formatted = format_instruction(&push_inst, true);
assert!(formatted.contains("PUSH2"));
assert!(formatted.contains("0x1234"));