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