crashanalysercmd/Libraries/Engine/CrashDebuggerLib/Structures/Register/RegisterEntry.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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 
       
    18 using System;
       
    19 using System.Collections.Generic;
       
    20 using System.Text;
       
    21 using SymbianStructuresLib.Debug.Symbols;
       
    22 using CrashDebuggerLib.Structures.KernelObjects;
       
    23 using SymbianStructuresLib.Arm.Registers;
       
    24 
       
    25 namespace CrashDebuggerLib.Structures.Register
       
    26 {
       
    27     public class RegisterEntry : ArmRegister
       
    28     {
       
    29         #region Constructors
       
    30         internal RegisterEntry( RegisterCollection aParent, TArmRegisterType aType )
       
    31             : base( aType )
       
    32         {
       
    33             iParent = aParent;
       
    34         }
       
    35 
       
    36         internal RegisterEntry( RegisterCollection aParent, string aName, uint aValue )
       
    37             : base( aName, aValue )
       
    38         {
       
    39             iParent = aParent;
       
    40         }
       
    41         #endregion
       
    42 
       
    43         #region API
       
    44         #endregion
       
    45 
       
    46         #region Properties
       
    47         public string SymbolString
       
    48         {
       
    49             get
       
    50             {
       
    51                 Symbol symbol = Symbol;
       
    52                 if ( symbol != null )
       
    53                 {
       
    54                     return symbol.Name;
       
    55                 }
       
    56                 return "0x" + Value.ToString( "x8" );
       
    57             }
       
    58         }
       
    59 
       
    60         public Symbol Symbol
       
    61         {
       
    62             get
       
    63             {
       
    64                 if ( iSymbol == null )
       
    65                 {
       
    66                     uint address = this.Value;
       
    67                     iSymbol = iParent.LookUpSymbol( address );
       
    68                 }
       
    69                 return iSymbol;
       
    70             }
       
    71         }
       
    72         #endregion
       
    73 
       
    74         #region Internal methods
       
    75         #endregion
       
    76 
       
    77         #region Internal constants
       
    78         #endregion
       
    79 
       
    80         #region From System.Object
       
    81         public override string ToString()
       
    82         {
       
    83             StringBuilder ret = new StringBuilder();
       
    84             //
       
    85             ret.Append( base.ToString() );
       
    86             Symbol symbol = Symbol;
       
    87             if ( symbol != null )
       
    88             {
       
    89                 ret.Append( " " + symbol.Name );
       
    90             }
       
    91             //
       
    92             return ret.ToString();
       
    93         }
       
    94         #endregion
       
    95 
       
    96         #region Data members
       
    97         private readonly RegisterCollection iParent;
       
    98         private Symbol iSymbol = null;
       
    99         #endregion
       
   100     }
       
   101 }