Documentation
¶
Index ¶
Constants ¶
const ( // MachineX86_64 is the ELF e_machine value for AMD64. MachineX86_64 = 62 // MachineAArch64 is the ELF e_machine value for AArch64. MachineAArch64 = 183 )
Variables ¶
This section is empty.
Functions ¶
func VerifyExpectations ¶
func VerifyExpectations(t *testing.T, lines []DisasmLine, expect []Expectation)
VerifyExpectations walks the objdump output and ensures each expectation is satisfied in order. Extra instructions after all expectations are ignored so padding emitted for alignment does not fail the test.
Types ¶
type DisasmLine ¶
DisasmLine represents a single instruction line emitted by objdump.
func DisassembleWithObjdump ¶
func DisassembleWithObjdump(t *testing.T, code []byte, machine uint16, extraArgs ...string) []DisasmLine
DisassembleWithObjdump wraps the provided code bytes into a minimal ELF for the supplied machine type and runs GNU objdump -d --no-show-raw-insn.
func DisassembleWithTool ¶
func DisassembleWithTool(t *testing.T, tool string, code []byte, machine uint16, args ...string) []DisasmLine
DisassembleWithTool wraps the provided code bytes into a minimal ELF for the supplied machine type and invokes the requested disassembler.
func (DisasmLine) Contains ¶
func (l DisasmLine) Contains(substr string) bool
Contains reports whether the normalized instruction text contains the provided substring.
type Expectation ¶
Expectation describes a single instruction that should appear in the disassembly output.