crashanalysercmd/Libraries/Engine/CrashItemLib/Crash/Stacks/CIStackEntry.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 SymbianUtils.Range;
       
    21 using SymbianStackLib.Engine;
       
    22 using SymbianStructuresLib.Uids;
       
    23 using SymbianStructuresLib.Debug.Symbols;
       
    24 using SymbianStructuresLib.Arm.Registers;
       
    25 using SymbianStackLib.Data.Output.Entry;
       
    26 using SymbianDebugLib.PluginAPI.Types.Symbol;
       
    27 using CrashItemLib.Crash;
       
    28 using CrashItemLib.Crash.Base;
       
    29 using CrashItemLib.Crash.Symbols;
       
    30 using CrashItemLib.Crash.Processes;
       
    31 using CrashItemLib.Crash.Registers;
       
    32 
       
    33 namespace CrashItemLib.Crash.Stacks
       
    34 {
       
    35 	public class CIStackEntry : CIElement
       
    36     {
       
    37         #region Constructors
       
    38         internal CIStackEntry( CIStack aParent, StackOutputEntry aEntry )
       
    39             : base( aParent.Container, aParent )
       
    40         {
       
    41             iEntry = aEntry;
       
    42 
       
    43             // If the stack entry references a symbol then associate it with
       
    44             // the parent dictionary immediately.
       
    45             if ( aEntry.Symbol != null )
       
    46             {
       
    47                 ICISymbolManager symbolManager = this.SymbolManager;
       
    48                 CISymbol symbol = symbolManager.SymbolDictionary.Register( aEntry.Symbol );
       
    49                 this.AddChild( symbol );
       
    50                 base.Trace( string.Format( "[CIStackEntry] address: 0x{0:x8}, symbol: {1}, symId: {2}", iEntry.Data, symbol.Symbol, symbol.Id ) );
       
    51             }
       
    52         }
       
    53         #endregion
       
    54 
       
    55         #region API
       
    56         #endregion
       
    57 
       
    58         #region Properties
       
    59         public CIStack Stack
       
    60         {
       
    61             get { return (CIStack) base.Parent; }
       
    62         }
       
    63 
       
    64         public CISymbol Symbol
       
    65         {
       
    66             get { return base.ChildByType( typeof( CISymbol ) ) as CISymbol; }
       
    67         }
       
    68 
       
    69         public CIRegister Register
       
    70         {
       
    71             get
       
    72             {
       
    73                 CIRegister ret = null;
       
    74                 //
       
    75                 if ( iEntry.IsRegisterBasedEntry )
       
    76                 {
       
    77                     TArmRegisterType type = iEntry.AssociatedRegister;
       
    78                     CIStack stack = Stack;
       
    79                     CIRegisterList registers = stack.Registers;
       
    80                     if ( registers != null )
       
    81                     {
       
    82                         ret = registers[ type ];
       
    83                     }
       
    84                 }
       
    85                 //
       
    86                 return ret;
       
    87             }
       
    88         }
       
    89 
       
    90         public bool MatchesSymbol
       
    91         {
       
    92             get { return Symbol != null; }
       
    93         }
       
    94 
       
    95         public uint Address
       
    96         {
       
    97             get { return iEntry.Address; }
       
    98         }
       
    99 
       
   100         public uint FunctionOffset
       
   101         {
       
   102             get { return iEntry.FunctionOffset; }
       
   103         }
       
   104 
       
   105         public uint Data
       
   106         {
       
   107             get { return iEntry.Data; }
       
   108         }
       
   109 
       
   110         public string DataAsString
       
   111         {
       
   112             get { return iEntry.DataAsString; }
       
   113         }
       
   114 
       
   115         public bool IsRegisterBasedEntry
       
   116         {
       
   117             get { return iEntry.IsRegisterBasedEntry; }
       
   118         }
       
   119 
       
   120         public bool IsAccurate
       
   121         {
       
   122             get { return iEntry.IsAccurate; }
       
   123         }
       
   124 
       
   125         public bool IsCurrentStackPointerEntry
       
   126         {
       
   127             get { return iEntry.IsCurrentStackPointerEntry; }
       
   128         }
       
   129 
       
   130         public bool IsGhost
       
   131         {
       
   132             get { return iEntry.IsGhost; }
       
   133         }
       
   134 
       
   135         public bool IsOutsideCurrentStackRange
       
   136         {
       
   137             get { return iEntry.IsOutsideCurrentStackRange; }
       
   138         }
       
   139 
       
   140         internal ICISymbolManager SymbolManager
       
   141         {
       
   142             get
       
   143             {
       
   144                 ICISymbolManager ret = base.Container;
       
   145                 CIProcess process = Stack.OwningProcess;
       
   146                 if ( process != null )
       
   147                 {
       
   148                     ret = process;
       
   149                 }
       
   150                 return ret;
       
   151             }
       
   152         }
       
   153         #endregion
       
   154 
       
   155         #region Internal methods
       
   156         #endregion
       
   157 
       
   158         #region From System.Object
       
   159         public override string ToString()
       
   160         {
       
   161             return iEntry.ToString();
       
   162         }
       
   163         #endregion
       
   164 
       
   165         #region Data members
       
   166         private readonly StackOutputEntry iEntry;
       
   167         #endregion
       
   168     }
       
   169 }