Skip to content

cache ¤

Caches return values until some event in the inferior happens, e.g. execution stops because of a SIGINT or breakpoint, or a new library/objfile are loaded, etc.

Classes:

Functions:

Attributes:

T module-attribute ¤

T = TypeVar('T', covariant=True)

P module-attribute ¤

P = ParamSpec('P')

debug module-attribute ¤

debug = NO_DEBUG

debug_name module-attribute ¤

debug_name = 'regs'

Cache module-attribute ¤

Cache = Union[Dict[Tuple[Any, ...], Any], DebugCacheDict]

EventSet module-attribute ¤

EventSet = int

IS_CACHING module-attribute ¤

IS_CACHING = True

IS_CACHING_DISABLED_FOR module-attribute ¤

IS_CACHING_DISABLED_FOR: EventSet = 0

DebugCacheDict ¤

DebugCacheDict(func: Callable[P, T], *args: Any, **kwargs: Any)

Bases: UserDict

Methods:

Attributes:

hits instance-attribute ¤

hits = 0

misses instance-attribute ¤

misses = 0

func instance-attribute ¤

func = func

name instance-attribute ¤

name = f'{split('.')[-1]}.{__name__}'

__getitem__ ¤

__getitem__(key: tuple[Any, ...]) -> Any

__setitem__ ¤

__setitem__(key: tuple[Any, ...], value: Any) -> None

clear ¤

clear() -> None

CachedFunction ¤

Bases: Protocol[T]

Methods:

Attributes:

cache instance-attribute ¤

cache: Cache

__call__ ¤

__call__(*args: Any, **kwargs: Any) -> T

CacheUntilEvent ¤

Bases: IntFlag

Not necessarily 1:1 with pwndbg.dbg_mod.EventTypes , but read the definition of that enum to get an idea of how these work.

Notably, STOP is also triggered when the user changes debugee memory or register state.

Attributes:

STOP class-attribute instance-attribute ¤

STOP = 1

EXIT class-attribute instance-attribute ¤

EXIT = 2

OBJFILE class-attribute instance-attribute ¤

OBJFILE = 4

START class-attribute instance-attribute ¤

START = 8

CONT class-attribute instance-attribute ¤

CONT = 16

THREAD class-attribute instance-attribute ¤

THREAD = 32

FOREVER class-attribute instance-attribute ¤

FOREVER = 64

events_to_event_set ¤

events_to_event_set(event_list: list[CacheUntilEvent]) -> EventSet

connect_clear_caching_events ¤

connect_clear_caching_events(
    event_dicts: dict[CacheUntilEvent, tuple[Any, ...]],
) -> None

Connect given debugger event hooks to corresponding _CacheUntilEvent instances

cache_until ¤

cache_until(
    *event_names: str,
) -> Callable[[Callable[P, T]], CachedFunction[T]]

All possible values of the function arguments must be hashable (so e.g. var: MyUnhashableType | None = None is not allowed, but may fail rarely). The return value of the function should not be mutable, must not be mutated.

clear_caches ¤

clear_caches() -> None

clear_cache ¤

clear_cache(cache_event: CacheUntilEvent) -> None