Context
P = ParamSpec('P')
module-attribute
¶
T = TypeVar('T')
module-attribute
¶
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_history: DefaultDict[str, List[List[str]]] = defaultdict(list)
module-attribute
¶
context_history_size = pwndbg.config.add_param('context-history-size', 50, 'number of context history entries to store')
module-attribute
¶
context_sections = {'a': context_args, 'r': context_regs, 'd': context_disasm, 's': context_stack, 'b': context_backtrace, 'c': context_code}
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
¶
log = logging.getLogger(__name__)
module-attribute
¶
output_settings: DefaultDict[str, Dict[str, Any]] = defaultdict(dict)
module-attribute
¶
outputs: Dict[str, str] = {}
module-attribute
¶
parser = argparse.ArgumentParser(description='Print out all registers and enhance the information.')
module-attribute
¶
selected_history_index: Optional[int] = None
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
¶
FileOutput
¶
StdOutput
¶
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, enabled=None)
¶
Print out the current register, instruction, and stack context.
Accepts subcommands 'reg', 'disasm', 'code', 'stack', 'backtrace', 'ghidra', 'args', 'threads', 'heap_tracker', 'expressions', and/or 'last_signal'.
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_last_signal(with_banner=True, target=sys.stdout, width=None)
¶
context_regs(target=sys.stdout, with_banner=True, width=None)
¶
context_stack(target=sys.stdout, with_banner=True, width=None)
¶
context_threads(with_banner=True, target=sys.stdout, width=None)
¶
contextnext(count)
¶
contextoutput(section, path, clearing, banner='both', width=None)
¶
contextprev(count)
¶
contextsearch(needle, section)
¶
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)
¶
history_handle_unchanged_contents()
¶
history_size_changed()
¶
output(section)
¶
Creates a context manager corresponding to configured context output
regs(regs=[])
¶
Print out all registers and enhance the information.