mfabik / rpms / satyr

Forked from rpms/satyr 3 years ago
Clone
Blob Blame History Raw
From 90f464eb0c1ee4f5c23cb34ec6d199ae648625fe Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 16 May 2014 13:50:22 +0200
Subject: [PATCH 1/5] Fulfill missing values in core/frames

File name of __kernel_vsyscall function frame cannot be resolved but we
known that the function comes from kernel.

The frame often appears in backtraces of sleep.

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 lib/abrt.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/lib/abrt.c b/lib/abrt.c
index 39bc45d..ed33800 100644
--- a/lib/abrt.c
+++ b/lib/abrt.c
@@ -24,6 +24,8 @@
 #include "operating_system.h"
 #include "core/unwind.h"
 #include "core/stacktrace.h"
+#include "core/thread.h"
+#include "core/frame.h"
 #include "core/fingerprint.h"
 #include "python/stacktrace.h"
 #include "koops/stacktrace.h"
@@ -62,6 +64,26 @@ sr_abrt_print_report_from_dir(const char *directory,
     return true;
 }
 
+static void
+fulfill_missing_values(struct sr_core_stacktrace *core_stacktrace)
+{
+    struct sr_core_thread *thread = core_stacktrace->threads;
+    while (thread)
+    {
+        struct sr_core_frame *frame = thread->frames;
+        while (frame)
+        {
+            if (!frame->file_name && frame->function_name
+                && strcmp("__kernel_vsyscall", frame->function_name) == 0)
+            {
+                frame->file_name = sr_strdup("kernel");
+            }
+            frame = frame->next;
+        }
+        thread = thread->next;
+    }
+}
+
 static bool
 create_core_stacktrace(const char *directory, const char *gdb_output,
                        bool hash_fingerprints, char **error_message)
@@ -87,6 +109,8 @@ create_core_stacktrace(const char *directory, const char *gdb_output,
     if (!core_stacktrace)
         return false;
 
+    fulfill_missing_values(core_stacktrace);
+
 #if 0
     sr_core_fingerprint_generate(core_stacktrace,
                                  error_message);
-- 
2.4.3