crashanalysercmd/Libraries/Engine/CrashItemLib/Engine/ProblemDetectors/Stack/CIPDStackDataValidator.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.Container;
       
    21 using CrashItemLib.Crash.Stacks;
       
    22 using CrashItemLib.Crash.Registers;
       
    23 using CrashItemLib.Crash.Base;
       
    24 using CrashItemLib.Crash.Messages;
       
    25 using CrashItemLib.Crash.Summarisable;
       
    26 using SymbianStructuresLib.Arm.Registers;
       
    27 using SymbianUtils.Range;
       
    28 
       
    29 namespace CrashItemLib.Engine.ProblemDetectors.Stack
       
    30 {
       
    31     internal class CIPDStackDataValidator : CIProblemDetector
       
    32     {
       
    33         #region Constructors
       
    34         public CIPDStackDataValidator()
       
    35 		{
       
    36         }
       
    37 		#endregion
       
    38 
       
    39         #region From CIProblemDetector
       
    40         public override void Check( CIContainer aContainer )
       
    41         {
       
    42             CISummarisableEntityList list = aContainer.Summaries;
       
    43             foreach ( CISummarisableEntity entry in list )
       
    44             {
       
    45                 bool stackAvailable = entry.IsAvailable( CISummarisableEntity.TElement.EElementStack );
       
    46                 bool regsAvailable = entry.IsAvailable( CISummarisableEntity.TElement.EElementRegisters );
       
    47                 if ( stackAvailable && regsAvailable )
       
    48                 {
       
    49                     CIStack stack = entry.Stack;
       
    50                     //
       
    51                     bool pointerAvailable = stack.Registers.Contains( TArmRegisterType.EArmReg_SP );
       
    52                     if ( pointerAvailable )
       
    53                     {
       
    54                         CIRegister regSP = stack.Pointer;
       
    55                         AddressRange stackDataRange = stack.RawDataRange;
       
    56                         //
       
    57                         if ( !stackDataRange.Contains( regSP ) )
       
    58                         {
       
    59                             base.CreateWarning( aContainer, stack,
       
    60                                 LibResources.CPIDStackDataValidator_Title,
       
    61                                 string.Format( LibResources.CPIDStackDataValidator_Description, base.CreateIdentifierText( entry ) )
       
    62                                 );
       
    63                         }
       
    64                     }
       
    65                 }
       
    66             }
       
    67         }
       
    68         #endregion
       
    69 
       
    70         #region Properties
       
    71         #endregion
       
    72 
       
    73         #region Internal methods
       
    74         #endregion
       
    75 
       
    76         #region From System.Object
       
    77         #endregion
       
    78 
       
    79         #region Data members
       
    80 		#endregion
       
    81     }
       
    82 }