diff options
author | Tim Pepper <timothy.c.pepper@linux.intel.com> | 2012-09-27 17:22:15 -0700 |
---|---|---|
committer | Tim Pepper <timothy.c.pepper@linux.intel.com> | 2012-09-27 17:22:15 -0700 |
commit | 7add2a6343ba53ca859a521037d59df98725a652 (patch) | |
tree | 6e71bc97c4085455df53ac9f1a6ddd6aeb9bb828 | |
parent | cdecf27fbff423a0ed510ba7d3c234d6a93906b0 (diff) | |
download | corewatcher-7add2a6343ba53ca859a521037d59df98725a652.tar.gz corewatcher-7add2a6343ba53ca859a521037d59df98725a652.tar.bz2 corewatcher-7add2a6343ba53ca859a521037d59df98725a652.zip |
Add timestamp from core
The server has been attributing a timestamp to a crash report based on the
time the report is received. This may differ greatly from the actual time
of the issue. This is easily fixed with a stat of the corefile.
Unfortunately, the same can't as easily be done for getting the os-build,
which may also be incorrectly attributed on the client side based on the
/etc/os-release file's contents at the time of a crash's processing by
corewatcher, as opposed to at the actual time of the crash.
Tracking the combination of the reported os_build, core time, and receiving
time should give us more rich reporting and ability to discern problems
between different classes of users (eg: more/less network connectedness,
more/less aggressive adoption of updates).
Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
-rw-r--r-- | src/coredump.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/coredump.c b/src/coredump.c index b967069..76d20de 100644 --- a/src/coredump.c +++ b/src/coredump.c @@ -321,16 +321,26 @@ static struct oops *extract_core(char *fullpath, char *appfile) { struct oops *oops = NULL; int ret = 0; - char *command = NULL, *h1 = NULL, *c1 = NULL, *c2 = NULL, *line = NULL, *text = NULL, *at = NULL; + char *command = NULL, *h1 = NULL, *c1 = NULL, *c2 = NULL, *line = NULL; + char *text = NULL, *at = NULL, *coretime = NULL; char *m1 = NULL, *m2 = NULL; FILE *file = NULL; char *badchar = NULL; char *release = get_release(); int parsing_maps = 0; + struct stat stat_buf; if (asprintf(&command, "LANG=C gdb --batch -f %s %s -x /etc/corewatcher/gdb.command 2> /dev/null", appfile, fullpath) == -1) return NULL; + if (stat(fullpath, &stat_buf) != -1) { + coretime = ctime(&stat_buf.st_mtime); + } + if (coretime == NULL) { + if (asprintf(&coretime, "Unknown\n") == -1) + return NULL; + } + if ((at = wrapper_scan(command))) { free(appfile); appfile = at; @@ -338,9 +348,11 @@ static struct oops *extract_core(char *fullpath, char *appfile) ret = asprintf(&h1, "cmdline: %s\n" - "release: %s\n", + "release: %s\n" + "time: %s", appfile, - release); + release, + coretime); free(release); if (ret == -1) h1 = strdup("Unknown"); |