Exemplo n.º 1
0
 def execute_command_in_frame(self, command, frame):
     # set up evaluation context
     if frame is not None:
         self.set_selected_frame(frame)
     # evaluate
     interp = self.debugger.GetCommandInterpreter()
     result = lldb.SBCommandReturnObject()
     if '\n' not in command:
         interp.HandleCommand(to_lldb_str(command), result)
     else:
         # multiline command
         tmp_file = tempfile.NamedTemporaryFile()
         log.info('multiline command in %s', tmp_file.name)
         tmp_file.write(to_lldb_str(command))
         tmp_file.flush()
         filespec = lldb.SBFileSpec()
         filespec.SetDirectory(os.path.dirname(tmp_file.name))
         filespec.SetFilename(os.path.basename(tmp_file.name))
         context = lldb.SBExecutionContext(frame)
         options = lldb.SBCommandInterpreterRunOptions()
         interp.HandleCommandsFromFile(filespec, context, options, result)
     sys.stdout.flush()
     return result
Exemplo n.º 2
0
def evaluate(expr, unwrap=False):
    exec_context = lldb.SBExecutionContext(lldb.frame)
    value = codelldb.evaluate_in_context(expr, True, exec_context)
    return Value.unwrap(value) if unwrap else value
Exemplo n.º 3
0
def evaluate(expr):
    exec_context = lldb.SBExecutionContext(lldb.frame)
    codelldb.evaluate_in_frame(expr, True, exec_context)