|
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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.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 Value of the d_type field of the standard descriptor header. |
|
42 */ |
|
43 typedef enum |
|
44 { |
|
45 /** Value to identify Sym32_syminfod */ |
|
46 ESYM_NOTE_SYM = 0x00000000, |
|
47 |
|
48 /** Value to identify Sym32_thrdinfod */ |
|
49 ESYM_NOTE_THRD = 0x00000010, |
|
50 |
|
51 /** Value to identify Sym32_procinfod */ |
|
52 ESYM_NOTE_PROC = 0x00000020, |
|
53 |
|
54 /** Value to identify Sym32_execinfod */ |
|
55 ESYM_NOTE_EXEC = 0x00000040, |
|
56 |
|
57 /** Value to identify Sym32_reginfod */ |
|
58 ESYM_NOTE_REG = 0x00000080, |
|
59 |
|
60 /** Value to identify string information */ |
|
61 ESYM_NOTE_STR = 0x00000100, |
|
62 |
|
63 /** Value to identify trace info */ |
|
64 ESYM_NOTE_TRACE = 0x00000200, |
|
65 |
|
66 /** Value to identify lock data info */ |
|
67 ESYM_NOTE_LOCKDATA = 0x00000400, |
|
68 |
|
69 /** Value to identify rom build info */ |
|
70 ESYM_NOTE_ROMBUILD = 0x00000800, |
|
71 |
|
72 /** Value to identify variant specific data */ |
|
73 ESYM_NOTE_VARIANT_DATA = 0x00010000 |
|
74 |
|
75 } ESYM_NOTE_TYPE; |
|
76 |
|
77 /** |
|
78 To uniquely identify executables associated with the crashed process an executable |
|
79 identifier is required, this identifier is defined as follows |
|
80 */ |
|
81 typedef struct |
|
82 { |
|
83 /** ID of the executable to match symbolic debug information to executable binary |
|
84 [Currently crash time iTimeLo (LSW) and iTimeHi (MSW)] */ |
|
85 Elf64_Word exec_id; |
|
86 |
|
87 /** CCITT CRC-32 Checksum of up to the first 1Kbytes of code segment. */ |
|
88 Elf32_Word exec_crc; |
|
89 |
|
90 /** @internalTechnology */ |
|
91 Elf32_Word exec_spare; |
|
92 } Sym32_execid; |
|
93 |
|
94 /** Size of Sym32_execid in bytes. @see Sym32_execid */ |
|
95 #define SYM32_EXECID_SIZE 16 |
|
96 |
|
97 /** |
|
98 The Symbian Info segment contains generic crash information. |
|
99 It is defined as a program segment with type PT_NOTE which |
|
100 references the segment descriptor Sym32_dhdr. |
|
101 The d_name field of the standard descriptor header is "CORE.SYMBIAN". |
|
102 The d_type field of the standard descriptor header is ESYM_NOTE_SYM. |
|
103 */ |
|
104 typedef struct |
|
105 { |
|
106 /** Date and time of the crash */ |
|
107 Elf64_Word sd_date_time; |
|
108 |
|
109 /** The ID of the crashed process as defined by Sym32_execid */ |
|
110 Sym32_execid sd_execid; |
|
111 |
|
112 /** The id of the thread causing the crash */ |
|
113 Elf64_Word sd_thread_id; |
|
114 |
|
115 /** The crashing threads owning process */ |
|
116 Elf64_Word sd_proc_id; |
|
117 |
|
118 /** Identifies whether the crash was caused by a Hardware Exception (set to 0) |
|
119 or Thread Kill (set to 1) */ |
|
120 Elf32_Word sd_exit_type; |
|
121 |
|
122 /** If sd_exit_type is Hardware Exception then set to e32const.h::TExcType |
|
123 if is Thread Kill then set to e32const.h::TExitType */ |
|
124 Elf32_Word sd_exit_reason; |
|
125 |
|
126 /** Only set if sd_exit_type is Thread Kill. Index into the CORE.SYMBIAN.STR |
|
127 note segment identifying the reason for the crash or ESYM_STR_UNDEF */ |
|
128 Elf32_Word sd_exit_cat; |
|
129 |
|
130 /** @internalTechnology */ |
|
131 Elf32_Word sd_spare; |
|
132 } Sym32_syminfod; |
|
133 |
|
134 /** Size of Sym32_syminfod in bytes. @see Sym32_syminfod */ |
|
135 #define SYM32_SYMINFO_SIZE 56 |
|
136 |
|
137 /** |
|
138 The descriptor contents immediately follow the header. |
|
139 To obtain the nth segment: nth segment offset = |
|
140 (Elf32_Phdr) element -> p_offset + sizeof(Sym32_dhdr) + n * d_descrsz |
|
141 */ |
|
142 typedef struct { |
|
143 /** Index into the CORE.SYMBIAN.STR note segment defining the name of |
|
144 the descriptor or ESYM_STR_UNDEF */ |
|
145 Elf32_Word d_name; |
|
146 |
|
147 /** Size of a single descriptor element */ |
|
148 Elf32_Word d_descrsz; |
|
149 |
|
150 /** Type of the descriptor defined */ |
|
151 Elf32_Word d_type; |
|
152 |
|
153 /** Index into the CORE.SYMBIAN.STR note segment defining the version |
|
154 of the following segment descriptor */ |
|
155 Elf32_Word d_version; |
|
156 |
|
157 /** Number of descriptor elements */ |
|
158 Elf32_Word d_elemnum; |
|
159 } Sym32_dhdr; |
|
160 |
|
161 /** Size of Sym32_dhdr in bytes. @see Sym32_dhdr */ |
|
162 #define SYM32_DESCHDR_SIZE 20 |
|
163 |
|
164 /** |
|
165 The Thread Info segment contains thread related information for one or more |
|
166 threads of the owning process. |
|
167 It is defined as a program segment with type PT_NOTE referencing the segment |
|
168 descriptor defined below. |
|
169 The d_name field of the standard descriptor header is "CORE.SYMBIAN.THREAD". |
|
170 The d_type field of the standard descriptor header is ESYM_NOTE_THRD. |
|
171 */ |
|
172 typedef struct { |
|
173 /** Id of the thread */ |
|
174 Elf64_Word td_id; |
|
175 |
|
176 /** Id of the owning process */ |
|
177 Elf64_Word td_owning_process; |
|
178 |
|
179 /** Index into the CORE.SYMBIAN.STR note segment defining the name of the |
|
180 thread or ESYM_STR_UNDEF */ |
|
181 Elf32_Word td_name; |
|
182 |
|
183 /** Priority of thread */ |
|
184 Elf32_Word td_priority; |
|
185 /** Supervisor stack pointer */ |
|
186 Elf32_Word td_svc_sp; |
|
187 |
|
188 /** Address of the supervisor stack */ |
|
189 Elf32_Word td_svc_stack; |
|
190 |
|
191 /** Size of the supervisor stack */ |
|
192 Elf32_Word td_svc_stacksz; |
|
193 |
|
194 /** Address of the user stack */ |
|
195 Elf32_Word td_usr_stack; |
|
196 |
|
197 /** Size of the user stack */ |
|
198 Elf32_Word td_usr_stacksz; |
|
199 |
|
200 /** id of the last cpu used */ |
|
201 Elf32_Word td_last_cpu_id; |
|
202 |
|
203 /** Address of threads heap */ |
|
204 Elf32_Word td_heap_add; |
|
205 |
|
206 /** Size of threads heap */ |
|
207 Elf32_Word td_heap_sz; |
|
208 |
|
209 } Sym32_thrdinfod; |
|
210 |
|
211 /** Size of Sym32_thrdinfod in bytes. @see Sym32_thrdinfod */ |
|
212 #define SYM32_THRINFO_SIZE 56 |
|
213 |
|
214 /** |
|
215 The Process Info segment contains process related information for the |
|
216 crashed threads owning process. It is defined as a program segment with |
|
217 type PT_NOTE referencing the segment descriptor defined below. |
|
218 The d_name field of the standard descriptor header is "CORE.SYMBIAN.PROCESS". |
|
219 The d_type field of the standard descriptor header is ESYM_NOTE_PROC. |
|
220 */ |
|
221 typedef struct { |
|
222 /** ID of the process */ |
|
223 Elf64_Word pd_id; |
|
224 |
|
225 /** Index into the CORE.SYMBIAN.STR note segment defining the |
|
226 name of the Process or ESYM_STR_UNDEF */ |
|
227 Elf32_Word pd_name; |
|
228 |
|
229 /** Priority of the process */ |
|
230 Elf32_Word pd_priority; |
|
231 |
|
232 } Sym32_procinfod; |
|
233 |
|
234 /** Size of Sym32_procinfod in bytes. @see Sym32_procinfod */ |
|
235 #define SYM32_PROCINFO_SIZE 16 |
|
236 |
|
237 /** |
|
238 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. |
|
239 The d_name field of the standard descriptor header is "CORE.SYMBIAN.EXECUTABLE". |
|
240 The d_type field of the standard descriptor header is ESYM_NOTE_EXEC. |
|
241 */ |
|
242 typedef struct { |
|
243 /** The ID of the executable as defined by Sym32_execid */ |
|
244 Sym32_execid ed_execid; |
|
245 |
|
246 /** Index into the CORE.SYMBIAN.STR note segment defining the name of |
|
247 the executable or ESYM_STR_UNDEF */ |
|
248 Elf32_Word ed_name; |
|
249 |
|
250 /** Execute in place TRUE (1) for XIP ROM code FALSE (0) otherwise */ |
|
251 Elf32_Word ed_XIP; |
|
252 |
|
253 /** Size of the executables code segment */ |
|
254 Elf32_Word ed_codesize; |
|
255 |
|
256 /** Execution address of the code segment */ |
|
257 Elf32_Word ed_coderunaddr; |
|
258 |
|
259 /** Build address of the code section (Non XIP only) */ |
|
260 Elf32_Word ed_codeloadaddr; |
|
261 |
|
262 /** Size of the executable rodata segment */ |
|
263 Elf32_Word ed_rodatasize; |
|
264 |
|
265 /** Execution address of the rodata segment */ |
|
266 Elf32_Word ed_rodatarunaddr; |
|
267 |
|
268 /** Build address of the rodata section (Non XIP only) */ |
|
269 Elf32_Word ed_rodataloadaddr; |
|
270 |
|
271 /** Size of the executable data segment */ |
|
272 Elf32_Word ed_datasize; |
|
273 |
|
274 /** Execution address of the data segment */ |
|
275 Elf32_Word ed_datarunaddr; |
|
276 |
|
277 /** Build address of the data section (Non XIP only) */ |
|
278 Elf32_Word ed_dataloadaddr; |
|
279 |
|
280 /** @internalTechnology */ |
|
281 Elf32_Word ed_spare; |
|
282 } Sym32_execinfod; |
|
283 |
|
284 /** Size of Sym32_execinfod in bytes. @see Sym32_execinfod */ |
|
285 #define SYM32_EXECINFO_SIZE 64 |
|
286 |
|
287 /** |
|
288 The register descriptor member Sym32_reginfod::rid_class is defined by this enumeration. |
|
289 @see Sym32_reginfod. |
|
290 */ |
|
291 typedef enum |
|
292 { |
|
293 /** Core processor register */ |
|
294 ESYM_REG_CORE = 0, |
|
295 /** Coprocessor register */ |
|
296 ESYM_REG_COPRO = 1 |
|
297 } ESYM_REGCLASS; |
|
298 |
|
299 /** |
|
300 The register descriptor member Sym32_reginfod::rid_repre is defined by this enumeration. |
|
301 @see Sym32_reginfod |
|
302 */ |
|
303 typedef enum |
|
304 { |
|
305 /** 8 Bit register contents */ |
|
306 ESYM_REG_8 = 0, |
|
307 /** 16 Bit register contents */ |
|
308 ESYM_REG_16 = 1, |
|
309 /** 32 Bit register contents */ |
|
310 ESYM_REG_32 = 2, |
|
311 /** 64 Bit register contents */ |
|
312 ESYM_REG_64 = 3 |
|
313 } ESYM_REGREP; |
|
314 |
|
315 /** |
|
316 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. |
|
317 The d_name field of the standard descriptor header is "CORE.SYMBIAN.REGISTER.<THREADID>". |
|
318 The d_type field of the standard descriptor header is ESYM_NOTE_REG. |
|
319 */ |
|
320 typedef struct { |
|
321 /** Thread which context relates to */ |
|
322 Elf64_Word rid_thread_id; |
|
323 |
|
324 /** Index into the CORE.SYMBIAN.STR note segment defining the version of |
|
325 the Register Data Info descriptor */ |
|
326 Elf32_Word rid_version; |
|
327 |
|
328 /** Number of registers this descriptor defines */ |
|
329 Elf32_Half rid_num_registers; |
|
330 |
|
331 /** Register class defined by ESYM_REGCLASS */ |
|
332 Elf32_Byte rid_class; |
|
333 |
|
334 /** Register representation defined by ESYM_REGREP */ |
|
335 Elf32_Byte rid_repre; |
|
336 |
|
337 } Sym32_reginfod; |
|
338 |
|
339 /** Size of Sym32_reginfod in bytes. @see Sym32_reginfod */ |
|
340 #define SYM32_REGINFO_SIZE 16 |
|
341 |
|
342 /** |
|
343 Immediately following the Register Info descriptor header is the information describing |
|
344 the individual registers. See document for register identifiers. |
|
345 The register identification scheme is the same as that used by the run mode debug interface. |
|
346 */ |
|
347 typedef struct { |
|
348 /** Register ID */ |
|
349 Elf32_Half rd_id; |
|
350 |
|
351 /** Sub register ID */ |
|
352 Elf32_Half rd_sub_id; |
|
353 |
|
354 /** Offset in bytes from the beginning of the file to the register data */ |
|
355 Elf32_Word rd_data; |
|
356 } Sym32_regdatad; |
|
357 |
|
358 /** Size of Sym32_regdatad in bytes. @see Sym32_regdatad */ |
|
359 #define SYM32_REGDATA_SIZE 8 |
|
360 |
|
361 /** |
|
362 Trace Data |
|
363 */ |
|
364 typedef struct { |
|
365 |
|
366 /** Trace version of the data */ |
|
367 Elf32_Word tr_version; |
|
368 |
|
369 /** Offset in bytes from the beginning of the file to the register data */ |
|
370 Elf32_Word tr_data; |
|
371 |
|
372 /** Size of trace data */ |
|
373 Elf32_Word tr_size; |
|
374 } Sym32_tracedata; |
|
375 |
|
376 #define SYM32_TRACEDATA_SIZE 12 |
|
377 |
|
378 typedef struct { |
|
379 |
|
380 /** Number of holds on the mutex from current thread see Kern::CodeSegLock() */ |
|
381 Elf32_Word lk_mutex_held_count; |
|
382 |
|
383 /** Number of threads waiting on the mutex see Kern::CodeSegLock() */ |
|
384 Elf32_Word lk_mutex_thread_wait_count; |
|
385 |
|
386 /** Number of kernel locks held see NKern::KernelLocked() */ |
|
387 Elf32_Word lk_lock_count; |
|
388 } Sym32_lockdata; |
|
389 |
|
390 #define SYM32_LOCKDATA_SIZE 12 |
|
391 |
|
392 typedef struct { |
|
393 |
|
394 /** Which mode the stack belongs to */ |
|
395 Elf32_Word es_type; |
|
396 |
|
397 /** Location of the data */ |
|
398 Elf32_Word es_data; |
|
399 |
|
400 /** Size of the data */ |
|
401 Elf32_Word es_size; |
|
402 } Sym32_cpu_exception_stk; |
|
403 |
|
404 #define SYM32_CPU_EXCEPTION_STK_SIZE 12 |
|
405 |
|
406 typedef struct { |
|
407 |
|
408 /** Location of the data */ |
|
409 Elf32_Word es_data; |
|
410 |
|
411 /** Size of the data */ |
|
412 Elf32_Word es_size; |
|
413 } Sym32_variant_spec_data; |
|
414 |
|
415 #define SYM32_VARIANT_SPEC_DATA_SIZE 8 |
|
416 |
|
417 typedef struct { |
|
418 |
|
419 /** Time of ROM build in miliseconds */ |
|
420 Elf64_Word rom_time; |
|
421 |
|
422 /** Build number of ROM */ |
|
423 Elf32_Half rom_build; |
|
424 |
|
425 /** Major version number of ROM built */ |
|
426 Elf32_Byte rom_major_version; |
|
427 |
|
428 /** Minor version number of ROM built */ |
|
429 Elf32_Byte rom_minor_version; |
|
430 |
|
431 /** Spare */ |
|
432 Elf32_Word spare1; |
|
433 |
|
434 } Sym32_rombuild; |
|
435 |
|
436 #define SYM32_ROMBUILD_SIZE 16 |
|
437 |
|
438 /** Program header member p_flags indicating that the segment may be executed. */ |
|
439 #define PF_X 1 |
|
440 |
|
441 /** Program header member p_flags indicating that the segment may be written to. */ |
|
442 #define PF_W 2 |
|
443 |
|
444 /** Program header member p_flags indicating that the segment may be read from. */ |
|
445 #define PF_R 4 |
|
446 |
|
447 /** |
|
448 Index to the NULL string, ie string is not defined. |
|
449 */ |
|
450 #define ESYM_STR_UNDEF 0 |
|
451 |
|
452 #endif |