crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianSymbolLib/Tests/SymbianSymbolLibTest/TestCode.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 using System;
       
    18 using System.IO;
       
    19 using System.Collections.Generic;
       
    20 using System.Text;
       
    21 using System.Threading;
       
    22 using SymbianUtils;
       
    23 using SymbianUtils.Range;
       
    24 using SymbianUtils.Tracer;
       
    25 using SymbianStructuresLib.CodeSegments;
       
    26 using SymbianStructuresLib.Debug.Symbols;
       
    27 using SymbianDebugLib.Engine;
       
    28 using SymbianDebugLib.Entity;
       
    29 using SymbianDebugLib.PluginAPI;
       
    30 using SymbianDebugLib.PluginAPI.Types;
       
    31 using SymbianDebugLib.PluginAPI.Types.Symbols;
       
    32 
       
    33 
       
    34 namespace SymbianSymbolLibTest
       
    35 {
       
    36     class TestCode : DisposableObject, ITracer
       
    37     {
       
    38         #region Constructors
       
    39         public TestCode()
       
    40         {
       
    41             iDebugEngine = new DbgEngine( this );
       
    42             iDebugEngine.UiMode = SymbianDebugLib.TDbgUiMode.EUiDisabled;
       
    43             iDebugEngine.EntityPrimingStarted += new DbgEngine.EventHandler( DebugEngine_EntityPrimingStarted );
       
    44             iDebugEngine.EntityPrimingProgress += new DbgEngine.EventHandler( DebugEngine_EntityPrimingProgress );
       
    45             iDebugEngine.EntityPrimingComplete += new DbgEngine.EventHandler( DebugEngine_EntityPrimingComplete );
       
    46         }
       
    47         #endregion
       
    48 
       
    49         #region API
       
    50         public void Clear()
       
    51         {
       
    52             iDebugEngine.Clear();
       
    53         }
       
    54 
       
    55         public void RunTests()
       
    56         {
       
    57             TestUDACode();
       
    58             TestCodeSegmentResolutionOBY();
       
    59             TestOBY();
       
    60             TestBigMapFile();
       
    61             TestCodeSegmentResolutionROFS();
       
    62             TestMapRVCT();
       
    63             TestMapGCCE();
       
    64             TestBigDsoData();
       
    65             TestZipMapFiles();
       
    66             TestHeapCellSymbolLookup();
       
    67             TestRofsDllAtDifferentBaseAddresses();
       
    68         }
       
    69         #endregion
       
    70 
       
    71         #region Tests
       
    72         private void TestRofsDllAtDifferentBaseAddresses()
       
    73         {
       
    74             Clear();
       
    75             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" );
       
    76             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
    77 
       
    78             using ( DbgEngineView view1 = iDebugEngine.CreateView( "TestView" ) )
       
    79             {
       
    80                 SymbolCollection colPageScalerAt70000000 = view1.Symbols.ActivateAndGetCollection( new CodeSegDefinition( @"Z:\sys\bin\PageScaler.dll", 0x70000000, 0x7A000000 ) );
       
    81                 System.Diagnostics.Debug.Assert( colPageScalerAt70000000 != null );
       
    82                 SymbolCollection col1 = view1.Symbols.CollectionByAddress( 0x70000000 );
       
    83                 System.Diagnostics.Debug.Assert( col1 != null );
       
    84 
       
    85                 // Make a second view
       
    86                 using ( DbgEngineView view2 = iDebugEngine.CreateView( "TestView" ) )
       
    87                 {
       
    88                     SymbolCollection colPageScalerAt75000000 = view2.Symbols.ActivateAndGetCollection( new CodeSegDefinition( @"Z:\sys\bin\PageScaler.dll", 0x75000000, 0x7A000000 ) );
       
    89                     System.Diagnostics.Debug.Assert( colPageScalerAt75000000 != null );
       
    90                     SymbolCollection col2 = view2.Symbols.CollectionByAddress( 0x75000000 );
       
    91                     System.Diagnostics.Debug.Assert( col2 != null );
       
    92 
       
    93                     // Check invalid requests
       
    94                     Symbol symTemp = null;
       
    95 
       
    96                     symTemp = view1.Symbols[ 0x80240000 ];
       
    97                     System.Diagnostics.Debug.Assert( symTemp == null );
       
    98                     symTemp = view1.Symbols[ 0x74240000 ];
       
    99                     System.Diagnostics.Debug.Assert( symTemp == null );
       
   100                     symTemp = view1.Symbols[ 0x78240000 ];
       
   101                     System.Diagnostics.Debug.Assert( symTemp == null );
       
   102 
       
   103                     symTemp = view2.Symbols[ 0x80240000 ];
       
   104                     System.Diagnostics.Debug.Assert( symTemp == null );
       
   105                     symTemp = view2.Symbols[ 0x74240000 ];
       
   106                     System.Diagnostics.Debug.Assert( symTemp == null );
       
   107                     symTemp = view2.Symbols[ 0x78240000 ];
       
   108                     System.Diagnostics.Debug.Assert( symTemp == null );
       
   109 
       
   110                     // Check offsets are maintained
       
   111                     int count = col1.Count;
       
   112                     for( int i=0; i<count; i++ )
       
   113                     {
       
   114                         Symbol sym1 = col1[ i ];
       
   115                         Symbol sym2 = col2[ i ];
       
   116                         //
       
   117                         System.Diagnostics.Debug.Assert( sym1.Name == sym2.Name );
       
   118                         System.Diagnostics.Debug.Assert( sym1.Object == sym2.Object );
       
   119                         System.Diagnostics.Debug.Assert( sym1.Type == sym2.Type );
       
   120                         //
       
   121                         uint delta = sym2.Address - sym1.Address;
       
   122                         System.Diagnostics.Debug.Assert( delta == ( 0x75000000 - 0x70000000 ) );
       
   123                     }
       
   124                 }
       
   125             }
       
   126         }
       
   127 
       
   128         private void TestMulitThreadedLookup()
       
   129         {
       
   130             Clear();
       
   131             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" );
       
   132             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   133 
       
   134             using ( DbgEngineView view = iDebugEngine.CreateView( "TestView" ) )
       
   135             {
       
   136                 DbgViewSymbols symView = view.Symbols;
       
   137 
       
   138                 SymbolCollection col = null;
       
   139 
       
   140                 // Should be possible to activate a file within a zip
       
   141                 SymbolCollection colPageScaler = symView.ActivateAndGetCollection( new CodeSegDefinition( @"Z:\sys\bin\PageScaler.dll", 0x70000000, 0x7A000000 ) );
       
   142                 System.Diagnostics.Debug.Assert( colPageScaler != null );
       
   143 
       
   144                 // Verify that the symbols were really read.
       
   145                 col = view.Symbols.CollectionByAddress( 0x70000000 );
       
   146                 System.Diagnostics.Debug.Assert( col != null );
       
   147                 System.Diagnostics.Debug.WriteLine( col.ToString( "full", null ) );
       
   148 
       
   149                 // Multithreaded symbol lookup times
       
   150                 ThreadPool.QueueUserWorkItem( new WaitCallback( MultiThreadedLookup ), new AsyncData( symView, iWaiter1, col, 10000 ) );
       
   151                 ThreadPool.QueueUserWorkItem( new WaitCallback( MultiThreadedLookup ), new AsyncData( symView, iWaiter2, col, 5000 ) );
       
   152                 ThreadPool.QueueUserWorkItem( new WaitCallback( MultiThreadedLookup ), new AsyncData( symView, iWaiter3, col, 8000 ) );
       
   153                 ThreadPool.QueueUserWorkItem( new WaitCallback( MultiThreadedLookup ), new AsyncData( symView, iWaiter4, col, 20000 ) );
       
   154 
       
   155                 // Wait
       
   156                 using ( iWaiter4 )
       
   157                 {
       
   158                     iWaiter4.WaitOne();
       
   159                 }
       
   160                 using ( iWaiter3 )
       
   161                 {
       
   162                     iWaiter3.WaitOne();
       
   163                 }
       
   164                 using ( iWaiter2 )
       
   165                 {
       
   166                     iWaiter2.WaitOne();
       
   167                 }
       
   168                 using ( iWaiter1 )
       
   169                 {
       
   170                     iWaiter1.WaitOne();
       
   171                 }
       
   172             }
       
   173         }
       
   174 
       
   175         private void TestZipMapFiles()
       
   176         {
       
   177             // So we can spot it in the profiler...
       
   178             //Thread.Sleep( 2000 );
       
   179             Clear();
       
   180             iDebugEngine.Add( @"C:\Tool Demo Files\8. For SymbianSymbolLib Test Code\S60_3_2_200846_RnD_merlin_emulator_hw.rom.symbol" );
       
   181             iDebugEngine.Add( @"C:\Tool Demo Files\2. Crash Data\File44\Platform_wk49\Symbols\mapfiles.zip" );
       
   182             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   183 
       
   184             using ( DbgEngineView view = iDebugEngine.CreateView( "TestView" ) )
       
   185             {
       
   186                 DbgViewSymbols symView = view.Symbols;
       
   187 
       
   188                 // Should be possible to activate a file within a zip
       
   189                 SymbolCollection activatedCol = symView.ActivateAndGetCollection( new CodeSegDefinition( @"Z:\sys\bin\AcCmOnItOr.dll", 0x70000000, 0x7A000000 ) );
       
   190                 System.Diagnostics.Debug.Assert( activatedCol != null );
       
   191 
       
   192                 // Verify that the symbols were really read.
       
   193                 SymbolCollection col = view.Symbols.CollectionByAddress( 0x70000000 );
       
   194                 System.Diagnostics.Debug.Assert( col != null );
       
   195                 System.Diagnostics.Debug.WriteLine( col.ToString( "full", null ) );
       
   196 
       
   197                 // Verify that the collections are the same
       
   198                 System.Diagnostics.Debug.Assert( activatedCol.Count == col.Count );
       
   199                 System.Diagnostics.Debug.Assert( activatedCol.FileName == col.FileName );
       
   200                 System.Diagnostics.Debug.Assert( activatedCol == col );
       
   201 
       
   202                 // Cannot activate the same dll twice
       
   203                 bool activated = symView.Activate( new CodeSegDefinition( @"Z:\sys\bin\AcCmOnItOr.dll", 0x80000000, 0x8A000000 ) );
       
   204                 System.Diagnostics.Debug.Assert( activated == false );
       
   205 
       
   206                 // Cannot activate an overlapping area.
       
   207                 activated = symView.Activate( new CodeSegDefinition( @"Z:\sys\bin\AIFW.dll", 0x70000000, 0x70040000 ) );
       
   208                 System.Diagnostics.Debug.Assert( activated == false );
       
   209 
       
   210                 // Cannot deactivate a non-activated dll
       
   211                 bool deactivated = symView.Deactivate( new CodeSegDefinition( @"Z:\sys\bin\AIUTILS.DLL" ) );
       
   212                 System.Diagnostics.Debug.Assert( deactivated == false );
       
   213 
       
   214                 // Cannot deactivate a missing dll
       
   215                 deactivated = symView.Deactivate( new CodeSegDefinition( @"Z:\sys\bin\THIS_DOES_NOT_EXIST.EXE" ) );
       
   216                 System.Diagnostics.Debug.Assert( deactivated == false );
       
   217 
       
   218                 // Look up first symbol
       
   219                 Symbol sym = null;
       
   220                 Symbol sym2 = null;
       
   221                 sym = symView.Lookup( 0x70000000, out col );
       
   222                 System.Diagnostics.Debug.Assert( sym != null && col == activatedCol && sym.Name == "_E32Dll" );
       
   223                 sym = symView.Lookup( 0x70000027, out col );
       
   224                 System.Diagnostics.Debug.Assert( sym != null && col == activatedCol && sym.Name == "_E32Dll" );
       
   225 
       
   226                 // For the following sequence, ensure that we discard the CAccMonitor::~CAccMonitor__sub_object()
       
   227                 // line and keep the CAccMonitor::~CAccMonitor() line instead. Ensure that the size of the 
       
   228                 // CAccMonitor::~CAccMonitor() entry has been calculated using the data from the sub_object entry which
       
   229                 // we threw away.
       
   230                 //
       
   231                 //     CAccMonitor::~CAccMonitor__deallocating() 0x00009195   Thumb Code    16  accmonitor.in(i._ZN11CAccMonitorD0Ev)
       
   232                 //     CAccMonitor::~CAccMonitor()              0x000091a5   Thumb Code     0  accmonitor.in(i._ZN11CAccMonitorD2Ev)
       
   233                 //     CAccMonitor::~CAccMonitor__sub_object()  0x000091a5   Thumb Code     8  accmonitor.in(i._ZN11CAccMonitorD2Ev)
       
   234                 //     CAccMonitorInfo::Reset()                 0x000091ad   Thumb Code    28  accmonitor.in(i._ZN15CAccMonitorInfo5ResetEv)
       
   235                 //
       
   236                 sym = FindByName( "CAccMonitor::~CAccMonitor__sub_object()", col );
       
   237                 System.Diagnostics.Debug.Assert( sym == null );
       
   238                 sym = FindByName( "CAccMonitor::~CAccMonitor()", col );
       
   239                 System.Diagnostics.Debug.Assert( sym != null && sym.Size == 8 );
       
   240 
       
   241                 // For the following sequence, ensure that we discard the sub object and keep the destructor.
       
   242                 //
       
   243                 //      RArray<unsigned long>::RArray()          0x00009289   Thumb Code    10  accmonitor.in(t._ZN6RArrayImEC1Ev)
       
   244                 //      RArray<unsigned long>::RArray__sub_object() 0x00009289   Thumb Code     0  accmonitor.in(t._ZN6RArrayImEC1Ev)
       
   245                 sym = FindByName( "RArray<unsigned long>::RArray__sub_object()", col );
       
   246                 System.Diagnostics.Debug.Assert( sym == null );
       
   247                 sym = FindByName( "RArray<unsigned long>::RArray()", col );
       
   248                 System.Diagnostics.Debug.Assert( sym != null && sym.Size == 10 );
       
   249 
       
   250                 // For the following sequence, ensure that the end of the first entry doesn't overlap with the start of the second.
       
   251                 //
       
   252                 //      typeinfo name for CAccMonitorCapMapper   0x000094a8   Data          23  accmonitor.in(.constdata__ZTS20CAccMonitorCapMapper)
       
   253                 //      typeinfo name for CAccMonitorContainer   0x000094bf   Data          23  accmonitor.in(.constdata__ZTS20CAccMonitorContainer)
       
   254                 //
       
   255                 sym = FindByName( "typeinfo name for CAccMonitorCapMapper", col );
       
   256                 System.Diagnostics.Debug.Assert( sym != null );
       
   257                 sym2 = FindByName( "typeinfo name for CAccMonitorContainer", col );
       
   258                 System.Diagnostics.Debug.Assert( sym2 != null );
       
   259                 System.Diagnostics.Debug.Assert( sym.AddressRange.Max + 1 == sym2.Address );
       
   260 
       
   261                 // Check no overlap
       
   262                 CheckNoOverlaps( col );
       
   263 
       
   264                 // Second symbol
       
   265                 sym = symView.Lookup( 0x70000028, out col );
       
   266                 System.Diagnostics.Debug.Assert( sym != null && col == activatedCol && sym.Name == "__cpp_initialize__aeabi_" );
       
   267 
       
   268                 // Deactivate an activated dll
       
   269                 deactivated = symView.Deactivate( new CodeSegDefinition( @"Z:\sys\bin\ACCMONITOR.DLL" ) );
       
   270                 System.Diagnostics.Debug.Assert( deactivated == true );
       
   271 
       
   272                 // symbol shouldn't be available anymore
       
   273                 sym = symView.Lookup( 0x70000000, out col );
       
   274                 System.Diagnostics.Debug.Assert( sym == null && col == null );
       
   275             }
       
   276         }
       
   277 
       
   278         private void TestMapRVCT()
       
   279         {
       
   280             Clear();
       
   281             iDebugEngine.Add( @"C:\Tool Demo Files\2. Crash Data\File55\RVCT\alarmserver.exe.map" );
       
   282             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   283 
       
   284             using ( DbgEngineView view = iDebugEngine.CreateView( "TestView" ) )
       
   285             {
       
   286                 DbgViewSymbols symView = view.Symbols;
       
   287                 SymbolCollection col = null;
       
   288 
       
   289                 // Should be possible to activate 
       
   290                 col = symView.ActivateAndGetCollection( new CodeSegDefinition( @"Z:\sys\bin\alarmserver.exe", 0x70000000, 0x7FFFFFFF ) );
       
   291                 System.Diagnostics.Debug.Assert( col != null );
       
   292                 System.Diagnostics.Debug.WriteLine( col.ToString( "full", null ) );
       
   293 
       
   294                 // Check invalid address
       
   295                 col = view.Symbols.CollectionByAddress( 0x700090a5 );
       
   296                 System.Diagnostics.Debug.Assert( col == null );
       
   297 
       
   298                 // Verify that the symbols were really read.
       
   299                 col = view.Symbols.CollectionByAddress( 0x700090a4 );
       
   300                 System.Diagnostics.Debug.Assert( col != null );
       
   301                 col = view.Symbols.CollectionByAddress( 0x70000000 );
       
   302                 System.Diagnostics.Debug.Assert( col != null );
       
   303                 col = view.Symbols.CollectionByAddress( 0x70000001 );
       
   304                 System.Diagnostics.Debug.Assert( col != null );
       
   305                 col = view.Symbols.CollectionByAddress( 0x70002001 );
       
   306                 System.Diagnostics.Debug.Assert( col != null );
       
   307 
       
   308                 // Check for overlaps
       
   309                 CheckNoOverlaps( col );
       
   310 
       
   311                 // Perform some lookup tests
       
   312                 string text = string.Empty;
       
   313 
       
   314                 text = view.Symbols.PlainText[ 0x70000000 ];
       
   315                 System.Diagnostics.Debug.Assert( text == "_E32Startup" );
       
   316                 text = view.Symbols.PlainText[ 0x70000001 ];
       
   317                 System.Diagnostics.Debug.Assert( text == "_E32Startup" );
       
   318                 text = view.Symbols.PlainText[ 0x7000006f ];
       
   319                 System.Diagnostics.Debug.Assert( text == "_E32Startup" );
       
   320                 text = view.Symbols.PlainText[ 0x70000070 ];
       
   321                 System.Diagnostics.Debug.Assert( text == "__cpp_initialize__aeabi_" );
       
   322                 text = view.Symbols.PlainText[ 0x700090a4 ];
       
   323                 System.Diagnostics.Debug.Assert( text == ".ARM.exidx$$Limit" );
       
   324             }
       
   325         }
       
   326 
       
   327         private void TestMapGCCE()
       
   328         {
       
   329             Clear();
       
   330             iDebugEngine.Add( @"C:\Tool Demo Files\2. Crash Data\File55\GCCE\alarmserver.exe.map" );
       
   331             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   332 
       
   333             using ( DbgEngineView view = iDebugEngine.CreateView( "TestView" ) )
       
   334             {
       
   335                 DbgViewSymbols symView = view.Symbols;
       
   336                 SymbolCollection col = null;
       
   337 
       
   338                 // Should be possible to activate 
       
   339                 col = symView.ActivateAndGetCollection( new CodeSegDefinition( @"Z:\sys\bin\alarmserver.exe", 0x70000000, 0x7FFFFFFF ) );
       
   340                 System.Diagnostics.Debug.Assert( col != null );
       
   341                 System.Diagnostics.Debug.WriteLine( col.ToString( "full", null ) );
       
   342 
       
   343                 // Check invalid address
       
   344                 col = view.Symbols.CollectionByAddress( 0x7000bcc8 );
       
   345                 System.Diagnostics.Debug.Assert( col == null );
       
   346 
       
   347                 // Verify that the symbols were really read.
       
   348                 col = view.Symbols.CollectionByAddress( 0x7000bcc7 );
       
   349                 System.Diagnostics.Debug.Assert( col != null );
       
   350                 col = view.Symbols.CollectionByAddress( 0x70000000 );
       
   351                 System.Diagnostics.Debug.Assert( col != null );
       
   352                 col = view.Symbols.CollectionByAddress( 0x70000001 );
       
   353                 System.Diagnostics.Debug.Assert( col != null );
       
   354                 col = view.Symbols.CollectionByAddress( 0x70002001 );
       
   355                 System.Diagnostics.Debug.Assert( col != null );
       
   356 
       
   357                 // Check for overlaps
       
   358                 CheckNoOverlaps( col );
       
   359 
       
   360                 // Perform some lookup tests
       
   361                 string text = string.Empty;
       
   362 
       
   363                 text = view.Symbols.PlainText[ 0x70000000 ];
       
   364                 System.Diagnostics.Debug.Assert( text == "_xxxx_call_user_invariant" );
       
   365                 text = view.Symbols.PlainText[ 0x70000001 ];
       
   366                 System.Diagnostics.Debug.Assert( text == "_xxxx_call_user_invariant" );
       
   367                 text = view.Symbols.PlainText[ 0x70000007 ];
       
   368                 System.Diagnostics.Debug.Assert( text == "_xxxx_call_user_invariant" );
       
   369                 text = view.Symbols.PlainText[ 0x70000008 ];
       
   370                 System.Diagnostics.Debug.Assert( text == "_xxxx_call_user_handle_exception" );
       
   371                 text = view.Symbols.PlainText[ 0x7000000f ];
       
   372                 System.Diagnostics.Debug.Assert( text == "_xxxx_call_user_handle_exception" );
       
   373                 text = view.Symbols.PlainText[ 0x70000070 ];
       
   374                 System.Diagnostics.Debug.Assert( text == "CASSrvServer::CASSrvServer()" );
       
   375                 text = view.Symbols.PlainText[ 0x7000bcc7 ];
       
   376                 System.Diagnostics.Debug.Assert( text == "typeinfo name for CASAltRequestQuietPeriodEnd" );
       
   377             }
       
   378         }
       
   379 
       
   380         private void TestBigDsoData()
       
   381         {
       
   382             Clear();
       
   383             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" );
       
   384             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   385 
       
   386             CodeSegDefinitionCollection codeSegs = new CodeSegDefinitionCollection();
       
   387             using ( StringReader reader = new StringReader( KTestBigDsoDataCodeSegList ) )
       
   388             {
       
   389                 string line = reader.ReadLine();
       
   390                 while ( line != null )
       
   391                 {
       
   392                     CodeSegDefinition def = CodeSegDefinitionParser.ParseDefinition( line );
       
   393                     if ( def != null )
       
   394                     {
       
   395                         codeSegs.Add( def );
       
   396                     }
       
   397                     line = reader.ReadLine();
       
   398                 }
       
   399             }
       
   400 
       
   401             using ( DbgEngineView view = iDebugEngine.CreateView( "TestView", codeSegs ) )
       
   402             {
       
   403                 // MemMan.dll contains a dodgy symbol:
       
   404                 // 
       
   405                 // 000031b4    0000    Image$$ER_RO$$Limit                       anon$$obj.o(linker$$defined$$symbols)
       
   406                 // 003f8024    0004    __dso_handle                              ucppfini.o(.data)
       
   407                 SymbolCollection colMemManDll = view.Symbols.CollectionByAddress( 0x79E18000 );
       
   408                 System.Diagnostics.Debug.Assert( colMemManDll != null );
       
   409 
       
   410                 // Verify it doesn't include the big dso object
       
   411                 Symbol bigDsoData = FindByName( "__dso_handle", colMemManDll );
       
   412                 System.Diagnostics.Debug.Assert( bigDsoData == null );
       
   413 
       
   414                 // Widget engine would otherwise overlap with memman.dll
       
   415                 SymbolCollection colWidgetEngineDll = view.Symbols.CollectionByAddress( 0x7A0C0000 );
       
   416                 System.Diagnostics.Debug.Assert( colMemManDll != null );
       
   417 
       
   418                 // Check no overlaps
       
   419                 CheckNoOverlaps( colMemManDll, colWidgetEngineDll );
       
   420 
       
   421             }
       
   422         }
       
   423 
       
   424         private void TestHeapCellSymbolLookup()
       
   425         {
       
   426             Clear();
       
   427             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\CoreImage\RM505_widgetui_rheap_rnd_rom.symbol" );
       
   428             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" );
       
   429             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\Variant03\RM505_widgetui_rheap_rnd.V03.rofs2.symbol" );
       
   430             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\Variant03\RM505_widgetui_rheap_rnd.V03.rofs3.symbol" );
       
   431             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   432 
       
   433             DoTestHeapCellSymbolLookup();
       
   434         }
       
   435 
       
   436         private void TestCodeSegmentResolutionROFS()
       
   437         {
       
   438             Clear();
       
   439             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\CoreImage\RM505_widgetui_rheap_rnd_rom.symbol" );
       
   440             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" );
       
   441             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\Variant03\RM505_widgetui_rheap_rnd.V03.rofs2.symbol" );
       
   442             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\Variant03\RM505_widgetui_rheap_rnd.V03.rofs3.symbol" );
       
   443             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   444 
       
   445             DoTestCodeSegmentResolution();
       
   446         }
       
   447 
       
   448         private void TestCodeSegmentResolutionOBY()
       
   449         {
       
   450             Clear();
       
   451             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\CoreImage\RM505_widgetui_rheap_rnd_rofs1.oby" );
       
   452             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\Variant03\RM505_widgetui_rheap_rnd.V03.rofs2.oby" );
       
   453             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\Variant03\RM505_widgetui_rheap_rnd.V03.rofs3.oby" );
       
   454             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\CoreImage\RM505_widgetui_rheap_rnd_rom.symbol" );
       
   455             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   456 
       
   457             DoTestCodeSegmentResolution();
       
   458         }
       
   459 
       
   460         private void TestOBY()
       
   461         {
       
   462             Clear();
       
   463             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\CoreImage\RM505_widgetui_rheap_rnd_rofs1.oby" );
       
   464             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\Variant03\RM505_widgetui_rheap_rnd.V03.rofs2.oby" );
       
   465             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\Variant03\RM505_widgetui_rheap_rnd.V03.rofs3.oby" );
       
   466             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\Rom_images_widgetui_rheap\ivalo\CoreImage\RM505_widgetui_rheap_rnd_rom.symbol" );
       
   467             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   468               
       
   469             DoTestHeapCellSymbolLookup();
       
   470         }
       
   471 
       
   472         private void TestBigMapFile()
       
   473         {
       
   474             Clear();
       
   475             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\epoc32\release\armv5\urel\browserengine.dll.map" );
       
   476             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\epoc32\release\armv5\urel\smart2go.exe.map" );
       
   477             iDebugEngine.Add( @"C:\Tool Demo Files\4. Heap Sample Data\11. Browser heap\epoc32\release\armv5\urel\avkon.dll.map" );
       
   478             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   479         }
       
   480 
       
   481         private void TestUDACode()
       
   482         {
       
   483             Clear();
       
   484             iDebugEngine.Add( @"C:\Tool Demo Files\2. Crash Data\File62\Ivalo_RM-505\Wk12\DebugMetaData\RM-505_52.50.2009.12_rnd.rofs1.symbol" );
       
   485             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   486 
       
   487             CodeSegDefinition csOnC = new CodeSegDefinition( @"C:\sys\bin\btaccesshost.exe", 0x80ef3ae8, 0x80efa988 );
       
   488 
       
   489             using ( DbgEngineView view = iDebugEngine.CreateView( "TestView" ) )
       
   490             {
       
   491                 DbgViewSymbols symView = view.Symbols;
       
   492                 SymbolCollection col = null;
       
   493 
       
   494                 // This won't activate
       
   495                 col = symView.ActivateAndGetCollection( csOnC );
       
   496                 System.Diagnostics.Debug.Assert( col == null );
       
   497             }
       
   498 
       
   499             // Now merge in the zip file containing lots of maps...
       
   500             iDebugEngine.Add( @"C:\Tool Demo Files\2. Crash Data\File62\Ivalo_RM-505\Wk12\DebugMetaData\mapfiles.zip" );
       
   501             iDebugEngine.Prime( SymbianUtils.TSynchronicity.ESynchronous );
       
   502 
       
   503             using ( DbgEngineView view = iDebugEngine.CreateView( "TestView" ) )
       
   504             {
       
   505                 DbgViewSymbols symView = view.Symbols;
       
   506                 SymbolCollection col = null;
       
   507 
       
   508                 // This should activate now
       
   509                 col = symView.ActivateAndGetCollection( csOnC );
       
   510                 System.Diagnostics.Debug.Assert( col != null );
       
   511             }
       
   512         }
       
   513         #endregion
       
   514 
       
   515         #region Constants
       
   516         private const string KTestBigDsoDataCodeSegList = @"CodeSegs - 807C4268-807D3844 z:\Sys\Bin\audiopolicyserver.dll
       
   517 CodeSegs - 809194C8-8091B458 z:\Sys\Bin\eapdsp.dll
       
   518 CodeSegs - 80698D48-806A4248 Z:\sys\bin\Cone.dll
       
   519 CodeSegs - 78750000-78750B08 Z:\sys\bin\EikSrvc.dll
       
   520 CodeSegs - 80742D38-80746288 Z:\sys\bin\gfxtrans.dll
       
   521 CodeSegs - 78828000-78828D98 Z:\sys\bin\akntransitionutils.dll
       
   522 CodeSegs - 78824000-78826F90 Z:\sys\bin\aknnotify.dll
       
   523 CodeSegs - 78820000-78821164 Z:\sys\bin\akncapserverclient.dll
       
   524 CodeSegs - 78834000-78838A18 Z:\sys\bin\cdlengine.dll
       
   525 CodeSegs - 78830000-7883060C Z:\sys\bin\FontUtils.dll
       
   526 CodeSegs - 7882C000-7882E204 Z:\sys\bin\FontProvider.dll
       
   527 CodeSegs - 80D8C168-80D8DFB4 Z:\sys\bin\FepBase.dll
       
   528 CodeSegs - 78894000-78894294 Z:\sys\bin\AknPictograph.dll
       
   529 CodeSegs - 7894C000-7895713C Z:\sys\bin\cXmlParser.dll
       
   530 CodeSegs - 78944000-7894820C Z:\sys\bin\XMLInterface.dll
       
   531 CodeSegs - 78724000-78741DC0 Z:\sys\bin\imcm.dll
       
   532 CodeSegs - 78710000-78720060 Z:\sys\bin\imut.dll
       
   533 CodeSegs - 80624CB8-8062D428 Z:\sys\bin\MediaClientAudio.dll
       
   534 CodeSegs - 78958000-78991F6C Z:\sys\bin\libopenvg.dll
       
   535 CodeSegs - 78994000-789955CC Z:\sys\bin\libopenvgu.dll
       
   536 CodeSegs - 78998000-78998570 Z:\sys\bin\libvgi.dll
       
   537 CodeSegs - 788B0000-78941128 Z:\sys\bin\SVGEngine.dll
       
   538 CodeSegs - 789BC000-789C0A24 Z:\sys\bin\COMMONENGINE.DLL
       
   539 CodeSegs - 789C4000-789C7904 Z:\sys\bin\DrmRights.DLL
       
   540 CodeSegs - 789D4000-789D41A8 Z:\sys\bin\DrmKeyStorage.dll
       
   541 CodeSegs - 789D0000-789D2230 Z:\sys\bin\DrmCrypto.DLL
       
   542 CodeSegs - 789C8000-789CE30C Z:\sys\bin\DrmServerInterfaces.DLL
       
   543 CodeSegs - 789D8000-789DB13C Z:\sys\bin\DRMCOMMON.DLL
       
   544 CodeSegs - 78A08000-78A09ED0 Z:\sys\bin\AknLayout2scalable.dll
       
   545 CodeSegs - 78A04000-78A04A0C Z:\sys\bin\AknLayout2.dll
       
   546 CodeSegs - 78A0C000-78A10908 Z:\sys\bin\lbs.dll
       
   547 CodeSegs - 78A14000-78A147F0 Z:\sys\bin\aknlistloadertfx.dll
       
   548 CodeSegs - 78A18000-78A19FDC Z:\sys\bin\touchfeedback.dll
       
   549 CodeSegs - 789EC000-78A01C88 Z:\sys\bin\eikctl.dll
       
   550 CodeSegs - 78A1C000-78A1E838 Z:\sys\bin\MediatorClient.dll
       
   551 CodeSegs - 789DC000-789EBE08 Z:\sys\bin\eikdlg.dll
       
   552 CodeSegs - 78A20000-78A21C50 Z:\sys\bin\DcfRep.dll
       
   553 CodeSegs - 78A24000-78A28E80 Z:\sys\bin\servicehandler.dll
       
   554 CodeSegs - 78A48000-78A4ECA8 Z:\sys\bin\cmmanagerdatabase.dll
       
   555 CodeSegs - 78A2C000-78A46364 Z:\sys\bin\cmmanager.dll
       
   556 CodeSegs - 789B0000-789B99E0 Z:\sys\bin\DRMHelper.dll
       
   557 CodeSegs - 78A50000-78A517EC Z:\sys\bin\disknotifyhandler.dll
       
   558 CodeSegs - 7899C000-789AD374 Z:\sys\bin\aknskinsrv.dll
       
   559 CodeSegs - 788A4000-788AC154 Z:\sys\bin\AknIcon.dll
       
   560 CodeSegs - 78A54000-78A6F26C Z:\sys\bin\aknskinrenderlib.dll
       
   561 CodeSegs - 80C79038-80C79D68 Z:\sys\bin\HWRMLightClient.dll
       
   562 CodeSegs - 78898000-788A3D30 Z:\sys\bin\aknskins.dll
       
   563 CodeSegs - 78A70000-78A709EC Z:\sys\bin\jplangutil.dll
       
   564 CodeSegs - 78A74000-78A75BF0 Z:\sys\bin\numbergrouping.dll
       
   565 CodeSegs - 78A78000-78A7AD40 Z:\sys\bin\EikCoCtlLaf.dll
       
   566 CodeSegs - 7883C000-788925B4 Z:\sys\bin\eikcoctl.dll
       
   567 CodeSegs - 78A7C000-78A80FE8 Z:\sys\bin\phoneclient.dll
       
   568 CodeSegs - 78A84000-78A86000 Z:\sys\bin\oommonitor.dll
       
   569 CodeSegs - 78A88000-78A94CA0 Z:\sys\bin\ptiengine.dll
       
   570 CodeSegs - 78758000-7881FF20 Z:\sys\bin\avkon.dll
       
   571 CodeSegs - 78754000-787562F8 Z:\sys\bin\UikLaf.dll
       
   572 CodeSegs - 78744000-7874EA34 Z:\sys\bin\EikCore.dll
       
   573 CodeSegs - 78CAC000-78CAEF64 Z:\sys\bin\WEPSecuritySettingsUI.dll
       
   574 CodeSegs - 78CB0000-78CB2BC4 Z:\sys\bin\WPASecuritySettingsUI.dll
       
   575 CodeSegs - 78C98000-78CAA7B8 Z:\sys\bin\ApEngine.dll
       
   576 CodeSegs - 78B2C000-78B2C800 Z:\sys\bin\directorylocalizer.dll
       
   577 CodeSegs - 78B30000-78B30460 Z:\sys\bin\AknMemoryCardUi.DLL
       
   578 CodeSegs - 78B38000-78B38B54 Z:\sys\bin\rsfwmountstore.dll
       
   579 CodeSegs - 78B3C000-78B3C858 Z:\sys\bin\rsfwmountutils.dll
       
   580 CodeSegs - 78B40000-78B405CC Z:\sys\bin\rsfwcontrol.dll
       
   581 CodeSegs - 78B34000-78B35488 Z:\sys\bin\rsfwmountman.dll
       
   582 CodeSegs - 78B20000-78B2A5AC Z:\sys\bin\commondialogs.dll
       
   583 CodeSegs - 78B44000-78B4BBAC Z:\sys\bin\FavouritesEngine.dll
       
   584 CodeSegs - 78AC4000-78AC5B18 Z:\sys\bin\mtur.dll
       
   585 CodeSegs - 78B4C000-78B4FA68 Z:\sys\bin\Sendui.dll
       
   586 CodeSegs - 78B70000-78B71718 Z:\sys\bin\mdccommon.dll
       
   587 CodeSegs - 78B60000-78B6C498 Z:\sys\bin\mdeclient.dll
       
   588 CodeSegs - 78B74000-78B74F30 Z:\sys\bin\HarvesterClient.dll
       
   589 CodeSegs - 78B58000-78B5DE0C Z:\sys\bin\ContentListingFramework.dll
       
   590 CodeSegs - 78B78000-78B7840C Z:\sys\bin\MediaCollectionManager.dll
       
   591 CodeSegs - 78B54000-78B56DA4 Z:\sys\bin\MGXUtils.dll
       
   592 CodeSegs - 78B50000-78B50BD0 Z:\sys\bin\MGXMediaFileApi.dll
       
   593 CodeSegs - 78B7C000-78B7CE98 Z:\sys\bin\SWInstCli.dll
       
   594 CodeSegs - 78B80000-78B80B94 Z:\sys\bin\aiwdialdata.dll
       
   595 CodeSegs - 78B10000-78B1D3D8 Z:\sys\bin\commonui.dll
       
   596 CodeSegs - 78D90000-78D945BC Z:\sys\bin\ConnectionUiUtilities.dll
       
   597 CodeSegs - 79C34000-79C37138 Z:\sys\bin\ConnectionManager.dll
       
   598 CodeSegs - 79528000-79528528 Z:\sys\bin\MGFetch.dll
       
   599 CodeSegs - 796C4000-796CA388 Z:\sys\bin\BrowserDialogsProvider.dll
       
   600 CodeSegs - 78F30000-78F30F20 Z:\sys\bin\WidgetRegistryClient.dll
       
   601 CodeSegs - 795C0000-795C73DC Z:\sys\bin\SenXml.dll
       
   602 CodeSegs - 795CC000-795CCF28 Z:\sys\bin\RTSecMgrUtil.dll
       
   603 CodeSegs - 795C8000-795CA7D4 Z:\sys\bin\RTSecMgrClient.dll
       
   604 CodeSegs - 795B4000-795BC558 Z:\sys\bin\Liwservicehandler.dll
       
   605 CodeSegs - 79E18000-79E1B1B4 Z:\sys\bin\MemMan.dll
       
   606 CodeSegs - 79E28000-79E80828 Z:\sys\bin\JavascriptCore.dll
       
   607 CodeSegs - 7965C000-7965CD28 Z:\sys\bin\RECENTURLSTORE.DLL
       
   608 CodeSegs - 79DC4000-79DF1518 Z:\sys\bin\WebKitUtils.dll
       
   609 CodeSegs - 78CD0000-78CD1184 Z:\sys\bin\httpfiltercommon.dll
       
   610 CodeSegs - 7A030000-7A036554 Z:\sys\bin\BrowserCache.dll
       
   611 CodeSegs - 79C4C000-79C4CD7C Z:\sys\bin\WEBUTILS.dll
       
   612 CodeSegs - 796A0000-796A28D8 Z:\sys\bin\PageScaler.dll
       
   613 CodeSegs - 78CD4000-78CD6298 Z:\sys\bin\fotaengine.dll
       
   614 CodeSegs - 78CC0000-78CCC408 Z:\sys\bin\HttpDMServEng.dll
       
   615 CodeSegs - 78D08000-78D0ED30 Z:\sys\bin\DrmParsers.DLL
       
   616 CodeSegs - 78D10000-78D10614 Z:\sys\bin\drmroapwbxmlparser.dll
       
   617 CodeSegs - 78CF4000-78D06A74 Z:\sys\bin\RoapHandler.DLL
       
   618 CodeSegs - 78CE4000-78CF1644 Z:\sys\bin\CodEng.dll
       
   619 CodeSegs - 78D14000-78D16470 Z:\sys\bin\MultipartParser.dll
       
   620 CodeSegs - 78CDC000-78CE2218 Z:\sys\bin\CodUi.dll
       
   621 CodeSegs - 78CD8000-78CD8414 Z:\sys\bin\CodDownload.dll
       
   622 CodeSegs - 78CB4000-78CBC878 Z:\sys\bin\DownloadMgr.dll
       
   623 CodeSegs - 78F2C000-78F2C4FC Z:\sys\bin\aknnotifyplugin.dll
       
   624 CodeSegs - 79478000-7948D470 Z:\sys\bin\CONNMON.DLL
       
   625 CodeSegs - 79974000-7997E04C Z:\sys\bin\DownloadMgrUiLib.dll
       
   626 CodeSegs - 79B90000-79BA06D8 Z:\sys\bin\backend.dll
       
   627 CodeSegs - 79BA4000-79BB4D54 Z:\sys\bin\libm.dll
       
   628 CodeSegs - 79B6C000-79B8DB8C Z:\sys\bin\libc.dll
       
   629 CodeSegs - 79BB8000-79BBA31C Z:\sys\bin\libpthread.dll
       
   630 CodeSegs - 79B2C000-79B2C480 Z:\sys\bin\ftokenclient.dll
       
   631 CodeSegs - 79B30000-79B30334 Z:\sys\bin\aknlayout2hierarchy.dll
       
   632 CodeSegs - 79B10000-79B2AEB0 Z:\sys\bin\alfclient.dll
       
   633 CodeSegs - 79854000-79856620 Z:\sys\bin\rt_gesturehelper.dll
       
   634 CodeSegs - 7A4CC000-7A722330 Z:\sys\bin\BrowserEngine.dll
       
   635 CodeSegs - 793EC000-793F2E54 Z:\sys\bin\WidgetUi.exe
       
   636 CodeSegs - 790A4000-7921DA68 Z:\sys\bin\10283389.dll
       
   637 CodeSegs - 79220000-7922FFE0 Z:\sys\bin\10285D7B.dll
       
   638 CodeSegs - 79264000-79264410 Z:\sys\bin\AknLayout2adaptation.dll
       
   639 CodeSegs - 79244000-79263FD0 Z:\sys\bin\101fe2aa.dll
       
   640 CodeSegs - 7926C000-7926EAC4 Z:\sys\bin\eikcdlg.dll
       
   641 CodeSegs - 79268000-792685DC Z:\sys\bin\akninit.dll
       
   642 CodeSegs - 79274000-79276BB0 Z:\sys\bin\102827CF.dll
       
   643 CodeSegs - 79334000-79334514 Z:\sys\bin\aknfepuiinterface.dll
       
   644 CodeSegs - 79338000-79338544 Z:\sys\bin\aknjapanesereading.dll
       
   645 CodeSegs - 7933C000-7933E2BC Z:\sys\bin\peninputclient.dll
       
   646 CodeSegs - 792F8000-79332F68 Z:\sys\bin\avkonfep.dll
       
   647 CodeSegs - 79340000-793504F0 Z:\sys\bin\AknFepUiAvkonPlugin.dll
       
   648 CodeSegs - 7935C000-79362600 Z:\sys\bin\101f84b9.dll
       
   649 CodeSegs - 7937C000-7937CA78 Z:\sys\bin\PtiKeymappings_01.dll
       
   650 CodeSegs - 79894000-7989738C Z:\sys\bin\httpfilterauthentication.dll
       
   651 CodeSegs - 79390000-79395438 Z:\sys\bin\PtiZiCore.dll
       
   652 CodeSegs - 80D43098-80D45818 Z:\sys\bin\httptransporthandler.dll
       
   653 CodeSegs - 79C80000-79C80EDC Z:\sys\bin\uaproffilter.dll
       
   654 CodeSegs - 79654000-796557E0 Z:\sys\bin\peninputimepluginitut.dll
       
   655 CodeSegs - 80B9F5C8-80BA92C0 Z:\sys\bin\xmlparserplugin.dll
       
   656 CodeSegs - 796AC000-796B08A4 Z:\sys\bin\cputils.dll
       
   657 CodeSegs - 796A8000-796A9970 Z:\sys\bin\cpclient.dll
       
   658 CodeSegs - 79E1C000-79E1C920 Z:\sys\bin\httpfilterIop.dll
       
   659 CodeSegs - 7A0C0000-7A0C5E44 Z:\sys\bin\WidgetEngine.dll
       
   660 CodeSegs - 7A158000-7A15DB88 Z:\sys\bin\jsdevice.dll
       
   661 CodeSegs - 80D4B2A8-80D51F28 Z:\sys\bin\httpclient.dll
       
   662 CodeSegs - 80D48928-80D4B224 Z:\sys\bin\HttpClientCodec.dll
       
   663 CodeSegs - 80D45ED8-80D488AC Z:\sys\bin\tfcorefilters.dll
       
   664 CodeSegs - 79C50000-79C51D08 Z:\sys\bin\HTTPFilterDRM.dll
       
   665 CodeSegs - 79C54000-79C54FB4 Z:\sys\bin\httpfilterproxy.dll
       
   666 CodeSegs - 79C5C000-79C5DB6C Z:\sys\bin\PnP.dll
       
   667 CodeSegs - 79C58000-79C5A63C Z:\sys\bin\PnpPaosFilter.dll
       
   668 CodeSegs - 78ED0000-78ED0CB4 Z:\sys\bin\wmdrmpkclient.dll
       
   669 CodeSegs - 78ECC000-78ECD2D0 Z:\sys\bin\drmasf.dll
       
   670 CodeSegs - 79C6C000-79C6CA94 Z:\sys\bin\wmdrmota.dll
       
   671 CodeSegs - 79C68000-79C6A884 Z:\sys\bin\CameseUtility.dll
       
   672 CodeSegs - 78DC0000-78DCA618 Z:\sys\bin\mpxcommon.dll
       
   673 CodeSegs - 79724000-79728994 Z:\sys\bin\mpxcollectionutility.dll
       
   674 CodeSegs - 79720000-79722344 Z:\sys\bin\mpxplaybackutility.dll
       
   675 CodeSegs - 79B00000-79B0058C Z:\sys\bin\mpxviewplugin.dll
       
   676 CodeSegs - 79AFC000-79AFDBF4 Z:\sys\bin\mpxviewutility.dll
       
   677 CodeSegs - 79C64000-79C6704C Z:\sys\bin\cameseuicommon.dll
       
   678 CodeSegs - 79C60000-79C6103C Z:\sys\bin\httpfiltercamese.dll
       
   679 CodeSegs - 79C70000-79C70924 Z:\sys\bin\musicshophttpfilter.dll
       
   680 CodeSegs - 79C74000-79C74DFC Z:\sys\bin\httpfilterconnhandler.dll
       
   681 CodeSegs - 7A20C000-7A20C854 Z:\sys\bin\CookieFilter.dll
       
   682 CodeSegs - 7A4BC000-7A4BD844 Z:\sys\bin\DeflateFilter.dll
       
   683 CodeSegs - 80A799D8-80A829A4 Z:\sys\bin\pngcodec.dll
       
   684 CodeSegs - 7A2EC000-7A300468 Z:\sys\bin\Zi8English.dll";
       
   685         #endregion
       
   686 
       
   687         #region From ITracer
       
   688         public void Trace( string aMessage )
       
   689         {
       
   690             if ( System.Diagnostics.Debugger.IsAttached )
       
   691             {
       
   692                 System.Diagnostics.Debug.WriteLine( aMessage );
       
   693             }
       
   694             else
       
   695             {
       
   696                 System.Console.WriteLine( aMessage );
       
   697             }
       
   698             //
       
   699             CheckTrace( aMessage.ToUpper() );
       
   700         }
       
   701 
       
   702         public void Trace( string aFormat, params object[] aParams )
       
   703         {
       
   704             string t = string.Format( aFormat, aParams );
       
   705             Trace( t );
       
   706         }
       
   707         #endregion
       
   708 
       
   709         #region Event handlers
       
   710         private void DebugEngine_EntityPrimingStarted( DbgEngine aEngine, DbgEntity aEntity, object aContext )
       
   711         {
       
   712             iTimePrimingStarted = DateTime.Now;
       
   713             Trace( "[Priming] Started : {0}, file: {1}", iTimePrimingStarted.ToString(), aEntity.FullName );
       
   714         }
       
   715 
       
   716         private void DebugEngine_EntityPrimingProgress( DbgEngine aEngine, DbgEntity aEntity, object aContext )
       
   717         {
       
   718             if ( aContext != null && aContext is int )
       
   719             {
       
   720                 int prog = (int) aContext;
       
   721                 if ( ( prog % 10 ) == 0 )
       
   722                 {
       
   723                     DateTime time = DateTime.Now;
       
   724                     TimeSpan ts = time - iTimePrimingStarted;
       
   725                     int ms = (int) ts.TotalMilliseconds;
       
   726                     Trace( "[Priming] Progress: {0:d12}, file: {1}", ms, aEntity.FullName );
       
   727                 }
       
   728             }
       
   729         }
       
   730 
       
   731         private void DebugEngine_EntityPrimingComplete( DbgEngine aEngine, DbgEntity aEntity, object aContext )
       
   732         {
       
   733             DateTime time = DateTime.Now;
       
   734             TimeSpan ts = time - iTimePrimingStarted;
       
   735             int ms = (int) ts.TotalMilliseconds;
       
   736             Trace( "[Priming] Complete: {0:d12}, file: {1}", ms, aEntity.FullName );
       
   737         }
       
   738         #endregion
       
   739 
       
   740         #region Internal methods
       
   741         private void MultiThreadedLookup( object aState )
       
   742         {
       
   743             AsyncData data = (AsyncData) aState;
       
   744             Random rand = new Random( 666 );
       
   745             AddressRange colRange = data.iCollection.SubsumedPrimaryRange;
       
   746             //
       
   747             for ( int i = 0; i < data.iIterations; i++ )
       
   748             {
       
   749                 uint offset = (uint) rand.Next( (int) colRange.Size );
       
   750                 uint address = colRange.Min + offset;
       
   751                 //
       
   752                 SymbolCollection col = null;
       
   753                 Symbol sym = data.iView.Lookup( address, out col );
       
   754             }
       
   755 
       
   756             data.iWaiter.Set();
       
   757         }
       
   758 
       
   759         private bool AreAllEntitiesPrimed
       
   760         {
       
   761             get
       
   762             {
       
   763                 bool ret = true;
       
   764                 //
       
   765                 foreach ( DbgEntity entity in iDebugEngine )
       
   766                 {
       
   767                     if ( !entity.IsPrimed )
       
   768                     {
       
   769                         ret = false;
       
   770                         break;
       
   771                     }
       
   772                 }
       
   773                 //
       
   774                 return ret;
       
   775             }
       
   776         }
       
   777 
       
   778         private void CheckNoOverlaps( SymbolCollection aCollection )
       
   779         {
       
   780             int count = aCollection.Count;
       
   781             for ( int i = 0; i < count - 1; i++ )
       
   782             {
       
   783                 Symbol s1 = aCollection[ i + 0 ];
       
   784                 Symbol s2 = aCollection[ i + 1 ];
       
   785                 //
       
   786                 System.Diagnostics.Debug.WriteLine( "Comparing: " + s1 + " vs " + s2 );
       
   787                 //
       
   788                 System.Diagnostics.Debug.Assert( s1.AddressRange.Min <= s1.AddressRange.Max );
       
   789                 System.Diagnostics.Debug.Assert( s1.AddressRange.Min < s2.AddressRange.Min );
       
   790                 System.Diagnostics.Debug.Assert( s1.AddressRange.Max < s2.AddressRange.Min );
       
   791             }
       
   792         }
       
   793 
       
   794         private void CheckNoOverlaps( SymbolCollection aCollection1, SymbolCollection aCollection2 )
       
   795         {
       
   796             // Check collection1 against collection2
       
   797             int count1 = aCollection1.Count;
       
   798             for ( int i = 0; i < count1; i++ )
       
   799             {
       
   800                 Symbol s = aCollection1[ i ];
       
   801 
       
   802                 bool foundBase = aCollection2.Contains( s.Address );
       
   803                 System.Diagnostics.Debug.Assert( foundBase == false );
       
   804                 //
       
   805                 bool foundLimit = aCollection2.Contains( s.AddressRange.Max );
       
   806                 System.Diagnostics.Debug.Assert( foundLimit == false );
       
   807             }
       
   808 
       
   809             // Check collection2 against collection1
       
   810             int count2 = aCollection2.Count;
       
   811             for ( int i = 0; i < count2; i++ )
       
   812             {
       
   813                 Symbol s = aCollection2[ i ];
       
   814 
       
   815                 bool foundBase = aCollection1.Contains( s.Address );
       
   816                 System.Diagnostics.Debug.Assert( foundBase == false );
       
   817                 //
       
   818                 bool foundLimit = aCollection1.Contains( s.AddressRange.Max );
       
   819                 System.Diagnostics.Debug.Assert( foundLimit == false );
       
   820             }
       
   821         }
       
   822 
       
   823         private Symbol FindByName( string aName, SymbolCollection aCollection )
       
   824         {
       
   825             Symbol ret = null;
       
   826             //
       
   827             foreach ( Symbol sym in aCollection )
       
   828             {
       
   829                 if ( sym.Name == aName )
       
   830                 {
       
   831                     ret = sym;
       
   832                     break;
       
   833                 }
       
   834             }
       
   835             //
       
   836             return ret;
       
   837         }
       
   838 
       
   839         private void CheckTrace( string aTrace )
       
   840         {
       
   841             bool overlap = aTrace.Contains( "OVERLAPS WITH EXISTING COLLECTION" );
       
   842             System.Diagnostics.Debug.Assert( overlap == false );
       
   843         }
       
   844 
       
   845         private void DoTestHeapCellSymbolLookup()
       
   846         {
       
   847             CodeSegDefinitionCollection codeSegs = new CodeSegDefinitionCollection();
       
   848             using ( StringReader reader = new StringReader( KTestBigDsoDataCodeSegList ) )
       
   849             {
       
   850                 string line = reader.ReadLine();
       
   851                 while ( line != null )
       
   852                 {
       
   853                     CodeSegDefinition def = CodeSegDefinitionParser.ParseDefinition( line );
       
   854                     if ( def != null )
       
   855                     {
       
   856                         codeSegs.Add( def );
       
   857                     }
       
   858                     line = reader.ReadLine();
       
   859                 }
       
   860             }
       
   861             codeSegs.SortByAddress();
       
   862 
       
   863             using ( DbgEngineView view = iDebugEngine.CreateView( "TestView", codeSegs ) )
       
   864             {
       
   865                 foreach ( TSymLookupEntry entry in TSymLookupEntry.KHeapSymbols )
       
   866                 {
       
   867                     SymbolCollection col = null;
       
   868                     Symbol sym = view.Symbols.Lookup( entry.iAddress, out col );
       
   869                     //
       
   870                     if ( sym != null )
       
   871                     {
       
   872                         string name = sym.Name;
       
   873                         System.Diagnostics.Debug.Assert( entry.iSymbol == name );
       
   874                     }
       
   875                     else
       
   876                     {
       
   877                         System.Diagnostics.Debug.Assert( entry.iSymbol == string.Empty );
       
   878                     }
       
   879                     //
       
   880                     if ( col != null )
       
   881                     {
       
   882                         string name = entry.iCollection.ToUpper();
       
   883                         bool match = col.FileName.Contains( name );
       
   884                         System.Diagnostics.Debug.Assert( match );
       
   885                     }
       
   886                     else
       
   887                     {
       
   888                         System.Diagnostics.Debug.Assert( entry.iCollection == string.Empty );
       
   889                     }
       
   890                     //
       
   891                     CodeSegDefinition def = codeSegs[ entry.iAddress ];
       
   892                     if ( def != null )
       
   893                     {
       
   894                         if ( entry.iSymbol == string.Empty )
       
   895                         {
       
   896                             // The original SymbolLib didn't find a symbolic match. It's okay
       
   897                             // if we did (or didn't) find a match using SymbianSymbolLib.
       
   898                         }
       
   899                         else if ( entry.iSymbol != string.Empty )
       
   900                         {
       
   901                             // SymbolLib found a match, SymbianSymbolLib must do too.
       
   902                             System.Diagnostics.Debug.Assert( sym != null );
       
   903                         }
       
   904                         if ( col == null )
       
   905                         {
       
   906                             // We didn't find a symbol collection for the specified address
       
   907                             // even though it falls within code segment range. Print a warning
       
   908                             // as this may be caused by dodgy symbol file content.
       
   909                             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}",
       
   910                                 entry.iAddress,
       
   911                                 entry.iAddress - def.Base,
       
   912                                 def ) );
       
   913                         }
       
   914                     }
       
   915                 }
       
   916             }
       
   917         }
       
   918 
       
   919         private void DoTestCodeSegmentResolution()
       
   920         {
       
   921             CodeSegDefinitionCollection codeSegs = new CodeSegDefinitionCollection();
       
   922             using ( StringReader reader = new StringReader( KTestBigDsoDataCodeSegList ) )
       
   923             {
       
   924                 string line = reader.ReadLine();
       
   925                 while ( line != null )
       
   926                 {
       
   927                     CodeSegDefinition def = CodeSegDefinitionParser.ParseDefinition( line );
       
   928                     if ( def != null )
       
   929                     {
       
   930                         codeSegs.Add( def );
       
   931                     }
       
   932                     line = reader.ReadLine();
       
   933                 }
       
   934             }
       
   935             codeSegs.SortByAddress();
       
   936 
       
   937             using ( DbgEngineView view = iDebugEngine.CreateView( "TestView", codeSegs ) )
       
   938             {
       
   939                 foreach ( CodeSegDefinition def in codeSegs )
       
   940                 {
       
   941                     SymbolCollection col = null;
       
   942                     Symbol sym = view.Symbols.Lookup( def.Base, out col );
       
   943                     System.Diagnostics.Debug.Assert( sym != null );
       
   944                 }
       
   945             }
       
   946         }
       
   947         #endregion
       
   948 
       
   949         #region From DisposableObject
       
   950         protected override void CleanupManagedResources()
       
   951         {
       
   952             try
       
   953             {
       
   954                 base.CleanupManagedResources();
       
   955             }
       
   956             finally
       
   957             {
       
   958                 iDebugEngine.Dispose();
       
   959             }
       
   960         }
       
   961         #endregion
       
   962 
       
   963         #region Data members
       
   964         private readonly DbgEngine iDebugEngine;
       
   965         private DateTime iTimePrimingStarted;
       
   966         private AutoResetEvent iWaiter1 = new AutoResetEvent( false );
       
   967         private AutoResetEvent iWaiter2 = new AutoResetEvent( false );
       
   968         private AutoResetEvent iWaiter3 = new AutoResetEvent( false );
       
   969         private AutoResetEvent iWaiter4 = new AutoResetEvent( false );
       
   970         #endregion
       
   971     }
       
   972 }