[PATCH] A bit better parsing of component name from NVR (#741647)
by Jakub Filak
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
meh/dump.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/meh/dump.py b/meh/dump.py
index e9779f0..0d63d12 100644
--- a/meh/dump.py
+++ b/meh/dump.py
@@ -143,7 +143,20 @@ class ExceptionDump(object):
"{0}".format(file_))
package = "{0}-{1}-{2}.{3}".format(header["name"], header["version"],
header["release"], header["arch"])
- component = header["sourcerpm"].split("-")[0]
+
+ # cuts the name from the NVR format: foo-blah-2.8.8-2.fc17.src.rpm
+ name_end = len(header["sourcerpm"])
+ try:
+ name_end = nvr.rindex('-')
+ except ValueError as e:
+ pass
+
+ try:
+ name_end = nvr[:name_end].rindex('-')
+ except ValueError as e:
+ pass
+
+ component = header["sourcerpm"][:name_end]
return (package, component)
--
1.7.11.7
11 years, 6 months
[Automatic Bug Reporting Tool - ABRT] #776: implement global locks
by fedora-badges
#776: implement global locks
--------------------+----------------------------------
Reporter: mtoman | Owner: crash-catcher@…
Type: defect | Status: new
Priority: major | Milestone: ABRT_server_release
Component: faf | Version:
Keywords: | Blocked By:
Blocking: |
--------------------+----------------------------------
(Needs some brainstorming)
Some faf-* scripts should only be ran once at one moment. As the scripts
may run on different machines, locks should probably be implemented in DB.
--
Ticket URL: <https://fedorahosted.org/abrt/ticket/776>
Automatic Bug Reporting Tool - ABRT <http://fedorahoted.org/abrt/>
Automatic bug reporting tool
11 years, 6 months
[ABRT PATCH] add collect_* event to reporting chains for CCpp/Python/Kernel
by Jakub Filak
- a part of rhbz#864014
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/plugins/ccpp_event.conf | 2 +-
src/plugins/koops_event.conf | 2 +-
src/plugins/python_event.conf | 2 +-
src/plugins/smolt_event.conf | 9 +++++++--
4 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/plugins/ccpp_event.conf b/src/plugins/ccpp_event.conf
index 47bf153..076d543 100644
--- a/src/plugins/ccpp_event.conf
+++ b/src/plugins/ccpp_event.conf
@@ -76,4 +76,4 @@ EVENT=analyze_CCpp analyzer=CCpp
# Reporting of C/Cpp problems
EVENT=report-gui analyzer=CCpp
- report-gtk -e report_uReport -e analyze_CCpp -e report_Bugzilla -e post_report -- "$DUMP_DIR"
+ report-gtk -e report_uReport -e analyze_CCpp -e "collect_*" -e report_Bugzilla -e post_report -- "$DUMP_DIR"
diff --git a/src/plugins/koops_event.conf b/src/plugins/koops_event.conf
index 4289dda..4381f0d 100644
--- a/src/plugins/koops_event.conf
+++ b/src/plugins/koops_event.conf
@@ -29,4 +29,4 @@ EVENT=post_report analyzer=Kerneloops
# Reporting of kernel oopses
EVENT=report-gui analyzer=Kerneloops
- report-gtk -e report_uReport -e report_Bugzilla -e post_report -- "$DUMP_DIR"
+ report-gtk -e report_uReport -e "collect_*" -e report_Bugzilla -e post_report -- "$DUMP_DIR"
diff --git a/src/plugins/python_event.conf b/src/plugins/python_event.conf
index 7c1b43a..5c9c2f2 100644
--- a/src/plugins/python_event.conf
+++ b/src/plugins/python_event.conf
@@ -24,4 +24,4 @@ EVENT=post_report analyzer=Python
# Reporting of python exceptions
EVENT=report-gui analyzer=Python
- report-gtk -e report_uReport -e report_Bugzilla -e post_report -- "$DUMP_DIR"
+ report-gtk -e report_uReport -e "collect_*" -e report_Bugzilla -e post_report -- "$DUMP_DIR"
diff --git a/src/plugins/smolt_event.conf b/src/plugins/smolt_event.conf
index addabf3..c5d4f1d 100644
--- a/src/plugins/smolt_event.conf
+++ b/src/plugins/smolt_event.conf
@@ -16,5 +16,10 @@ EVENT=collect_Smolt
echo "Smolt package not installed, can't save profile"
exit 0
}
- smoltSendProfile -p >smolt_data 2>&1 || exit $?
- echo "Smolt profile successfully saved"
+ if smoltSendProfile -p >smolt_data 2>&1; then
+ echo "Smolt profile successfully saved"
+ else
+ # Don't fail because this event is executed in every reporting process
+ # and smolt profile is not so important item to break reporting
+ echo "Can't save smolt profile"
+ fi
--
1.7.11.4
11 years, 6 months
[btparser PATCHv2] normalize kernel oopses
by Martin Milata
---
lib/Makefile.am | 1 +
lib/Makefile.in | 12 ++++++++-
lib/normalize.h | 7 +++++
lib/normalize_oops.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/normalize.at | 49 +++++++++++++++++++++++++++++++++++
5 files changed, 141 insertions(+), 1 deletion(-)
create mode 100644 lib/normalize_oops.c
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 4fba7f4..b66c69d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -36,6 +36,7 @@ libbtparser_la_SOURCES = \
normalize_libstdcpp.c \
normalize_linux.c \
normalize_xorg.c \
+ normalize_oops.c \
sharedlib.c \
strbuf.c \
thread.c \
diff --git a/lib/Makefile.in b/lib/Makefile.in
index fdf2888..290859e 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -95,7 +95,8 @@ am_libbtparser_la_OBJECTS = $(am__objects_1) \
libbtparser_la-normalize_gtk.lo \
libbtparser_la-normalize_libstdcpp.lo \
libbtparser_la-normalize_linux.lo \
- libbtparser_la-normalize_xorg.lo libbtparser_la-sharedlib.lo \
+ libbtparser_la-normalize_xorg.lo \
+ libbtparser_la-normalize_oops.lo libbtparser_la-sharedlib.lo \
libbtparser_la-strbuf.lo libbtparser_la-thread.lo \
libbtparser_la-utils.lo
libbtparser_la_OBJECTS = $(am_libbtparser_la_OBJECTS)
@@ -291,6 +292,7 @@ libbtparser_la_SOURCES = \
normalize_libstdcpp.c \
normalize_linux.c \
normalize_xorg.c \
+ normalize_oops.c \
sharedlib.c \
strbuf.c \
thread.c \
@@ -398,6 +400,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbtparser_la-normalize_gtk.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbtparser_la-normalize_libstdcpp.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbtparser_la-normalize_linux.Plo(a)am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbtparser_la-normalize_oops.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbtparser_la-normalize_xorg.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbtparser_la-sharedlib.Plo(a)am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbtparser_la-strbuf.Plo(a)am__quote@
@@ -558,6 +561,13 @@ libbtparser_la-normalize_xorg.lo: normalize_xorg.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbtparser_la_CFLAGS) $(CFLAGS) -c -o libbtparser_la-normalize_xorg.lo `test -f 'normalize_xorg.c' || echo '$(srcdir)/'`normalize_xorg.c
+libbtparser_la-normalize_oops.lo: normalize_oops.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbtparser_la_CFLAGS) $(CFLAGS) -MT libbtparser_la-normalize_oops.lo -MD -MP -MF $(DEPDIR)/libbtparser_la-normalize_oops.Tpo -c -o libbtparser_la-normalize_oops.lo `test -f 'normalize_oops.c' || echo '$(srcdir)/'`normalize_oops.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libbtparser_la-normalize_oops.Tpo $(DEPDIR)/libbtparser_la-normalize_oops.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='normalize_oops.c' object='libbtparser_la-normalize_oops.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbtparser_la_CFLAGS) $(CFLAGS) -c -o libbtparser_la-normalize_oops.lo `test -f 'normalize_oops.c' || echo '$(srcdir)/'`normalize_oops.c
+
libbtparser_la-sharedlib.lo: sharedlib.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbtparser_la_CFLAGS) $(CFLAGS) -MT libbtparser_la-sharedlib.lo -MD -MP -MF $(DEPDIR)/libbtparser_la-sharedlib.Tpo -c -o libbtparser_la-sharedlib.lo `test -f 'sharedlib.c' || echo '$(srcdir)/'`sharedlib.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libbtparser_la-sharedlib.Tpo $(DEPDIR)/libbtparser_la-sharedlib.Plo
diff --git a/lib/normalize.h b/lib/normalize.h
index 738a4f3..dcc024b 100644
--- a/lib/normalize.h
+++ b/lib/normalize.h
@@ -85,6 +85,13 @@ btp_normalize_paired_unknown_function_names(struct btp_thread *thread1, struct b
void
btp_normalize_optimize_thread(struct btp_thread *thread);
+/**
+ * Normalize thread created from kerneloops backtrace. NOT for use with
+ * userspace threads.
+ */
+void
+btp_normalize_oops_thread(struct btp_thread *thread);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/normalize_oops.c b/lib/normalize_oops.c
new file mode 100644
index 0000000..0530447
--- /dev/null
+++ b/lib/normalize_oops.c
@@ -0,0 +1,73 @@
+/*
+ normalize_oops.c
+
+ Copyright (C) 2010 Red Hat, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "normalize.h"
+#include "frame.h"
+#include "thread.h"
+#include "utils.h"
+#include <stdlib.h>
+#include <assert.h>
+
+static int ptrstrcmp(const void *s1, const void *s2)
+{
+ return btp_strcmp0(*(const char**)s1, *(const char**)s2);
+}
+
+void
+btp_normalize_oops_thread(struct btp_thread *thread)
+{
+ /* !!! MUST BE SORTED !!! */
+ const char *blacklist[] = {
+ "do_softirq",
+ "do_vfs_ioctl",
+ "flush_kthread_worker",
+ "gs_change",
+ "irq_exit",
+ "kernel_thread_helper",
+ "kthread",
+ "process_one_work",
+ "system_call_fastpath",
+ "warn_slowpath_common",
+ "warn_slowpath_fmt",
+ "warn_slowpath_fmt_taint",
+ "warn_slowpath_null",
+ "worker_thread",
+ NULL
+ };
+
+ struct btp_frame *frame = thread->frames;
+ while (frame)
+ {
+ struct btp_frame *next_frame = frame->next;
+
+ /* do not drop frames belonging to a module */
+ bool in_module = (btp_strcmp0(frame->library_name, "vmlinux") != 0);
+ bool in_blacklist = bsearch(&(frame->function_name), blacklist,
+ sizeof(blacklist)/sizeof(blacklist[0]),
+ sizeof(blacklist[0]), ptrstrcmp);
+
+ if (!in_module && in_blacklist)
+ {
+ bool success = btp_thread_remove_frame(thread, frame);
+ assert(success);
+ }
+
+ frame = next_frame;
+ }
+}
diff --git a/tests/normalize.at b/tests/normalize.at
index d519757..a293c82 100644
--- a/tests/normalize.at
+++ b/tests/normalize.at
@@ -152,3 +152,52 @@ int main()
return 0;
}
])
+
+AT_TESTFUN([btp_normalize_oops],
+[
+UTILS
+
+#define t(name) (assert(f), assert(btp_strcmp0(f->function_name, name) == 0), f = f->next);
+
+int main()
+{
+ struct btp_thread *thread;
+ struct btp_frame *f;
+
+ thread = create_thread(14,
+ "warn_slowpath_common",
+ "warn_slowpath_null",
+ "brcms_c_wait_for_tx_completion",
+ "brcms_ops_flush",
+ "ieee80211_scan_work",
+ "switch_to",
+ "process_one_work",
+ "ieee80211_run_deferred_scan",
+ "worker_thread",
+ "manage_workers",
+ "kthread",
+ "kernel_thread_helper",
+ "kthread_freezable_should_stop",
+ "gs_change"
+ );
+
+ for (f = thread->frames; f; f = f->next)
+ {
+ f->library_name = btp_strdup("vmlinux");
+ }
+
+ btp_normalize_oops_thread(thread);
+
+ f = thread->frames;
+ t("brcms_c_wait_for_tx_completion");
+ t("brcms_ops_flush");
+ t("ieee80211_scan_work");
+ t("switch_to");
+ t("ieee80211_run_deferred_scan");
+ t("manage_workers");
+ t("kthread_freezable_should_stop");
+ assert(f == NULL);
+
+ return 0;
+}
+])
--
1.7.11.4
11 years, 6 months
[LIBREPORT PATCH] expand events from a chain and process resulting events separately
by Jakub Filak
- for crash of vim the command $ 'report-gtk -e collect_* -- $DUMP_DIR'
will execute the following list of events:
collect_smolt
collect_vimrc_user
collect_vimrc_system
- a part of rhbz#864014
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gui-wizard-gtk/wizard.c | 69 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 66 insertions(+), 3 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 2bd8a63..ebed3fa 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -49,6 +49,8 @@ typedef struct event_gui_data_t
/* if(g_hash_table_lookup(g_loaded_texts, FILENAME_COMMENT)) ... */
static GHashTable *g_loaded_texts;
static char *g_event_selected;
+static char *g_event_selected_origin;
+static char *g_event_selected_list;
static unsigned g_black_event_count = 0;
static pid_t g_event_child_pid = 0;
@@ -1502,7 +1504,7 @@ static void on_btn_cancel_event(GtkButton *button)
static bool is_processing_finished()
{
- return !g_expert_mode && !g_auto_event_list;
+ return !g_expert_mode && !g_auto_event_list && !g_event_selected_list;
}
static void update_gui_on_finished_reporting()
@@ -1519,6 +1521,10 @@ static void terminate_event_chain()
if (g_expert_mode)
return;
+ free(g_event_selected_origin);
+ g_event_selected_list = NULL;
+ g_event_selected_origin = NULL;
+
g_auto_event_list = NULL;
update_gui_on_finished_reporting();
}
@@ -2211,10 +2217,64 @@ static void setup_and_start_even_run(const char *event_name)
static const char *get_next_processed_event(GList **events_list)
{
- if (!events_list || !*events_list)
+ if ((!events_list || !*events_list) && (!g_event_selected_list))
return NULL;
const char *event_name = (const char *)(*events_list)->data;
+ const size_t event_len = strlen(event_name);
+ if (!g_event_selected_list && event_name[event_len-1] == '*')
+ {
+ struct dump_dir *dd = dd_opendir(g_dump_dir_name, DD_OPEN_READONLY);
+ if (!dd)
+ error_msg_and_die("Can't open directory '%s'", g_dump_dir_name);
+
+ /* Erase '*' */
+ char *event_pfx = xstrndup(event_name, event_len - 1);
+
+ /* Will be replaced later but need to know
+ * that unwound list is just initialized */
+ event_name = NULL;
+
+ /* get 'event1\nevent2\nevent3\n' or '' if no event is possible */
+ g_event_selected_origin =
+ g_event_selected_list =
+ list_possible_events(dd, g_dump_dir_name, event_pfx);
+
+ dd_close(dd);
+
+ free(event_pfx);
+ }
+
+ if (g_event_selected_list)
+ { /* processing unwound events from event having trailing '*' */
+ char *next = strchr(g_event_selected_list, '\n');
+ if (next)
+ { /* 'event1\0event2\nevent3\n' */
+ next[0] = '\0';
+ /* 'event1' */
+ event_name = g_event_selected_list;
+ /* 'event2\nevent3\n' */
+ g_event_selected_list = next + 1;
+ }
+
+ if (g_event_selected_list[0] == '\0')
+ { /* the list is finished or no event was possible */
+ free(g_event_selected_origin);
+ g_event_selected_origin = NULL;
+ g_event_selected_list = NULL;
+ }
+ }
+
+ if (!g_event_selected_list)
+ { /* the list of unwound events is finished or wasn't used */
+ *events_list = g_list_next(*events_list);
+
+ /* an event name has trailing '*' but no possible event was found */
+ if (!event_name)
+ /* Beware of recursion!
+ * Skip event with trailing '*' and no possible event */
+ return get_next_processed_event(events_list);
+ }
clear_warnings();
const bool acceptable = check_minimal_bt_rating(event_name);
@@ -2222,11 +2282,14 @@ static const char *get_next_processed_event(GList **events_list)
if (!acceptable)
{
+ free(g_event_selected_origin);
+ g_event_selected_list = NULL;
+ g_event_selected_origin = NULL;
+
*events_list = NULL;
return NULL;
}
- *events_list = g_list_next(*events_list);
return event_name;
}
--
1.7.11.4
11 years, 6 months
[LIBREPORT PATCH] don't update the selected event while processing it
by Jakub Filak
- If user wrote a comment or added a file, the selected event was
updated to the post-create event
- closes rhbz#861973
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gui-wizard-gtk/main.c | 2 +-
src/gui-wizard-gtk/wizard.c | 10 +++++-----
src/gui-wizard-gtk/wizard.h | 16 +++++++++++++++-
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/gui-wizard-gtk/main.c b/src/gui-wizard-gtk/main.c
index c09f6d8..4748eb8 100644
--- a/src/gui-wizard-gtk/main.c
+++ b/src/gui-wizard-gtk/main.c
@@ -146,7 +146,7 @@ int main(int argc, char **argv)
g_custom_logger = &show_error_as_msgbox;
- update_gui_state_from_problem_data();
+ update_gui_state_from_problem_data(UPDATE_SELECTED_EVENT);
/* Enter main loop */
gtk_main();
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 2bd8a63..7aef587 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -473,7 +473,7 @@ static void save_text_if_changed(const char *name, const char *new_value)
//FIXME: else: what to do with still-unsaved data in the widget??
dd_close(dd);
problem_data_reload_from_dump_dir();
- update_gui_state_from_problem_data();
+ update_gui_state_from_problem_data(/* don't update selected event */ 0);
}
}
@@ -1292,7 +1292,7 @@ static void update_ls_details_checkboxes(void)
}
}
-void update_gui_state_from_problem_data(void)
+void update_gui_state_from_problem_data(int flags)
{
update_window_title();
remove_tabs_from_notebook(g_notebook);
@@ -1326,7 +1326,7 @@ void update_gui_state_from_problem_data(void)
G_CALLBACK(event_rb_was_toggled)
);
- if (g_expert_mode)
+ if (flags & UPDATE_SELECTED_EVENT && g_expert_mode)
{
/* Update the value of currently selected event */
free(g_event_selected);
@@ -1746,7 +1746,7 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
gtk_widget_set_sensitive(g_btn_next, true);
problem_data_reload_from_dump_dir();
- update_gui_state_from_problem_data();
+ update_gui_state_from_problem_data(UPDATE_SELECTED_EVENT);
if (retval)
{
@@ -2635,7 +2635,7 @@ static void on_btn_add_file(GtkButton *button)
if (!message)
{
problem_data_reload_from_dump_dir();
- update_gui_state_from_problem_data();
+ update_gui_state_from_problem_data(/* don't update selected event */ 0);
/* Set flags for the new item */
update_ls_details_checkboxes();
}
diff --git a/src/gui-wizard-gtk/wizard.h b/src/gui-wizard-gtk/wizard.h
index a6bccf7..d2caaa6 100644
--- a/src/gui-wizard-gtk/wizard.h
+++ b/src/gui-wizard-gtk/wizard.h
@@ -22,7 +22,21 @@
#include "internal_libreport_gtk.h"
void create_assistant(void);
-void update_gui_state_from_problem_data(void);
+
+enum
+{
+ /*
+ * the selected event is updated to a first event wich can be applied on
+ * the current problem directory
+ */
+ UPDATE_SELECTED_EVENT = 1 << 0,
+};
+
+/* Loads problem's data and update GUI elements according to the data.
+ *
+ * @param flags Flags to alternate the update process
+ */
+void update_gui_state_from_problem_data(int flags);
void show_error_as_msgbox(const char *msg);
--
1.7.11.4
11 years, 6 months
[btparser PATCH] normalize kernel oopses
by Martin Milata
---
lib/core-backtrace-oops.c | 53 +++++++++++
tests/Makefile.am | 2 +-
tests/Makefile.in | 2 +-
tests/atlocal.in | 2 +-
tests/corebt-oops.at | 228 ++++++++++++++++++++++++++++++++++++++++++++++
tests/testsuite.at | 1 +
6 files changed, 285 insertions(+), 3 deletions(-)
create mode 100644 tests/corebt-oops.at
diff --git a/lib/core-backtrace-oops.c b/lib/core-backtrace-oops.c
index 98e79c9..58cb79d 100644
--- a/lib/core-backtrace-oops.c
+++ b/lib/core-backtrace-oops.c
@@ -61,6 +61,57 @@ Modules linked in:
----- END -----
*/
+static GList *
+normalize_kerneloops(GList *kerneloops)
+{
+ /* NULL-terminated array of function names to drop */
+ const char *blacklist[] = {
+ "warn_slowpath_common",
+ "warn_slowpath_null",
+ "warn_slowpath_fmt",
+ "warn_slowpath_fmt_taint",
+ "do_softirq",
+ "flush_kthread_worker",
+ "system_call_fastpath",
+ "kernel_thread_helper",
+ "gs_change",
+ "worker_thread",
+ "do_vfs_ioctl",
+ "process_one_work",
+ "kthread",
+ "irq_exit",
+ NULL
+ };
+
+ GList *next = kerneloops;
+
+ while (next)
+ {
+ bool drop = false;
+ struct backtrace_entry *frame = (struct backtrace_entry *)next->data;
+ const char **func_cur;
+
+ for (func_cur = blacklist; *func_cur != NULL; func_cur++)
+ {
+ if (btp_strcmp0(*func_cur, frame->symbol) == 0)
+ {
+ drop = true;
+ break;
+ }
+ }
+
+ next = g_list_next(next);
+
+ if (drop)
+ {
+ kerneloops = g_list_remove(kerneloops, frame);
+ btp_backtrace_entry_free(frame);
+ }
+ }
+
+ return kerneloops;
+}
+
GList *
btp_parse_kerneloops(char *text, const char *kernelver)
{
@@ -194,6 +245,8 @@ btp_parse_kerneloops(char *text, const char *kernelver)
if (nextline)
*(nextline - 1) = '\n';
+ result = normalize_kerneloops(result);
+
return result;
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d138c84..9e695b7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,4 @@
-EXTRA_DIST = backtraces
+EXTRA_DIST = backtraces oopses
## ------------ ##
## package.m4. ##
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 29ec3b2..16f6ae6 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -181,7 +181,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-EXTRA_DIST = backtraces package.m4 $(TESTSUITE_AT) $(TESTSUITE) \
+EXTRA_DIST = backtraces oopses package.m4 $(TESTSUITE_AT) $(TESTSUITE) \
atlocal.in
TESTSUITE_AT = \
local.at \
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 856e5fe..3aaa34a 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -6,7 +6,7 @@ CC='@CC@'
LIBTOOL="$abs_top_builddir/libtool"
# We want no optimization.
-CFLAGS="@O0CFLAGS@ -I$abs_top_builddir -D_GNU_SOURCE"
+CFLAGS="@O0CFLAGS@ -I$abs_top_builddir -D_GNU_SOURCE @GLIB_CFLAGS@"
# Are special link options needed?
LDFLAGS="@LDFLAGS@ $abs_top_builddir/lib/libbtparser.la"
diff --git a/tests/corebt-oops.at b/tests/corebt-oops.at
new file mode 100644
index 0000000..2efa040
--- /dev/null
+++ b/tests/corebt-oops.at
@@ -0,0 +1,228 @@
+# Checking the btparser. -*- Autotest -*-
+
+AT_BANNER([Core-level backtrace for kerneloops])
+
+## --------------------------- ##
+## btp_parse_kerneloops_x86_64 ##
+## --------------------------- ##
+
+AT_TESTFUN([btp_parse_kerneloops_x86_64],
+[[
+#include <lib/core-backtrace-oops.h>
+#include <lib/utils.h>
+#include <glib.h>
+#include <assert.h>
+
+char *kver = "3.2.2-1.fc16.x86_64";
+GList *oops = NULL;
+
+void t(uint64_t addr, char *sym, char *mod)
+{
+ assert(oops);
+ struct backtrace_entry *f = oops->data;
+
+ assert(f->address == addr);
+ assert(strcmp(f->symbol, sym) == 0);
+ assert(strcmp(f->filename, mod) == 0);
+ oops = g_list_next(oops);
+}
+
+int main(void)
+{
+ char *str = btp_file_to_string("../../oopses/oops.x86_64");
+ assert(str);
+ oops = btp_parse_kerneloops(str, kver);
+ assert(oops);
+
+ t(0xffffffffa03eb6b8, "ath_rc_get_highest_rix", "ath9k");
+ t(0xffffffffa03eb88c, "ath_get_rate", "ath9k");
+ t(0xffffffff81088610, "insert_work", "vmlinux");
+ t(0xffffffffa04e7aa6, "rate_control_get_rate", "mac80211");
+ t(0xffffffffa04f389f, "invoke_tx_handlers", "mac80211");
+ t(0xffffffffa04d2dac, "sta_info_get", "mac80211");
+ t(0xffffffffa04f46d0, "ieee80211_tx", "mac80211");
+ t(0xffffffffa04f47b1, "ieee80211_xmit", "mac80211");
+ t(0xffffffffa04f4e5f, "ieee80211_subif_start_xmit", "mac80211");
+ t(0xffffffff810992f7, "getnstimeofday", "vmlinux");
+ t(0xffffffff814d48a2, "dev_hard_start_xmit", "vmlinux");
+ t(0xffffffff814f03af, "sch_direct_xmit", "vmlinux");
+ t(0xffffffff814d4de4, "dev_queue_xmit", "vmlinux");
+ t(0xffffffff814fdf85, "nf_hook_slow", "vmlinux");
+ t(0xffffffff8150cec0, "ip_fragment", "vmlinux");
+ t(0xffffffff8150d02b, "ip_finish_output", "vmlinux");
+ t(0xffffffff8150db88, "ip_output", "vmlinux");
+ t(0xffffffff8150d254, "ip_local_out", "vmlinux");
+ t(0xffffffff8150d289, "ip_local_out", "vmlinux");
+ t(0xffffffff8150d3df, "ip_queue_xmit", "vmlinux");
+ t(0xffffffff81524804, "tcp_transmit_skb", "vmlinux");
+ t(0xffffffff81525f31, "tcp_retransmit_skb", "vmlinux");
+ t(0xffffffff81113056, "perf_event_task_tick", "vmlinux");
+ t(0xffffffff8152789d, "tcp_retransmit_timer", "vmlinux");
+ t(0xffffffff81527ed8, "tcp_write_timer", "vmlinux");
+ t(0xffffffff8107d35b, "run_timer_softirq", "vmlinux");
+ t(0xffffffff812bf1d4, "timerqueue_add", "vmlinux");
+ t(0xffffffff81527d50, "tcp_retransmit_timer", "vmlinux");
+ t(0xffffffff8101b8d3, "native_sched_clock", "vmlinux");
+ t(0xffffffff8101b3b9, "read_tsc", "vmlinux");
+ t(0xffffffff810a09d4, "tick_program_event", "vmlinux");
+ t(0xffffffff815eba2c, "call_softirq", "vmlinux");
+ t(0xffffffff815ec3ce, "smp_apic_timer_interrupt", "vmlinux");
+ t(0xffffffff815ea29e, "apic_timer_interrupt", "vmlinux");
+ t(0xffffffff8130fd2d, "intel_idle", "vmlinux");
+ t(0xffffffff8130fd0f, "intel_idle", "vmlinux");
+ t(0xffffffff814927f1, "cpuidle_idle_call", "vmlinux");
+ t(0xffffffff8101322a, "cpu_idle", "vmlinux");
+ t(0xffffffff815d01b6, "start_secondary", "vmlinux");
+ assert(oops == NULL);
+
+ return 0;
+}
+]])
+
+## ------------------------- ##
+## btp_parse_kerneloops_i386 ##
+## ------------------------- ##
+
+AT_TESTFUN([btp_parse_kerneloops_i386],
+[[
+#include <lib/core-backtrace-oops.h>
+#include <lib/utils.h>
+#include <glib.h>
+#include <assert.h>
+
+char *kver = "3.3.1-3.fc16.i686.PAE";
+GList *oops = NULL;
+
+void t(uint64_t addr, char *sym)
+{
+ assert(oops);
+ struct backtrace_entry *f = oops->data;
+
+ assert(f->address == addr);
+ assert(strcmp(f->symbol, sym) == 0);
+ assert(strcmp(f->filename, "vmlinux") == 0);
+ oops = g_list_next(oops);
+}
+
+int main(void)
+{
+ char *str = btp_file_to_string("../../oopses/oops.i386");
+ assert(str);
+ oops = btp_parse_kerneloops(str, kver);
+ assert(oops);
+
+ t(0xc087237a, "dev_watchdog");
+ t(0xc087237a, "dev_watchdog");
+ t(0xc087237a, "dev_watchdog");
+ t(0xc044d410, "tasklet_hi_schedule_first");
+ t(0xc0454827, "run_timer_softirq");
+ t(0xc0477a2f, "sched_clock_cpu");
+ t(0xc08721a0, "qdisc_reset");
+ t(0xc044d410, "tasklet_hi_schedule_first");
+ t(0xc044d410, "tasklet_hi_schedule_first");
+ t(0xc042ea79, "smp_apic_timer_interrupt");
+ t(0xc094b865, "apic_timer_interrupt");
+ t(0xc0437ee5, "native_safe_halt");
+ t(0xc041975c, "default_idle");
+ t(0xc0411308, "cpu_idle");
+ t(0xc092ac05, "rest_init");
+ t(0xc0be278b, "start_kernel");
+ t(0xc0be21c5, "loglevel");
+ t(0xc0be20ac, "i386_start_kernel");
+ assert(oops == NULL);
+
+ return 0;
+}
+]])
+
+## -------------------------- ##
+## btp_parse_kerneloops_s390x ##
+## -------------------------- ##
+
+AT_TESTFUN([btp_parse_kerneloops_s390x],
+[[
+#include <lib/core-backtrace-oops.h>
+#include <lib/utils.h>
+#include <glib.h>
+#include <assert.h>
+
+char *kver = "2.6.41.4-1.fc15.s390x";
+GList *oops = NULL;
+
+void t(uint64_t addr, char *sym)
+{
+ assert(oops);
+ struct backtrace_entry *f = oops->data;
+
+ assert(f->address == addr);
+ assert(strcmp(f->symbol, sym) == 0);
+ assert(strcmp(f->filename, "vmlinux") == 0);
+ oops = g_list_next(oops);
+}
+
+int main(void)
+{
+ char *str = btp_file_to_string("../../oopses/oops.s390x");
+ assert(str);
+ oops = btp_parse_kerneloops(str, kver);
+ assert(oops);
+
+ t(0x000000000045400c, "list_add");
+ t(0x000000000024798e, "anon_vma_fork");
+ t(0x0000000000149786, "dup_mm");
+ t(0x000000000014a860, "copy_process");
+ t(0x000000000014b14c, "do_fork");
+ t(0x0000000000106c16, "SyS_clone");
+ t(0x0000000000631e08, "sysc_tracego");
+ /* XXX: the rest is not parsed correctly? */
+
+ return 0;
+}
+]])
+
+## -------------------------- ##
+## btp_parse_kerneloops_armv7 ##
+## -------------------------- ##
+
+AT_TESTFUN([btp_parse_kerneloops_armv7],
+[[
+#include <lib/core-backtrace-oops.h>
+#include <lib/utils.h>
+#include <glib.h>
+#include <assert.h>
+
+char *kver = "N/A";
+GList *oops = NULL;
+
+void t(uint64_t addr, char *sym)
+{
+ assert(oops);
+ struct backtrace_entry *f = oops->data;
+
+ assert(f->address == addr);
+ assert(strcmp(f->symbol, sym) == 0);
+ assert(strcmp(f->filename, "vmlinux") == 0);
+ oops = g_list_next(oops);
+}
+
+int main(void)
+{
+ char *str = btp_file_to_string("../../oopses/oops.armv7");
+ assert(str);
+ oops = btp_parse_kerneloops(str, kver);
+ assert(oops);
+
+ t(0xc0014210, "unwind_backtrace");
+ t(0xc024c208, "dss_driver_probe");
+ t(0xc0294520, "driver_probe_device");
+ t(0xc02946b8, "driver_attach");
+ t(0xc0293788, "bus_for_each_dev");
+ t(0xc0293ef4, "bus_add_driver");
+ t(0xc0294b64, "driver_register");
+ t(0xc0008858, "do_one_initcall");
+ t(0xc06c48bc, "kernel_init");
+ assert(oops == NULL);
+
+ return 0;
+}
+]])
diff --git a/tests/testsuite.at b/tests/testsuite.at
index fbbd4a2..be2bac9 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -10,3 +10,4 @@ m4_include([normalize.at])
m4_include([metrics.at])
m4_include([cluster.at])
m4_include([sharedlib.at])
+m4_include([corebt-oops.at])
--
1.7.11.4
11 years, 6 months