//========================================= // load //========================================= public bool load(uint lineNum, Hashtable BlockAllocs) { this.Text = " line :" + lineNum; // IDictionaryEnumerator _enumerator = BlockAllocs.GetEnumerator(); while (_enumerator.MoveNext()) { BlockAlloc block = (BlockAlloc)_enumerator.Value; SymbolInfo.LookupInfo li = new SymbolInfo.LookupInfo(); string callstack = ""; string spacing = ""; for (int i = block.mContext.mBackTraceSize - 1; i >= 0; i--) { HaloWarsMem.getSymbolInfo().lookupImmediate(block.mContext.mBackTrace[i], ref li); string shortName = Path.GetFileName(li.mFilename); if (HaloWarsMem.getSymbolInfo().isIgnoreSymbol(shortName)) { continue; } string displayString = ""; if (shortName == "?") { displayString = "unkown (..)"; } else { displayString = shortName + "::" + li.mSymbol + " (line " + li.mLine + ") \n"; } listBox1.Items.Add(spacing + displayString); //if (lastNode != null) // lastNode = lastNode.Nodes.Add(displayString); //else // lastNode = tv.Nodes.Add(displayString); spacing += " "; } listBox1.Items.Add(" (" + MemoryNumber.convert(block.mBlockSize) + ")"); listBox1.Items.Add("=========================================================="); listBox1.Items.Add("=========================================================="); } return(true); }
//========================================= // allocMem //========================================= public void allocMem(uint pHeap, uint pBlock, uint blockSize, HaloWarsMem.BALContext context) { if (mAllocations.Contains(pBlock)) { GlobalErrors.addError(" LineAlloc : Multiple Allocations of block 0x" + pBlock.ToString("x") + " in heap 0x" + pHeap.ToString("x")); return; } BlockAlloc ba = new BlockAlloc(); ba.mpHeap = pHeap; ba.mpBlock = pBlock; ba.mBlockSize = blockSize; context.copyTo(ref ba.mContext); mAllocations.Add(pBlock, ba); mTotalBytes += blockSize; }
//============================================================================== // getBlockContaining //============================================================================== public BlockAlloc getBlockContaining(uint pBlock) { BlockAlloc ba = (BlockAlloc)mAllocations[pBlock]; return(ba); }