예제 #1
0
        //=========================================
        // allocMem
        //=========================================
        public void allocMem(uint pHeap, uint pBlock, uint blockSize, HaloWarsMem.BALContext context)
        {
            SymbolInfo.LookupInfo li = new SymbolInfo.LookupInfo();

            for (int i = 0; i < context.mBackTraceSize; i++)
            {
                HaloWarsMem.getSymbolInfo().lookup(context.mBackTrace[i], ref li);
                if (HaloWarsMem.getSymbolInfo().isIgnoreSymbol(Path.GetFileName(li.mFilename)))
                {
                    continue;
                }

                if (mBlockToFile.Contains(pBlock))
                {
                    GlobalErrors.addError("HeapAlloc : Multiple Allocations of block 0x" + pBlock.ToString("x") + " in heap 0x" + pHeap.ToString("x"));
                    return;
                }

                FileAlloc fa = (FileAlloc)mAllocations[li.mFilename];
                if (fa == null)
                {
                    fa = new FileAlloc(li.mFilename);
                    mAllocations.Add(li.mFilename, fa);
                }

                mBlockToFile.Add(pBlock, li.mFilename);
                fa.allocMem(pHeap, pBlock, blockSize, (uint)li.mLine, context);


                break;
            }

            mNumNews++;
        }
예제 #2
0
        //=========================================
        // 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);
        }
예제 #3
0
        //============================================================================
        // onClientConnected
        //============================================================================
        public void onClientConnected(string name, string pdbFilename)
        {
            AllocStats.clearHeaps();


            LoadSymbolsParams lsp = new LoadSymbolsParams();

            lsp.mProcHandle     = 0x00ABBEEF;  // Process.GetCurrentProcess().Id;
            lsp.mSymbolFileName = pdbFilename; //string sName = @"C:\depot\phoenix\xbox\code\xgame\xbox\debug\xgameD.exe";

            //since this takes so long, spend display a 'wait' bar to the user..
            {
                mSymbolProcEvent.Reset();

                BackgroundWorker mWorkerThread = new BackgroundWorker();
                mWorkerThread.WorkerReportsProgress = false;
                //mWorkerThread.ProgressChanged += bw_ProgressChanged;
                mWorkerThread.WorkerSupportsCancellation = false;
                //mWorkerThread.RunWorkerCompleted += bw_RunWorkerCompleted;
                mWorkerThread.DoWork += bw_DoWork;
                mWorkerThread.RunWorkerAsync(lsp);

                HaloWarsMem.loadSymbolInfo((uint)lsp.mProcHandle, lsp.mSymbolFileName);

                mSymbolProcEvent.Set();
            }
            AllocLogStream.unpauseProcessing();


            heapLines.onConnect();
            heapKey.onConnect();
            heapFileView.onConnect();
            topAllocs.onConnect();
            mFileTimelines.onConnect();
            mFileGroupings.onConnect();
        }
예제 #4
0
        //============================================================================
        // onMessageRecieved
        //============================================================================
        public void onMessageRecieved(PacketWrapper packet)
        {
            HaloWarsMem.eALPacketType type = (HaloWarsMem.eALPacketType)packet.mPacketType;

            switch (type)
            {
            //================================================
            case HaloWarsMem.eALPacketType.cALNew:
            {
                HaloWarsMem.BALPacketNew pkt = new HaloWarsMem.BALPacketNew(packet.mPacketSize, packet.mPacketData);

                HeapAlloc pHeap = AllocStats.getHeapFromBasePtr(pkt.mpHeap);
                if (pHeap == null)
                {
                    return;
                }

                pHeap.allocMem(pkt.mSize, pkt.mpBlock, pkt.mBlockSize, pkt.mContext);

                //pass on
                mFileGroupings.onNew(pkt.mpHeap, pkt.mSize, pkt.mpBlock, pkt.mBlockSize, pkt.mContext);
                break;
            }

            //================================================
            case HaloWarsMem.eALPacketType.cALResize:
            {
                HaloWarsMem.BALPacketResize pkt = new HaloWarsMem.BALPacketResize(packet.mPacketSize, packet.mPacketData);

                HeapAlloc pHeap = AllocStats.getHeapFromBasePtr(pkt.mpHeap);
                if (pHeap == null)
                {
                    return;
                }


                //pass on
                mFileGroupings.onResize(pkt.mpHeap, pkt.mpOrigBlock, pkt.mNewSize, pkt.mpNewBlock, pkt.mContext);


                //this needs to be done last
                pHeap.resizeMem(pkt.mpOrigBlock, pkt.mNewSize, pkt.mpNewBlock, pkt.mContext);



                break;
            }

            //================================================
            case HaloWarsMem.eALPacketType.cALDelete:
            {
                HaloWarsMem.BALPacketDelete pkt = new HaloWarsMem.BALPacketDelete(packet.mPacketSize, packet.mPacketData);

                HeapAlloc pHeap = AllocStats.getHeapFromBasePtr(pkt.mpHeap);
                if (pHeap == null)
                {
                    return;
                }


                //pass on
                mFileGroupings.onDelete(pkt.mpHeap, pkt.mpBlock, pkt.mContext);
                //need to pass on before deletion to ensure any queries occur
                pHeap.deleteMem(pkt.mpBlock, pkt.mContext);


                break;
            }

            //================================================
            case HaloWarsMem.eALPacketType.cALRegisterHeap:
            {
                HaloWarsMem.BALPacketRegisterHeap pkt = new HaloWarsMem.BALPacketRegisterHeap(packet.mPacketSize, packet.mPacketData);

                AllocStats.registerHeap(pkt);

                //propagate to those that care..
                heapLines.onHeapRegister(pkt.mPtr, pkt.mFlags, pkt.mName);
                heapFileView.onHeapRegister(pkt.mPtr, pkt.mFlags, pkt.mName);
                break;
            }

            //================================================
            case HaloWarsMem.eALPacketType.cALIgnoreLeaf:
            {
                HaloWarsMem.BALPacketIgnoreLeaf pkt = new HaloWarsMem.BALPacketIgnoreLeaf(packet.mPacketSize, packet.mPacketData);
                HaloWarsMem.getSymbolInfo().addIgnoreSymbol(pkt.mSymbolName);

                break;
            }

            case HaloWarsMem.eALPacketType.cALEOF:
            {
                heapLines.onDisconnect();
                heapKey.onDisconnect();
                topAllocs.onDisconnect();
                heapFileView.onDisconnect();
                mFileTimelines.onDisconnect();
                mFileGroupings.onDisconnect();
                break;
            }
            }
            ;
        }