epoc32/include/tools/coredump/symbianelfdefs.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 //
    15 
    16 #ifndef __SYMBIANELFDEFS_H__
    17 #define __SYMBIANELFDEFS_H__
    18 
    19 #include <elfdefs.h>
    20 
    21 /**
    22 @file
    23 @publishedPartner 
    24 @released
    25 
    26 Symbian Core Dump specific ELF definitions. 
    27 
    28 The definitions in this file implement the interface described in document
    29 SGL_TS0028_027_symbian_core_dump_file_format.doc. 
    30 
    31 @see CSymbianElfFormatter
    32 */
    33 
    34 /** Definition of 64 bit memory */
    35 typedef unsigned long long Elf64_Word;
    36 
    37 /** Definition of 8 bit memory */
    38 typedef unsigned char Elf32_Byte;
    39 
    40 
    41 
    42 /**
    43 Value of the d_type field of the standard descriptor header. 
    44 */
    45 typedef enum
    46 {
    47 	/**  Value to identify Sym32_syminfod */
    48 	ESYM_NOTE_SYM	= 0x00000000,
    49 
    50 	/**  Value to identify Sym32_thrdinfod */
    51 	ESYM_NOTE_THRD	= 0x00000010,
    52 
    53 	/** Value to identify Sym32_procinfod */
    54 	ESYM_NOTE_PROC	= 0x00000020,
    55 
    56 	/** Value to identify Sym32_execinfod */
    57 	ESYM_NOTE_EXEC	= 0x00000040,
    58 
    59 	/** Value to identify Sym32_reginfod */
    60 	ESYM_NOTE_REG	= 0x00000080,
    61 
    62 	/** Value to identify string information */
    63 	ESYM_NOTE_STR	= 0x00000100
    64 
    65 } ESYM_NOTE_TYPE;
    66 
    67 
    68 /**
    69 To uniquely identify executables associated with the crashed process an executable 
    70 identifier is required, this identifier is defined as follows
    71 */
    72 typedef struct
    73 {
    74 	/** ID of the executable to match symbolic debug information to executable binary 
    75 	[Currently crash time iTimeLo (LSW) and iTimeHi (MSW)] */
    76 	Elf64_Word		exec_id;
    77 
    78 	/** CCITT CRC-32 Checksum of up to the first 1Kbytes of code segment. */
    79 	Elf32_Word		exec_crc;
    80 
    81 	/** @internalTechnology */
    82     Elf32_Word		exec_spare;
    83 } Sym32_execid;
    84 
    85 /** Size of Sym32_execid in bytes. @see Sym32_execid */
    86 #define SYM32_EXECID_SIZE	16
    87 
    88 /**
    89 The Symbian Info segment contains generic crash information. 
    90 It is defined as a program segment with type PT_NOTE which 
    91 references the segment descriptor Sym32_dhdr.
    92 The d_name field of the standard descriptor header is "CORE.SYMBIAN".
    93 The d_type field of the standard descriptor header is ESYM_NOTE_SYM.
    94 */
    95 typedef struct
    96 {
    97 	/** Date and time of the crash */
    98 	Elf64_Word		sd_date_time;
    99 
   100 	/** The ID of the crashed process as defined by Sym32_execid */
   101 	Sym32_execid	sd_execid;
   102 
   103 	/** The id of the thread causing the crash */
   104 	Elf64_Word		sd_thread_id;
   105 
   106 	/** The crashing threads owning process */
   107 	Elf64_Word		sd_proc_id;
   108 
   109 	/** Identifies whether the crash was caused by a Hardware Exception (set to 0) 
   110 	or Thread Kill (set to 1) */
   111 	Elf32_Word		sd_exit_type;
   112 
   113 	/** If sd_exit_type is Hardware Exception then set to e32const.h::TExcType 
   114 	if is Thread Kill then set to e32const.h::TExitType */
   115 	Elf32_Word		sd_exit_reason;
   116 
   117 	/** Only set if sd_exit_type is Thread Kill. Index into the CORE.SYMBIAN.STR 
   118 	note segment identifying the reason for the crash or ESYM_STR_UNDEF */
   119 	Elf32_Word		sd_exit_cat;
   120 
   121 	/** @internalTechnology */
   122     Elf32_Word		sd_spare;
   123 } Sym32_syminfod;
   124 
   125 /** Size of Sym32_syminfod in bytes. @see Sym32_syminfod */
   126 #define SYM32_SYMINFO_SIZE	56
   127 
   128 /**
   129  The descriptor contents immediately follow the header. 
   130  To obtain the nth segment: nth segment offset = 
   131  (Elf32_Phdr) element -> p_offset + sizeof(Sym32_dhdr) + n * d_descrsz
   132  */
   133 typedef struct {
   134 	/** Index into the CORE.SYMBIAN.STR note segment defining the name of 
   135 	the descriptor or ESYM_STR_UNDEF */
   136 	Elf32_Word	d_name;
   137 
   138 	/** Size of a single descriptor element */
   139 	Elf32_Word	d_descrsz;	
   140 
   141 	/** Type of the descriptor defined */
   142 	Elf32_Word	d_type;		
   143 
   144 	/** Index into the CORE.SYMBIAN.STR note segment defining the version 
   145 	of the following segment descriptor */
   146 	Elf32_Word	d_version;	
   147 
   148 	/** Number of descriptor elements */
   149 	Elf32_Word	d_elemnum;	
   150 } Sym32_dhdr;
   151 
   152 /** Size of Sym32_dhdr in bytes. @see Sym32_dhdr */
   153 #define SYM32_DESCHDR_SIZE	20
   154 
   155 /**
   156 The Thread Info segment contains thread related information for one or more 
   157 threads of the owning process. 
   158 It is defined as a program segment with type PT_NOTE referencing the segment 
   159 descriptor defined below.
   160 The d_name field of the standard descriptor header is "CORE.SYMBIAN.THREAD".
   161 The d_type field of the standard descriptor header is ESYM_NOTE_THRD.
   162 */
   163 typedef struct {
   164 	/** Id of the thread */
   165 	Elf64_Word	td_id;
   166 
   167 	/** Id of the owning process */
   168 	Elf64_Word	td_owning_process;
   169 
   170 	/** Index into the CORE.SYMBIAN.STR note segment defining the name of the 
   171 	thread or ESYM_STR_UNDEF */
   172 	Elf32_Word	td_name;
   173 
   174 	/** Priority of thread */
   175 	Elf32_Word	td_priority;
   176 	/** Supervisor stack pointer */
   177 	Elf32_Word	td_svc_sp;
   178 
   179 	/** Address of the supervisor stack */
   180 	Elf32_Word	td_svc_stack;
   181 
   182 	/** Size of the supervisor stack */
   183 	Elf32_Word	td_svc_stacksz;
   184 
   185 	/** Address of the user stack */
   186 	Elf32_Word	td_usr_stack; 
   187 
   188 	/** Size of the user stack */
   189 	Elf32_Word	td_usr_stacksz;
   190 
   191 	/** @internalTechnology */
   192 	Elf32_Word	td_spare;
   193 } Sym32_thrdinfod;
   194 
   195 /** Size of Sym32_thrdinfod in bytes. @see Sym32_thrdinfod */
   196 #define SYM32_THRINFO_SIZE	48
   197 
   198 /**
   199 The Process Info segment contains process related information for the 
   200 crashed threads owning process. It is defined as a program segment with 
   201 type PT_NOTE referencing the segment descriptor defined below.
   202 The d_name field of the standard descriptor header is "CORE.SYMBIAN.PROCESS".
   203 The d_type field of the standard descriptor header is ESYM_NOTE_PROC.
   204 */
   205 typedef struct {
   206 	/** ID of the process */
   207 	Elf64_Word	pd_id;
   208 
   209 	/** Index into the CORE.SYMBIAN.STR note segment defining the 
   210 	name of the Process or ESYM_STR_UNDEF */
   211 	Elf32_Word	pd_name;
   212 
   213 	/** Priority of the process */
   214 	Elf32_Word	pd_priority;
   215 
   216 } Sym32_procinfod;
   217 
   218 /** Size of Sym32_procinfod in bytes. @see Sym32_procinfod */
   219 #define SYM32_PROCINFO_SIZE	16
   220 
   221 
   222 /**
   223 The Executable Info segment contains information defining the location of the given executables image segments in the processes address space; this includes statically and dynamically linked executables also. It is defined as a program segment with type PT_NOTE referencing the segment descriptor defined below.
   224 The d_name field of the standard descriptor header is "CORE.SYMBIAN.EXECUTABLE".
   225 The d_type field of the standard descriptor header is ESYM_NOTE_EXEC.
   226 */
   227 typedef struct {
   228 	/** The ID of the executable as defined by Sym32_execid */
   229 	Sym32_execid	ed_execid;
   230 
   231 	/** Index into the CORE.SYMBIAN.STR note segment defining the name of 
   232 	the executable or ESYM_STR_UNDEF */
   233 	Elf32_Word		ed_name;
   234 
   235 	/** Execute in place TRUE (1) for XIP ROM code FALSE (0) otherwise */
   236 	Elf32_Word		ed_XIP;
   237 
   238 	/** Size of the executables code segment */
   239 	Elf32_Word		ed_codesize;
   240 
   241 	/** Execution address of the code segment */
   242 	Elf32_Word		ed_coderunaddr;
   243 
   244 	/** Build address of the code section (Non XIP only) */
   245 	Elf32_Word		ed_codeloadaddr;
   246 
   247 	/** Size of the executable rodata segment */
   248 	Elf32_Word		ed_rodatasize;
   249 
   250 	/** Execution address of the rodata segment */
   251 	Elf32_Word		ed_rodatarunaddr;
   252 
   253 	/** Build address of the rodata section (Non XIP only) */
   254 	Elf32_Word		ed_rodataloadaddr;
   255 
   256 	/** Size of the executable data segment */
   257 	Elf32_Word		ed_datasize;
   258 
   259 	/** Execution address of the data segment */
   260 	Elf32_Word		ed_datarunaddr;
   261 
   262 	/** Build address of the data section (Non XIP only) */
   263 	Elf32_Word		ed_dataloadaddr;
   264 
   265 	/** @internalTechnology */
   266 	Elf32_Word		ed_spare;
   267 } Sym32_execinfod;
   268 
   269 /** Size of Sym32_execinfod in bytes. @see Sym32_execinfod */
   270 #define SYM32_EXECINFO_SIZE	64
   271 
   272 
   273 /**
   274 The register descriptor member Sym32_reginfod::rid_class is defined by this enumeration.
   275 @see Sym32_reginfod.
   276 */
   277 typedef enum 
   278 {
   279 	/** Core processor register */
   280 	ESYM_REG_CORE = 0, 	
   281 	/** Coprocessor register */
   282 	ESYM_REG_COPRO = 1	
   283 } ESYM_REGCLASS;	
   284 
   285 /**
   286 The register descriptor member Sym32_reginfod::rid_repre is defined by this enumeration.
   287 @see Sym32_reginfod
   288 */
   289 typedef enum
   290 {
   291 	/** 8 Bit register contents */
   292 	ESYM_REG_8	= 0,	
   293 	/** 16 Bit register contents */
   294 	ESYM_REG_16	= 1,	
   295 	/** 32 Bit register contents */
   296 	ESYM_REG_32	= 2,	
   297 	/** 64 Bit register contents */
   298 	ESYM_REG_64	= 3		
   299 } ESYM_REGREP;
   300 
   301 
   302 /**
   303 The Register Info segment contains a register context for a given thread. The core dump file may include zero or more register contexts for one or more threads within the owning process. It is defined as a program segment with type PT_NOTE referencing the segment descriptor defined below.
   304 The d_name field of the standard descriptor header is "CORE.SYMBIAN.REGISTER.<THREADID>".
   305 The d_type field of the standard descriptor header is ESYM_NOTE_REG.
   306 */
   307 typedef struct {
   308 	/** Thread which context relates to */
   309 	Elf64_Word	rid_thread_id;
   310 
   311 	/** Index into the CORE.SYMBIAN.STR note segment defining the version of 
   312 	the Register Data Info descriptor */
   313 	Elf32_Word	rid_version;
   314 
   315 	/** Number of registers this descriptor defines */
   316 	Elf32_Half	rid_num_registers;
   317 
   318 	/** Register class defined by ESYM_REGCLASS */
   319 	Elf32_Byte	rid_class;
   320 
   321 	/** Register representation defined by ESYM_REGREP */
   322 	Elf32_Byte	rid_repre;
   323 
   324 } Sym32_reginfod;
   325 
   326 /** Size of Sym32_reginfod in bytes. @see Sym32_reginfod */
   327 #define SYM32_REGINFO_SIZE	16
   328 
   329 
   330 /**
   331 Immediately following the Register Info descriptor header is the information describing 
   332 the individual registers. See document for register identifiers. 
   333 The register identification scheme is the same as that used by the run mode debug interface.
   334 */
   335 typedef struct {	
   336 	/** Register ID */
   337 	Elf32_Half	rd_id;
   338 
   339 	/**  Sub register ID */
   340 	Elf32_Half	rd_sub_id;
   341 
   342 	/** Offset in bytes from the beginning of the file to the register data */
   343 	Elf32_Word	rd_data; 
   344 } Sym32_regdatad;
   345 
   346 /** Size of Sym32_regdatad in bytes. @see Sym32_regdatad */
   347 #define SYM32_REGDATA_SIZE	8
   348 
   349 
   350 /** Program header member p_flags indicating that the segment may be executed. */
   351 #define PF_X 1
   352 
   353 /** Program header member p_flags indicating that the segment may be written to. */
   354 #define PF_W 2
   355 
   356 /** Program header member p_flags indicating that the segment may be read from. */
   357 #define PF_R 4 
   358 
   359 
   360 /**
   361 Index to the NULL string, ie string is not defined.
   362 */
   363 #define ESYM_STR_UNDEF 0
   364 
   365 #endif
   366