Skip to content

nearpc ¤

Classes:

Functions:

Attributes:

c module-attribute ¤

c = ColorConfig(
    "nearpc",
    [
        ColorParamSpec("symbol", "normal", "color for nearpc command (symbol)"),
        ColorParamSpec(
            "address", "normal", "color for nearpc command (address)"
        ),
        ColorParamSpec(
            "prefix", "none", "color for nearpc command (prefix marker)"
        ),
        ColorParamSpec(
            "breakpoint", "red", "color for nearpc command (breakpoint marker)"
        ),
        ColorParamSpec(
            "syscall-name",
            "red",
            "color for nearpc command (resolved syscall name)",
        ),
        ColorParamSpec(
            "argument", "bold", "color for nearpc command (target argument)"
        ),
        ColorParamSpec(
            "integration-comments",
            "bold",
            "color for nearpc command (integration comments)",
        ),
        ColorParamSpec(
            "branch-marker",
            "normal",
            "color for nearpc command (branch marker line)",
        ),
    ],
)

nearpc_branch_marker module-attribute ¤

nearpc_branch_marker = add_param(
    "nearpc-branch-marker", "    ↓", "branch marker line for nearpc command"
)

nearpc_branch_marker_contiguous module-attribute ¤

nearpc_branch_marker_contiguous = add_param(
    "nearpc-branch-marker-contiguous",
    " ",
    "contiguous branch marker line for nearpc command",
)

show_args module-attribute ¤

show_args = add_param(
    "nearpc-show-args", True, "whether to show call arguments below instruction"
)

show_opcode_bytes module-attribute ¤

show_opcode_bytes = add_param(
    "nearpc-num-opcode-bytes",
    0,
    "number of opcode bytes to print for each instruction",
    param_class=PARAM_ZUINTEGER,
)

opcode_separator_bytes module-attribute ¤

opcode_separator_bytes = add_param(
    "nearpc-opcode-separator-bytes",
    1,
    "number of spaces between opcode bytes",
    param_class=PARAM_ZUINTEGER,
)

COLUMNS_ALLOCATED_FOR_BRANCH_VISUALIZATION module-attribute ¤

COLUMNS_ALLOCATED_FOR_BRANCH_VISUALIZATION = 20

TOP_LEFT_CORNER module-attribute ¤

TOP_LEFT_CORNER = '┌'

BOT_LEFT_CORNER module-attribute ¤

BOT_LEFT_CORNER = '└'

HORZ_SYMBOL module-attribute ¤

HORZ_SYMBOL = '─'

VERT_SYMBOL module-attribute ¤

VERT_SYMBOL = '│'

START_SYMBOL module-attribute ¤

START_SYMBOL = '<'

END_SYMBOL module-attribute ¤

END_SYMBOL = '>'

DOTTED_VERTICAL module-attribute ¤

DOTTED_VERTICAL = '╎'

UP_SYMBOL module-attribute ¤

UP_SYMBOL = '▲'

offset_to_color_map module-attribute ¤

offset_to_color_map = {
    0: white,
    1: red,
    2: green,
    3: purple,
    4: blue,
    5: white,
    6: yellow,
    7: light_red,
    8: light_purple,
    9: light_gray,
    10: light_green,
}

last_run_ids module-attribute ¤

last_run_ids: dict[JumpRange, int] = {}

JumpRange ¤

JumpRange(s: int, e: int)

Methods:

Attributes:

start instance-attribute ¤

start: int = s

end instance-attribute ¤

end: int = e

forward instance-attribute ¤

forward: bool = start < end

min instance-attribute ¤

min: int = min(start, end)

max instance-attribute ¤

max: int = max(start, end)

contains ¤

contains(address: int) -> bool

overlaps ¤

overlaps(other: JumpRange) -> bool

__repr__ ¤

__repr__() -> str

ljust_padding ¤

ljust_padding(lst: list[str]) -> tuple[list[str], int]

Returns (list of padded strings, max length of string)

colorize_branch_vis_line ¤

colorize_branch_vis_line(offset: int, string: str)

preprocess_branch_visualization ¤

preprocess_branch_visualization(
    instructions: list[PwndbgInstruction], repeat: bool
) -> tuple[dict[int, list[JumpRange]], dict[JumpRange, int], int]

Returns (pair_map dictionary,pair_id dictionary, maximum_pair_id)

create_branch_visualization_strings ¤

create_branch_visualization_strings(
    pair_map: dict[int, list[JumpRange]],
    pair_id: dict[JumpRange, int],
    maximum_pair_id: int,
    addr: int,
    is_first_address: bool,
) -> tuple[str, str]

Returns tuple of (string, string for empty line)

nearpc ¤

nearpc(
    pc: int | None = None,
    lines: int | None = None,
    back_lines: int = 0,
    total_lines: int | None = None,
    emulate=False,
    repeat=False,
    use_cache=False,
    linear=False,
    branch_visualization=False,
    end_address: int | None = None,
) -> list[str]

Disassemble near a specified address.

The linear argument specifies if we should disassemble linearly in memory, or take jumps into account