Пример #1
0
def execute_in_instance(result, pycode, debugger):
    try:
        debugger = into_swig_wrapper(debugger, SBDebugger)
        eval_globals = getattr(__main__, debugger.GetInstanceName() + '_dict')
        exec(pycode, eval_globals)
        result[0] = BoolResult.Ok(True)
    except Exception as err:
        log.error(traceback.format_exc())
        error = lldb.SBError()
        error.SetErrorString(str(err))
        error = from_swig_wrapper(error, SBError)
        result[0] = BoolResult.Err(error)
    return True
Пример #2
0
def evaluate_in_context(code, simple_expr, execution_context):
    frame = execution_context.GetFrame()
    if simple_expr:
        eval_globals = {}
        eval_locals = PyEvalContext(frame)
        eval_globals['__frame_vars'] = eval_locals
    else:
        debugger = execution_context.GetTarget().GetDebugger()
        eval_globals = getattr(__main__, debugger.GetInstanceName() + '_dict')
        eval_globals['__frame_vars'] = PyEvalContext(frame)
        eval_locals = {}
        lldb.frame = frame
        lldb.thread = frame.GetThread()
        lldb.process = lldb.thread.GetProcess()
        lldb.target = lldb.process.GetTarget()
        lldb.debugger = lldb.target.GetDebugger()
    return eval(code, eval_globals, eval_locals)