void SetFirstStackBytesStartingAddress(ParserField aField, uint aValue) { ThreadStackInfo stackInfo = (ThreadStackInfo)aField.Tag; ThreadStackData stackData = stackInfo.Data; stackData.SetStartingAddress(aValue); }
private ParserParagraph PrepareSupervisorStack(ThreadStackInfo aStackInfo) { ParserParagraph para = new ParserParagraph("STACK_SUPERVISOR"); // ParserLine l1 = ParserLine.NewSymFormat("Supervisor stack base at %08x, size == %x\r\n"); l1.ElementComplete += new ParserElementBase.ElementCompleteHandler(DisableUserStackParagraph); l1.SetTargetProperties(aStackInfo, "BaseAddress", "Size"); // ParserLine l2 = ParserLine.NewSymFormat("Stack pointer == %08x\r\n"); l2.SetTargetProperties(aStackInfo, "StackPointer"); // Collect the raw stack bytes ParserLine l3 = ParserLine.NewSymFormat("%08x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x"); l3.IsNeverEnding = true; l3.DisableWhenComplete = false; l3.SetTargetMethod(aStackInfo.Data, "Add"); // Record the starting address of the stack data l3[0].SetTargetMethod(this, "SetFirstStackBytesStartingAddress"); l3[0].Tag = aStackInfo; // para.Add(l1, l2, l3); return(para); }
private ParserParagraph PrepareUserStack(ThreadStackInfo aStackInfo) { ParserParagraph para = new ParserParagraph(KParagraphUser); // ParserLine l0 = ParserLine.New("No user-mode stack"); l0.ElementComplete += new ParserElementBase.ElementCompleteHandler(NoUserStackCallBack); // ParserLine l1 = ParserLine.NewSymFormat("User stack base at %08x, size == %x\r\n"); l1.SetTargetProperties(aStackInfo, "BaseAddress", "Size"); // ParserLine l2 = ParserLine.NewSymFormat("Stack pointer == %08x\r\n"); l2.SetTargetProperties(aStackInfo, "StackPointer"); // // Not needed - ParserLine l3 = ParserLine.NewSymFormat( "Stack mapped at %08x\r\n" ); //l3.SetTargetProperties( aStackInfo.Data, "MappedAddress" ); // Collect the raw stack bytes ParserLine l4 = ParserLine.NewSymFormat("%08x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x"); l4.IsNeverEnding = true; l4.DisableWhenComplete = false; l4.SetTargetMethod(aStackInfo.Data, "Add"); // Record the starting address of the stack data l4[0].SetTargetMethod(this, "SetFirstStackBytesStartingAddress"); l4[0].Tag = aStackInfo; // para.Add(l0, l1, l2, l4); return(para); }
private void ProcessFunctionCall(ThreadStackInfo thread, StackFrame call, IReadOnlyList <StackSampleFrame> frames, int index) { while (true) { if (index >= frames.Count) { thread.TopFunctionCall = call; return; } var frame = frames[index]; var child = new StackFrame { Parent = call, FunctionIntId = frame.InternalId, Ip = frame.Ip }; call = child; index = index + 1; } }
private bool UpdateCallTree(StackSample arg, ThreadStackInfo thread) { var lastFunctionCall = thread.TopFunctionCall; if (arg.MatchPrefixSize == 0) //Empty stack { lastFunctionCall = thread.RootFunctionCall; } else //Unwind stack till last unchanged frame { var depth = arg.StackSize - arg.MatchPrefixSize; while (lastFunctionCall != null && depth > 0) { lastFunctionCall = lastFunctionCall.Parent; depth--; } if (lastFunctionCall == null) { //Something's gone wrong return(true); } thread.TopFunctionCall = lastFunctionCall; } //Ip has changed if (arg.Ip.HasValue) { lastFunctionCall.Ip = arg.Ip; } ProcessFunctionCall(thread, lastFunctionCall, arg.Frames, 0); return(false); }