summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2010-04-15 12:12:59 +0200
committerKarel Klic <kklic@redhat.com>2010-04-15 12:12:59 +0200
commitf05c9b25335c84c7b5861fce80fd941ec81212f3 (patch)
tree4374f95b52366fb0fb8762b631a623b585921214
parente3ceced26a07433865fafc11b37933146f532af9 (diff)
downloadabrt-f05c9b25335c84c7b5861fce80fd941ec81212f3.tar.gz
abrt-f05c9b25335c84c7b5861fce80fd941ec81212f3.tar.xz
abrt-f05c9b25335c84c7b5861fce80fd941ec81212f3.zip
Crash function is now detected even for threads without an abort frame.
Added new option --crash-frame to abrt-backtrace and updated its manual page.
-rw-r--r--lib/Plugins/CCpp.cpp9
-rw-r--r--lib/Utils/backtrace.c2
-rw-r--r--src/utils/abrt-backtrace.117
-rw-r--r--src/utils/abrt-backtrace.c29
4 files changed, 42 insertions, 15 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 9bdcda9f..cf25c73f 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -761,13 +761,12 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force)
/* Get the function name from the crash frame. */
if (crash_thread)
{
+ struct frame *crash_frame = crash_thread->frames;
struct frame *abort_frame = thread_find_abort_frame(crash_thread);
if (abort_frame)
- {
- struct frame *crash_frame = abort_frame->next;
- if (crash_frame && crash_frame->function && 0 != strcmp(crash_frame->function, "??"))
- dd.SaveText(FILENAME_CRASH_FUNCTION, crash_frame->function);
- }
+ crash_frame = abort_frame->next;
+ if (crash_frame && crash_frame->function && 0 != strcmp(crash_frame->function, "??"))
+ dd.SaveText(FILENAME_CRASH_FUNCTION, crash_frame->function);
}
backtrace_free(backtrace);
diff --git a/lib/Utils/backtrace.c b/lib/Utils/backtrace.c
index 9c77d8c9..a2efa766 100644
--- a/lib/Utils/backtrace.c
+++ b/lib/Utils/backtrace.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 2009 RedHat inc.
This program is free software; you can redistribute it and/or modify
diff --git a/src/utils/abrt-backtrace.1 b/src/utils/abrt-backtrace.1
index 96e0c445..4383f1d0 100644
--- a/src/utils/abrt-backtrace.1
+++ b/src/utils/abrt-backtrace.1
@@ -30,19 +30,26 @@ unsupported format.
.PP
.B Various options
-.IP "\-n, \-\-single-thread"
+.IP "\-n, \-\-single\-thread"
Removes all threads except the one that caused the crash from
the internal representation of the backtrace.
-.IP "\-d=N, \-\-frame-depth=N"
+.IP "\-d=N, \-\-frame\-depth=N"
Display only the top N frames in every thread.
Frames that are a part of system error handling do not count to the N.
So more than N frames can be displayed, but N of them are useful for examination.
N must be larger than 1.
-.IP "\-r, \-\-remove-exit-handlers"
+.IP "\-r, \-\-remove\-exit\-handlers"
Do not display exit handlers and frames that comes after them in the backtrace.
-.IP "\-p, \-\-debug-parser"
+.IP "\-m, \-\-remove\-noncrash\-frames"
+Do not display frames known as not causing the crash, but which are a common
+part of backtraces.
+.IP "\-a, \-\-rate"
+Print backtrace rating from 0 to 4.
+.IP "\-c, \-\-crash\-function"
+Print crash function if it's successfully detected.
+.IP "\-p, \-\-debug\-parser"
Prints debug information when parsing the backtrace.
-.IP "\-s, \-\-debug-scanner"
+.IP "\-s, \-\-debug\-scanner"
Prints debug information when scanning the input file for the parser.
.SH "SEE ALSO"
diff --git a/src/utils/abrt-backtrace.c b/src/utils/abrt-backtrace.c
index 8ea7e20e..d02c9633 100644
--- a/src/utils/abrt-backtrace.c
+++ b/src/utils/abrt-backtrace.c
@@ -1,5 +1,5 @@
/*
- main.cpp - parses command line arguments
+ abrt-backtrace.c - parses command line arguments
Copyright (C) 2009 RedHat inc.
@@ -46,9 +46,10 @@ static struct argp_option options[] = {
{"remove-exit-handlers" , 'r', 0 , 0, "Removes exit handler frames from the displayed backtrace"},
{"remove-noncrash-frames", 'm', 0 , 0, "Removes common frames known as not causing crash"},
{"rate" , 'a', 0 , 0, "Prints the backtrace rating from 0 to 4"},
+ {"crash-function" , 'c', 0 , 0, "Prints crash function"},
{"debug-parser" , 'p', 0 , 0, "Prints parser debug information"},
{"debug-scanner" , 's', 0 , 0, "Prints scanner debug information"},
- {"verbose" , 'v', 0 , 0, "Print human-friendly superfluous output."},
+ {"verbose" , 'v', 0 , 0, "Prints human-friendly superfluous output."},
{ 0 }
};
@@ -63,6 +64,7 @@ struct arguments
bool debug_scanner;
bool verbose;
bool rate;
+ bool crash_function;
char *filename;
};
@@ -91,6 +93,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 's': arguments->debug_scanner = true; break;
case 'v': arguments->verbose = true; break;
case 'a': arguments->rate = true; break;
+ case 'c': arguments->crash_function = true; break;
case ARGP_KEY_ARG:
if (arguments->filename)
@@ -131,6 +134,7 @@ int main(int argc, char **argv)
arguments.verbose = false;
arguments.filename = 0;
arguments.rate = false;
+ arguments.crash_function = false;
argp_parse(&argp, argc, argv, 0, 0, &arguments);
/* If we are about to rate a backtrace, the other values must be set accordingly,
@@ -144,6 +148,14 @@ int main(int argc, char **argv)
arguments.remove_noncrash_frames = true;
}
+ /* If we are about to print the crash function, the other values must be set
+ accordingly. */
+ if (arguments.crash_function)
+ {
+ arguments.independent = false;
+ arguments.single_thread = true;
+ }
+
char *bttext = NULL;
/* If a filename was provided, read input from file.
@@ -310,9 +322,18 @@ int main(int argc, char **argv)
else rating = "4";
puts(rating);
}
- else
- backtrace_print_tree(backtrace, arguments.verbose);
+ if (arguments.crash_function && crash_thread)
+ {
+ struct frame *crash_frame = crash_thread->frames;
+ struct frame *abort_frame = thread_find_abort_frame(crash_thread);
+ if (abort_frame)
+ crash_frame = abort_frame->next;
+ if (crash_frame && crash_frame->function)
+ puts(crash_frame->function);
+ }
+
+ backtrace_print_tree(backtrace, arguments.verbose);
backtrace_free(backtrace);
return retval;
}