def internal_evaluate_expression(dbg, seq, thread_id, frame_id, expression, is_exec, trim_if_too_big, attr_to_set_result): ''' gets the value of a variable ''' try: result = pydevd_vars.evaluate_expression(dbg, thread_id, frame_id, expression, is_exec) if attr_to_set_result != "": pydevd_vars.change_attr_expression(thread_id, frame_id, attr_to_set_result, expression, dbg, result) xml = "<xml>" xml += pydevd_xml.var_to_xml(result, expression, trim_if_too_big) xml += "</xml>" cmd = dbg.cmd_factory.make_evaluate_expression_message(seq, xml) dbg.writer.add_command(cmd) except: exc = get_exception_traceback_str() cmd = dbg.cmd_factory.make_error_message(seq, "Error evaluating expression " + exc) dbg.writer.add_command(cmd)
def do_it(self, dbg): ''' Converts request into python variable ''' try: result = pydevd_vars.change_attr_expression(self.thread_id, self.frame_id, self.attr, self.expression, dbg) xml = "<xml>" xml += pydevd_xml.var_to_xml(result, "") xml += "</xml>" cmd = dbg.cmd_factory.make_variable_changed_message(self.sequence, xml) dbg.writer.add_command(cmd) except Exception: cmd = dbg.cmd_factory.make_error_message(self.sequence, "Error changing variable attr:%s expression:%s traceback:%s" % (self.attr, self.expression, get_exception_traceback_str())) dbg.writer.add_command(cmd)
def change_variable(self, name, value, py_db, fmt=None): frame = self.frame pydevd_vars.change_attr_expression(frame, name, value, py_db) return self.get_child_variable_named(name, fmt=fmt)