internal void OnBranch(uint aAddress, TArmInstructionSet aInstructionSet, TArmExceptionType aExceptionType, TETMBranchType aBranchType) { if (Branch != null) { ETMBranch branch = new ETMBranch(new SymAddress(aAddress), iBranchCounter, aBranchType, aInstructionSet, aExceptionType); // Try to find a symbol SymbolCollection col = null; Symbol sym = LookUpSymbol(aAddress, out col); // if (sym != null) { branch.Symbol = sym; } else if (col != null) { branch.SymbolText = string.Format("Unknown Symbol from \'{0}\'", col.FileName.FileNameInHost); } // Cascade event Branch(branch); } ++iBranchCounter; }
private void ETB_Branch(ETMBranch aBranch) { if (iCurrentStack != null) { iCurrentStack.HandleBranch(aBranch); } }
internal void HandleBranch(ETMBranch aBranch) { TETBStackEntry last = LastEntry; if (last != null) { TETBStackEntry entry = new TETBStackEntry(aBranch); // if (last.SymbolAddress == entry.SymbolAddress) { if (entry.SymbolOffset > last.SymbolOffset) { // Internal branch? E.g. if statement, or loop? } else { PushBranch(entry); } } else if (aBranch.SymbolAddressOffset == 0 && aBranch.Symbol != null) { // Guess: calling a new function PushBranch(entry); } else { bool save = true; // Check if we have branched back to an earlier function without // popping back through the call stack int count = iEntries.Count; for (int i = count - 2; i >= 0; i--) { last = iEntries[i]; if (last.SymbolAddress == entry.SymbolAddress) { if (entry.SymbolOffset > last.SymbolOffset) { // We appear to have jumped back to a calling function - so // discard later items on stack. int deleteCount = count - i - 1; iEntries.RemoveRange(i + 1, deleteCount); save = false; break; } } } if (save) { PushBranch(entry); } } } else { PushBranch(aBranch); } }
private void PushBranch(ETMBranch aBranch) { TETBStackEntry entry = new TETBStackEntry(aBranch); PushBranch(entry); }
public TETBStackEntry(ETMBranch aBranch) { iBranch = aBranch; }