Esempio n. 1
0
        private void DoTestCodeSegmentResolution()
        {
            CodeSegDefinitionCollection codeSegs = new CodeSegDefinitionCollection();

            using (StringReader reader = new StringReader(KTestBigDsoDataCodeSegList))
            {
                string line = reader.ReadLine();
                while (line != null)
                {
                    CodeSegDefinition def = CodeSegDefinitionParser.ParseDefinition(line);
                    if (def != null)
                    {
                        codeSegs.Add(def);
                    }
                    line = reader.ReadLine();
                }
            }
            codeSegs.SortByAddress();

            using (DbgEngineView view = iDebugEngine.CreateView("TestView", codeSegs))
            {
                foreach (CodeSegDefinition def in codeSegs)
                {
                    SymbolCollection col = null;
                    Symbol           sym = view.Symbols.Lookup(def.Base, out col);
                    System.Diagnostics.Debug.Assert(sym != null);
                }
            }
        }
Esempio n. 2
0
 public virtual void LoadFromDefinitionCollection(CodeSegDefinitionCollection aCollection, TSynchronicity aSynchronicity)
 {
     foreach (CodeSegDefinition definition in aCollection)
     {
         LoadFromDefinition(definition, aSynchronicity);
     }
 }
Esempio n. 3
0
        private void RunObyMapViewTest()
        {
            CodeSegDefinitionCollection codeSegs = new CodeSegDefinitionCollection();

            //
            codeSegs.Add(new CodeSegDefinition(@"Z:\sys\bin\WidgetLauncher.exe", 0x7A120000, 0x7A170000));

            using (DbgEngineView view = iDebugEngine.CreateView("TestView", codeSegs))
            {
            }
        }
 protected override void HandleReadStarted()
 {
     try
     {
         // Prepare view
         CodeSegDefinitionCollection codeSegs = iDataSource.MetaData.CodeSegments;
         iDebugView = iDebugEngine.CreateView("Heap Analyser: " + iDataSource.ThreadName, codeSegs);
     }
     finally
     {
         base.HandleReadStarted();
     }
 }
Esempio n. 5
0
        public CodeSegDefinitionCollection GetCodeSegDefinitions()
        {
            CodeSegDefinitionCollection ret = new CodeSegDefinitionCollection();

            //
            foreach (ProcessCodeSeg codeSeg in CodeSegments)
            {
                CodeSegDefinition codeSegDef = new CodeSegDefinition();
                codeSegDef.Set(codeSeg.ProcessLocalRunAddress, codeSeg.ProcessLocalRunAddressEnd);
                codeSegDef.FileName = codeSeg.FileName;
                ret.Add(codeSegDef);
            }
            //
            return(ret);
        }
Esempio n. 6
0
 internal DbgEngineView(DbgEngine aEngine, string aName, CodeSegDefinitionCollection aCodeSegments, TDbgViewDeactivationType aDeactivationType)
 {
     iName             = aName;
     iEngine           = aEngine;
     iDeactivationType = aDeactivationType;
     iCodeSegments     = new CodeSegDefinitionCollection(aCodeSegments);
     //
     iViewCode = (DbgViewCode)EngineCode.CreateView(iName);
     if (iViewCode != null)
     {
         iViewCode.Activate(aCodeSegments);
     }
     //
     iViewSymbols = (DbgViewSymbol)EngineSymbols.CreateView(iName);
     if (iViewSymbols != null)
     {
         iViewSymbols.Activate(aCodeSegments);
     }
 }
Esempio n. 7
0
        private void TestBigDsoData()
        {
            Clear();
            iDebugEngine.Add(@"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\CoreImage\RM505_widgetui_rheap_rnd_rofs1.symbol");
            iDebugEngine.Prime(SymbianUtils.TSynchronicity.ESynchronous);

            CodeSegDefinitionCollection codeSegs = new CodeSegDefinitionCollection();

            using (StringReader reader = new StringReader(KTestBigDsoDataCodeSegList))
            {
                string line = reader.ReadLine();
                while (line != null)
                {
                    CodeSegDefinition def = CodeSegDefinitionParser.ParseDefinition(line);
                    if (def != null)
                    {
                        codeSegs.Add(def);
                    }
                    line = reader.ReadLine();
                }
            }

            using (DbgEngineView view = iDebugEngine.CreateView("TestView", codeSegs))
            {
                // MemMan.dll contains a dodgy symbol:
                //
                // 000031b4    0000    Image$$ER_RO$$Limit                       anon$$obj.o(linker$$defined$$symbols)
                // 003f8024    0004    __dso_handle                              ucppfini.o(.data)
                SymbolCollection colMemManDll = view.Symbols.CollectionByAddress(0x79E18000);
                System.Diagnostics.Debug.Assert(colMemManDll != null);

                // Verify it doesn't include the big dso object
                Symbol bigDsoData = FindByName("__dso_handle", colMemManDll);
                System.Diagnostics.Debug.Assert(bigDsoData == null);

                // Widget engine would otherwise overlap with memman.dll
                SymbolCollection colWidgetEngineDll = view.Symbols.CollectionByAddress(0x7A0C0000);
                System.Diagnostics.Debug.Assert(colMemManDll != null);

                // Check no overlaps
                CheckNoOverlaps(colMemManDll, colWidgetEngineDll);
            }
        }
Esempio n. 8
0
        public void LoadDynamicCodeSegments(CodeSegDefinitionCollection aCodeSegments, TSynchronicity aSynchronicity)
        {
            // Unload any pre-existing dynamically loaded content
            ROFSEngine.UnloadAll();

            // We must attempt to dynamically load all the code segements listed.
            // For codesegments that we have no corresponding collection for, we'll allow
            // a stub codesegment to be created in the ROFS engine - this ensures we
            // at least show the codesegment name (though not function addresses) when we
            // encounter an unrecognised address within the codesegment address space.
            //
            // For everything else, we load it (if it exists) or then if it's already been
            // loaded by the CORE ROM symbol file, we ignore the request.

            // These are the code segs that we'll eventually push through to the
            // ROFS engine.
            CodeSegDefinitionCollection codeSegsToAttemptToLoad = new CodeSegDefinitionCollection();

            // First pass - identify which code seg entries we already have loaded.
            foreach (CodeSegDefinition def in aCodeSegments)
            {
                // Check if there is already a valid definition for this entry in
                // the CORE ROM symbol table. If there is, the we don't need to do
                // anything.
                bool loaded = ROMEngine.IsLoaded(def);
                if (!loaded)
                {
                    Trace("SymbolManager.LoadDynamicCodeSegments() - will attempt to load: " + def);
                    codeSegsToAttemptToLoad.Add(def);
                }
                else
                {
                    Trace("SymbolManager.LoadDynamicCodeSegments() - not loading XIP code seg: " + def);
                }
            }

            // Now, we have a ratified list that contains only code segments that weren't already managed
            // by the CORE ROM engine.
            ROFSEngine.LoadFromDefinitionCollection(codeSegsToAttemptToLoad, aSynchronicity);
        }
Esempio n. 9
0
        public DbgEngineView CreateView(string aName, CodeSegDefinitionCollection aCodeSegments, TDbgViewDeactivationType aDeactivationType)
        {
            DbgEngineView ret = new DbgEngineView(this, aName, aCodeSegments, aDeactivationType);

            return(ret);
        }
Esempio n. 10
0
 public DbgEngineView CreateView(string aName, CodeSegDefinitionCollection aCodeSegments)
 {
     return(CreateView(aName, aCodeSegments, TDbgViewDeactivationType.EDoNothing));
 }
Esempio n. 11
0
        private void DoTestHeapCellSymbolLookup()
        {
            CodeSegDefinitionCollection codeSegs = new CodeSegDefinitionCollection();

            using (StringReader reader = new StringReader(KTestBigDsoDataCodeSegList))
            {
                string line = reader.ReadLine();
                while (line != null)
                {
                    CodeSegDefinition def = CodeSegDefinitionParser.ParseDefinition(line);
                    if (def != null)
                    {
                        codeSegs.Add(def);
                    }
                    line = reader.ReadLine();
                }
            }
            codeSegs.SortByAddress();

            using (DbgEngineView view = iDebugEngine.CreateView("TestView", codeSegs))
            {
                foreach (TSymLookupEntry entry in TSymLookupEntry.KHeapSymbols)
                {
                    SymbolCollection col = null;
                    Symbol           sym = view.Symbols.Lookup(entry.iAddress, out col);
                    //
                    if (sym != null)
                    {
                        string name = sym.Name;
                        System.Diagnostics.Debug.Assert(entry.iSymbol == name);
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(entry.iSymbol == string.Empty);
                    }
                    //
                    if (col != null)
                    {
                        string name  = entry.iCollection.ToUpper();
                        bool   match = col.FileName.Contains(name);
                        System.Diagnostics.Debug.Assert(match);
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(entry.iCollection == string.Empty);
                    }
                    //
                    CodeSegDefinition def = codeSegs[entry.iAddress];
                    if (def != null)
                    {
                        if (entry.iSymbol == string.Empty)
                        {
                            // The original SymbolLib didn't find a symbolic match. It's okay
                            // if we did (or didn't) find a match using SymbianSymbolLib.
                        }
                        else if (entry.iSymbol != string.Empty)
                        {
                            // SymbolLib found a match, SymbianSymbolLib must do too.
                            System.Diagnostics.Debug.Assert(sym != null);
                        }
                        if (col == null)
                        {
                            // We didn't find a symbol collection for the specified address
                            // even though it falls within code segment range. Print a warning
                            // as this may be caused by dodgy symbol file content.
                            System.Diagnostics.Debug.WriteLine(string.Format(@"WARNING: couldn't find symbol for: 0x{0:x8}, offset: 0x{1:x8}, even though code seg match was found: {2}",
                                                                             entry.iAddress,
                                                                             entry.iAddress - def.Base,
                                                                             def));
                        }
                    }
                }
            }
        }
 public CIElementFinalizationParameters(CIEngine aEngine, string aName, CodeSegDefinitionCollection aCodeSegments)
 {
     iEngine          = aEngine;
     iDebugEngineView = aEngine.DebugEngine.CreateView(aName, aCodeSegments);
 }