1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/tools/coredump/symbianelfdefs.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,366 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __SYMBIANELFDEFS_H__
1.20 +#define __SYMBIANELFDEFS_H__
1.21 +
1.22 +#include <elfdefs.h>
1.23 +
1.24 +/**
1.25 +@file
1.26 +@publishedPartner
1.27 +@released
1.28 +
1.29 +Symbian Core Dump specific ELF definitions.
1.30 +
1.31 +The definitions in this file implement the interface described in document
1.32 +SGL_TS0028_027_symbian_core_dump_file_format.doc.
1.33 +
1.34 +@see CSymbianElfFormatter
1.35 +*/
1.36 +
1.37 +/** Definition of 64 bit memory */
1.38 +typedef unsigned long long Elf64_Word;
1.39 +
1.40 +/** Definition of 8 bit memory */
1.41 +typedef unsigned char Elf32_Byte;
1.42 +
1.43 +
1.44 +
1.45 +/**
1.46 +Value of the d_type field of the standard descriptor header.
1.47 +*/
1.48 +typedef enum
1.49 +{
1.50 + /** Value to identify Sym32_syminfod */
1.51 + ESYM_NOTE_SYM = 0x00000000,
1.52 +
1.53 + /** Value to identify Sym32_thrdinfod */
1.54 + ESYM_NOTE_THRD = 0x00000010,
1.55 +
1.56 + /** Value to identify Sym32_procinfod */
1.57 + ESYM_NOTE_PROC = 0x00000020,
1.58 +
1.59 + /** Value to identify Sym32_execinfod */
1.60 + ESYM_NOTE_EXEC = 0x00000040,
1.61 +
1.62 + /** Value to identify Sym32_reginfod */
1.63 + ESYM_NOTE_REG = 0x00000080,
1.64 +
1.65 + /** Value to identify string information */
1.66 + ESYM_NOTE_STR = 0x00000100
1.67 +
1.68 +} ESYM_NOTE_TYPE;
1.69 +
1.70 +
1.71 +/**
1.72 +To uniquely identify executables associated with the crashed process an executable
1.73 +identifier is required, this identifier is defined as follows
1.74 +*/
1.75 +typedef struct
1.76 +{
1.77 + /** ID of the executable to match symbolic debug information to executable binary
1.78 + [Currently crash time iTimeLo (LSW) and iTimeHi (MSW)] */
1.79 + Elf64_Word exec_id;
1.80 +
1.81 + /** CCITT CRC-32 Checksum of up to the first 1Kbytes of code segment. */
1.82 + Elf32_Word exec_crc;
1.83 +
1.84 + /** @internalTechnology */
1.85 + Elf32_Word exec_spare;
1.86 +} Sym32_execid;
1.87 +
1.88 +/** Size of Sym32_execid in bytes. @see Sym32_execid */
1.89 +#define SYM32_EXECID_SIZE 16
1.90 +
1.91 +/**
1.92 +The Symbian Info segment contains generic crash information.
1.93 +It is defined as a program segment with type PT_NOTE which
1.94 +references the segment descriptor Sym32_dhdr.
1.95 +The d_name field of the standard descriptor header is "CORE.SYMBIAN".
1.96 +The d_type field of the standard descriptor header is ESYM_NOTE_SYM.
1.97 +*/
1.98 +typedef struct
1.99 +{
1.100 + /** Date and time of the crash */
1.101 + Elf64_Word sd_date_time;
1.102 +
1.103 + /** The ID of the crashed process as defined by Sym32_execid */
1.104 + Sym32_execid sd_execid;
1.105 +
1.106 + /** The id of the thread causing the crash */
1.107 + Elf64_Word sd_thread_id;
1.108 +
1.109 + /** The crashing threads owning process */
1.110 + Elf64_Word sd_proc_id;
1.111 +
1.112 + /** Identifies whether the crash was caused by a Hardware Exception (set to 0)
1.113 + or Thread Kill (set to 1) */
1.114 + Elf32_Word sd_exit_type;
1.115 +
1.116 + /** If sd_exit_type is Hardware Exception then set to e32const.h::TExcType
1.117 + if is Thread Kill then set to e32const.h::TExitType */
1.118 + Elf32_Word sd_exit_reason;
1.119 +
1.120 + /** Only set if sd_exit_type is Thread Kill. Index into the CORE.SYMBIAN.STR
1.121 + note segment identifying the reason for the crash or ESYM_STR_UNDEF */
1.122 + Elf32_Word sd_exit_cat;
1.123 +
1.124 + /** @internalTechnology */
1.125 + Elf32_Word sd_spare;
1.126 +} Sym32_syminfod;
1.127 +
1.128 +/** Size of Sym32_syminfod in bytes. @see Sym32_syminfod */
1.129 +#define SYM32_SYMINFO_SIZE 56
1.130 +
1.131 +/**
1.132 + The descriptor contents immediately follow the header.
1.133 + To obtain the nth segment: nth segment offset =
1.134 + (Elf32_Phdr) element -> p_offset + sizeof(Sym32_dhdr) + n * d_descrsz
1.135 + */
1.136 +typedef struct {
1.137 + /** Index into the CORE.SYMBIAN.STR note segment defining the name of
1.138 + the descriptor or ESYM_STR_UNDEF */
1.139 + Elf32_Word d_name;
1.140 +
1.141 + /** Size of a single descriptor element */
1.142 + Elf32_Word d_descrsz;
1.143 +
1.144 + /** Type of the descriptor defined */
1.145 + Elf32_Word d_type;
1.146 +
1.147 + /** Index into the CORE.SYMBIAN.STR note segment defining the version
1.148 + of the following segment descriptor */
1.149 + Elf32_Word d_version;
1.150 +
1.151 + /** Number of descriptor elements */
1.152 + Elf32_Word d_elemnum;
1.153 +} Sym32_dhdr;
1.154 +
1.155 +/** Size of Sym32_dhdr in bytes. @see Sym32_dhdr */
1.156 +#define SYM32_DESCHDR_SIZE 20
1.157 +
1.158 +/**
1.159 +The Thread Info segment contains thread related information for one or more
1.160 +threads of the owning process.
1.161 +It is defined as a program segment with type PT_NOTE referencing the segment
1.162 +descriptor defined below.
1.163 +The d_name field of the standard descriptor header is "CORE.SYMBIAN.THREAD".
1.164 +The d_type field of the standard descriptor header is ESYM_NOTE_THRD.
1.165 +*/
1.166 +typedef struct {
1.167 + /** Id of the thread */
1.168 + Elf64_Word td_id;
1.169 +
1.170 + /** Id of the owning process */
1.171 + Elf64_Word td_owning_process;
1.172 +
1.173 + /** Index into the CORE.SYMBIAN.STR note segment defining the name of the
1.174 + thread or ESYM_STR_UNDEF */
1.175 + Elf32_Word td_name;
1.176 +
1.177 + /** Priority of thread */
1.178 + Elf32_Word td_priority;
1.179 + /** Supervisor stack pointer */
1.180 + Elf32_Word td_svc_sp;
1.181 +
1.182 + /** Address of the supervisor stack */
1.183 + Elf32_Word td_svc_stack;
1.184 +
1.185 + /** Size of the supervisor stack */
1.186 + Elf32_Word td_svc_stacksz;
1.187 +
1.188 + /** Address of the user stack */
1.189 + Elf32_Word td_usr_stack;
1.190 +
1.191 + /** Size of the user stack */
1.192 + Elf32_Word td_usr_stacksz;
1.193 +
1.194 + /** @internalTechnology */
1.195 + Elf32_Word td_spare;
1.196 +} Sym32_thrdinfod;
1.197 +
1.198 +/** Size of Sym32_thrdinfod in bytes. @see Sym32_thrdinfod */
1.199 +#define SYM32_THRINFO_SIZE 48
1.200 +
1.201 +/**
1.202 +The Process Info segment contains process related information for the
1.203 +crashed threads owning process. It is defined as a program segment with
1.204 +type PT_NOTE referencing the segment descriptor defined below.
1.205 +The d_name field of the standard descriptor header is "CORE.SYMBIAN.PROCESS".
1.206 +The d_type field of the standard descriptor header is ESYM_NOTE_PROC.
1.207 +*/
1.208 +typedef struct {
1.209 + /** ID of the process */
1.210 + Elf64_Word pd_id;
1.211 +
1.212 + /** Index into the CORE.SYMBIAN.STR note segment defining the
1.213 + name of the Process or ESYM_STR_UNDEF */
1.214 + Elf32_Word pd_name;
1.215 +
1.216 + /** Priority of the process */
1.217 + Elf32_Word pd_priority;
1.218 +
1.219 +} Sym32_procinfod;
1.220 +
1.221 +/** Size of Sym32_procinfod in bytes. @see Sym32_procinfod */
1.222 +#define SYM32_PROCINFO_SIZE 16
1.223 +
1.224 +
1.225 +/**
1.226 +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.
1.227 +The d_name field of the standard descriptor header is "CORE.SYMBIAN.EXECUTABLE".
1.228 +The d_type field of the standard descriptor header is ESYM_NOTE_EXEC.
1.229 +*/
1.230 +typedef struct {
1.231 + /** The ID of the executable as defined by Sym32_execid */
1.232 + Sym32_execid ed_execid;
1.233 +
1.234 + /** Index into the CORE.SYMBIAN.STR note segment defining the name of
1.235 + the executable or ESYM_STR_UNDEF */
1.236 + Elf32_Word ed_name;
1.237 +
1.238 + /** Execute in place TRUE (1) for XIP ROM code FALSE (0) otherwise */
1.239 + Elf32_Word ed_XIP;
1.240 +
1.241 + /** Size of the executables code segment */
1.242 + Elf32_Word ed_codesize;
1.243 +
1.244 + /** Execution address of the code segment */
1.245 + Elf32_Word ed_coderunaddr;
1.246 +
1.247 + /** Build address of the code section (Non XIP only) */
1.248 + Elf32_Word ed_codeloadaddr;
1.249 +
1.250 + /** Size of the executable rodata segment */
1.251 + Elf32_Word ed_rodatasize;
1.252 +
1.253 + /** Execution address of the rodata segment */
1.254 + Elf32_Word ed_rodatarunaddr;
1.255 +
1.256 + /** Build address of the rodata section (Non XIP only) */
1.257 + Elf32_Word ed_rodataloadaddr;
1.258 +
1.259 + /** Size of the executable data segment */
1.260 + Elf32_Word ed_datasize;
1.261 +
1.262 + /** Execution address of the data segment */
1.263 + Elf32_Word ed_datarunaddr;
1.264 +
1.265 + /** Build address of the data section (Non XIP only) */
1.266 + Elf32_Word ed_dataloadaddr;
1.267 +
1.268 + /** @internalTechnology */
1.269 + Elf32_Word ed_spare;
1.270 +} Sym32_execinfod;
1.271 +
1.272 +/** Size of Sym32_execinfod in bytes. @see Sym32_execinfod */
1.273 +#define SYM32_EXECINFO_SIZE 64
1.274 +
1.275 +
1.276 +/**
1.277 +The register descriptor member Sym32_reginfod::rid_class is defined by this enumeration.
1.278 +@see Sym32_reginfod.
1.279 +*/
1.280 +typedef enum
1.281 +{
1.282 + /** Core processor register */
1.283 + ESYM_REG_CORE = 0,
1.284 + /** Coprocessor register */
1.285 + ESYM_REG_COPRO = 1
1.286 +} ESYM_REGCLASS;
1.287 +
1.288 +/**
1.289 +The register descriptor member Sym32_reginfod::rid_repre is defined by this enumeration.
1.290 +@see Sym32_reginfod
1.291 +*/
1.292 +typedef enum
1.293 +{
1.294 + /** 8 Bit register contents */
1.295 + ESYM_REG_8 = 0,
1.296 + /** 16 Bit register contents */
1.297 + ESYM_REG_16 = 1,
1.298 + /** 32 Bit register contents */
1.299 + ESYM_REG_32 = 2,
1.300 + /** 64 Bit register contents */
1.301 + ESYM_REG_64 = 3
1.302 +} ESYM_REGREP;
1.303 +
1.304 +
1.305 +/**
1.306 +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.
1.307 +The d_name field of the standard descriptor header is "CORE.SYMBIAN.REGISTER.<THREADID>".
1.308 +The d_type field of the standard descriptor header is ESYM_NOTE_REG.
1.309 +*/
1.310 +typedef struct {
1.311 + /** Thread which context relates to */
1.312 + Elf64_Word rid_thread_id;
1.313 +
1.314 + /** Index into the CORE.SYMBIAN.STR note segment defining the version of
1.315 + the Register Data Info descriptor */
1.316 + Elf32_Word rid_version;
1.317 +
1.318 + /** Number of registers this descriptor defines */
1.319 + Elf32_Half rid_num_registers;
1.320 +
1.321 + /** Register class defined by ESYM_REGCLASS */
1.322 + Elf32_Byte rid_class;
1.323 +
1.324 + /** Register representation defined by ESYM_REGREP */
1.325 + Elf32_Byte rid_repre;
1.326 +
1.327 +} Sym32_reginfod;
1.328 +
1.329 +/** Size of Sym32_reginfod in bytes. @see Sym32_reginfod */
1.330 +#define SYM32_REGINFO_SIZE 16
1.331 +
1.332 +
1.333 +/**
1.334 +Immediately following the Register Info descriptor header is the information describing
1.335 +the individual registers. See document for register identifiers.
1.336 +The register identification scheme is the same as that used by the run mode debug interface.
1.337 +*/
1.338 +typedef struct {
1.339 + /** Register ID */
1.340 + Elf32_Half rd_id;
1.341 +
1.342 + /** Sub register ID */
1.343 + Elf32_Half rd_sub_id;
1.344 +
1.345 + /** Offset in bytes from the beginning of the file to the register data */
1.346 + Elf32_Word rd_data;
1.347 +} Sym32_regdatad;
1.348 +
1.349 +/** Size of Sym32_regdatad in bytes. @see Sym32_regdatad */
1.350 +#define SYM32_REGDATA_SIZE 8
1.351 +
1.352 +
1.353 +/** Program header member p_flags indicating that the segment may be executed. */
1.354 +#define PF_X 1
1.355 +
1.356 +/** Program header member p_flags indicating that the segment may be written to. */
1.357 +#define PF_W 2
1.358 +
1.359 +/** Program header member p_flags indicating that the segment may be read from. */
1.360 +#define PF_R 4
1.361 +
1.362 +
1.363 +/**
1.364 +Index to the NULL string, ie string is not defined.
1.365 +*/
1.366 +#define ESYM_STR_UNDEF 0
1.367 +
1.368 +#endif
1.369 +