// An array of this frame's parameters // private VariableInformation[] m_parameters; // An array of this frame's locals // private VariableInformation[] m_locals; public AD7StackFrame(AD7Engine engine, DebuggedThread thread, SquirrelDebugContext ctx, SquirrelStackFrame squirrelsf) { m_engine = engine; m_thread = thread; sqframe = squirrelsf; this.ctx = ctx; //m_threadContext = threadContext; // Try to get source information for this location. If symbols for this file have not been found, this will fail. /*m_hasSource = m_engine.DebuggedProcess.GetSourceInformation( * m_threadContext.eip, * ref m_documentName, * ref m_functionName, * ref m_lineNum, * ref m_numParameters, * ref m_numLocals); * * // If source information is available, create the collections of locals and parameters and populate them with * // values from the debuggee. * if (m_hasSource) * { * if (m_numParameters > 0) * { * m_parameters = new VariableInformation[m_numParameters]; * m_engine.DebuggedProcess.GetFunctionArgumentsByIP(m_threadContext.eip, m_threadContext.ebp, m_parameters); * } * * if (m_numLocals > 0) * { * m_locals = new VariableInformation[m_numLocals]; * m_engine.DebuggedProcess.GetFunctionLocalsByIP(m_threadContext.eip, m_threadContext.ebp, m_locals); * } * }*/ }
internal string GetCurrentLocation() { if (sqframes.Count > 0) { SquirrelStackFrame sqsf = sqframes[0]; string ret = sqsf.Function + ":" + sqsf.Line + " [" + sqsf.Source + "]"; return(ret); } else { return("unknown"); } }
void BuildStackFrames(XmlNodeList xcalls, SquirrelDebugValue[] objstable, List <SquirrelStackFrame> frames) { int nframe = 0; foreach (XmlElement call in xcalls) { SquirrelStackFrame frame = new SquirrelStackFrame(); frame.Address = (ulong)nframe++; frame.Function = call.GetAttribute("fnc") + "()"; frame.Source = UnFixupPath(call.GetAttribute("src")); frame.Line = Convert.ToInt32(call.GetAttribute("line")); if (frame.Source != "NATIVE") { foreach (XmlNode n in call.ChildNodes) { if (n.Name == "w") { SquirrelDebugObject watch = new SquirrelDebugObject(); XmlElement loc = (XmlElement)n; watch.id = Convert.ToUInt32(loc.GetAttribute("id")); watch.Name = loc.GetAttribute("exp"); String status = loc.GetAttribute("status"); SquirrelDebugValue theval; if (status == "ok") { //String _typeof = loc.GetAttribute("typeof"); String type = loc.GetAttribute("type"); String val = loc.GetAttribute("val"); if (type == "t" || type == "a" || type == "x" || type == "y") { theval = objstable[Convert.ToInt32(val)]; } else { theval = new SquirrelDebugValue(val, UnpackType(type)); } watch.Value = theval; frame.Watches.Add(watch.Name, watch); } /*else * { * theval = new SquirrelDebugValue("<cannot evaluate>", "<cannot evaluate>"); * }*/ } if (n.Name == "l") { SquirrelDebugObject lvar = new SquirrelDebugObject(); XmlElement loc = (XmlElement)n; lvar.Name = loc.GetAttribute("name"); String type = loc.GetAttribute("type"); String val = loc.GetAttribute("val"); SquirrelDebugValue theval; if (type == "t" || type == "a" || type == "x" || type == "y") { theval = objstable[Convert.ToInt32(val)]; } else { theval = new SquirrelDebugValue(val, UnpackType(type)); } lvar.Value = theval; frame.Locals.Add(lvar); } } } frames.Add(frame); } }