automotive-dlt
dlt_cdh.h
Go to the documentation of this file.
1 /*
2  * @licence app begin@
3  * SPDX license identifier: MPL-2.0
4  *
5  * Copyright (C) 2011-2015, BMW AG
6  *
7  * This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
8  *
9  * This Source Code Form is subject to the terms of the
10  * Mozilla Public License (MPL), v. 2.0.
11  * If a copy of the MPL was not distributed with this file,
12  * You can obtain one at http://mozilla.org/MPL/2.0/.
13  *
14  * For further information see http://www.genivi.org/.
15  * @licence end@
16  */
17 
28 #ifndef DLT_CDH_H
29 #define DLT_CDH_H
30 
31 #include <unistd.h>
32 #include <stdint.h>
33 #include <elf.h>
34 #include <sys/procfs.h>
35 #include <sys/user.h>
36 
37 #include "dlt_cdh_streamer.h"
38 
39 #define CORE_DIRECTORY "/var/core"
40 #define CORE_TMP_DIRECTORY "/var/core_tmp"
41 #define CORE_LOCK_DIRECTORY "/tmp/.core_locks"
42 #define CORE_MAX_FILENAME_LENGTH 255
43 #define MAX_PROC_NAME_LENGTH 32
44 #define CRASH_ID_LEN 8
45 #define CRASHID_FILE "/tmp/.crashid" // the file where the white screen app will read the crashid
46 
47 #define CORE_FILE_PATTERN "%s/core.%d.%s.%d.gz"
48 #define CONTEXT_FILE_PATTERN "%s/context.%d.%s.%d.txt"
49 
50 #define ELF_Ehdr Elf32_Ehdr
51 #define ELF_Phdr Elf32_Phdr
52 #define ELF_Shdr Elf32_Shdr
53 #define ELF_Nhdr Elf32_Nhdr
54 
55 typedef struct
56 {
57  uint64_t pc;
58  uint64_t ip;
59  uint64_t lr;
60 
62 
63 typedef struct
64 {
66  char threadname[MAX_PROC_NAME_LENGTH];
67  pid_t pid;
68  uint32_t timestamp;
69  int signal;
70 
73 
74  // coredump content, for crash id generation
77  char* m_Nhdr; // buffer with all NOTE pages
78 
79  unsigned int m_note_page_size;
80 
82 
84  uint64_t m_crashid_phase1;
85  unsigned char m_crashid[CRASH_ID_LEN];
86 
87 } proc_info_t;
88 
89 cdh_status_t get_exec_name(unsigned int p_pid_str, char* p_exec_name, int p_exec_name_maxsize);
95 
96 #endif // #ifndef DLT_CDH_H
unsigned int m_note_page_size
Definition: dlt_cdh.h:79
ELF_Ehdr m_Ehdr
Definition: dlt_cdh.h:75
pid_t m_crashed_pid
Definition: dlt_cdh.h:83
cdh_status_t get_exec_name(unsigned int p_pid_str, char *p_exec_name, int p_exec_name_maxsize)
cdh_status_t treat_coredump(proc_info_t *p_proc)
int signal
Definition: dlt_cdh.h:69
uint64_t m_crashid_phase1
Definition: dlt_cdh.h:84
cdh_status_t
#define ELF_Ehdr
Definition: dlt_cdh.h:50
#define MAX_PROC_NAME_LENGTH
Definition: dlt_cdh.h:43
int can_create_coredump
Definition: dlt_cdh.h:71
uint64_t lr
Definition: dlt_cdh.h:59
cdh_status_t check_core_directory()
Definition: dlt_cdh.c:294
uint64_t pc
Definition: dlt_cdh.h:57
file_streamer_t streamer
Definition: dlt_cdh.h:72
#define CRASH_ID_LEN
Definition: dlt_cdh.h:44
pid_t pid
Definition: dlt_cdh.h:67
cdh_status_t move_to_core_directory(proc_info_t *p_proc)
Definition: dlt_cdh.c:320
cdh_status_t treat_crash_data(proc_info_t *p_proc)
cdh_registers_t m_registers
Definition: dlt_cdh.h:81
cdh_status_t write_proc_context(const proc_info_t *)
#define ELF_Phdr
Definition: dlt_cdh.h:51
uint64_t ip
Definition: dlt_cdh.h:58
uint32_t timestamp
Definition: dlt_cdh.h:68
char * m_Nhdr
Definition: dlt_cdh.h:77
ELF_Phdr * m_pPhdr
Definition: dlt_cdh.h:76