#define CRASH_STACK_TIMEOUT_MS DEFAULT_COMMAND_TIMEOUT_MS
#define ZIP_TIMEOUT_MS DEFAULT_COMMAND_TIMEOUT_MS
+#define SYSTEM_REPORT_NAME "system"
+
enum {
RET_EXCEED = 1,
NUM_EXCEED,
{
assert(cinfo);
+ if (cinfo->pid_info <= 0) {
+ cinfo->cmd_line = strdup(SYSTEM_REPORT_NAME);
+ cinfo->comm = strdup(SYSTEM_REPORT_NAME);
+ if (cinfo->cmd_line == NULL || cinfo->comm == NULL) {
+ _E("Couldn't allocate memory\n");
+ return false;
+ }
+ return true;
+ }
+
char buf[PATH_MAX];
char proc_name[PATH_MAX];
/* Note: caller of this function is responsible for cleaning up the cinfo on failure */
bool set_crash_info(struct crash_info *cinfo)
{
+ bool system_dump = cinfo->pid_info <= 0;
+ bool zip_report = system_dump || config.allow_zip;
+
set_crash_info_defaults(cinfo);
if (!get_cmd_info(cinfo)) {
return false;
}
- const char *suffix = config.report_type >= REP_TYPE_FULL ? (config.allow_zip ? ".zip" : "") : ".info";
+ const char *suffix = (system_dump || config.report_type >= REP_TYPE_FULL) ? (zip_report ? ".zip" : "") : ".info";
bool is_app = set_appinfo(cinfo->cmd_line, &cinfo->appid, &cinfo->pkgid);
if (!cinfo->appid || !cinfo->pkgid)
goto out_oom;
static bool run(struct crash_info *cinfo)
{
+ /* Special PID ( <= 0) for which the report will contain only
+ * dump_systemstate output
+ */
+ bool system_dump = cinfo->pid_info <= 0;
+ bool zip_report = system_dump || config.allow_zip;
+
/* Execute processes in parallel */
static pid_t dump_state_pid = 0, extra_script_pid = 0;
int debug_mode = access(DEBUGMODE_PATH, F_OK) == 0;
- if (config.report_type >= REP_TYPE_FULL) {
+ if (system_dump || config.report_type >= REP_TYPE_FULL) {
/* Exec dump_systemstate */
if (!dump_system_state(cinfo, &dump_state_pid)) {
_E("Failed to get system state report");
_I("Creating report for pid %d, tid %d, cmdline %s, pkgid %s",
cinfo->pid_info, cinfo->tid_info, cinfo->cmd_line, cinfo->pkgid);
- /* Exec crash modules */
- if (!execute_crash_modules(cinfo)) {
- _E("Failed to get basic crash information");
- return false;
- }
+ if (!system_dump) {
+ /* Exec crash modules */
+ if (!execute_crash_modules(cinfo)) {
+ _E("Failed to get basic crash information");
+ return false;
+ }
- if (!cinfo->livedump && config.release_early)
- release_crashed_process();
+ if (!cinfo->livedump && config.release_early)
+ release_crashed_process();
+ }
char *temp_report;
- if (config.report_type >= REP_TYPE_FULL) {
- /* Save shared objects info (file names, bulid IDs, rpm package names) */
- if (config.dump_so_info)
- save_so_info(cinfo);
- else
- _I("Not saving .so_info (disabled in configuration)");
+ if (system_dump || config.report_type >= REP_TYPE_FULL) {
+ if (!system_dump) {
+ /* Save shared objects info (file names, bulid IDs, rpm package names) */
+ if (config.dump_so_info)
+ save_so_info(cinfo);
+ else
+ _I("Not saving .so_info (disabled in configuration)");
+ }
/* Wait misc. pids */
wait_for_pid(dump_state_pid, NULL);
if (extra_script_pid > 0)
wait_for_pid(extra_script_pid, NULL);
- if (config.allow_zip)
+ if (zip_report)
compress(cinfo);
- temp_report = config.allow_zip ? cinfo->zip_path : cinfo->pfx;
+ temp_report = (zip_report) ? cinfo->zip_path : cinfo->pfx;
} else
temp_report = cinfo->info_path;
if (cinfo->print_result_path)
printf("REPORT_PATH=%s\n", cinfo->result_path);
- if (!cinfo->livedump) {
- if (!config.release_early)
- release_crashed_process();
+ if (!system_dump) {
+ if (!cinfo->livedump) {
+ if (!config.release_early)
+ release_crashed_process();
- launch_dbus_notify(cinfo);
+ launch_dbus_notify(cinfo);
- /* launch crash-popup only if the .debugmode file exists */
- if (debug_mode)
- launch_crash_popup(cinfo);
- } else if (cinfo->kill) {
- kill_pid(cinfo->pid_info, SIGKILL, false);
+ /* launch crash-popup only if the .debugmode file exists */
+ if (debug_mode)
+ launch_crash_popup(cinfo);
+ } else if (cinfo->kill) {
+ kill_pid(cinfo->pid_info, SIGKILL, false);
+ }
}
return true;