Skip to content

Context

backtrace_frame_label = theme.add_param('backtrace-frame-label', '', 'frame number label for backtrace') module-attribute

backtrace_lines = pwndbg.config.add_param('context-backtrace-lines', 8, 'number of lines to print in the backtrace context') module-attribute

banner_arg = parser.add_argument('banner', type=str, nargs='?', default='both', help='Where a banner should be placed: both, top , bottom, none') module-attribute

c = ColorConfig('backtrace', [ColorParamSpec('prefix', 'none', 'color for prefix of current backtrace label'), ColorParamSpec('address', 'none', 'color for backtrace (address)'), ColorParamSpec('symbol', 'none', 'color for backtrace (symbol)'), ColorParamSpec('frame-label', 'none', 'color for backtrace (frame label)')]) module-attribute

config_clear_screen = pwndbg.config.add_param('context-clear-screen', False, 'whether to clear the screen before printing the context') module-attribute

config_context_ghidra = pwndbg.config.add_param('context-ghidra', 'never', 'when to try to decompile the current function with ghidra (slow and requires radare2/r2pipe or rizin/rzpipe) (valid values: always, never, if-no-source)') module-attribute

config_context_sections = pwndbg.config.add_param('context-sections', 'regs disasm code ghidra stack backtrace expressions threads heap-tracker', 'which context sections are displayed (controls order)') module-attribute

config_max_threads_display = pwndbg.config.add_param('context-max-threads', 4, 'maximum number of threads displayed by the context command') module-attribute

config_output = pwndbg.config.add_param('context-output', 'stdout', 'where pwndbg should output ("stdout" or file/tty).') module-attribute

context_sections = {'r': context_regs, 'd': context_disasm, 'a': context_args, 'c': context_code, 's': context_stack, 'b': context_backtrace, 'e': context_expressions, 'g': context_ghidra, 'h': context_heap_tracker, 't': context_threads} module-attribute

disasm_lines = pwndbg.config.add_param('context-disasm-lines', 10, 'number of additional lines to print in the disasm context') module-attribute

expressions = [] module-attribute

last_signal: List[str] = [] module-attribute

output_settings = {} module-attribute

outputs: Dict[str, str] = {} module-attribute

parser = argparse.ArgumentParser(description='Print out all registers and enhance the information.') module-attribute

should_decompile = pwndbg.config.add_param('context-integration-decompile', True, 'whether context should fall back to decompilation with no source code') module-attribute

source_disasm_lines = pwndbg.config.add_param('context-code-lines', 10, 'number of source code lines to print by the context command') module-attribute

stack_lines = pwndbg.config.add_param('context-stack-lines', 8, 'number of lines to print in the stack context') module-attribute

thread_status_messages = {'running': pwndbg.color.light_green('running'), 'stopped': pwndbg.color.yellow('stopped'), 'exited': pwndbg.color.gray('exited ')} module-attribute

CallOutput

A context manager which calls a function on write

func = func instance-attribute

__enter__()

__eq__(other)

__exit__(*args, **kwargs)

__hash__()

__init__(func)

flush()

isatty()

write(data)

FileOutput

A context manager wrapper to reopen files on enter

args = args instance-attribute

handle = None instance-attribute

__enter__()

__eq__(other)

__exit__(*args, **kwargs)

__hash__()

__init__(*args)

StdOutput

A context manager wrapper to give stdout

__enter__()

__eq__(other)

__exit__(*args, **kwargs)

__hash__()

calculate_padding_to_align(length, align)

Calculates the number of spaces to append to reach the next alignment. The next alignment point is given by "x * align >= length".

clear_screen(out=sys.stdout)

Clear the screen by moving the cursor to top-left corner and clearing the content. Different terminals may act differently

compact_regs(regs, width=None, target=sys.stdout)

context(subcontext=None)

Print out the current register, instruction, and stack context.

Accepts subcommands 'reg', 'disasm', 'code', 'stack', 'backtrace', 'ghidra' and 'args'.

context_args(with_banner=True, target=sys.stdout, width=None)

context_backtrace(with_banner=True, target=sys.stdout, width=None)

context_code(target=sys.stdout, with_banner=True, width=None)

context_disasm(target=sys.stdout, with_banner=True, width=None)

context_expressions(target=sys.stdout, with_banner=True, width=None)

context_ghidra(target=sys.stdout, with_banner=True, width=None)

Print out the source of the current function decompiled by ghidra.

The context-ghidra config parameter is used to configure whether to always, never or only show the context if no source is available.

context_heap_tracker(target=sys.stdout, with_banner=True, width=None)

context_regs(target=sys.stdout, with_banner=True, width=None)

context_signal()

context_stack(target=sys.stdout, with_banner=True, width=None)

context_threads(with_banner=True, target=sys.stdout, width=None)

contextoutput(section, path, clearing, banner='both', width=None)

contextunwatch(num)

contextwatch(expression, cmd)

get_filename_and_formatted_source()

Returns formatted, lines limited and highlighted source as list or if it isn't there - an empty list

get_highlight_source(filename)

get_regs(regs=None)

get_thread_status(thread)

output(section)

Creates a context manager corresponding to configured context output

regs(regs=[])

Print out all registers and enhance the information.

save_signal(signal)

validate_context_sections()