On Sat, 2011-03-26 at 15:01 +0100, Karel Klic wrote:
Hi,
the attached patch splits a part of abrt-action-generate-backtrace to a
new tool abrt-action-analyze-backtrace, which is used by both LocalGDB
and RetraceServer analyzers.
Then new abrt-action-analyze-backtrace tool reads backtrace and
generates duplication hash, detects crash function, and provides
backtrace rating. These steps haven't been performed for remotely
analyzed crashes so far.
This patch introduced a bug into abrt-action-generate-backtrace.
Now it doesn't delete the .lock file.
See below (as seen in git log):
dd_close(dd) has been lost. Now it exits after dd_save_text() calls.
Please fix.
--
vda
+ dd_save_text(dd, FILENAME_BACKTRACE, backtrace);
/* Don't be completely silent. gdb run takes a few seconds,
* it is useful to let user know it (maybe) worked.
*/
- log(_("Backtrace is generated and saved, %u bytes"),
(int)strlen(backtrace_str));
- free(backtrace_str);
-
- /* Store backtrace hash */
-
- if (!backtrace)
- {
- /*
- * The parser failed. Compute the UUID from the executable
- * and package only. This is not supposed to happen often.
- */
- VERB1 log(_("Backtrace parsing failed for %s"), dump_dir_name);
- VERB1 log("%d:%d: %s", location.line, location.column,
location.message);
- struct strbuf *emptybt = strbuf_new();
- strbuf_prepend_str(emptybt, executable);
- strbuf_prepend_str(emptybt, package);
-
- char hash_str[SHA1_RESULT_LEN*2 + 1];
- create_hash(hash_str, emptybt->buf);
-
- dd_save_text(dd, FILENAME_DUPHASH, hash_str);
- /*
- * Other parts of ABRT assume that if no rating is available,
- * it is ok to allow reporting of the bug. To be sure no bad
- * backtrace is reported, rate the backtrace with the lowest
- * rating.
- */
- dd_save_text(dd, FILENAME_RATING, "0");
-
- strbuf_free(emptybt);
- free(package);
- free(executable);
- dd_close(dd);
-
- /* Report success even if the parser failed, as the backtrace
- * has been created and rated. The failure is caused by a flaw
- * in the parser, not in the backtrace.
- */
- return 0;
- }
-
- /* Compute duplication hash. */
- char *str_hash_core = btp_backtrace_get_duplication_hash(backtrace);
- struct strbuf *str_hash = strbuf_new();
- strbuf_append_str(str_hash, package);
- strbuf_append_str(str_hash, executable);
- strbuf_append_str(str_hash, str_hash_core);
-
- char hash_str[SHA1_RESULT_LEN*2 + 1];
- create_hash(hash_str, str_hash->buf);
-
- dd_save_text(dd, FILENAME_DUPHASH, hash_str);
- strbuf_free(str_hash);
- free(str_hash_core);
-
- /* Compute the backtrace rating. */
- float quality = btp_backtrace_quality_complex(backtrace);
- const char *rating;
- if (quality < 0.6f)
- rating = "0";
- else if (quality < 0.7f)
- rating = "1";
- else if (quality < 0.8f)
- rating = "2";
- else if (quality < 0.9f)
- rating = "3";
- else
- rating = "4";
- dd_save_text(dd, FILENAME_RATING, rating);
-
- /* Get the function name from the crash frame. */
- struct btp_frame *crash_frame = btp_backtrace_get_crash_frame(backtrace);
- if (crash_frame)
- {
- if (crash_frame->function_name &&
- 0 != strcmp(crash_frame->function_name, "??"))
- {
- dd_save_text(dd, FILENAME_CRASH_FUNCTION, crash_frame->function_name);
- }
- btp_frame_free(crash_frame);
- }
- btp_backtrace_free(backtrace);
- dd_close(dd);
-
- free(executable);
- free(package);
+ log(_("Backtrace is generated and saved, %u bytes"),
(int)strlen(backtrace));
+ free(backtrace);
return 0;
}