public static AD7StackFrame create(AD7Engine engine, AD7Thread thread, string[] frameInfo, ref bool created)
{
created = false;
if (thread.__stackFrames != null)
{
foreach (AD7StackFrame frame in thread.__stackFrames)
{
if (frame.m_documentName != null && frame.m_functionName != null)
{
if (frame.m_documentName == frameInfo[3] && frame.m_functionName == frameInfo[2]) // frameInfo[2] = func, frameInfo[3] = file
return frame;
}
}
}
else
thread.__stackFrames = new ArrayList();
AD7StackFrame newFrame = new AD7StackFrame(engine, thread, frameInfo);
if (thread.__stackFrames == null) // that's weird, but sometimes VS is not initializing __stackFrames, so I added this loop to avoid other problems.
thread.__stackFrames = new ArrayList() { newFrame };
else
thread.__stackFrames.Add(newFrame);
created = true;
return newFrame;
}