(subcontext=None)
Print out the current register, instruction, and stack context.

    Accepts subcommands 'reg', 'disasm', 'code', 'stack', 'backtrace', 'ghidra' and 'args'.
Print out the current register, instruction, and stack context.
Print out the current register instruction and stack context .
def context(subcontext=None):
    """
    Print out the current register, instruction, and stack context.

    Accepts subcommands 'reg', 'disasm', 'code', 'stack', 'backtrace', 'ghidra' and 'args'.
    """
    if subcontext is None:
        subcontext = []
    args = subcontext

    if len(args) == 0:
        args = config_context_sections.split()

    sections = [("legend", lambda target=None, **kwargs: [M.legend()])] if args else []
    sections += [(arg, context_sections.get(arg[0], None)) for arg in args]

    result = defaultdict(list)
    result_settings = defaultdict(dict)
    for section, func in sections:
        if func:
            target = output(section)
            # Last section of an output decides about output settings
            settings = output_settings.get(section, {})
            result_settings[target].update(settings)
            with target as out:
                result[target].extend(func(target=out,
                                           width=settings.get("width", None),
                                           with_banner=settings.get("banner_top", True)))

    for target, res in result.items():
        settings = result_settings[target]
        if len(res) > 0 and settings.get("banner_bottom", True):
            with target as out:
                res.append(pwndbg.ui.banner("", target=out,
                                            width=settings.get("width", None)))

    for target, lines in result.items():
        with target as out:
            if result_settings[target].get("clearing", config_clear_screen) and lines:
                clear_screen(out)
            out.write("\n".join(lines))
            if out is sys.stdout:
                out.write('\n')
            out.flush()
def context ( subcontext = None ) : if subcontext is None : subcontext = [ ] args = subcontext if len ( args ) == 0 : args = config_context_sections . split ( ) sections = [ ( "legend" , lambda target = None , * * kwargs : [ M . legend ( ) ] ) ] if args else [ ] sections += [ ( arg , context_sections . get ( arg [ 0 ] , None ) ) for arg in args ] result = defaultdict ( list ) result_settings = defaultdict ( dict ) for section , func in sections : if func : target = output ( section ) # Last section of an output decides about output settings settings = output_settings . get ( section , { } ) result_settings [ target ] . update ( settings ) with target as out : result [ target ] . extend ( func ( target = out , width = settings . get ( "width" , None ) , with_banner = settings . get ( "banner_top" , True ) ) ) for target , res in result . items ( ) : settings = result_settings [ target ] if len ( res ) > 0 and settings . get ( "banner_bottom" , True ) : with target as out : res . append ( pwndbg . ui . banner ( "" , target = out , width = settings . get ( "width" , None ) ) ) for target , lines in result . items ( ) : with target as out : if result_settings [ target ] . get ( "clearing" , config_clear_screen ) and lines : clear_screen ( out ) out . write ( "\n" . join ( lines ) ) if out is sys . stdout : out . write ( '\n' ) out . flush ( )