This code snipped shows how easy it is to show list of threads and it's frames with details in the report
// This code snippet shows how easy it is to show list of threads and it's frames with details
public class ThreadAnalysis : iPlugType
{
public override void RunAnalysis()
{
BeginReport("Thread Analysis");
// ****************** THREAD INFO ********************
// Iterate through all threads
foreach (ThreadStack threaditem in Analyzer.ThreadStackCollection)
{
WriteHTMLLine("<b>Thread # {0}, SystemID # {1}</b>" ,
CreateBookmark(AnchorType.Thread, threaditem.ThreadID.ToString()) ,
threaditem.SystemID.ToString());
WriteDataLine("Entry point : {0}" ,
Analyzer.GetSymbolFromAddress(Analyzer.GetEntryPointForThread(threaditem.ThreadID)));
WriteDataLine("Create Time : {0} {1}" ,
threaditem.CreateTime.ToShortDateString(),
threaditem.CreateTime.ToLongTimeString());
WriteDataLine("Time spent in User Mode : {0}",threaditem.UserTimeAsString);
WriteDataLine("Time spent in Kernel Mode : {0}",threaditem.KernelTimeAsString);
WriteBlankLine();
//Iterate through all frames
WriteDataLine("Fr#.ChildEBP...ReturnAddr.Function Arguments"); // Heading
foreach (ThreadFrame frameitem in threaditem.ThreadFrameCollection)
{
WriteDataLine("{0} {1} {2} {3} {4} {5} {6} {7} {8}",
frameitem.FrameNumber.ToString("x3"),
Analyzer.GetAsHexString(frameitem.ChildEBP),
Analyzer.GetAsHexString(frameitem.ReturnAddress),
Analyzer.GetAsHexString(frameitem.arg1),
Analyzer.GetAsHexString(frameitem.arg2),
Analyzer.GetAsHexString(frameitem.arg3),
Analyzer.GetAsHexString(frameitem.arg4),
frameitem.FunctionName,
frameitem.SourceInfo
);
}
WriteBlankLine();
}
EndReport();
}
}