crashanalysercmd/Libraries/Engine/CrashItemLib/Engine/ProblemDetectors/CodeSeg/CIPDCodeSegAvailability.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.Text;
       
    19 using System.Collections.Generic;
       
    20 using CrashItemLib.Crash.Base;
       
    21 using CrashItemLib.Crash.Container;
       
    22 using CrashItemLib.Crash.CodeSegs;
       
    23 using CrashItemLib.Crash.Stacks;
       
    24 using CrashItemLib.Crash.Registers;
       
    25 using CrashItemLib.Crash.Messages;
       
    26 using CrashItemLib.Crash.Summarisable;
       
    27 using SymbianStructuresLib.Arm.Registers;
       
    28 using SymbianUtils.Range;
       
    29 
       
    30 namespace CrashItemLib.Engine.ProblemDetectors.CodeSeg
       
    31 {
       
    32     internal class CIPDCodeSegAvailability : CIProblemDetector
       
    33     {
       
    34         #region Constructors
       
    35         public CIPDCodeSegAvailability()
       
    36 		{
       
    37         }
       
    38 		#endregion
       
    39 
       
    40         #region From CIProblemDetector
       
    41         public override void Check( CIContainer aContainer )
       
    42         {
       
    43             CIElementList<CICodeSeg> allCodeSegs = aContainer.ChildrenByType<CICodeSeg>( CIElement.TChildSearchType.EEntireHierarchy );
       
    44             foreach ( CICodeSeg codeSeg in allCodeSegs )
       
    45             {
       
    46                 bool isResolved = codeSeg.IsResolved;
       
    47                 if ( !isResolved )
       
    48                 {
       
    49                     CreateMissingWarning( codeSeg );
       
    50                 }
       
    51                 if ( codeSeg.IsMismatched )
       
    52                 {
       
    53                     CreateMismatchWarning( codeSeg );
       
    54                 }
       
    55             }
       
    56         }
       
    57         #endregion
       
    58 
       
    59         #region Properties
       
    60         #endregion
       
    61 
       
    62         #region Internal methods
       
    63         private void CreateMismatchWarning( CICodeSeg aCodeSeg )
       
    64         {
       
    65             CIMessageWarning warning = new CIMessageWarning( aCodeSeg.Container, LibResources.CIPDCodeSegAvailability_CodeSegMisMatch_Title );
       
    66             warning.AddLineFormatted( LibResources.CIPDCodeSegAvailability_CodeSegMisMatch_Description_L1, aCodeSeg, aCodeSeg.OwningProcess.Name );
       
    67             warning.AddLineFormatted( LibResources.CIPDCodeSegAvailability_CodeSegMisMatch_Description_L2, aCodeSeg.Base, aCodeSeg.MismatchAddress );
       
    68             //
       
    69             aCodeSeg.AddChild( warning );
       
    70         }
       
    71 
       
    72         private void CreateMissingWarning( CICodeSeg aCodeSeg )
       
    73         {
       
    74             CIMessageWarning warning = new CIMessageWarning( aCodeSeg.Container, LibResources.CIPDCodeSegAvailability_NoSymbols_Title );
       
    75             warning.AddLineFormatted( LibResources.CIPDCodeSegAvailability_NoSymbols_Description, aCodeSeg, aCodeSeg.OwningProcess.Name );
       
    76             //
       
    77             aCodeSeg.AddChild( warning );
       
    78         }
       
    79         #endregion
       
    80 
       
    81         #region From System.Object
       
    82         #endregion
       
    83 
       
    84         #region Data members
       
    85 		#endregion
       
    86     }
       
    87 }