summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Pepper <timothy.c.pepper@linux.intel.com>2012-12-05 16:44:40 -0800
committerTim Pepper <timothy.c.pepper@linux.intel.com>2012-12-05 16:44:40 -0800
commit410145d51ea0463b4a72139d1ac7c74c975ac20c (patch)
treeb639af91953c696713d492f127272ee534187987
parent172376ab4b844f0addb91e0914210b7800329269 (diff)
downloadcorewatcher-410145d51ea0463b4a72139d1ac7c74c975ac20c.tar.gz
corewatcher-410145d51ea0463b4a72139d1ac7c74c975ac20c.tar.bz2
corewatcher-410145d51ea0463b4a72139d1ac7c74c975ac20c.zip
Skip cores where gdb notes a mismatch between core and executable
Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
-rw-r--r--src/coredump.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/coredump.c b/src/coredump.c
index 169ba95..d592588 100644
--- a/src/coredump.c
+++ b/src/coredump.c
@@ -229,7 +229,7 @@ static struct oops *extract_core(char *fullpath, char *appfile, char *reportname
fprintf(stderr, "+ extract_core() called for %s\n", fullpath);
- if (asprintf(&command, "LANG=C gdb --batch -f '%s' '%s' -x /etc/corewatcher/gdb.command 2> /dev/null", appfile, fullpath) == -1)
+ if (asprintf(&command, "LANG=C gdb --batch -f '%s' '%s' -x /etc/corewatcher/gdb.command 2>&1", appfile, fullpath) == -1)
return NULL;
file = popen(command, "r");
@@ -264,6 +264,19 @@ static struct oops *extract_core(char *fullpath, char *appfile, char *reportname
if (bytesread == -1)
break;
+ /* gdb outputs (to stderr) two strings starting with "warning: ":
+ * warning: core file may not match specified executable file.
+ * warning: exec file is newer than core file.
+ * We can't trust the gdb 'bt' if these are seen.
+ */
+ if (strncmp(line, "warning: ", 9) == 0) {
+ free(line);
+ pclose(file);
+ free(h1);
+ fprintf(stderr, "+ core/executable mismatch for %s\n", fullpath);
+ return NULL;
+ }
+
/* try to figure out if we're onto the maps output yet */
if (strncmp(line, "From", 4) == 0) {
parsing_maps = 1;
@@ -521,6 +534,9 @@ static struct oops *process_common(char *fullpath)
}
oops = extract_core(fullpath, appfile, reportname);
+ if (!oops)
+ goto err;
+
write_core_detail_file(oops);
free(reportname);
free(appfile);
@@ -552,6 +568,7 @@ static void *create_report(char *fullpath)
oops = process_common(fullpath);
if (!oops) {
fprintf(stderr, "+ Did not generate struct oops for %s\n", fullpath);
+ move_core(fullpath, "skipped");
return NULL;
}