dump_systemstate: dump installed package list
authorSunmin Lee <sunm.lee@samsung.com>
Mon, 25 Feb 2019 01:55:42 +0000 (10:55 +0900)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Tue, 26 Mar 2019 13:24:27 +0000 (14:24 +0100)
Some package information is required to debug crash.
Add it as an option of dump_systemstate.

Change-Id: I140e2d00b35157c7f463426483dea074d739b73e
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
[ Backported from different repository ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
src/crash-manager/crash-manager.c
src/dump_systemstate/dump_systemstate.c

index 9d3bec5..8aba8ae 100644 (file)
@@ -687,7 +687,7 @@ exit:
 
 static bool dump_system_state(const struct crash_info *cinfo, pid_t *pid)
 {
-       char *av[] = {"/usr/bin/dump_systemstate", "-d", "-k", "-j", "-f",  cinfo->log_path, NULL};
+       char *av[] = {"/usr/bin/dump_systemstate", "-d", "-k", "-j", "-p", "-f",  cinfo->log_path, NULL};
        return spawn(av, NULL, NULL, NULL, pid, NULL);
 }
 
index 2d2c5b5..0d79cca 100644 (file)
@@ -67,11 +67,12 @@ static struct dump_item {
 
 static void usage()
 {
-       fprintf(stderr, "usage: dump_systemstate [-k] [-d] [-f file]\n"
+       fprintf(stderr, "usage: dump_systemstate [-k] [-d] [-j] [-p] [-f file]\n"
                        "  -f: write to file (instead of stdout)\n"
                        "  -k: dump kernel messages (only root)\n"
                        "  -d: dump dlog messages\n"
                        "  -j: dump journal log messages\n"
+                       "  -p: dump list of installed packages\n"
           );
 }
 
@@ -99,12 +100,13 @@ int main(int argc, char *argv[])
        bool arg_dlog = false;
        bool arg_dmesg = false;
        bool arg_journal = false;
+       bool arg_pkgs = false;
        char timestr[80];
        time_t cur_time;
        struct tm gm_tm;
        struct tm loc_tm;
 
-       while ((c = getopt(argc, argv, "hf:kdj")) != -1) {
+       while ((c = getopt(argc, argv, "hf:kdjp")) != -1) {
                switch (c) {
                case 'd':
                        arg_dlog = true;
@@ -115,6 +117,9 @@ int main(int argc, char *argv[])
                case 'j':
                        arg_journal = true;
                        break;
+               case 'p':
+                       arg_pkgs = true;
+                       break;
                case 'f':
                        arg_file = optarg;
                        break;
@@ -206,6 +211,12 @@ int main(int argc, char *argv[])
                spawn_wait_checked(get_sys_args, NULL);
        }
 
+       if (arg_pkgs) {
+               fprintf_fd(out_fd, "\n==== Installed packages (/usr/bin/pkgcmd -l)\n");
+               char *pkgcmd_args[] = {"/usr/bin/pkgcmd", "-l", NULL};
+               spawn_wait_checked(pkgcmd_args, NULL);
+       }
+
        if (arg_dmesg && is_root) {
                fprintf_fd(out_fd, "\n==== Kernel messages (TZ=UTC /bin/dmesg -T)\n");
                char *dmesg_args[] = {"/bin/dmesg", "-T", NULL};