Skip to content

memory ¤

Functions:

  • get_address_and_symbol –

    Convert and colorize address 0x7ffff7fcecd0 to string 0x7ffff7fcecd0 (_dl_fini)

  • get_address_or_symbol –

    Convert and colorize address to symbol if it can be resolved, else return colorized address

  • attempt_colorized_symbol –

    Convert address to colorized symbol (if symbol is there), else None

  • get –

    Returns a colorized string representing the provided address.

  • legend –

Attributes:

ColorFunction module-attribute ¤

ColorFunction = Callable[[str], str]

c module-attribute ¤

c = ColorConfig(
    "memory",
    [
        ColorParamSpec("stack", "yellow", "color for stack memory"),
        ColorParamSpec("heap", "blue", "color for heap memory"),
        ColorParamSpec("code", "red", "color for executable memory"),
        ColorParamSpec("data", "purple", "color for all other writable memory"),
        ColorParamSpec("rodata", "normal", "color for all read only memory"),
        ColorParamSpec("wx", "underline", "color added to all WX memory"),
        ColorParamSpec(
            "guard", "cyan", "color added to all guard pages (no perms)"
        ),
    ],
)

get_address_and_symbol ¤

get_address_and_symbol(address: int) -> str

Convert and colorize address 0x7ffff7fcecd0 to string 0x7ffff7fcecd0 (_dl_fini) If no symbol exists for the address, return colorized address

get_address_or_symbol ¤

get_address_or_symbol(address: int) -> str

Convert and colorize address to symbol if it can be resolved, else return colorized address

attempt_colorized_symbol ¤

attempt_colorized_symbol(address: int) -> str | None

Convert address to colorized symbol (if symbol is there), else None

get ¤

get(
    address: int | Value | Any,
    text: str | None = None,
    prefix: str | None = None,
) -> str

Returns a colorized string representing the provided address.

Parameters:

  • address (int | Value | Any) –

    Address to look up

  • text (str | None, default: None ) –

    Optional text to use in place of the address in the return value string.

  • prefix (str | None, default: None ) –

    Optional text to set at beginning in the return value string.

legend ¤

legend()