diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-06-19 12:07:12 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-06-19 12:38:45 +0200 |
commit | 8d4e028f1868c47864ec873d9f30c3ee961a8849 (patch) | |
tree | 8a16e81f48f49c2d5aa210d8992f0c7d4a8470c2 /src/journal/coredumpctl.c | |
parent | 8271bd16ce9327834d8580e55bb5e4e0896fd98a (diff) |
coredump: include stacktrace of coredumps in the log message
elfutils' libdw is maintained, can read DWARF debug data and appears to
be the library of choice for generating backtraces today.
Diffstat (limited to 'src/journal/coredumpctl.c')
-rw-r--r-- | src/journal/coredumpctl.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c index ea459469ee..9eaa8979a0 100644 --- a/src/journal/coredumpctl.c +++ b/src/journal/coredumpctl.c @@ -403,7 +403,8 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) { *sgnl = NULL, *exe = NULL, *comm = NULL, *cmdline = NULL, *unit = NULL, *user_unit = NULL, *session = NULL, *boot_id = NULL, *machine_id = NULL, *hostname = NULL, - *coredump = NULL, *slice = NULL, *cgroup = NULL, *owner_uid = NULL; + *coredump = NULL, *slice = NULL, *cgroup = NULL, + *owner_uid = NULL, *message = NULL; const void *d; size_t l; @@ -427,6 +428,7 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) { retrieve(d, l, "_BOOT_ID", &boot_id); retrieve(d, l, "_MACHINE_ID", &machine_id); retrieve(d, l, "_HOSTNAME", &hostname); + retrieve(d, l, "MESSAGE", &message); } if (need_space) @@ -522,6 +524,14 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) { if (access(coredump, F_OK) >= 0) fprintf(file, " Coredump: %s\n", coredump); + if (message) { + _cleanup_free_ char *m = NULL; + + m = strreplace(message, "\n", "\n "); + + fprintf(file, " Message: %s\n", strstrip(m ?: message)); + } + return 0; } @@ -696,7 +706,7 @@ static int run_gdb(sd_journal *j) { if (errno == ENOENT) log_error("Coredump neither in journal file nor stored externally on disk."); else - log_error("Failed to access coredump fiile: %s", strerror(-r)); + log_error("Failed to access coredump file: %m"); return -errno; } |