Skip to content

arch ¤

Classes:

Functions:

Attributes:

DEBUG_ENHANCEMENT module-attribute ¤

DEBUG_ENHANCEMENT = False

groups module-attribute ¤

groups = {v: _cfor (k, v) in items() if startswith('CS_GRP_')}

ops module-attribute ¤

ops = {v: _1for (k, v) in items() if startswith('CS_OP_')}

access module-attribute ¤

access = {v: _Qfor (k, v) in items() if startswith('CS_AC_')}

DO_NOT_EMULATE module-attribute ¤

DO_NOT_EMULATE = {CS_GRP_INT, CS_GRP_INVALID, CS_GRP_IRET}

DisassemblyAssistant ¤

DisassemblyAssistant(architecture: PWNDBG_SUPPORTED_ARCHITECTURES_TYPE)

Methods:

  • enhance

    Enhance the instruction - resolving branch targets, conditionals, and adding annotations

  • can_reason_about_process_state

    Determine if the program counter of the process equals the address of the instruction being enhanced.

  • dump

    Debug-only method.

Attributes:

architecture instance-attribute ¤

architecture: PWNDBG_SUPPORTED_ARCHITECTURES_TYPE = architecture

op_handlers instance-attribute ¤

op_handlers: dict[
    int, Callable[[PwndbgInstruction, EnhancedOperand, Emulator], int | None]
] = {
    CS_OP_IMM: _parse_immediate,
    CS_OP_REG: _parse_register,
    CS_OP_MEM: _parse_memory,
}

op_names instance-attribute ¤

op_names: dict[
    int, Callable[[PwndbgInstruction, EnhancedOperand], str | None]
] = {
    CS_OP_IMM: _immediate_string,
    CS_OP_REG: _register_string,
    CS_OP_MEM: _memory_string,
}

enhance ¤

enhance(instruction: PwndbgInstruction, emu: Emulator = None) -> None

Enhance the instruction - resolving branch targets, conditionals, and adding annotations

This is the only public method that should be called on this object externally.

can_reason_about_process_state ¤

can_reason_about_process_state(instruction: PwndbgInstruction) -> bool

Determine if the program counter of the process equals the address of the instruction being enhanced. If so, it means we can safely reason and read from registers and memory to enhance values that we can add to the annotation string. This becomes relevent when NOT emulating, and is meant to allow more details when the PC is at the instruction being enhanced

dump ¤

dump(instruction: PwndbgInstruction)

Debug-only method.

syntax_highlight ¤

syntax_highlight(ins)

register_assign ¤

register_assign(left: str, right: str) -> str

memory_assign ¤

memory_assign(left: str, right: str) -> str

memory_or_register_assign ¤

memory_or_register_assign(left: str, right: str, mem_assign: bool) -> str

Used when we don't know until runtime whether a codepath will annotate a register or memory location.