Skip to content

Chain

LIMIT = pwndbg.config.add_param('dereference-limit', 5, 'max number of pointers to dereference in a chain') module-attribute

c = ColorConfig('chain', [ColorParamSpec('arrow', 'normal', 'color of chain formatting (arrow)'), ColorParamSpec('contiguous-marker', 'normal', 'color of chain formatting (contiguous marker)')]) module-attribute

config_arrow_left = theme.add_param('chain-arrow-left', '◂—', 'left arrow of chain formatting') module-attribute

config_arrow_right = theme.add_param('chain-arrow-right', '—▸', 'right arrow of chain formatting') module-attribute

config_contiguous = theme.add_param('chain-contiguous-marker', '...', 'contiguous marker of chain formatting') module-attribute

format(value, limit=LIMIT, code=True, offset=0, hard_stop=None, hard_end=0, safe_linking=False, enhance_string_len=None)

Recursively dereferences an address into string representation, or convert the list representation of address dereferences into string representation.

Parameters:

Name Type Description Default
value(int|list)

Either the starting address to be sent to get, or the result of get (a list)

required
limit(int)

Number of valid pointers

required
code(bool)

Hint that indicates the value may be an instruction

required
offset(int)

Offset into the address to get the next pointer

required
hard_stop(int)

Value to stop on

required
hard_end int

Value to append when hard_stop is reached: null, value of hard stop, a string.

0
safe_linking(bool)

whether this chain use safe-linking

required
enhance_string_len(int)

The length of string to display for enhancement of the last pointer

required

Returns: A string representing pointers of each address and reference Strings format: 0x0804a10 —▸ 0x08061000 ◂— 0x41414141

get(address, limit=LIMIT, offset=0, hard_stop=None, hard_end=0, include_start=True, safe_linking=False)

Recursively dereferences an address. For bare metal, it will stop when the address is not in any of vmmap pages to avoid redundant dereference.

Parameters:

Name Type Description Default
address(int)

the first address to begin dereferencing

required
limit(int)

number of valid pointers

required
offset(int)

offset into the address to get the next pointer

required
hard_stop(int)

address to stop at

required
hard_end int

value to append when hard_stop is reached

0
include_start(bool)

whether to include starting address or not

required
safe_linking(bool)

whether this chain use safe-linking

required

Returns:

Type Description
List[int] | None

A list representing pointers of each address and reference