private void HandleThreadFrameList(Socket socket) { // list of thread frames var frames = new List <PythonStackFrame>(); int tid = socket.ReadInt(); var thread = _threads[tid]; int frameCount = socket.ReadInt(); for (int i = 0; i < frameCount; i++) { int startLine = socket.ReadInt(); int endLine = socket.ReadInt(); int lineNo = socket.ReadInt(); string frameName = socket.ReadString(); string filename = socket.ReadString(); int argCount = socket.ReadInt(); int varCount = socket.ReadInt(); PythonEvaluationResult[] variables = new PythonEvaluationResult[varCount]; var frame = new PythonStackFrame(thread, frameName, filename, startLine, endLine, lineNo, argCount, i); for (int j = 0; j < variables.Length; j++) { string name = socket.ReadString(); variables[j] = ReadPythonObject(socket, name, "", false, frame); } frame.SetVariables(variables); frames.Add(frame); } Debug.WriteLine("Received frames for thread {0}", tid); _frames = frames; _frameEvent.Set(); }
private void HandleEnumChildren(Socket socket) { int execId = socket.ReadInt(); ChildrenInfo completion; lock (_pendingChildEnums) { completion = _pendingChildEnums[execId]; _pendingChildEnums.Remove(execId); } int childCount = socket.ReadInt(); bool childIsIndex = socket.ReadInt() == 1; PythonEvaluationResult[] res = new PythonEvaluationResult[childCount]; for (int i = 0; i < res.Length; i++) { string expr = socket.ReadString(); res[i] = ReadPythonObject(socket, completion.Text, expr, childIsIndex, completion.Frame); } completion.Completion(res); }
private bool ChildrenMatch(ChildInfo curChild, PythonEvaluationResult curReceived) { return curReceived.ChildName == curChild.ChildText && (curReceived.StringRepr == curChild.Repr || curChild.Repr == null) && (Version.Version.Is3x() || (curChild.HexRepr == null || curChild.HexRepr == curReceived.HexRepr));// __hex__ no longer used in 3.x, http://mail.python.org/pipermail/python-list/2009-September/1218287.html }
private void HandleThreadFrameList(Stream stream) { // list of thread frames var frames = new List<PythonStackFrame>(); long tid = stream.ReadInt64(); PythonThread thread; _threads.TryGetValue(tid, out thread); var threadName = stream.ReadString(); int frameCount = stream.ReadInt32(); for (int i = 0; i < frameCount; i++) { int startLine = stream.ReadInt32(); int endLine = stream.ReadInt32(); int lineNo = stream.ReadInt32(); string frameName = stream.ReadString(); string filename = stream.ReadString(); int argCount = stream.ReadInt32(); var frameKind = (FrameKind)stream.ReadInt32(); PythonStackFrame frame = null; if (thread != null) { switch (frameKind) { case FrameKind.Django: string sourceFile = stream.ReadString(); var sourceLine = stream.ReadInt32(); frame = new DjangoStackFrame(thread, frameName, filename, startLine, endLine, lineNo, argCount, i, sourceFile, sourceLine); break; default: frame = new PythonStackFrame(thread, frameName, filename, startLine, endLine, lineNo, argCount, i, frameKind); break; } } int varCount = stream.ReadInt32(); PythonEvaluationResult[] variables = new PythonEvaluationResult[varCount]; for (int j = 0; j < variables.Length; j++) { string name = stream.ReadString(); if (frame != null) { variables[j] = ReadPythonObject(stream, name, name, frame); } } if (frame != null) { frame.SetVariables(variables); frames.Add(frame); } } Debug.WriteLine("Received frames for thread {0}", tid); if (thread != null) { thread.Frames = frames; if (threadName != null) { thread.Name = threadName; } } }
private void HandleEnumChildren(Stream stream) { int execId = stream.ReadInt32(); ChildrenInfo completion; lock (_pendingChildEnums) { if (_pendingChildEnums.TryGetValue(execId, out completion)) { _pendingChildEnums.Remove(execId); _ids.Free(execId); } else { Debug.Fail("Received enum children result with unknown execution ID " + execId); } } var children = new PythonEvaluationResult[stream.ReadInt32()]; for (int i = 0; i < children.Length; i++) { string childName = stream.ReadString(); string childExpr = stream.ReadString(); children[i] = ReadPythonObject(stream, childExpr, childName, completion != null ? completion.Frame : null); } if (completion != null) { completion.Completion(children); } }
internal void SetVariables(PythonEvaluationResult[] variables) { _variables = variables; }