USAGE_EXCEED
};
+enum {
+ REP_TYPE_INFO = 0,
+ REP_TYPE_FULL
+};
+
+#define REP_DEFAULT_TYPE REP_TYPE_FULL
+
+#define REP_TYPE_FULL_STR "FULL"
+#define REP_TYPE_INFO_STR "INFO"
+
struct file_info {
bool isdir;
int size;
static char* crash_root_path;
static char* crash_crash_path;
static char* crash_temp_path;
+static int report_type;
/* Paths and variables */
static struct crash_info {
return 1;
}
+static const char* report_type_to_str(const int report_type)
+{
+ switch (report_type) {
+ case REP_TYPE_INFO:
+ return REP_TYPE_INFO_STR;
+ break;
+ case REP_TYPE_FULL:
+ return REP_TYPE_FULL_STR;
+ default:
+ return NULL;
+ break;
+ }
+}
+
+static int report_type_from_str(const char* report_type_str)
+{
+ if (report_type_str == NULL)
+ return -1;
+
+ if (strncmp(report_type_str, REP_TYPE_FULL_STR, strlen(REP_TYPE_FULL_STR)) == 0)
+ return REP_TYPE_FULL;
+ else if (strncmp(report_type_str, REP_TYPE_INFO_STR, strlen(REP_TYPE_INFO_STR)) == 0)
+ return REP_TYPE_INFO;
+
+ return -1;
+}
+
static int get_config(void)
{
dictionary *ini = NULL;
_E("strdup error: %m\n");
return -1;
}
+ report_type = REP_DEFAULT_TYPE;
ini = iniparser_load(CRASH_CONF_FILE);
if (!ini) {
}
}
+ snprintf(key, sizeof(key), "%s:%s", CRASH_SECTION, "ReportType");
+ value_str = iniparser_getstring(ini, key, NULL);
+ if (value_str == NULL) {
+ _D("Invalid value for ReportType. Use default value [ %s ]",
+ report_type_to_str(report_type));
+ } else {
+ _D("ReportType [ %s ]", value_str);
+ report_type = report_type_from_str(value_str);
+
+ if (report_type < 0) {
+ _E("Unknown ReportType %s. Fallback to default: %s",
+ value_str, report_type_to_str(REP_DEFAULT_TYPE));
+ report_type = REP_DEFAULT_TYPE;
+ }
+ }
+
iniparser_freedict(ini);
return 1;
}
_D("Execute crash module: ");
#ifdef TIZEN_ENABLE_COREDUMP
- execute_crash_pipe(argc, argv);
+ if (report_type >= REP_TYPE_FULL)
+ execute_crash_pipe(argc, argv);
#endif
#ifdef TIZEN_ENABLE_MINICOREDUMP
_E("Failed to delete temp directory");
}
+static void move_info_file(void)
+{
+ int lock_fd;
+
+ if ((lock_fd = lock_dumpdir()) < 0)
+ return;
+
+ char dest_path[PATH_MAX];
+ snprintf(dest_path, sizeof(dest_path), "%s/%s.info",
+ crash_crash_path, crash_info.name);
+ if (!rename(crash_info.info_path, dest_path))
+ clean_dump();
+ else
+ _E("Failed to move %s to %s",
+ crash_info.info_path, dest_path);
+
+ unlock_dumpdir(lock_fd);
+ if (remove_dir(crash_info.temp_dir, 1) < 0)
+ _E("Failed to delete temp directory");
+}
+
static int wait_for_opt(unsigned int timeout)
{
unsigned int count = 0;
get_sysassert_cs();
#endif
- /* Exec dump_systemstate */
- dump_state_pid = dump_system_state();
-
- /* Copy maps file to temp dir */
- copy_maps();
+ if (report_type >= REP_TYPE_FULL) {
+ /* Exec dump_systemstate */
+ dump_state_pid = dump_system_state();
+ /* Copy maps file to temp dir */
+ copy_maps();
+ }
/* Exec crash modules */
execute_crash_modules(argc, argv);
- /* Save shared objects info (file names, bulid IDs, rpm package names) */
- save_so_info();
- remove_maps();
+ if (report_type >= REP_TYPE_FULL) {
+ /* Save shared objects info (file names, bulid IDs, rpm package names) */
+ save_so_info();
+ remove_maps();
- /* Wait dump_system_state */
- wait_system_command(dump_state_pid);
+ /* Wait dump_system_state */
+ wait_system_command(dump_state_pid);
- /* Tar compression */
- if (allow_zip)
- compress();
- else
- move_dump_dir();
+ /* Tar compression */
+ if (allow_zip)
+ compress();
+ else
+ move_dump_dir();
+ } else {
+ move_info_file();
+ }
#if defined(TIZEN_ENABLE_COREDUMP) || defined(TIZEN_ENABLE_MINICOREDUMP)
/* launch crash-popup only if the .debugmode file is exist*/
if (debug_mode)