williamr@4: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@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 williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // williamr@4: williamr@4: #ifndef __SYMBIANELFDEFS_H__ williamr@4: #define __SYMBIANELFDEFS_H__ williamr@4: williamr@4: #include williamr@4: williamr@4: /** williamr@4: @file williamr@4: @publishedPartner williamr@4: @released williamr@4: williamr@4: Symbian Core Dump specific ELF definitions. williamr@4: williamr@4: The definitions in this file implement the interface described in document williamr@4: SGL_TS0028_027_symbian_core_dump_file_format.doc. williamr@4: williamr@4: @see CSymbianElfFormatter williamr@4: */ williamr@4: williamr@4: /** Definition of 64 bit memory */ williamr@4: typedef unsigned long long Elf64_Word; williamr@4: williamr@4: /** Definition of 8 bit memory */ williamr@4: typedef unsigned char Elf32_Byte; williamr@4: williamr@4: williamr@4: williamr@4: /** williamr@4: Value of the d_type field of the standard descriptor header. williamr@4: */ williamr@4: typedef enum williamr@4: { williamr@4: /** Value to identify Sym32_syminfod */ williamr@4: ESYM_NOTE_SYM = 0x00000000, williamr@4: williamr@4: /** Value to identify Sym32_thrdinfod */ williamr@4: ESYM_NOTE_THRD = 0x00000010, williamr@4: williamr@4: /** Value to identify Sym32_procinfod */ williamr@4: ESYM_NOTE_PROC = 0x00000020, williamr@4: williamr@4: /** Value to identify Sym32_execinfod */ williamr@4: ESYM_NOTE_EXEC = 0x00000040, williamr@4: williamr@4: /** Value to identify Sym32_reginfod */ williamr@4: ESYM_NOTE_REG = 0x00000080, williamr@4: williamr@4: /** Value to identify string information */ williamr@4: ESYM_NOTE_STR = 0x00000100 williamr@4: williamr@4: } ESYM_NOTE_TYPE; williamr@4: williamr@4: williamr@4: /** williamr@4: To uniquely identify executables associated with the crashed process an executable williamr@4: identifier is required, this identifier is defined as follows williamr@4: */ williamr@4: typedef struct williamr@4: { williamr@4: /** ID of the executable to match symbolic debug information to executable binary williamr@4: [Currently crash time iTimeLo (LSW) and iTimeHi (MSW)] */ williamr@4: Elf64_Word exec_id; williamr@4: williamr@4: /** CCITT CRC-32 Checksum of up to the first 1Kbytes of code segment. */ williamr@4: Elf32_Word exec_crc; williamr@4: williamr@4: /** @internalTechnology */ williamr@4: Elf32_Word exec_spare; williamr@4: } Sym32_execid; williamr@4: williamr@4: /** Size of Sym32_execid in bytes. @see Sym32_execid */ williamr@4: #define SYM32_EXECID_SIZE 16 williamr@4: williamr@4: /** williamr@4: The Symbian Info segment contains generic crash information. williamr@4: It is defined as a program segment with type PT_NOTE which williamr@4: references the segment descriptor Sym32_dhdr. williamr@4: The d_name field of the standard descriptor header is "CORE.SYMBIAN". williamr@4: The d_type field of the standard descriptor header is ESYM_NOTE_SYM. williamr@4: */ williamr@4: typedef struct williamr@4: { williamr@4: /** Date and time of the crash */ williamr@4: Elf64_Word sd_date_time; williamr@4: williamr@4: /** The ID of the crashed process as defined by Sym32_execid */ williamr@4: Sym32_execid sd_execid; williamr@4: williamr@4: /** The id of the thread causing the crash */ williamr@4: Elf64_Word sd_thread_id; williamr@4: williamr@4: /** The crashing threads owning process */ williamr@4: Elf64_Word sd_proc_id; williamr@4: williamr@4: /** Identifies whether the crash was caused by a Hardware Exception (set to 0) williamr@4: or Thread Kill (set to 1) */ williamr@4: Elf32_Word sd_exit_type; williamr@4: williamr@4: /** If sd_exit_type is Hardware Exception then set to e32const.h::TExcType williamr@4: if is Thread Kill then set to e32const.h::TExitType */ williamr@4: Elf32_Word sd_exit_reason; williamr@4: williamr@4: /** Only set if sd_exit_type is Thread Kill. Index into the CORE.SYMBIAN.STR williamr@4: note segment identifying the reason for the crash or ESYM_STR_UNDEF */ williamr@4: Elf32_Word sd_exit_cat; williamr@4: williamr@4: /** @internalTechnology */ williamr@4: Elf32_Word sd_spare; williamr@4: } Sym32_syminfod; williamr@4: williamr@4: /** Size of Sym32_syminfod in bytes. @see Sym32_syminfod */ williamr@4: #define SYM32_SYMINFO_SIZE 56 williamr@4: williamr@4: /** williamr@4: The descriptor contents immediately follow the header. williamr@4: To obtain the nth segment: nth segment offset = williamr@4: (Elf32_Phdr) element -> p_offset + sizeof(Sym32_dhdr) + n * d_descrsz williamr@4: */ williamr@4: typedef struct { williamr@4: /** Index into the CORE.SYMBIAN.STR note segment defining the name of williamr@4: the descriptor or ESYM_STR_UNDEF */ williamr@4: Elf32_Word d_name; williamr@4: williamr@4: /** Size of a single descriptor element */ williamr@4: Elf32_Word d_descrsz; williamr@4: williamr@4: /** Type of the descriptor defined */ williamr@4: Elf32_Word d_type; williamr@4: williamr@4: /** Index into the CORE.SYMBIAN.STR note segment defining the version williamr@4: of the following segment descriptor */ williamr@4: Elf32_Word d_version; williamr@4: williamr@4: /** Number of descriptor elements */ williamr@4: Elf32_Word d_elemnum; williamr@4: } Sym32_dhdr; williamr@4: williamr@4: /** Size of Sym32_dhdr in bytes. @see Sym32_dhdr */ williamr@4: #define SYM32_DESCHDR_SIZE 20 williamr@4: williamr@4: /** williamr@4: The Thread Info segment contains thread related information for one or more williamr@4: threads of the owning process. williamr@4: It is defined as a program segment with type PT_NOTE referencing the segment williamr@4: descriptor defined below. williamr@4: The d_name field of the standard descriptor header is "CORE.SYMBIAN.THREAD". williamr@4: The d_type field of the standard descriptor header is ESYM_NOTE_THRD. williamr@4: */ williamr@4: typedef struct { williamr@4: /** Id of the thread */ williamr@4: Elf64_Word td_id; williamr@4: williamr@4: /** Id of the owning process */ williamr@4: Elf64_Word td_owning_process; williamr@4: williamr@4: /** Index into the CORE.SYMBIAN.STR note segment defining the name of the williamr@4: thread or ESYM_STR_UNDEF */ williamr@4: Elf32_Word td_name; williamr@4: williamr@4: /** Priority of thread */ williamr@4: Elf32_Word td_priority; williamr@4: /** Supervisor stack pointer */ williamr@4: Elf32_Word td_svc_sp; williamr@4: williamr@4: /** Address of the supervisor stack */ williamr@4: Elf32_Word td_svc_stack; williamr@4: williamr@4: /** Size of the supervisor stack */ williamr@4: Elf32_Word td_svc_stacksz; williamr@4: williamr@4: /** Address of the user stack */ williamr@4: Elf32_Word td_usr_stack; williamr@4: williamr@4: /** Size of the user stack */ williamr@4: Elf32_Word td_usr_stacksz; williamr@4: williamr@4: /** @internalTechnology */ williamr@4: Elf32_Word td_spare; williamr@4: } Sym32_thrdinfod; williamr@4: williamr@4: /** Size of Sym32_thrdinfod in bytes. @see Sym32_thrdinfod */ williamr@4: #define SYM32_THRINFO_SIZE 48 williamr@4: williamr@4: /** williamr@4: The Process Info segment contains process related information for the williamr@4: crashed threads owning process. It is defined as a program segment with williamr@4: type PT_NOTE referencing the segment descriptor defined below. williamr@4: The d_name field of the standard descriptor header is "CORE.SYMBIAN.PROCESS". williamr@4: The d_type field of the standard descriptor header is ESYM_NOTE_PROC. williamr@4: */ williamr@4: typedef struct { williamr@4: /** ID of the process */ williamr@4: Elf64_Word pd_id; williamr@4: williamr@4: /** Index into the CORE.SYMBIAN.STR note segment defining the williamr@4: name of the Process or ESYM_STR_UNDEF */ williamr@4: Elf32_Word pd_name; williamr@4: williamr@4: /** Priority of the process */ williamr@4: Elf32_Word pd_priority; williamr@4: williamr@4: } Sym32_procinfod; williamr@4: williamr@4: /** Size of Sym32_procinfod in bytes. @see Sym32_procinfod */ williamr@4: #define SYM32_PROCINFO_SIZE 16 williamr@4: williamr@4: williamr@4: /** williamr@4: 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. williamr@4: The d_name field of the standard descriptor header is "CORE.SYMBIAN.EXECUTABLE". williamr@4: The d_type field of the standard descriptor header is ESYM_NOTE_EXEC. williamr@4: */ williamr@4: typedef struct { williamr@4: /** The ID of the executable as defined by Sym32_execid */ williamr@4: Sym32_execid ed_execid; williamr@4: williamr@4: /** Index into the CORE.SYMBIAN.STR note segment defining the name of williamr@4: the executable or ESYM_STR_UNDEF */ williamr@4: Elf32_Word ed_name; williamr@4: williamr@4: /** Execute in place TRUE (1) for XIP ROM code FALSE (0) otherwise */ williamr@4: Elf32_Word ed_XIP; williamr@4: williamr@4: /** Size of the executables code segment */ williamr@4: Elf32_Word ed_codesize; williamr@4: williamr@4: /** Execution address of the code segment */ williamr@4: Elf32_Word ed_coderunaddr; williamr@4: williamr@4: /** Build address of the code section (Non XIP only) */ williamr@4: Elf32_Word ed_codeloadaddr; williamr@4: williamr@4: /** Size of the executable rodata segment */ williamr@4: Elf32_Word ed_rodatasize; williamr@4: williamr@4: /** Execution address of the rodata segment */ williamr@4: Elf32_Word ed_rodatarunaddr; williamr@4: williamr@4: /** Build address of the rodata section (Non XIP only) */ williamr@4: Elf32_Word ed_rodataloadaddr; williamr@4: williamr@4: /** Size of the executable data segment */ williamr@4: Elf32_Word ed_datasize; williamr@4: williamr@4: /** Execution address of the data segment */ williamr@4: Elf32_Word ed_datarunaddr; williamr@4: williamr@4: /** Build address of the data section (Non XIP only) */ williamr@4: Elf32_Word ed_dataloadaddr; williamr@4: williamr@4: /** @internalTechnology */ williamr@4: Elf32_Word ed_spare; williamr@4: } Sym32_execinfod; williamr@4: williamr@4: /** Size of Sym32_execinfod in bytes. @see Sym32_execinfod */ williamr@4: #define SYM32_EXECINFO_SIZE 64 williamr@4: williamr@4: williamr@4: /** williamr@4: The register descriptor member Sym32_reginfod::rid_class is defined by this enumeration. williamr@4: @see Sym32_reginfod. williamr@4: */ williamr@4: typedef enum williamr@4: { williamr@4: /** Core processor register */ williamr@4: ESYM_REG_CORE = 0, williamr@4: /** Coprocessor register */ williamr@4: ESYM_REG_COPRO = 1 williamr@4: } ESYM_REGCLASS; williamr@4: williamr@4: /** williamr@4: The register descriptor member Sym32_reginfod::rid_repre is defined by this enumeration. williamr@4: @see Sym32_reginfod williamr@4: */ williamr@4: typedef enum williamr@4: { williamr@4: /** 8 Bit register contents */ williamr@4: ESYM_REG_8 = 0, williamr@4: /** 16 Bit register contents */ williamr@4: ESYM_REG_16 = 1, williamr@4: /** 32 Bit register contents */ williamr@4: ESYM_REG_32 = 2, williamr@4: /** 64 Bit register contents */ williamr@4: ESYM_REG_64 = 3 williamr@4: } ESYM_REGREP; williamr@4: williamr@4: williamr@4: /** williamr@4: 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. williamr@4: The d_name field of the standard descriptor header is "CORE.SYMBIAN.REGISTER.". williamr@4: The d_type field of the standard descriptor header is ESYM_NOTE_REG. williamr@4: */ williamr@4: typedef struct { williamr@4: /** Thread which context relates to */ williamr@4: Elf64_Word rid_thread_id; williamr@4: williamr@4: /** Index into the CORE.SYMBIAN.STR note segment defining the version of williamr@4: the Register Data Info descriptor */ williamr@4: Elf32_Word rid_version; williamr@4: williamr@4: /** Number of registers this descriptor defines */ williamr@4: Elf32_Half rid_num_registers; williamr@4: williamr@4: /** Register class defined by ESYM_REGCLASS */ williamr@4: Elf32_Byte rid_class; williamr@4: williamr@4: /** Register representation defined by ESYM_REGREP */ williamr@4: Elf32_Byte rid_repre; williamr@4: williamr@4: } Sym32_reginfod; williamr@4: williamr@4: /** Size of Sym32_reginfod in bytes. @see Sym32_reginfod */ williamr@4: #define SYM32_REGINFO_SIZE 16 williamr@4: williamr@4: williamr@4: /** williamr@4: Immediately following the Register Info descriptor header is the information describing williamr@4: the individual registers. See document for register identifiers. williamr@4: The register identification scheme is the same as that used by the run mode debug interface. williamr@4: */ williamr@4: typedef struct { williamr@4: /** Register ID */ williamr@4: Elf32_Half rd_id; williamr@4: williamr@4: /** Sub register ID */ williamr@4: Elf32_Half rd_sub_id; williamr@4: williamr@4: /** Offset in bytes from the beginning of the file to the register data */ williamr@4: Elf32_Word rd_data; williamr@4: } Sym32_regdatad; williamr@4: williamr@4: /** Size of Sym32_regdatad in bytes. @see Sym32_regdatad */ williamr@4: #define SYM32_REGDATA_SIZE 8 williamr@4: williamr@4: williamr@4: /** Program header member p_flags indicating that the segment may be executed. */ williamr@4: #define PF_X 1 williamr@4: williamr@4: /** Program header member p_flags indicating that the segment may be written to. */ williamr@4: #define PF_W 2 williamr@4: williamr@4: /** Program header member p_flags indicating that the segment may be read from. */ williamr@4: #define PF_R 4 williamr@4: williamr@4: williamr@4: /** williamr@4: Index to the NULL string, ie string is not defined. williamr@4: */ williamr@4: #define ESYM_STR_UNDEF 0 williamr@4: williamr@4: #endif williamr@4: