crashanalysercmd/Libraries/Engine/CrashDebuggerLib/Structures/Thread/ThreadStackInfo.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 CrashDebuggerLib.Structures.KernelObjects;
       
    22 using CrashDebuggerLib.Structures.Common;
       
    23 using CrashDebuggerLib.Structures.Process;
       
    24 
       
    25 namespace CrashDebuggerLib.Structures.Thread
       
    26 {
       
    27     public class ThreadStackInfo : CrashDebuggerAware
       
    28     {
       
    29         #region Enumerations
       
    30         public enum TType
       
    31         {
       
    32             ETypeSupervisor = 0,
       
    33             ETypeUser
       
    34         }
       
    35         #endregion
       
    36 
       
    37         #region Constructors
       
    38         public ThreadStackInfo( CrashDebuggerInfo aCrashDebugger, DThread aThread, TType aType )
       
    39             : base( aCrashDebugger )
       
    40         {
       
    41             iType = aType;
       
    42             iThread = aThread;
       
    43             iData = new ThreadStackData( aCrashDebugger, this );
       
    44         }
       
    45         #endregion
       
    46 
       
    47         #region API
       
    48         #endregion
       
    49 
       
    50         #region Properties
       
    51         public TType Type
       
    52         {
       
    53             get { return iType; }
       
    54         }
       
    55 
       
    56         public uint BaseAddress
       
    57         {
       
    58             get { return iBaseAddress; }
       
    59             set { iBaseAddress = value; }
       
    60         }
       
    61 
       
    62         public uint Size
       
    63         {
       
    64             get { return iSize; }
       
    65             set { iSize = value; }
       
    66         }
       
    67 
       
    68         public uint StackPointer
       
    69         {
       
    70             get { return iStackPointer; }
       
    71             set { iStackPointer = value; }
       
    72         }
       
    73 
       
    74         public ThreadStackData Data
       
    75         {
       
    76             get { return iData; }
       
    77         }
       
    78 
       
    79         public DThread Thread
       
    80         {
       
    81             get { return iThread; }
       
    82         }
       
    83 
       
    84         public DProcess Process
       
    85         {
       
    86             get
       
    87             {
       
    88                 DThread thread = this.Thread;
       
    89                 return thread.OwningProcess;
       
    90             }
       
    91         }
       
    92         #endregion
       
    93 
       
    94         #region Internal methods
       
    95         #endregion
       
    96 
       
    97         #region Internal constants
       
    98         #endregion
       
    99 
       
   100         #region Clipboard Support
       
   101         public string ToClipboard()
       
   102         {
       
   103             StringBuilder ret = new StringBuilder();
       
   104             //
       
   105             string type = "Supervisor";
       
   106             if ( iType == TType.ETypeUser )
       
   107             {
       
   108                 type = "User";
       
   109             }
       
   110             //
       
   111             ret.AppendFormat( "{0} Stack @ 0x{1:x8}, Stack Pointer: 0x{2:x8}" + System.Environment.NewLine, type.ToUpper(), BaseAddress, StackPointer );
       
   112             ret.AppendLine( iData.CallStackToString() );
       
   113             //
       
   114             return ret.ToString();
       
   115         }
       
   116         #endregion
       
   117 
       
   118         #region From System.Object
       
   119         public override string ToString()
       
   120         {
       
   121             return base.ToString();
       
   122         }
       
   123         #endregion
       
   124 
       
   125         #region Data members
       
   126         private readonly TType iType;
       
   127         private uint iBaseAddress = 0;
       
   128         private uint iSize = 0;
       
   129         private uint iStackPointer = 0;
       
   130         private readonly DThread iThread;
       
   131         private readonly ThreadStackData iData;
       
   132         #endregion
       
   133     }
       
   134 }