epoc32/include/tools/coredump/crashdata.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Common Crash Data definitions used between the core dump server, 
    15 // formatters and user interfaces
    16 //
    17 
    18 
    19 
    20 /**
    21  @file
    22  @publishedPartner 
    23  @released
    24  @see CCrashDataSource
    25  @see RCoreDumpSession
    26 */
    27 
    28 #ifndef CRASH_DATA_H
    29 #define CRASH_DATA_H
    30 
    31 #include <e32std.h>
    32 #include <e32const.h>
    33 #include <rm_debug_api.h>
    34 
    35 using namespace Debug;
    36 
    37 /**
    38 Crash event information. This is given to a formatter when a crash occurs.
    39 @see CCoreDumpFormatter::CrashEventL()
    40 */
    41 struct TCrashInfo
    42 {
    43 
    44 	/** 
    45 	Type of crash event
    46 	*/
    47 	enum TCrashType 
    48 	{ 
    49 	/** ECrashException is raised when a hardware exception occurs */
    50 	ECrashException, 
    51 
    52 	/** ECrashKill is raised when a thread is killed or panicked */
    53 	ECrashKill,
    54 
    55     /** 
    56 	@internalTechnology
    57 	Guard
    58 	*/
    59     ECrashLast
    60 	};
    61 
    62     /** Type of crash
    63 	@see  TCrashType 
    64 	*/
    65 	TCrashType		iType; 
    66 
    67 	/** Exception type or exit type. 
    68 	If crash type iType is ECrashException, this is set to e32const.h::TExcType 
    69 	If crash type iType is ECrashKill, this is set to e32const.h::TExitType.
    70 	*/
    71     TUint32			iExcNumber;
    72 
    73 	/** This is only set when iType is ECrashKill. Kernel panic code. */
    74 	TInt			iReason; 
    75 
    76 	/** Crash category description. Valid when crash type is ECrashKill */
    77     TBuf<KMaxExitCategoryName> iCategory; 
    78 
    79 	/** Crashed thread id */
    80 	TUint64			iTid;
    81 
    82 	/** Crashed process id */
    83 	TUint64			iPid;
    84 
    85 	/** Crash time */
    86     TUint64			iTime; 
    87 
    88 	/** Register context at time of crash. 
    89 	@see TRmdArmExcInfo
    90 	@see Debug::TRmdArmExcInfo
    91 	*/
    92     TRmdArmExcInfo  iContext;
    93 
    94     /** Reserved for future.
    95 	@internalTechnology */
    96     TUint32 iSpare1;
    97 	/** @internalTechnology */
    98     TUint32 iSpare2;
    99 	/** @internalTechnology */
   100     TUint32 iSpare3;
   101 };
   102 
   103 /**
   104 Code segment information. 
   105 @see CServerCrashDataSource::GetCodeSegmentsL()
   106 */
   107 struct TCodeSegInfo
   108 {
   109 
   110 	/**
   111 	Name of code segment. 
   112 	*/
   113     TBufC<KMaxPath> iName;
   114 
   115 	/**
   116 	Set to trie to indicates that this executable is executing in place.
   117 	*/
   118     TBool		iXIP;
   119 
   120 
   121 	/**
   122 	Type of the code segment. 
   123 	@see Debug::TCodeSegType
   124 	@see TCodeSegType
   125 	*/
   126     TCodeSegType iType;
   127 
   128 	/**	Code size in bytes	*/
   129     TUint32		iCodeSize;
   130 
   131 	/**	Code segment run address. If code segment is XIP then 
   132 	this is the same as iCodeLoadAddr */
   133     TLinAddr	iCodeRunAddr;
   134 
   135 	/**	Address where code segement was loaded from */
   136     TLinAddr	iCodeLoadAddr;
   137 
   138 	/**	Size on bytes of the read only data */
   139     TUint32		iRoDataSize;
   140 
   141 	/**	Address of read only data at run time. If code segment is XIP then 
   142 	this is the same as iRoDataLoadAddr */
   143     TLinAddr	iRoDataRunAddr;
   144 
   145 	/**	Address where read only data was loaded from */
   146     TLinAddr	iRoDataLoadAddr;
   147 
   148 	/** Writable data size in bytes. Combined .bss and .data sections  */
   149     TUint32		iDataSize;
   150 
   151 	/** Address of writable data at run time */
   152     TLinAddr	iDataRunAddr;
   153 
   154 	/** Build time address of initialised writable data */
   155     TLinAddr	iDataLoadAddr;
   156 
   157     /** reserved for future 
   158 	@internalTechnology */
   159     TUint32 iSpare1;
   160 	/** @internalTechnology */
   161     TUint32 iSpare2;
   162 	/** @internalTechnology */
   163     TUint32 iSpare3;
   164 };
   165 
   166 /**
   167 Pointer array of TCodeSegInfo objects.
   168 @see TCodeSegInfo
   169 */
   170 typedef RPointerArray<TCodeSegInfo> RCodeSegPointerList;
   171 
   172 
   173 /**
   174 Detailed information about a register. 
   175 The Symbian ELF format defines the register identification format.
   176 The Debug Security Server implements this format.
   177 @see CCrashDataSource::ReadRegistersL()
   178 */
   179 class TRegisterData
   180 {
   181 
   182 public: 
   183 
   184 	IMPORT_C    TUint16		GetId()   const;
   185 	IMPORT_C    TUint16		GetSubId() const;
   186 	IMPORT_C    TUint8		GetSize() const;
   187 	IMPORT_C    TUint8		GetClass() const;
   188 	IMPORT_C    TBool		SameRegister( const TRegisterData & other ) const;
   189 	
   190 	IMPORT_C    TUint8		GetContent8()  const;
   191 	IMPORT_C    TUint16		GetContent16() const;
   192 	IMPORT_C    TUint32		GetContent32() const;
   193 	IMPORT_C    TUint64		GetContent64() const;
   194 
   195 	IMPORT_C    void		SetContent8(  const TUint8 aVal );
   196 	IMPORT_C    void		SetContent16( const TUint16 aVal );
   197 	IMPORT_C    void		SetContent32( const TUint32 aVal );
   198 	IMPORT_C    void		SetContent64( const TUint64 aVal );
   199 	IMPORT_C    void		SetContent( const TUint aVal );
   200 
   201 	IMPORT_C    void		SetContent( const TRegisterData & other );
   202 
   203 	IMPORT_C    TBool		Available( ) const;
   204 	IMPORT_C    void		SetAvailable( const TBool aAvailable );
   205 
   206 
   207 	/**
   208 	This is the same as symbianelfdefs.h ESYM_REGREP. 
   209 	@see ESYM_REGREP
   210 	*/
   211 	typedef enum TRegisterRepresentation
   212 		{
   213 		/** 8 Bit register */
   214 		ERegRepr8	= 0,	
   215 		/** 16 Bit register */
   216 		ERegRepr16	= 1,
   217 		/** 32 Bit register */
   218 		ERegRepr32	= 2,
   219 		/** 64 Bit register */
   220 		ERegRepr64	= 3,
   221 		/** 
   222 		@internalTechnology
   223 		*/
   224 		ERegReprLast
   225 		};
   226     
   227 	/**
   228 	This is the same as symbianelfdefs.h ESYM_REGCLASS. 
   229 	@see ESYM_REGCLASS
   230 	*/
   231 	typedef enum TRegisterClass
   232 		{
   233 		/** A Core register */
   234 		ERegClassCore	= 0,	
   235 		/** A Co Processor register */
   236 		ERegClassCoPro	= 1, 
   237 		/** 
   238 		@internalTechnology
   239 		*/
   240 		ERegClassLast
   241 		};
   242 
   243 
   244 	/**
   245 	Register identifier
   246 	*/
   247 	union 
   248         {
   249 	    /** Used when calling the Debug Security Server */
   250         TRegisterInfo regInfo;
   251 
   252         /** Same as Sym32_reginfod::rd_id
   253 	    if rid_class == ESYM_REG_CORE 
   254 	      rd_id is one of rm_debug_api.h::TFunctionalityRegister
   255 	    else 
   256 	      rd_id is CoProcessor number, eg 15 for ARM CP15 
   257 
   258 		@see Sym32_reginfod::rd_id
   259 		*/
   260 		TUint16		iId;
   261         };
   262 
   263 	/** Same as Sym32_reginfod::rid_class
   264 		Type of register ESYM_REG_CLASS :{ ESYM_REG_CORE = 0, ESYM_REG_COPRO = 1 } 
   265 	@see Sym32_reginfod::rid_class
   266 	*/
   267 	TUint8		iRegClass;
   268 
   269 	/** Same as Sym32_reginfod::rd_sub_id		
   270 		Only used if rid_clas == ESYM_REG_COPRO
   271 
   272   	   Bitfield is made up of the following fields:
   273          bits 13 to 11  : OpCode2
   274          bits 10 to 8   : OpCode1
   275          bits 7  to 4   : CRn
   276          bits 3  to 0   : CRm 
   277 
   278 	@see Sym32_reginfod::rd_sub_id		
   279 	*/
   280 	TUint16		iSubId;
   281 
   282 	/** Same as Sym32_reginfod::rd_repre
   283 		{ ESYM_REG_8 == 0, ESYM_REG_16 == 1, ESYM_REG_32 == 2, ESYM_REG_64 == 3 }
   284 		Determines which version of GetContent*() to use 
   285 	@see Sym32_reginfod::rd_repre
   286 	*/
   287 	TUint8		iSize;
   288 
   289 
   290 	/** True if the content of this register was succesfully obtained from 
   291 	the target */
   292 	TBool       iAvailable;
   293 
   294 	/** Register value */
   295 	union
   296 	{
   297 		/** Value of an 8 bit register */
   298 		TUint8		iValue8;
   299 
   300 		/** Value of a 16 bit register */
   301 		TUint16		iValue16;
   302 
   303 		/** Value of a 32 bit register */
   304 		TUint32		iValue32;
   305 
   306 		/** Value of a 64 bit register */
   307 		TUint64		iValue64;
   308 	};
   309 
   310 	/** Reserved for future use
   311 	@internalTechnology */
   312 	TUint32 iSpare1;
   313 
   314 	/** @internalTechnology */
   315 	TUint32 iSpare2;
   316 
   317 	/** @internalTechnology */
   318 	TUint32 iSpare3;
   319 };
   320 
   321 
   322 /**
   323 @publishedPartner 
   324 @released
   325 
   326 List of TRegisterData objects.
   327 @see TRegisterData
   328 @see RArray
   329 */
   330 typedef RArray<TRegisterData> RRegisterList;
   331 
   332 
   333 #endif // CRASH_DATA_H
   334 
   335