crash-manager: pass tid number to identify failing thread 05/104805/2
authorŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 13 Dec 2016 15:03:49 +0000 (16:03 +0100)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Wed, 14 Dec 2016 15:09:55 +0000 (16:09 +0100)
Accept tid as second argument for crash-manager and pass it to
crash-stack.

Change-Id: Icfc0db6f5675eb781777ea7a7c5dc2d4cb581105

src/crash-manager/99-crash-manager.conf.in
src/crash-manager/crash-manager.c
src/crash-stack/crash-stack.c

index 481362f..a58a81c 100644 (file)
@@ -1,3 +1,3 @@
 # Tizen crash-manager
-kernel.core_pattern=|/usr/bin/crash-manager %p %u %g %s %t %e %E
+kernel.core_pattern=|/usr/bin/crash-manager %p %i %u %g %s %t %e %E
 kernel.core_pipe_limit=10
index a80b3f6..604009f 100644 (file)
@@ -88,6 +88,7 @@ static bool allow_zip;
 static struct crash_info {
        char *cmd_info;
        char *pid_info;
+       char *tid_info;
        char time_info[80];
        char temp_dir[PATH_MAX];
        char name[FILENAME_MAX];
@@ -217,10 +218,11 @@ static int set_crash_info(char *argv[])
        time_t time_val;
        struct tm loc_tm;
 
-       crash_info.cmd_info = argv[6];
        crash_info.pid_info = argv[1];
+       crash_info.tid_info = argv[2];
+       crash_info.cmd_info = argv[7];
 
-       time_val = atoll(argv[5]);
+       time_val = atoll(argv[6]);
        localtime_r(&time_val, &loc_tm);
        strftime(crash_info.time_info, sizeof(crash_info.time_info),
                        "%Y%m%d%H%M%S", &loc_tm);
@@ -456,9 +458,11 @@ static void execute_crash_modules(int argc, char *argv[], int debug)
        /* Execute crash-stack */
        /*
        ret = snprintf(command, sizeof(command),
-                       "%s --pid %s >> %s",
+                       "%s --pid %s --tid %s >> %s",
                        CRASH_STACK_PATH,
-                       crash_info.pid_info, crash_info.info_path);
+                       crash_info.pid_info,
+                       crash_info.tid_info,
+                       crash_info.info_path);
        if (ret < 0) {
                _E("Failed to snprintf for crash-stack command");
                return;
@@ -766,7 +770,7 @@ int main(int argc, char *argv[])
 
        /* .dbugmode: launch crash-popup */
        if (access(DEBUGMODE_FILE, F_OK) == 0)
-               launch_crash_popup(argv[7]);
+               launch_crash_popup(argv[8]);
 
        /* Exec dump_systemstate */
        dump_system_state();
index 4c41983..0ec8990 100644 (file)
@@ -58,6 +58,7 @@ static FILE *errfile = NULL;          ///< global error stream
  */
 enum {
        OPT_PID,
+       OPT_TID,
        OPT_OUTPUTFILE,
        OPT_ERRFILE
 };
@@ -67,6 +68,7 @@ enum {
  */
 const struct option opts[] = {
        { "pid", required_argument, 0, OPT_PID },
+       { "tid", required_argument, 0, OPT_TID },
        { "output", required_argument, 0, OPT_OUTPUTFILE },
        { "erroutput", required_argument, 0, OPT_ERRFILE },
        { 0, 0, 0, 0 }
@@ -710,6 +712,7 @@ int main(int argc, char **argv)
 {
        int c, i;
        pid_t pid = 0;
+       /* pid_t tid = 0; */
 
        const char *core_file_name;
 
@@ -720,6 +723,9 @@ int main(int argc, char **argv)
                case OPT_PID:
                        pid = atoi(optarg);
                        break;
+               case OPT_TID:
+                       /* tid = atoi(optarg); */
+                       break;
                case OPT_OUTPUTFILE:
                        outputfile = fopen(optarg, "w");
                        break;