[SATYR PATCH 1/2] Move public headers into separate directory

Martin Milata mmilata at redhat.com
Thu Jun 13 09:51:12 UTC 2013


- headers that we want exposed to the users have been moved to include/
- problem-type-specific headers have its own subdirectory, e.g. instead
  of koops_frame.h there is now koops/frame.h
- the rest of the sources were adapted to this change

Signed-off-by: Martin Milata <mmilata at redhat.com>
---
 Makefile.am                   |   4 +-
 configure.ac                  |   1 +
 include/Makefile.am           |  52 +++++
 include/abrt.h                |  61 ++++++
 include/core/fingerprint.h    |  53 +++++
 include/core/frame.h          | 213 +++++++++++++++++++
 include/core/stacktrace.h     | 147 +++++++++++++
 include/core/thread.h         | 141 +++++++++++++
 include/core/unwind.h         |  38 ++++
 include/deb.h                 |  46 +++++
 include/distance.h            | 122 +++++++++++
 include/frame.h               |  64 ++++++
 include/gdb/frame.h           | 468 ++++++++++++++++++++++++++++++++++++++++++
 include/gdb/sharedlib.h       | 134 ++++++++++++
 include/gdb/stacktrace.h      | 318 ++++++++++++++++++++++++++++
 include/gdb/thread.h          | 263 ++++++++++++++++++++++++
 include/java/frame.h          | 263 ++++++++++++++++++++++++
 include/java/stacktrace.h     | 146 +++++++++++++
 include/java/thread.h         | 231 +++++++++++++++++++++
 include/json.h                | 131 ++++++++++++
 include/koops/frame.h         | 233 +++++++++++++++++++++
 include/koops/stacktrace.h    | 176 ++++++++++++++++
 include/location.h            | 161 +++++++++++++++
 include/metrics.h             | 219 ++++++++++++++++++++
 include/normalize.h           |  86 ++++++++
 include/operating_system.h    |  60 ++++++
 include/python/frame.h        | 188 +++++++++++++++++
 include/python/stacktrace.h   | 119 +++++++++++
 include/report.h              |  70 +++++++
 include/report_type.h         |  44 ++++
 include/rpm.h                 | 220 ++++++++++++++++++++
 include/stacktrace.h          |  87 ++++++++
 include/strbuf.h              | 159 ++++++++++++++
 include/thread.h              |  73 +++++++
 include/utils.h               | 392 +++++++++++++++++++++++++++++++++++
 lib/Makefile.am               |  41 +---
 lib/abrt.c                    |  12 +-
 lib/abrt.h                    |  61 ------
 lib/core_fingerprint.c        |   8 +-
 lib/core_fingerprint.h        |  53 -----
 lib/core_frame.c              |   2 +-
 lib/core_frame.h              | 213 -------------------
 lib/core_stacktrace.c         |  12 +-
 lib/core_stacktrace.h         | 147 -------------
 lib/core_thread.c             |   4 +-
 lib/core_thread.h             | 141 -------------
 lib/core_unwind.c             |   2 +-
 lib/core_unwind.h             |  38 ----
 lib/core_unwind_elfutils.c    |   6 +-
 lib/core_unwind_libunwind.c   |   6 +-
 lib/deb.h                     |  46 -----
 lib/distance.c                |  20 +-
 lib/distance.h                | 122 -----------
 lib/frame.c                   |  10 +-
 lib/frame.h                   |  64 ------
 lib/gdb_frame.c               |   2 +-
 lib/gdb_frame.h               | 468 ------------------------------------------
 lib/gdb_sharedlib.c           |   2 +-
 lib/gdb_sharedlib.h           | 134 ------------
 lib/gdb_stacktrace.c          |   8 +-
 lib/gdb_stacktrace.h          | 318 ----------------------------
 lib/gdb_thread.c              |   6 +-
 lib/gdb_thread.h              | 263 ------------------------
 lib/java_frame.c              |   2 +-
 lib/java_frame.h              | 263 ------------------------
 lib/java_stacktrace.c         |   6 +-
 lib/java_stacktrace.h         | 146 -------------
 lib/java_thread.c             |   4 +-
 lib/java_thread.h             | 231 ---------------------
 lib/json.h                    | 131 ------------
 lib/koops_frame.c             |   2 +-
 lib/koops_frame.h             | 233 ---------------------
 lib/koops_stacktrace.c        |   4 +-
 lib/koops_stacktrace.h        | 176 ----------------
 lib/location.h                | 161 ---------------
 lib/metrics.c                 |   4 +-
 lib/metrics.h                 | 219 --------------------
 lib/normalize.c               |  10 +-
 lib/normalize.h               |  86 --------
 lib/operating_system.h        |  60 ------
 lib/python_frame.c            |   2 +-
 lib/python_frame.h            | 188 -----------------
 lib/python_stacktrace.c       |   4 +-
 lib/python_stacktrace.h       | 119 -----------
 lib/report.c                  |   8 +-
 lib/report.h                  |  70 -------
 lib/report_type.h             |  44 ----
 lib/rpm.h                     | 220 --------------------
 lib/stacktrace.c              |  10 +-
 lib/stacktrace.h              |  87 --------
 lib/strbuf.h                  | 159 --------------
 lib/thread.c                  |  10 +-
 lib/thread.h                  |  73 -------
 lib/utils.h                   | 392 -----------------------------------
 python/Makefile.am            |   3 +-
 python/py_cluster.c           |   4 +-
 python/py_common.c            |   2 +-
 python/py_gdb_frame.c         |   8 +-
 python/py_gdb_sharedlib.c     |   4 +-
 python/py_gdb_stacktrace.c    |  12 +-
 python/py_gdb_thread.c        |   8 +-
 python/py_java_frame.c        |   8 +-
 python/py_java_stacktrace.c   |  12 +-
 python/py_java_thread.c       |  10 +-
 python/py_koops_frame.c       |   8 +-
 python/py_koops_stacktrace.c  |  12 +-
 python/py_metrics.c           |   4 +-
 python/py_module.c            |   2 +-
 python/py_python_frame.c      |   8 +-
 python/py_python_stacktrace.c |  14 +-
 satyr.c                       |  24 +--
 tests/abrt.at                 |   4 +-
 tests/atlocal.in              |   2 +-
 tests/cluster.at              |   8 +-
 tests/core_frame.at           |  14 +-
 tests/core_stacktrace.at      |  18 +-
 tests/core_thread.at          |  14 +-
 tests/gdb_frame.at            |  40 ++--
 tests/gdb_sharedlib.at        |  14 +-
 tests/gdb_stacktrace.at       |  42 ++--
 tests/gdb_thread.at           |  38 ++--
 tests/java_frame.at           |  34 +--
 tests/java_stacktrace.at      |  34 +--
 tests/java_testcases.c        |   8 +-
 tests/java_thread.at          |  50 ++---
 tests/koops_frame.at          |  12 +-
 tests/koops_stacktrace.at     |  18 +-
 tests/metrics.at              |  10 +-
 tests/normalize.at            |  18 +-
 tests/operating_system.at     |   4 +-
 tests/rpm.at                  |  12 +-
 tests/strbuf.at               |   4 +-
 tests/utils.at                |  44 ++--
 133 files changed, 5560 insertions(+), 5541 deletions(-)
 create mode 100644 include/Makefile.am
 create mode 100644 include/abrt.h
 create mode 100644 include/core/fingerprint.h
 create mode 100644 include/core/frame.h
 create mode 100644 include/core/stacktrace.h
 create mode 100644 include/core/thread.h
 create mode 100644 include/core/unwind.h
 create mode 100644 include/deb.h
 create mode 100644 include/distance.h
 create mode 100644 include/frame.h
 create mode 100644 include/gdb/frame.h
 create mode 100644 include/gdb/sharedlib.h
 create mode 100644 include/gdb/stacktrace.h
 create mode 100644 include/gdb/thread.h
 create mode 100644 include/java/frame.h
 create mode 100644 include/java/stacktrace.h
 create mode 100644 include/java/thread.h
 create mode 100644 include/json.h
 create mode 100644 include/koops/frame.h
 create mode 100644 include/koops/stacktrace.h
 create mode 100644 include/location.h
 create mode 100644 include/metrics.h
 create mode 100644 include/normalize.h
 create mode 100644 include/operating_system.h
 create mode 100644 include/python/frame.h
 create mode 100644 include/python/stacktrace.h
 create mode 100644 include/report.h
 create mode 100644 include/report_type.h
 create mode 100644 include/rpm.h
 create mode 100644 include/stacktrace.h
 create mode 100644 include/strbuf.h
 create mode 100644 include/thread.h
 create mode 100644 include/utils.h
 delete mode 100644 lib/abrt.h
 delete mode 100644 lib/core_fingerprint.h
 delete mode 100644 lib/core_frame.h
 delete mode 100644 lib/core_stacktrace.h
 delete mode 100644 lib/core_thread.h
 delete mode 100644 lib/core_unwind.h
 delete mode 100644 lib/deb.h
 delete mode 100644 lib/distance.h
 delete mode 100644 lib/frame.h
 delete mode 100644 lib/gdb_frame.h
 delete mode 100644 lib/gdb_sharedlib.h
 delete mode 100644 lib/gdb_stacktrace.h
 delete mode 100644 lib/gdb_thread.h
 delete mode 100644 lib/java_frame.h
 delete mode 100644 lib/java_stacktrace.h
 delete mode 100644 lib/java_thread.h
 delete mode 100644 lib/json.h
 delete mode 100644 lib/koops_frame.h
 delete mode 100644 lib/koops_stacktrace.h
 delete mode 100644 lib/location.h
 delete mode 100644 lib/metrics.h
 delete mode 100644 lib/normalize.h
 delete mode 100644 lib/operating_system.h
 delete mode 100644 lib/python_frame.h
 delete mode 100644 lib/python_stacktrace.h
 delete mode 100644 lib/report.h
 delete mode 100644 lib/report_type.h
 delete mode 100644 lib/rpm.h
 delete mode 100644 lib/stacktrace.h
 delete mode 100644 lib/strbuf.h
 delete mode 100644 lib/thread.h
 delete mode 100644 lib/utils.h

diff --git a/Makefile.am b/Makefile.am
index 8ee051c..2e0c7ac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,11 @@
-SUBDIRS = lib python tests
+SUBDIRS = lib python tests include
 
 # Automatic update of libtool.
 libtool: $(LIBTOOL_DEPS)
 	$(SHELL) ./config.status libtool
 
 bin_PROGRAMS = satyr
-satyr_CFLAGS = -Wall
+satyr_CFLAGS = -Wall -Iinclude -Ilib
 satyr_SOURCES = satyr.c
 satyr_LDADD = lib/libsatyr.la
 
diff --git a/configure.ac b/configure.ac
index 0429f14..6f59125 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,7 @@ AC_CONFIG_FILES([
 	lib/Makefile
 	python/Makefile
 	tests/Makefile
+	include/Makefile
 	tests/atlocal
 ])
 
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..89e0201
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,52 @@
+mainheadersdir = $(includedir)/satyr
+mainheaders_HEADERS = \
+	abrt.h \
+	deb.h \
+	distance.h \
+	json.h \
+	location.h \
+	metrics.h \
+	normalize.h \
+	operating_system.h \
+	report.h \
+	report_type.h \
+	rpm.h \
+	strbuf.h \
+	utils.h \
+	stacktrace.h \
+	thread.h \
+	frame.h
+
+# If you know HOW can I include subdirectories without explicitly enumerating
+# them, PLEASE tell me.
+
+coreheadersdir = $(includedir)/satyr/core
+coreheaders_HEADERS = \
+	core/fingerprint.h \
+	core/frame.h \
+	core/stacktrace.h \
+	core/thread.h \
+	core/unwind.h
+
+gdbheadersdir = $(includedir)/satyr/gdb
+gdbheaders_HEADERS = \
+	gdb/frame.h \
+	gdb/sharedlib.h \
+	gdb/stacktrace.h \
+	gdb/thread.h
+
+javaheadersdir = $(includedir)/satyr/java
+javaheaders_HEADERS = \
+	java/frame.h \
+	java/thread.h \
+	java/stacktrace.h
+
+koopsheadersdir = $(includedir)/satyr/koops
+koopsheaders_HEADERS = \
+	koops/frame.h \
+	koops/stacktrace.h
+
+pythonheadersdir = $(includedir)/satyr/python
+pythonheaders_HEADERS = \
+	python/frame.h \
+	python/stacktrace.h
diff --git a/include/abrt.h b/include/abrt.h
new file mode 100644
index 0000000..5ff2a60
--- /dev/null
+++ b/include/abrt.h
@@ -0,0 +1,61 @@
+/*
+    abrt.h
+
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_ABRT_H
+#define SATYR_ABRT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+
+bool
+sr_abrt_print_report_from_dir(const char *directory,
+                              char **error_message);
+
+bool
+sr_abrt_create_core_stacktrace(const char *directory,
+                               bool hash_fingerprints,
+                               char **error_message);
+
+struct sr_rpm_package *
+sr_abrt_parse_dso_list(const char *text);
+
+struct sr_rpm_package *
+sr_abrt_rpm_packages_from_dir(const char *directory,
+                              char **error_message);
+
+struct sr_operating_system *
+sr_abrt_operating_system_from_dir(const char *directory,
+                                  char **error_message);
+
+struct sr_report *
+sr_abrt_report_from_dir(const char *directory,
+                        char **error_message);
+
+enum sr_report_type
+sr_abrt_type_from_analyzer(const char *analyzer);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/core/fingerprint.h b/include/core/fingerprint.h
new file mode 100644
index 0000000..e32f249
--- /dev/null
+++ b/include/core/fingerprint.h
@@ -0,0 +1,53 @@
+/*
+    core_fingerprint.h
+
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_CORE_FINGERPRINT_H
+#define SATYR_CORE_FINGERPRINT_H
+
+/**
+ * @file
+ * @brief Fingerprint algorithm for core stack traces.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+
+struct sr_core_stacktrace;
+struct sr_core_thread;
+
+bool
+sr_core_fingerprint_generate(struct sr_core_stacktrace *stacktrace,
+                             char **error_message);
+
+bool
+sr_core_fingerprint_generate_for_binary(struct sr_core_thread *thread,
+                                        const char *binary_path,
+                                        char **error_message);
+
+void
+sr_core_fingerprint_hash(struct sr_core_stacktrace *stacktrace);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SATYR_CORE_FINGERPRINT_H
diff --git a/include/core/frame.h b/include/core/frame.h
new file mode 100644
index 0000000..c7817db
--- /dev/null
+++ b/include/core/frame.h
@@ -0,0 +1,213 @@
+/*
+    core_frame.h
+
+    Copyright (C) 2011, 2012  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.
+*/
+#ifndef SATYR_CORE_FRAME_H
+#define SATYR_CORE_FRAME_H
+
+/**
+ * @file
+ * @brief Single frame of core stack trace thread.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <inttypes.h>
+#include <stdbool.h>
+
+struct sr_strbuf;
+struct sr_location;
+struct sr_json_value;
+
+/**
+ * @brief A function call on call stack of a core dump.
+ */
+struct sr_core_frame
+{
+    enum sr_report_type type;
+
+    /** Address of the machine code in memory.  This is useful only
+     * when build_id is not present for some reason.  For example,
+     * this might be a null dereference (address is 0) or calling a
+     * method from null class pointer (address is a low number --
+     * offset to the class).
+     *
+     * Some programs generate machine code during runtime (JavaScript
+     * engines, JVM, the Gallium llvmpipe driver).
+     */
+    uint64_t address;
+
+    /** Build id of the ELF binary.  It might be NULL if the frame
+     * does not point to memory with code.
+     */
+    char *build_id;
+    // in ELF section
+    uint64_t build_id_offset;
+    // function name
+    char *function_name;
+    // so or executable
+    char *file_name;
+    /** Fingerprint of the function contents, optionally hashed */
+    char *fingerprint;
+
+    /** Is the fingerprint hashed or raw? */
+    bool fingerprint_hashed;
+
+    /**
+     * A sibling frame residing below this one, or NULL if this is the
+     * last frame in the parent thread.
+     */
+    struct sr_core_frame *next;
+};
+
+/**
+ * Creates and initializes a new frame structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_core_frame_free().
+ */
+struct sr_core_frame *
+sr_core_frame_new();
+
+/**
+ * Initializes all members of the frame structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a frame structure placed on the
+ * stack.
+ */
+void
+sr_core_frame_init(struct sr_core_frame *frame);
+
+/**
+ * Releases the memory held by the frame. The frame siblings are not
+ * released.
+ * @param frame
+ * If the frame is NULL, no operation is performed.
+ */
+void
+sr_core_frame_free(struct sr_core_frame *frame);
+
+/**
+ * Creates a duplicate of the frame.
+ * @param frame
+ * It must be non-NULL pointer. The frame is not modified by calling
+ * this function.
+ * @param siblings
+ * Whether to duplicate also siblings referenced by frame->next.  If
+ * false, frame->next is not duplicated for the new frame, but it is
+ * set to NULL.
+ * @returns
+ * This function never returns NULL. If the returned duplicate is not
+ * shallow, it must be released by calling the function
+ * sr_gdb_frame_free().
+ */
+struct sr_core_frame *
+sr_core_frame_dup(struct sr_core_frame *frame,
+                  bool siblings);
+
+/**
+ * Checks whether the frame represents a call of function with certain
+ * function name.
+ * @param frame
+ *   A stack trace frame.
+ * @param ...
+ *   Names of executables or shared libaries that should contain the
+ *   function name.  The list needs to be terminated by NULL.  Just
+ *   NULL will cause ANY file name to match and succeed.  The name
+ *   of file is searched as a substring.
+ * @returns
+ *   True if the frame corresponds to a function with function_name,
+ *   residing in a specified executable or shared binary.
+ */
+bool
+sr_core_frame_calls_func(struct sr_core_frame *frame,
+                         const char *function_name,
+                         ...);
+
+/**
+ * Compares two frames.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_core_frame_cmp(struct sr_core_frame *frame1,
+                  struct sr_core_frame *frame2);
+
+/**
+ * Compares two frames for thread distance calculations.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_core_frame_cmp_distance(struct sr_core_frame *frame1,
+                           struct sr_core_frame *frame2);
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' frame.  If 'dest' is NULL, it
+ * returns the 'item' frame.
+ */
+struct sr_core_frame *
+sr_core_frame_append(struct sr_core_frame *dest,
+                     struct sr_core_frame *item);
+
+struct sr_core_frame *
+sr_core_frame_from_json(struct sr_json_value *root,
+                        char **error_message);
+
+/**
+ * Returns a textual representation of the frame.
+ * @param frame
+ * It must be a non-NULL pointer.  It's not modified by calling this
+ * function.
+ */
+char *
+sr_core_frame_to_json(struct sr_core_frame *frame);
+
+/**
+ * Appends textual representation of the frame to the string buffer dest.
+ */
+void
+sr_core_frame_append_to_str(struct sr_core_frame *frame,
+                            struct sr_strbuf *dest);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/core/stacktrace.h b/include/core/stacktrace.h
new file mode 100644
index 0000000..765bdec
--- /dev/null
+++ b/include/core/stacktrace.h
@@ -0,0 +1,147 @@
+/*
+    core_stacktrace.h
+
+    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.
+*/
+#ifndef SATYR_CORE_STACKTRACE_H
+#define SATYR_CORE_STACKTRACE_H
+
+/**
+ * @file
+ * @brief A stack trace of a core dump.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <inttypes.h>
+
+struct sr_core_thread;
+struct sr_location;
+struct sr_json_value;
+
+/**
+ * @brief A stack trace of a core dump.
+ */
+struct sr_core_stacktrace
+{
+    enum sr_report_type type;
+
+    /** Signal number. */
+    uint16_t signal;
+
+    char *executable;
+
+    /**
+     * @brief Thread responsible for the crash.
+     *
+     * It might be NULL if the crash thread is not detected.
+     */
+    struct sr_core_thread *crash_thread;
+
+    struct sr_core_thread *threads;
+};
+
+/**
+ * Creates and initializes a new stacktrace structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_core_stacktrace_free().
+ */
+struct sr_core_stacktrace *
+sr_core_stacktrace_new();
+
+/**
+ * Initializes all members of the stacktrace structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a stacktrace structure placed on the
+ * stack.
+ */
+void
+sr_core_stacktrace_init(struct sr_core_stacktrace *stacktrace);
+
+/**
+ * Releases the memory held by the stacktrace, its threads and frames.
+ * @param stacktrace
+ * If the stacktrace is NULL, no operation is performed.
+ */
+void
+sr_core_stacktrace_free(struct sr_core_stacktrace *stacktrace);
+
+/**
+ * Creates a duplicate of the stacktrace.
+ * @param stacktrace
+ * The stacktrace to be copied. It's not modified by this function.
+ * @returns
+ * This function never returns NULL.  The returned duplicate must be
+ * released by calling the function sr_core_stacktrace_free().
+ */
+struct sr_core_stacktrace *
+sr_core_stacktrace_dup(struct sr_core_stacktrace *stacktrace);
+
+/**
+ * Returns a number of threads in the stacktrace.
+ * @param stacktrace
+ * It's not modified by calling this function.
+ */
+int
+sr_core_stacktrace_get_thread_count( struct sr_core_stacktrace *stacktrace);
+
+struct sr_core_thread *
+sr_core_stacktrace_find_crash_thread(struct sr_core_stacktrace *stacktrace);
+
+/**
+ * @note
+ * Stacktrace can be serialized to JSON string via
+ * sr_core_stacktrace_to_json().
+ */
+struct sr_core_stacktrace *
+sr_core_stacktrace_from_json(struct sr_json_value *root,
+                             char **error_message);
+
+struct sr_core_stacktrace *
+sr_core_stacktrace_from_json_text(const char *text,
+                                  char **error_message);
+
+/**
+ * Returns brief, human-readable explanation of the stacktrace.
+ */
+char *
+sr_core_stacktrace_get_reason(struct sr_core_stacktrace *stacktrace);
+
+/**
+ * Serializes stacktrace to string.
+ * @returns
+ * Newly allocated memory containing the textual representation of the
+ * provided stacktrace.  Caller should free the memory when it's no
+ * longer needed.
+ */
+char *
+sr_core_stacktrace_to_json(struct sr_core_stacktrace *stacktrace);
+
+struct sr_core_stacktrace *
+sr_core_stacktrace_create(const char *gdb_stacktrace_text,
+                          const char *unstrip_text,
+                          const char *executable_path);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/core/thread.h b/include/core/thread.h
new file mode 100644
index 0000000..23bfd59
--- /dev/null
+++ b/include/core/thread.h
@@ -0,0 +1,141 @@
+/*
+    core_thread.h
+
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_CORE_THREAD_H
+#define SATYR_CORE_THREAD_H
+
+/**
+ * @file
+ * @brief Single thread of execution of a core stack trace.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+#include <inttypes.h>
+
+struct sr_core_frame;
+struct sr_strbuf;
+struct sr_location;
+struct sr_json_value;
+
+/**
+ * @brief A thread of execution on call stack of a core dump.
+ */
+struct sr_core_thread
+{
+    enum sr_report_type type;
+
+    /** Thread id. */
+    int64_t id;
+
+    /**
+     * Thread's frames, starting from the top of the stack.
+     */
+    struct sr_core_frame *frames;
+
+    /**
+     * A sibling thread, or NULL if this is the last thread in a
+     * stacktrace.
+     */
+    struct sr_core_thread *next;
+};
+
+/**
+ * Creates and initializes a new frame structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_core_thread_free().
+ */
+struct sr_core_thread *
+sr_core_thread_new();
+
+/**
+ * Initializes all members of the thread to default values.
+ * No memory is released, members are simply overwritten.
+ * This is useful for initializing a thread structure placed on the
+ * stack.
+ */
+void
+sr_core_thread_init(struct sr_core_thread *thread);
+
+/**
+ * Releases the memory held by the thread. The thread siblings are not
+ * released.  Thread frames are released.
+ * @param thread
+ * If thread is NULL, no operation is performed.
+ */
+void
+sr_core_thread_free(struct sr_core_thread *thread);
+
+/**
+ * Creates a duplicate of the thread.
+ * @param thread
+ * It must be non-NULL pointer. The thread is not modified by calling
+ * this function.
+ * @param siblings
+ * Whether to duplicate also siblings referenced by thread->next. If
+ * false, thread->next is not duplicated for the new frame, but it is
+ * set to NULL.
+ */
+struct sr_core_thread *
+sr_core_thread_dup(struct sr_core_thread *thread,
+                   bool siblings);
+
+/**
+ * Compares two threads. When comparing the threads, it compares also
+ * their frames, including the frame numbers.
+ * @returns
+ * Returns 0 if the threads are same.  Returns negative number if t1
+ * is found to be 'less' than t2.  Returns positive number if t1 is
+ * found to be 'greater' than t2.
+ */
+int
+sr_core_thread_cmp(struct sr_core_thread *thread1,
+                   struct sr_core_thread *thread2);
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' thread.  If 'dest' is NULL, it
+ * returns the 'item' frame.
+ */
+struct sr_core_thread *
+sr_core_thread_append(struct sr_core_thread *dest,
+                      struct sr_core_thread *item);
+
+struct sr_core_frame *
+sr_core_thread_find_exit_frame(struct sr_core_thread *thread);
+
+struct sr_core_thread *
+sr_core_thread_from_json(struct sr_json_value *root,
+                         char **error_message);
+
+char *
+sr_core_thread_to_json(struct sr_core_thread *thread,
+                       bool is_crash_thread);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/core/unwind.h b/include/core/unwind.h
new file mode 100644
index 0000000..55af5a5
--- /dev/null
+++ b/include/core/unwind.h
@@ -0,0 +1,38 @@
+/*
+    core_unwind.h
+
+    Copyright (C) 2010, 2011, 2012  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.
+*/
+#ifndef SATYR_CORE_UNWIND_H
+#define SATYR_CORE_UNWIND_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sr_core_stacktrace;
+
+struct sr_core_stacktrace *
+sr_parse_coredump(const char *coredump_filename,
+                  const char *executable_filename,
+                  char **error_message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/deb.h b/include/deb.h
new file mode 100644
index 0000000..f32e888
--- /dev/null
+++ b/include/deb.h
@@ -0,0 +1,46 @@
+/*
+    deb.h
+
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_DEB_H
+#define SATYR_DEB_H
+
+/**
+ * @file
+ * @brief Deb-related structures and utilities.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+
+struct sr_deb_package
+{
+    struct sr_deb_package *next;
+};
+
+void
+sr_deb_package_free(struct sr_deb_package *package, bool recursive);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/distance.h b/include/distance.h
new file mode 100644
index 0000000..356c715
--- /dev/null
+++ b/include/distance.h
@@ -0,0 +1,122 @@
+/*
+    distance.h
+
+    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.
+*/
+#ifndef SATYR_DISTANCE_H
+#define SATYR_DISTANCE_H
+
+/**
+ * @file
+ * @brief Distance between stack trace threads.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+
+struct sr_gdb_frame;
+struct sr_gdb_thread;
+struct sr_core_frame;
+struct sr_core_thread;
+struct sr_java_frame;
+struct sr_java_thread;
+struct sr_koops_frame;
+struct sr_koops_stacktrace;
+struct sr_python_frame;
+struct sr_python_stacktrace;
+
+enum sr_distance_type
+{
+    /* Jaro-Winkler distance:
+     *
+     * Gets number of matching function names(match_count) from both
+     * threads and number of transpositions in place(trans_count) if
+     * the transpositioned function names are not farther away than
+     * frame_count/2 - 1.  Then computes the Jaro-Winkler distance
+     * according to the formula.  NOTE: The Jaro-Winkler distance is
+     * not a metric distance as it does not satisfy the triangle
+     * inequality.  Returns a number between 0 and 1: 0 = no
+     * similarity, 1 = similar threads.
+     */
+    SR_DISTANCE_JARO_WINKLER,
+
+    /* Jaccard distance:
+     *
+     * Gives a number representing the difference of the size of the
+     * intersection and union divided by the size of the union of two
+     * threads.  Function names positions in the thread are not taken
+     * into account.  Returns a number between 0 and 1: 0 = similar
+     * threads, 1 = no similarity.
+     */
+    SR_DISTANCE_JACCARD,
+
+    /* Levenshtein distance:
+     *
+     * Computes the distance of two threads creating a matrix of
+     * distances between all the frames in each thread.  Computes a
+     * number representing how many function names need to be
+     * different in one thread to match all the function names in
+     * second thread at each respective positions or how many function
+     * names need to be different to have a match.  The number is
+     * always between 0 and n, where n is the frame count of longer
+     * thread 0 = similar threads, n = no similar function names.
+     * This is normalized to a result between 0 and 1 that is
+     * returned.
+     */
+    SR_DISTANCE_LEVENSHTEIN,
+
+    /* Damerau-Levenshtein distance:
+     *
+     * Like the Levenshtein distance, but with transpositions. NOTE:
+     * The triangle inequality does not hold.
+     */
+    SR_DISTANCE_DAMERAU_LEVENSHTEIN
+};
+
+float
+sr_distance_gdb(enum sr_distance_type distance_type,
+                struct sr_gdb_thread *thread1,
+                struct sr_gdb_thread *thread2);
+
+float
+sr_distance_core(enum sr_distance_type distance_type,
+                 struct sr_core_thread *thread1,
+                 struct sr_core_thread *thread2);
+
+float
+sr_distance_java(enum sr_distance_type distance_type,
+                 struct sr_java_thread *thread1,
+                 struct sr_java_thread *thread2);
+
+float
+sr_distance_koops(enum sr_distance_type distance_type,
+                  struct sr_koops_stacktrace *stacktrace1,
+                  struct sr_koops_stacktrace *stacktrace2);
+
+float
+sr_distance_python(enum sr_distance_type distance_type,
+                   struct sr_python_stacktrace *stacktrace1,
+                   struct sr_python_stacktrace *stacktrace2);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/frame.h b/include/frame.h
new file mode 100644
index 0000000..bb23419
--- /dev/null
+++ b/include/frame.h
@@ -0,0 +1,64 @@
+/*
+    frame.h
+
+    Copyright (C) 2013  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.
+*/
+#ifndef SATYR_FRAME_H
+#define SATYR_FRAME_H
+
+/**
+ * Functions declared here work with all frame types, i.e.
+ * * sr_core_frame
+ * * sr_python_frame
+ * * sr_koops_frame
+ * * sr_java_frame
+ * * sr_gdb_frame
+ * You may need to explicitly cast the pointer to struct sr_frame in order to
+ * avoid compiler warning.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+
+struct sr_strbuf;
+
+struct sr_frame
+{
+   enum sr_report_type type;
+};
+
+/**
+ * Return the next frame linked from this frame (corresponds to reading the
+ * "next" struct member).
+ */
+struct sr_frame *
+sr_frame_next(struct sr_frame *frame);
+
+/**
+ * Appends textual representation of the frame to buffer strbuf.
+ */
+void
+sr_frame_append_to_str(struct sr_frame *frame, struct sr_strbuf *strbuf);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/gdb/frame.h b/include/gdb/frame.h
new file mode 100644
index 0000000..756b458
--- /dev/null
+++ b/include/gdb/frame.h
@@ -0,0 +1,468 @@
+/*
+    gdb_frame.h
+
+    Copyright (C) 2010, 2011, 2012  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.
+*/
+#ifndef SATYR_GDB_FRAME_H
+#define SATYR_GDB_FRAME_H
+
+/**
+ * @file
+ * @brief Single frame of GDB stack trace thread.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+#include <stdint.h>
+
+struct sr_strbuf;
+struct sr_location;
+
+/**
+ * @brief A function call of a GDB-produced stack trace.
+ *
+ * A frame representing a function call or a signal handler on a call
+ * stack of a thread.
+ */
+struct sr_gdb_frame
+{
+    enum sr_report_type type;
+
+    /**
+     * A function name or NULL. If it's NULL, signal_handler_called is
+     * true.
+     */
+    char *function_name;
+
+    /**
+     * A function type, or NULL if it isn't present.
+     */
+    char *function_type;
+
+    /**
+     * A frame number in a thread. It does not necessarily show the
+     * actual position in the thread, as this number is set by the
+     * parser and never updated.
+     */
+    uint32_t number;
+
+    /**
+     * The name of the source file containing the function definition,
+     * or the name of the binary file (.so) with the binary code of
+     * the function, or NULL.
+     */
+    char *source_file;
+
+    /**
+     * A line number in the source file, determining the position of
+     * the function definition, or -1 when unknown.
+     */
+    uint32_t source_line;
+
+    /**
+     * Signal handler was called on this frame.
+     */
+    bool signal_handler_called;
+
+    /**
+     * The function address in the computer memory, or -1 when the
+     * address is unknown. Address is unknown when the frame
+     * represents inlined function.
+     */
+    uint64_t address;
+
+    /**
+     * A library name or NULL.
+     */
+    char *library_name;
+
+    /**
+     * A sibling frame residing below this one, or NULL if this is the
+     * last frame in the parent thread.
+     */
+    struct sr_gdb_frame *next;
+};
+
+/**
+ * Creates and initializes a new frame structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_gdb_frame_free().
+ */
+struct sr_gdb_frame *
+sr_gdb_frame_new();
+
+/**
+ * Initializes all members of the frame structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a frame structure placed on the
+ * stack.
+ */
+void
+sr_gdb_frame_init(struct sr_gdb_frame *frame);
+
+/**
+ * Releases the memory held by the frame. The frame siblings are not
+ * released.
+ * @param frame
+ * If the frame is NULL, no operation is performed.
+ */
+void
+sr_gdb_frame_free(struct sr_gdb_frame *frame);
+
+/**
+ * Creates a duplicate of the frame.
+ * @param frame
+ * It must be non-NULL pointer. The frame is not modified by calling
+ * this function.
+ * @param siblings
+ * Whether to duplicate also siblings referenced by frame->next.  If
+ * false, frame->next is not duplicated for the new frame, but it is
+ * set to NULL.
+ * @returns
+ * This function never returns NULL. The returned duplicate frame must
+ * be released by calling the function sr_gdb_frame_free().
+ */
+struct sr_gdb_frame *
+sr_gdb_frame_dup(struct sr_gdb_frame *frame,
+                 bool siblings);
+
+/**
+ * Checks whether the frame represents a call of function with certain
+ * function name.
+ * @param frame
+ *   A stack trace frame.
+ * @param ...
+ *   Names of source files or shared libaries that should contain the
+ *   function name.  The list needs to be terminated by NULL.  Just
+ *   NULL can be provided, and source file cannot be present in order
+ *   to succeed.  An empty string will cause ANY source file to match
+ *   and succeed.  The name of source file is searched as a substring.
+ * @returns
+ *   True if the frame corresponds to a function with function_name,
+ *   residing in a source file.
+ */
+bool
+sr_gdb_frame_calls_func(struct sr_gdb_frame *frame,
+                        const char *function_name,
+                        ...);
+
+/**
+ * Compares two frames.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param compare_number
+ * Indicates whether to include the frame numbers in the
+ * comparsion. If set to false, the frame numbers are ignored.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_gdb_frame_cmp(struct sr_gdb_frame *frame1,
+                 struct sr_gdb_frame *frame2,
+                 bool compare_number);
+
+/**
+ * Compares two frames, but only by their function and library names.
+ * Two unknown functions ("??") are assumed to be different and unknown
+ * library names to be the same.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_gdb_frame_cmp_distance(struct sr_gdb_frame *frame1,
+                          struct sr_gdb_frame *frame2);
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' frame.  If 'dest' is NULL, it
+ * returns the 'item' frame.
+ */
+struct sr_gdb_frame *
+sr_gdb_frame_append(struct sr_gdb_frame *dest,
+                    struct sr_gdb_frame *item);
+
+/**
+ * Appends the textual representation of the frame to the string
+ * buffer.
+ * @param frame
+ * It must be a non-NULL pointer.  It's not modified by calling this
+ * function.
+ */
+void
+sr_gdb_frame_append_to_str(struct sr_gdb_frame *frame,
+                           struct sr_strbuf *dest,
+                           bool verbose);
+
+/**
+ * If the input contains a complete frame, this function parses the
+ * frame text, returns it in a structure, and moves the input pointer
+ * after the frame.  If the input does not contain proper, complete
+ * frame, the function does not modify input and returns NULL.
+ * @returns
+ * Allocated pointer with a frame structure. The pointer should be
+ * released by sr_gdb_frame_free().
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  When this function returns NULL, the structure will contain
+ * the error line, column, and message.  The line and column members
+ * of the location are gradually increased as the parser handles the
+ * input, so the location should be initialized before calling this
+ * function to get reasonable values.
+ */
+struct sr_gdb_frame *
+sr_gdb_frame_parse(const char **input,
+                   struct sr_location *location);
+
+/**
+ * If the input contains a proper frame start section, parse the frame
+ * number, and move the input pointer after this section. Otherwise do
+ * not modify input.
+ * @returns
+ * The number of characters parsed from input. 0 if the input does not
+ * contain a frame start.
+ * @code
+ * "#1 "
+ * "#255  "
+ * @endcode
+ */
+int
+sr_gdb_frame_parse_frame_start(const char **input,
+                               uint32_t *number);
+
+/**
+ * Parses C++ operator on input.  Supports even 'operator new[]' and
+ * 'operator delete[]'.
+ * @param target
+ * The parsed operator name is appened to the string buffer provided,
+ * if an operator is found. Otherwise the string buffer is not
+ * changed.
+ * @returns
+ * The number of characters parsed from input. 0 if the input does not
+ * contain operator.
+ */
+int
+sr_gdb_frame_parseadd_operator(const char **input,
+                               struct sr_strbuf *target);
+
+/**
+ * Parses a part of function name from the input.
+ * @param target
+ * Pointer to a non-allocated pointer. This function will set the
+ * pointer to newly allocated memory containing the name chunk, if it
+ * returns positive, nonzero value.
+ * @returns
+ * The number of characters parsed from input. 0 if the input does not
+ * contain a part of function name.
+ */
+int
+sr_gdb_frame_parse_function_name_chunk(const char **input,
+                                       bool space_allowed,
+                                       char **target);
+
+/**
+ * If the input buffer contains part of function name containing
+ * braces, for example "(anonymous namespace)", parse it, append the
+ * contents to target and move input after the braces.  Otherwise do
+ * not modify the input and the target.
+ * @returns
+ * The number of characters parsed from input. 0 if the input does not
+ * contain a braced part of function name.
+ */
+int
+sr_gdb_frame_parse_function_name_braces(const char **input,
+                                        char **target);
+
+/**
+ * @returns
+ * The number of characters parsed from input. 0 if the input does not
+ * contain a template part of function name.
+ */
+int
+sr_gdb_frame_parse_function_name_template(const char **input,
+                                          char **target);
+
+/**
+ * Parses the function name, which is a part of the frame header, from
+ * the input. If the frame header contains also the function type,
+ * it's also parsed.
+ * @param function_name
+ * A pointer pointing to an uninitialized pointer. This function
+ * allocates a string and sets the pointer to it if it parses the
+ * function name from the input successfully.  The memory returned
+ * this way must be released by the caller using the function free().
+ * If this function returns true, this pointer is guaranteed to be
+ * non-NULL.
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  The line and column members of the location are gradually
+ * increased as the parser handles the input, so the location should
+ * be initialized before calling this function to get reasonable
+ * values.  When this function returns false (an error occurred), the
+ * structure will contain the error line, column, and message.
+ * @returns
+ * True if the input stream contained a function name, which has been
+ * parsed. False otherwise.
+ */
+bool
+sr_gdb_frame_parse_function_name(const char **input,
+                                 char **function_name,
+                                 char **function_type,
+                                 struct sr_location *location);
+
+/**
+ * Skips function arguments which are a part of the frame header, in
+ * the input stream.
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  The line and column members of the location are gradually
+ * increased as the parser handles the input, so the location should
+ * be initialized before calling this function to get reasonable
+ * values.  When this function returns false (an error occurred), the
+ * structure will contain the error line, column, and message.
+ */
+bool
+sr_gdb_frame_skip_function_args(const char **input,
+                                struct sr_location *location);
+
+/**
+ * If the input contains proper function call, parse the function
+ * name and store it to result, move the input pointer after whole
+ * function call, and return true. Otherwise do not modify the input
+ * and return false.
+ *
+ * If this function returns true, the caller is responsible to free
+ * the the function_name.
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  The line and column members of the location are gradually
+ * increased as the parser handles the input, so the location should
+ * be initialized before calling this function to get reasonable
+ * values.  When this function returns false (an error occurred), the
+ * structure will contain the error line, column, and message.
+ */
+bool
+sr_gdb_frame_parse_function_call(const char **input,
+                                 char **function_name,
+                                 char **function_type,
+                                 struct sr_location *location);
+
+/**
+ * If the input contains address and function call, parse them, move
+ * the input pointer after this sequence, and return true.
+ * Otherwise do not modify the input and return false.
+ *
+ * If this function returns true, the caller is responsible to free
+ * the parameter function.
+ *
+ * @code
+ * 0x000000322160e7fd in fsync ()
+ * 0x000000322222987a in write_to_temp_file (
+ * filename=0x18971b0 "/home/jfclere/.recently-used.xbel",
+ * contents=<value optimized out>, length=29917, error=0x7fff3cbe4110)
+ * @endcode
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  The line and column members of the location are gradually
+ * increased as the parser handles the input, so the location should
+ * be initialized before calling this function to get reasonable
+ * values.  When this function returns false (an error occurred), the
+ * structure will contain the error line, column, and message.
+ */
+bool
+sr_gdb_frame_parse_address_in_function(const char **input,
+                                       uint64_t *address,
+                                       char **function_name,
+                                       char **function_type,
+                                       struct sr_location *location);
+
+/**
+ * If the input contains sequence "from path/to/file:fileline" or "at
+ * path/to/file:fileline", parse it, move the input pointer after this
+ * sequence and return true. Otherwise do not modify the input and
+ * return false.
+ *
+ * The ':' followed by line number is optional. If it is not present,
+ * the fileline is set to -1.
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  The line and column members of the location are gradually
+ * increased as the parser handles the input, so the location should
+ * be initialized before calling this function to get reasonable
+ * values.  When this function returns false (an error occurred), the
+ * structure will contain the error line, column, and message.
+ */
+bool
+sr_gdb_frame_parse_file_location(const char **input,
+                                 char **file,
+                                 uint32_t *file_line,
+                                 struct sr_location *location);
+
+/**
+ * If the input contains proper frame header, this function
+ * parses the frame header text, moves the input pointer
+ * after the frame header, and returns a frame struct.
+ * If the input does not contain proper frame header, this function
+ * returns NULL and does not modify input.
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  The line and column members of the location are gradually
+ * increased as the parser handles the input, so the location should
+ * be initialized before calling this function to get reasonable
+ * values.  When this function returns false (an error occurred), the
+ * structure will contain the error line, column, and message.
+ * @returns
+ * Newly created frame struct or NULL. The returned frame struct
+ * should be released by sr_gdb_frame_free().
+ */
+struct sr_gdb_frame *
+sr_gdb_frame_parse_header(const char **input,
+                          struct sr_location *location);
+
+/**
+ * Removes first num chars from function name in the frame if it begins
+ * with the prefix.
+ */
+void
+sr_gdb_frame_remove_func_prefix(struct sr_gdb_frame *frame,
+                                const char *prefix,
+                                int num);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/gdb/sharedlib.h b/include/gdb/sharedlib.h
new file mode 100644
index 0000000..d19ee04
--- /dev/null
+++ b/include/gdb/sharedlib.h
@@ -0,0 +1,134 @@
+/*
+    gdb_sharedlib.h
+
+    Copyright (C) 2011, 2012  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.
+*/
+#ifndef SATYR_GDB_SHAREDLIB_H
+#define SATYR_GDB_SHAREDLIB_H
+
+/**
+ * @file
+ * @brief Shared library information as produced by GDB.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+#include <inttypes.h>
+
+enum
+{
+    SYMS_OK,
+    SYMS_WRONG,
+    SYMS_NOT_FOUND,
+};
+
+/**
+ * @brief A shared library memory location as reported by GDB.
+ */
+struct sr_gdb_sharedlib
+{
+    uint64_t from;
+    uint64_t to;
+    int symbols;
+    char *soname;
+    struct sr_gdb_sharedlib *next;
+};
+
+/**
+ * Creates and initializes a new sharedlib structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_gdb_sharedlib_free().
+ */
+struct sr_gdb_sharedlib *
+sr_gdb_sharedlib_new();
+
+/**
+ * Initializes all members of the sharedlib to default values.  No
+ * memory is released, members are simply overwritten.  This is useful
+ * for initializing a sharedlib structure placed on the stack.
+ */
+void
+sr_gdb_sharedlib_init(struct sr_gdb_sharedlib *sharedlib);
+
+/**
+ * Releases the memory held by the sharedlib.  Sharedlibs referenced
+ * by .next are not released.
+ * @param sharedlib
+ * If sharedlib is NULL, no operation is performed.
+ */
+void
+sr_gdb_sharedlib_free(struct sr_gdb_sharedlib *sharedlib);
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' sharedlib.  If 'dest' is NULL, it
+ * returns the 'item' sharedlib.
+ */
+struct sr_gdb_sharedlib *
+sr_gdb_sharedlib_append(struct sr_gdb_sharedlib *dest,
+                        struct sr_gdb_sharedlib *item);
+
+/**
+ * Creates a duplicate of the sharedlib structure.
+ * @param sharedlib
+ * Structure to be duplicated.
+ * @param siblings
+ * Whether to duplicate a single structure or whole list.
+ * @returns
+ * Never returns NULL. Returns the duplicated structure
+ * or the first structure in the duplicated list.
+ */
+struct sr_gdb_sharedlib *
+sr_gdb_sharedlib_dup(struct sr_gdb_sharedlib *sharedlib,
+                     bool siblings);
+
+/**
+ * Returns the number of sharedlibs in the list.
+ */
+int
+sr_gdb_sharedlib_count(struct sr_gdb_sharedlib *sharedlib);
+
+/**
+ * Finds whether the address belongs to some sharedlib
+ * from the list starting by 'first'.
+ * @returns
+ * Pointer to an existing structure or NULL if not found.
+ */
+struct sr_gdb_sharedlib *
+sr_gdb_sharedlib_find_address(struct sr_gdb_sharedlib *first,
+                              uint64_t address);
+
+/**
+ * Parses the output of GDB's 'info sharedlib' command.
+ * @param input
+ * String representing the stacktrace.
+ * @returns
+ * First element of the list of loaded libraries.
+ */
+struct sr_gdb_sharedlib *
+sr_gdb_sharedlib_parse(const char *input);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/gdb/stacktrace.h b/include/gdb/stacktrace.h
new file mode 100644
index 0000000..f7eff36
--- /dev/null
+++ b/include/gdb/stacktrace.h
@@ -0,0 +1,318 @@
+/*
+    gdb_stacktrace.h
+
+    Copyright (C) 2012  ABRT Team
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_GDB_STACKTRACE_H
+#define SATYR_GDB_STACKTRACE_H
+
+/**
+ * @file
+ * @brief Stack trace as produced by GDB.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+
+struct sr_gdb_thread;
+struct sr_gdb_frame;
+struct sr_location;
+
+/**
+ * @brief A stack trace produced by GDB.
+ *
+ * A stacktrace obtained at the time of a program crash, consisting of
+ * several threads which contains frames.
+ *
+ * This structure represents a stacktrace as produced by the GNU
+ * Debugger.
+ */
+struct sr_gdb_stacktrace
+{
+    enum sr_report_type type;
+
+    struct sr_gdb_thread *threads;
+
+    /**
+     * The frame where the crash happened according to debugger.  It
+     * might be that we can not tell to which thread this frame
+     * belongs, because some threads end with mutually
+     * indistinguishable frames.
+     */
+    struct sr_gdb_frame *crash;
+
+    /**
+     * Shared libraries loaded at the moment of crash.
+     */
+    struct sr_gdb_sharedlib *libs;
+};
+
+/**
+ * Creates and initializes a new stack trace structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_gdb_stacktrace_free().
+ */
+struct sr_gdb_stacktrace *
+sr_gdb_stacktrace_new();
+
+/**
+ * Initializes all members of the stacktrace structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a stacktrace structure placed on the
+ * stack.
+ */
+void
+sr_gdb_stacktrace_init(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Releases the memory held by the stacktrace, its threads, frames,
+ * shared libraries.
+ * @param stacktrace
+ * If the stacktrace is NULL, no operation is performed.
+ */
+void
+sr_gdb_stacktrace_free(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Creates a duplicate of a stacktrace.
+ * @param stacktrace
+ * The stacktrace to be copied. It's not modified by this function.
+ * @returns
+ * This function never returns NULL.  The returned duplicate must be
+ * released by calling the function sr_gdb_stacktrace_free().
+ */
+struct sr_gdb_stacktrace *
+sr_gdb_stacktrace_dup(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Returns a number of threads in the stacktrace.
+ * @param stacktrace
+ * It's not modified by calling this function.
+ */
+int
+sr_gdb_stacktrace_get_thread_count(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Removes all threads from the stacktrace and deletes them, except the
+ * one provided as a parameter.
+ * @param thread
+ * This function does not check whether the thread is a member of the
+ * stacktrace.  If it's not, all threads are removed from the stacktrace
+ * and then deleted.
+ */
+void
+sr_gdb_stacktrace_remove_threads_except_one(struct sr_gdb_stacktrace *stacktrace,
+                                            struct sr_gdb_thread *thread);
+
+/**
+ * Searches all threads and tries to find the one that caused the
+ * crash.  It might return NULL if the thread cannot be determined.
+ * @param stacktrace
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ */
+struct sr_gdb_thread *
+sr_gdb_stacktrace_find_crash_thread(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Remove frames from the bottom of threads in the stacktrace, until
+ * all threads have at most 'depth' frames.
+ * @param stacktrace
+ * Must be non-NULL pointer.
+ */
+void
+sr_gdb_stacktrace_limit_frame_depth(struct sr_gdb_stacktrace *stacktrace,
+                                    int depth);
+
+/**
+ * Evaluates the quality of the stacktrace. The quality is the ratio of
+ * the number of frames with function name fully known to the number
+ * of all frames.  This function does not take into account that some
+ * frames are more important than others.
+ * @param stacktrace
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * A number between 0 and 1. 0 means the lowest quality, 1 means full
+ * stacktrace is known (all function names are known).
+ */
+float
+sr_gdb_stacktrace_quality_simple(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Evaluates the quality of the stacktrace. The quality is determined
+ * depending on the ratio of frames with function name fully known to
+ * all frames.
+ * @param stacktrace
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * A number between 0 and 1. 0 means the lowest quality, 1 means full
+ * stacktrace is known.  The returned value takes into account that the
+ * thread which caused the crash is more important than the other
+ * threads, and the frames around the crash frame are more important
+ * than distant frames.
+ */
+float
+sr_gdb_stacktrace_quality_complex(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Returns textual representation of the stacktrace.
+ * @param stacktrace
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * This function never returns NULL. The caller is responsible for
+ * releasing the returned memory using function free().
+ */
+char *
+sr_gdb_stacktrace_to_text(struct sr_gdb_stacktrace *stacktrace,
+                          bool verbose);
+
+/**
+ * Analyzes the stacktrace to get the frame where a crash occurred.
+ * @param stacktrace
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * The returned value must be released by calling sr_gdb_frame_free()
+ * when it's no longer needed, because it is a deep copy of the crash
+ * frame from the stacktrace.  NULL is returned if the crash frame is
+ * not found.
+ */
+struct sr_gdb_frame *
+sr_gdb_stacktrace_get_crash_frame(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Calculates the duplication hash string of the stacktrace.
+ * @param stacktrace
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * This function never returns NULL. The caller is responsible for
+ * releasing the returned memory using function free().
+ */
+char *
+sr_gdb_stacktrace_get_duplication_hash(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Parses a textual stack trace and puts it into a structure.  If
+ * parsing fails, the input parameter is not changed and NULL is
+ * returned.
+ * @code
+ * struct sr_location location;
+ * sr_location_init(&location);
+ * char *input = "...";
+ * struct sr_gdb_stacktrace *stacktrace;
+ * stacktrace = sr_gdb_stacktrace_parse(input, location);
+ * if (!stacktrace)
+ * {
+ *   fprintf(stderr,
+ *           "Failed to parse the stacktrace.\n"
+ *           "Line %d, column %d: %s\n",
+ *           location.line,
+ *           location.column,
+ *           location.message);
+ *   exit(-1);
+ * }
+ * sr_gdb_stacktrace_free(stacktrace);
+ * @endcode
+ * @param input
+ * Pointer to the string with the stacktrace. If this function returns
+ * a non-NULL value, this pointer is modified to point after the
+ * stacktrace that was just parsed.
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  The line and column members of the location are gradually
+ * increased as the parser handles the input, so the location should
+ * be initialized by sr_location_init() before calling this function
+ * to get reasonable values.  When this function returns false (an
+ * error occurred), the structure will contain the error line, column,
+ * and message.
+ * @returns
+ * A newly allocated stacktrace structure or NULL. A stacktrace struct
+ * is returned when at least one thread was parsed from the input and
+ * no error occurred. The returned structure should be released by
+ * sr_gdb_stacktrace_free().
+ */
+struct sr_gdb_stacktrace *
+sr_gdb_stacktrace_parse(const char **input,
+                        struct sr_location *location);
+
+/**
+ * Parse stacktrace header if it is available in the stacktrace.  The
+ * header usually contains frame where the program crashed.
+ * @param input
+ * Pointer that will be moved to point behind the header if the header
+ * is successfully detected and parsed.
+ * @param frame
+ * If this function succeeds and returns true, *frame contains the
+ * crash frame that is usually a part of the header. If no frame is
+ * detected in the header, *frame is set to NULL.
+ * @code
+ * [New Thread 11919]
+ * [New Thread 11917]
+ * Core was generated by `evince file:///tmp/Factura04-05-2010.pdf'.
+ * Program terminated with signal 8, Arithmetic exception.
+ * #0  0x000000322a2362b9 in repeat (image=<value optimized out>,
+ *     mask=<value optimized out>, mask_bits=<value optimized out>)
+ *     at pixman-bits-image.c:145
+ * 145     pixman-bits-image.c: No such file or directory.
+ *         in pixman-bits-image.c
+ * @endcode
+ */
+bool
+sr_gdb_stacktrace_parse_header(const char **input,
+                               struct sr_gdb_frame **frame,
+                               struct sr_location *location);
+
+/**
+ * Set library names in all frames in the stacktrace according to the
+ * the sharedlib data.
+ */
+void
+sr_gdb_stacktrace_set_libnames(struct sr_gdb_stacktrace *stacktrace);
+
+/**
+ * Return short text representation of the crash thread.  The trace is
+ * normalized and functions without names (signal handlers) are removed.
+ * @param stacktrace
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param max_frames
+ * The maximum number of frames in the returned crash thread.
+ * Superfluous frames are not included in the output.
+ * @returns
+ * Brief text representation of the crash thread suitable for being part of a
+ * bugzilla comment. The string is allocated by the function and must be freed
+ * using the free() function.
+ */
+char *
+sr_gdb_stacktrace_to_short_text(struct sr_gdb_stacktrace *stacktrace,
+                                int max_frames);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/gdb/thread.h b/include/gdb/thread.h
new file mode 100644
index 0000000..f601b8f
--- /dev/null
+++ b/include/gdb/thread.h
@@ -0,0 +1,263 @@
+/*
+    gdb_thread.h
+
+    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.
+*/
+#ifndef SATYR_GDB_THREAD_H
+#define SATYR_GDB_THREAD_H
+
+/**
+ * @file
+ * @brief Single thread of execution of GDB stack trace.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+#include <stdint.h>
+
+struct sr_gdb_frame;
+struct sr_strbuf;
+struct sr_location;
+struct sr_gdb_sharedlib;
+
+/**
+ * @brief A thread of execution of a GDB-produced stack trace.
+ *
+ * Represents a thread containing frames.
+ */
+struct sr_gdb_thread
+{
+    enum sr_report_type type;
+
+    uint32_t number;
+
+    /**
+     * Thread's frames, starting from the top of the stack.
+     */
+    struct sr_gdb_frame *frames;
+
+    /**
+     * A sibling thread, or NULL if this is the last thread in a
+     * stacktrace.
+     */
+    struct sr_gdb_thread *next;
+};
+
+/**
+ * Creates and initializes a new frame structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_gdb_thread_free().
+ */
+struct sr_gdb_thread *
+sr_gdb_thread_new();
+
+/**
+ * Initializes all members of the thread to default values.
+ * No memory is released, members are simply overwritten.
+ * This is useful for initializing a thread structure placed on the
+ * stack.
+ */
+void
+sr_gdb_thread_init(struct sr_gdb_thread *thread);
+
+/**
+ * Releases the memory held by the thread. The thread siblings are not
+ * released.
+ * @param thread
+ * If thread is NULL, no operation is performed.
+ */
+void
+sr_gdb_thread_free(struct sr_gdb_thread *thread);
+
+/**
+ * Creates a duplicate of the thread.
+ * @param thread
+ * It must be non-NULL pointer. The thread is not modified by calling
+ * this function.
+ * @param siblings
+ * Whether to duplicate also siblings referenced by thread->next. If
+ * false, thread->next is not duplicated for the new frame, but it is
+ * set to NULL.
+ */
+struct sr_gdb_thread *
+sr_gdb_thread_dup(struct sr_gdb_thread *thread,
+                  bool siblings);
+
+/**
+ * Compares two threads. When comparing the threads, it compares also
+ * their frames, including the frame numbers.
+ * @returns
+ * Returns 0 if the threads are same.  Returns negative number if t1
+ * is found to be 'less' than t2.  Returns positive number if t1 is
+ * found to be 'greater' than t2.
+ */
+int
+sr_gdb_thread_cmp(struct sr_gdb_thread *thread1,
+                  struct sr_gdb_thread *thread2);
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' thread.
+ */
+struct sr_gdb_thread *
+sr_gdb_thread_append(struct sr_gdb_thread *dest,
+                     struct sr_gdb_thread *item);
+
+/**
+ * Counts the number of 'good' frames and the number of all frames in
+ * a thread. Good means that the function name is known (so it's not
+ * just '??').
+ * @param ok_count
+ * @param all_count
+ * Not zeroed. This function just adds the numbers to ok_count and
+ * all_count.
+ */
+void
+sr_gdb_thread_quality_counts(struct sr_gdb_thread *thread,
+                             int *ok_count,
+                             int *all_count);
+
+/**
+ * Returns the quality of the thread. The quality is the ratio of the
+ * number of frames with function name fully known to the number of
+ * all frames.  This function does not take into account that some
+ * frames are more important than others.
+ * @param thread
+ * Must be a non-NULL pointer. It's not modified in this function.
+ * @returns
+ * A number between 0 and 1. 0 means the lowest quality, 1 means full
+ * thread stacktrace is known. If the thread contains no frames, this
+ * function returns 1.
+ */
+float
+sr_gdb_thread_quality(struct sr_gdb_thread *thread);
+
+/**
+ * Removes the frame from the thread and then deletes it.
+ * @returns
+ * True if the frame was found in the thread and removed and deleted.
+ * False if the frame was not found in the thread.
+ */
+bool
+sr_gdb_thread_remove_frame(struct sr_gdb_thread *thread,
+                           struct sr_gdb_frame *frame);
+
+/**
+ * Removes all the frames from the thread that are above certain
+ * frame.
+ * @returns
+ * True if the frame was found, and all the frames that were above the
+ * frame in the thread were removed from the thread and then deleted.
+ * False if the frame was not found in the thread.
+ */
+bool
+sr_gdb_thread_remove_frames_above(struct sr_gdb_thread *thread,
+                                  struct sr_gdb_frame *frame);
+
+/**
+ * Keeps only the top n frames in the thread.
+ */
+void
+sr_gdb_thread_remove_frames_below_n(struct sr_gdb_thread *thread,
+                                    int n);
+
+/**
+ * Appends a textual representation of 'thread' to the 'str'.
+ */
+void
+sr_gdb_thread_append_to_str(struct sr_gdb_thread *thread,
+                            struct sr_strbuf *dest,
+                            bool verbose);
+
+/**
+ * If the input contains proper thread with frames, parse the thread,
+ * move the input pointer after the thread, and return a structure
+ * representing the thread.  Otherwise to not modify the input pointer
+ * and return NULL.
+ * @param location
+ * The caller must provide a pointer to struct sr_location here.  The
+ * line and column members are gradually increased as the parser
+ * handles the input, keep this in mind to get reasonable values.
+ * When this function returns NULL (an error occurred), the structure
+ * will contain the error line, column, and message.
+ * @returns
+ * NULL or newly allocated structure, which should be released by
+ * calling sr_gdb_thread_free().
+ */
+struct sr_gdb_thread *
+sr_gdb_thread_parse(const char **input,
+                    struct sr_location *location);
+
+/**
+ * If the input contains a LWP section in form of "(LWP [0-9]+), move
+ * the input pointer after this section. Otherwise do not modify
+ * input.
+ * @returns
+ * The number of characters parsed from input. 0 if the input does not
+ * contain a LWP section.
+ */
+int
+sr_gdb_thread_skip_lwp(const char **input);
+
+/**
+ * Create a thread from function and library names.
+ * @param input
+ * String containing function names and library names separated
+ * by space, one frame per line.
+ * @returns
+ * Newly allocated structure, which should be released by
+ * calling sr_gdb_thread_free().
+ */
+struct sr_gdb_thread *
+sr_gdb_thread_parse_funs(const char *input);
+
+/**
+ * Prepare a string representing thread which contains just the function
+ * and library names. This can be used to store only data necessary for
+ * comparison.
+ * @returns
+ * Newly allocated string, which should be released by
+ * calling free(). The string can be parsed by sr_gdb_thread_parse_funs().
+ */
+char *
+sr_gdb_thread_format_funs(struct sr_gdb_thread *thread);
+
+/**
+ * Set library names in all frames in the thread according to the
+ * the sharedlib data.
+ */
+void
+sr_gdb_thread_set_libnames(struct sr_gdb_thread *thread,
+                           struct sr_gdb_sharedlib *libs);
+
+/**
+ * Return copy of the thread optimized for comparison.
+ */
+struct sr_gdb_thread *
+sr_gdb_thread_get_optimized(struct sr_gdb_thread *thread,
+                            struct sr_gdb_sharedlib *libs, int max_frames);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/java/frame.h b/include/java/frame.h
new file mode 100644
index 0000000..b1be1c9
--- /dev/null
+++ b/include/java/frame.h
@@ -0,0 +1,263 @@
+/*
+    java_frame.h
+
+    Copyright (C) 2012  ABRT Team
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_JAVA_FRAME_H
+#define SATYR_JAVA_FRAME_H
+
+/**
+ * @file
+ * @brief java frame structure and related algorithms.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+#include <stdint.h>
+
+struct sr_strbuf;
+struct sr_location;
+
+struct sr_java_frame
+{
+    enum sr_report_type type;
+
+    /**
+     * FQDN - Fully qualified domain name. Can be NULL.
+     *
+     * Method:
+     *   <Namespace>.<Type>.<Function name>
+     *
+     * Exception:
+     *   <Namespace>.<Type>
+     */
+    char *name;
+
+    /**
+     * A Java file. Can be NULL.
+     * (Always NULL if frame is exception)
+     */
+    char *file_name;
+
+    /**
+     * Line no. in the Java file. 0 is used when file_line is missing.
+     * (Always 0 if frame is exception)
+     */
+    uint32_t file_line;
+
+    /**
+     * A path to jar file or class file. Can be NULL.
+     * (Always NULL if frame is exception)
+     */
+    char *class_path;
+
+    /**
+     * True if method is native.
+     * (Always false if frame is exception)
+     */
+    bool is_native;
+
+    /**
+     * True if frame is exception.
+     */
+    bool is_exception;
+
+    /**
+     * Exception message. Can be NULL.
+     * (Always NULL if frame is NOT exception).
+     */
+    char *message;
+
+    struct sr_java_frame *next;
+};
+
+/**
+ * Creates and initializes a new frame structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_java_frame_free().
+ */
+struct sr_java_frame *
+sr_java_frame_new();
+
+/**
+ * Creates and initializes a new exception in frame structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_java_frame_free().
+ */
+struct sr_java_frame *
+sr_java_frame_new_exception();
+
+/**
+ * Initializes all members of the frame structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a frame structure placed on the
+ * stack.
+ */
+void
+sr_java_frame_init(struct sr_java_frame *frame);
+
+/**
+ * Releases the memory held by the frame. The frame siblings are not
+ * released.
+ * @param frame
+ * If the frame is NULL, no operation is performed.
+ */
+void
+sr_java_frame_free(struct sr_java_frame *frame);
+
+/**
+ * Releases the memory held by the frame all its siblings.
+ * @param frame
+ * If the frame is NULL, no operation is performed.
+ */
+void
+sr_java_frame_free_full(struct sr_java_frame *frame);
+
+/**
+ * Gets a number of frame in list.
+ * @param frame
+ * If the frame is NULL, no operation is performed.
+ * @returns
+ * A number of frames.
+ */
+struct sr_java_frame *
+sr_java_frame_get_last(struct sr_java_frame *frame);
+
+/**
+ * Creates a duplicate of the frame.
+ * @param frame
+ * It must be non-NULL pointer. The frame is not modified by calling
+ * this function.
+ * @param siblings
+ * Whether to duplicate also siblings referenced by frame->next.  If
+ * false, frame->next is not duplicated for the new frame, but it is
+ * set to NULL.
+ * @returns
+ * This function never returns NULL. The returned duplicate frame must
+ * be released by calling the function sr_java_frame_free().
+ */
+struct sr_java_frame *
+sr_java_frame_dup(struct sr_java_frame *frame,
+                  bool siblings);
+
+/**
+ * Compares two frames.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_java_frame_cmp(struct sr_java_frame *frame1,
+                  struct sr_java_frame *frame2);
+
+/**
+ * Compares two frames.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_java_frame_cmp_distance(struct sr_java_frame *frame1,
+                           struct sr_java_frame *frame2);
+
+
+/**
+ * Appends the textual representation of the frame to the string
+ * buffer.
+ * @param frame
+ * It must be a non-NULL pointer.  It's not modified by calling this
+ * function.
+ */
+void
+sr_java_frame_append_to_str(struct sr_java_frame *frame,
+                            struct sr_strbuf *dest);
+
+/**
+ * If the input contains proper exception with frames, parse the exception,
+ * move the input pointer after the exception, and return a structure
+ * representing the exception. Otherwise to not modify the input pointer
+ * and return NULL.
+ * @param location
+ * The caller must provide a pointer to struct sr_location here.  The
+ * line and column members are gradually increased as the parser
+ * handles the input, keep this in mind to get reasonable values.
+ * When this function returns NULL (an error occurred), the structure
+ * will contain the error line, column, and message.
+ * @returns
+ * NULL or newly allocated structure, which should be released by
+ * calling sr_java_frame_free().
+ */
+
+struct sr_java_frame *
+sr_java_frame_parse_exception(const char **input,
+                              struct sr_location *location);
+
+/**
+ * If the input contains a complete frame, this function parses the
+ * frame text, returns it in a structure, and moves the input pointer
+ * after the frame.  If the input does not contain proper, complete
+ * frame, the function does not modify input and returns NULL.
+ * @returns
+ * Allocated pointer with a frame structure. The pointer should be
+ * released by sr_java_frame_free().
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  When this function returns NULL, the structure will contain
+ * the error line, column, and message.  The line and column members
+ * of the location are gradually increased as the parser handles the
+ * input, so the location should be initialized before calling this
+ * function to get reasonable values.
+ */
+struct sr_java_frame *
+sr_java_frame_parse(const char **input,
+                    struct sr_location *location);
+
+/**
+ * Returns a textual representation of the frame.
+ * @param frame
+ * It must be a non-NULL pointer.  It's not modified by calling this
+ * function.
+ */
+char *
+sr_java_frame_to_json(struct sr_java_frame *frame);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/java/stacktrace.h b/include/java/stacktrace.h
new file mode 100644
index 0000000..ef16918
--- /dev/null
+++ b/include/java/stacktrace.h
@@ -0,0 +1,146 @@
+/*
+    java_stacktrace.h
+
+    Copyright (C) 2012  ABRT Team
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_JAVA_STACKTRACE_H
+#define SATYR_JAVA_STACKTRACE_H
+
+/**
+ * @file
+ * @brief java stack trace structure and related algorithms.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sr_java_thread;
+struct sr_location;
+
+#include "report_type.h"
+#include <stdint.h>
+
+struct sr_java_stacktrace
+{
+    enum sr_report_type type;
+
+    /**
+     * Threads of stack trace. Always non-NULL.
+     */
+    struct sr_java_thread *threads;
+};
+
+/**
+ * Creates and initializes a new stacktrace structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_java_stacktrace_free().
+ */
+struct sr_java_stacktrace *
+sr_java_stacktrace_new();
+
+/**
+ * Initializes all members of the stacktrace structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a stacktrace structure placed on the
+ * stack.
+ */
+void
+sr_java_stacktrace_init(struct sr_java_stacktrace *stacktrace);
+
+/**
+ * Releases the memory held by the stacktrace and its frames.
+ * @param stacktrace
+ * If the stacktrace is NULL, no operation is performed.
+ */
+void
+sr_java_stacktrace_free(struct sr_java_stacktrace *stacktrace);
+
+/**
+ * Creates a duplicate of the stacktrace.
+ * @param stacktrace
+ * The stacktrace to be copied. It's not modified by this function.
+ * @returns
+ * This function never returns NULL.  The returned duplicate must be
+ * released by calling the function sr_java_stacktrace_free().
+ */
+struct sr_java_stacktrace *
+sr_java_stacktrace_dup(struct sr_java_stacktrace *stacktrace);
+
+/**
+ * Compares two stacktraces.
+ * @returns
+ * Returns 0 if the stacktraces are same.  Returns negative number if t1
+ * is found to be 'less' than t2.  Returns positive number if t1 is
+ * found to be 'greater' than t2.
+ */
+int
+sr_java_stacktrace_cmp(struct sr_java_stacktrace *stacktrace1,
+                       struct sr_java_stacktrace *stacktrace2);
+
+/**
+ * Parses a textual stack trace and puts it into a structure.  If
+ * parsing fails, the input parameter is not changed and NULL is
+ * returned.
+ * @param input
+ * Pointer to the string with the stacktrace. If this function returns
+ * a non-NULL value, this pointer is modified to point after the
+ * stacktrace that was just parsed.
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  The line and column members of the location are gradually
+ * increased as the parser handles the input, so the location should
+ * be initialized by sr_location_init() before calling this function
+ * to get reasonable values.  When this function returns false (an
+ * error occurred), the structure will contain the error line, column,
+ * and message.
+ * @returns
+ * A newly allocated stacktrace structure or NULL. A stacktrace struct
+ * is returned when at least one thread was parsed from the input and
+ * no error occurred. The returned structure should be released by
+ * sr_java_stacktrace_free().
+ */
+struct sr_java_stacktrace *
+sr_java_stacktrace_parse(const char **input,
+                         struct sr_location *location);
+
+/**
+ * Returns brief, human-readable explanation of the stacktrace.
+ */
+char *
+sr_java_stacktrace_get_reason(struct sr_java_stacktrace *stacktrace);
+
+/**
+ * Serializes stacktrace to string.
+ * @returnes
+ * Newly allocated memory containing the textual representation of the
+ * provided stacktrace.  Caller should free the memory when it's no
+ * longer needed.
+ */
+char *
+sr_java_stacktrace_to_json(struct sr_java_stacktrace *stacktrace);
+
+struct sr_java_thread *
+sr_java_find_crash_thread(struct sr_java_stacktrace *stacktrace);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/java/thread.h b/include/java/thread.h
new file mode 100644
index 0000000..0fd8c6e
--- /dev/null
+++ b/include/java/thread.h
@@ -0,0 +1,231 @@
+/*
+    java_thread.h
+
+    Copyright (C) 2012  ABRT Team
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_JAVA_THREAD_H
+#define SATYR_JAVA_THREAD_H
+
+/**
+ * @file
+ * @brief Single thread of execution of JAVA stack trace.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+#include <stdint.h>
+
+struct sr_java_frame;
+struct sr_strbuf;
+struct sr_location;
+
+/**
+ * @brief A thread of execution of a JAVA-produced stack trace.
+ *
+ * Represents a thread containing frames.
+ */
+struct sr_java_thread
+{
+    enum sr_report_type type;
+
+    /**
+     * Thread name. Can be NULL
+     */
+    char *name;
+
+    /**
+     * Thread's exceptiopn. Can be NULL
+     */
+    struct sr_java_frame *frames;
+
+    /**
+     * A sibling thread, or NULL if this is the last thread in a
+     * stacktrace.
+     */
+    struct sr_java_thread *next;
+};
+
+/**
+ * Creates and initializes a new frame structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_java_thread_free().
+ */
+struct sr_java_thread *
+sr_java_thread_new();
+
+/**
+ * Initializes all members of the thread to default values.
+ * No memory is released, members are simply overwritten.
+ * This is useful for initializing a thread structure placed on the
+ * stack.
+ */
+void
+sr_java_thread_init(struct sr_java_thread *thread);
+
+/**
+ * Releases the memory held by the thread. The thread siblings are not
+ * released.
+ * @param thread
+ * If thread is NULL, no operation is performed.
+ */
+void
+sr_java_thread_free(struct sr_java_thread *thread);
+
+/**
+ * Creates a duplicate of the thread.
+ * @param thread
+ * It must be non-NULL pointer. The thread is not modified by calling
+ * this function.
+ * @param siblings
+ * Whether to duplicate also siblings referenced by thread->next. If
+ * false, thread->next is not duplicated for the new exception, but it is
+ * set to NULL.
+ */
+struct sr_java_thread *
+sr_java_thread_dup(struct sr_java_thread *thread,
+                   bool siblings);
+
+/**
+ * Compares two threads. When comparing the threads, it compares also
+ * their frames.
+ * @returns
+ * Returns 0 if the threads are same.  Returns negative number if t1
+ * is found to be 'less' than t2.  Returns positive number if t1 is
+ * found to be 'greater' than t2.
+ */
+int
+sr_java_thread_cmp(struct sr_java_thread *thread1,
+                   struct sr_java_thread *thread2);
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' thread.
+ */
+struct sr_java_thread *
+sr_java_thread_append(struct sr_java_thread *dest,
+                      struct sr_java_thread *item);
+
+/**
+ * Counts the number of 'good' frames and the number of all frames in
+ * a thread. Good means that the function name is known (so it's not
+ * just '??').
+ * @param ok_count
+ * @param all_count
+ * Not zeroed. This function just adds the numbers to ok_count and
+ * all_count.
+ */
+void
+sr_java_thread_quality_counts(struct sr_java_thread *thread,
+                              int *ok_count,
+                              int *all_count);
+
+/**
+ * Returns the quality of the thread. The quality is the ratio of the
+ * number of frames with function name fully known to the number of
+ * all frames.  This function does not take into account that some
+ * frames are more important than others.
+ * @param thread
+ * Must be a non-NULL pointer. It's not modified in this function.
+ * @returns
+ * A number between 0 and 1. 0 means the lowest quality, 1 means full
+ * thread stacktrace is known. If the thread contains no frames, this
+ * function returns 1.
+ */
+float
+sr_java_thread_quality(struct sr_java_thread *thread);
+
+/**
+ * Removes the frame from the thread and then deletes it.
+ * @returns
+ * True if the frame was found in the thread and removed and deleted.
+ * False if the frame was not found in the thread.
+ */
+bool
+sr_java_thread_remove_frame(struct sr_java_thread *thread,
+                            struct sr_java_frame *frame);
+
+/**
+ * Removes all the frames from the thread that are above certain
+ * frame.
+ * @returns
+ * True if the frame was found, and all the frames that were above the
+ * frame in the thread were removed from the thread and then deleted.
+ * False if the frame was not found in the thread.
+ */
+bool
+sr_java_thread_remove_frames_above(struct sr_java_thread *thread,
+                                   struct sr_java_frame *frame);
+
+/**
+ * Keeps only the top n frames in the thread.
+ */
+void
+sr_java_thread_remove_frames_below_n(struct sr_java_thread *thread,
+                                     int n);
+
+/**
+ * Appends a textual representation of 'thread' to the 'str'.
+ */
+void
+sr_java_thread_append_to_str(struct sr_java_thread *thread,
+                             struct sr_strbuf *dest);
+
+/**
+ * If the input contains proper thread with frames, parse the thread,
+ * move the input pointer after the thread, and return a structure
+ * representing the thread.  Otherwise to not modify the input pointer
+ * and return NULL.
+ * @param location
+ * The caller must provide a pointer to struct sr_location here.  The
+ * line and column members are gradually increased as the parser
+ * handles the input, keep this in mind to get reasonable values.
+ * When this function returns NULL (an error occurred), the structure
+ * will contain the error line, column, and message.
+ * @returns
+ * NULL or newly allocated structure, which should be released by
+ * calling sr_java_thread_free().
+ */
+struct sr_java_thread *
+sr_java_thread_parse(const char **input,
+                     struct sr_location *location);
+
+/**
+ * Prepare a string representing thread which contains just the function
+ * and library names. This can be used to store only data necessary for
+ * comparison.
+ * @returns
+ * Newly allocated string, which should be released by
+ * calling free().
+ */
+char *
+sr_java_thread_format_funs(struct sr_java_thread *thread);
+
+char *
+sr_java_thread_to_json(struct sr_java_thread *thread);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/json.h b/include/json.h
new file mode 100644
index 0000000..99370df
--- /dev/null
+++ b/include/json.h
@@ -0,0 +1,131 @@
+/*
+    json.h
+
+    Copyright (C) 2012  James McLaughlin et al.
+    https://github.com/udp/json-parser
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    2. Redistributions in binary form must reproduce the above
+    copyright notice, this list of conditions and the following
+    disclaimer in the documentation and/or other materials provided
+    with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+    PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR
+    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+    AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+    POSSIBILITY OF SUCH DAMAGE.
+*/
+#ifndef SATYR_JSON_H
+#define SATYR_JSON_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sr_location;
+struct sr_strbuf;
+
+struct sr_json_settings
+{
+   unsigned long max_memory;
+   int settings;
+};
+
+#define SR_JSON_RELAXED_COMMAS 1
+
+enum sr_json_type
+{
+   SR_JSON_NONE,
+   SR_JSON_OBJECT,
+   SR_JSON_ARRAY,
+   SR_JSON_INTEGER,
+   SR_JSON_DOUBLE,
+   SR_JSON_STRING,
+   SR_JSON_BOOLEAN,
+   SR_JSON_NULL
+};
+
+extern const struct sr_json_value
+sr_json_value_none;
+
+struct sr_json_value
+{
+   struct sr_json_value *parent;
+   enum sr_json_type type;
+
+   union
+   {
+      int boolean;
+      long long integer;
+      double dbl;
+
+      struct
+      {
+         unsigned length;
+
+          /* null terminated */
+         char *ptr;
+      } string;
+
+      struct
+      {
+         unsigned length;
+
+         struct
+         {
+            char *name;
+            struct sr_json_value *value;
+         } *values;
+
+      } object;
+
+      struct
+      {
+         unsigned length;
+         struct sr_json_value **values;
+      } array;
+   } u;
+
+   union
+   {
+      struct sr_json_value *next_alloc;
+      void *object_mem;
+   } _reserved;
+};
+
+struct sr_json_value *
+sr_json_parse(const char *json);
+
+struct sr_json_value *
+sr_json_parse_ex(struct sr_json_settings *settings,
+                 const char *json,
+                 struct sr_location *location);
+
+void
+sr_json_value_free(struct sr_json_value *value);
+
+char *
+sr_json_escape(const char *text);
+
+struct sr_strbuf*
+sr_json_append_escaped(struct sr_strbuf *strbuf, const char *str);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/include/koops/frame.h b/include/koops/frame.h
new file mode 100644
index 0000000..269fb73
--- /dev/null
+++ b/include/koops/frame.h
@@ -0,0 +1,233 @@
+/*
+    koops_frame.h
+
+    Copyright (C) 2012  ABRT Team
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_KOOPS_FRAME_H
+#define SATYR_KOOPS_FRAME_H
+
+/**
+ * @file
+ * @brief Kernel oops stack frame.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+#include <stdint.h>
+
+struct sr_strbuf;
+
+/**
+ * @brief Kernel oops stack frame.
+ */
+struct sr_koops_frame
+{
+    enum sr_report_type type;
+
+    /**
+     * Address of the function in memory.  It is set to 0 when the
+     * address is not available.  In such a case, function_name is
+     * available.
+     */
+    uint64_t address;
+
+    /**
+     * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=arch/x86/kernel/dumpstack.c
+     * printk_address(unsigned long address, int reliable)
+     */
+    bool reliable;
+
+    /**
+     * Might be NULL.  If it is null, address must be set.
+     */
+    char *function_name;
+
+    uint64_t function_offset;
+
+    uint64_t function_length;
+
+    /**
+     * Might be NULL.
+     */
+    char *module_name;
+
+    /**
+     * It is set to 0 when the address is not available.
+     */
+    uint64_t from_address;
+
+    /**
+     * Might be NULL.
+     */
+    char *from_function_name;
+
+    uint64_t from_function_offset;
+
+    uint64_t from_function_length;
+
+    /**
+     * Might be NULL.
+     */
+    char *from_module_name;
+
+    struct sr_koops_frame *next;
+};
+
+/**
+ * Creates and initializes a new frame structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_koops_frame_free().
+ */
+struct sr_koops_frame *
+sr_koops_frame_new();
+
+/**
+ * Initializes all members of the frame structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a frame structure placed on the
+ * stack.
+ */
+void
+sr_koops_frame_init(struct sr_koops_frame *frame);
+
+/**
+ * Releases the memory held by the frame. The frame siblings are not
+ * released.
+ * @param frame
+ * If the frame is NULL, no operation is performed.
+ */
+void
+sr_koops_frame_free(struct sr_koops_frame *frame);
+
+/**
+ * Creates a duplicate of the frame.
+ * @param frame
+ * It must be non-NULL pointer. The frame is not modified by calling
+ * this function.
+ * @param siblings
+ * Whether to duplicate also siblings referenced by frame->next.  If
+ * false, frame->next is not duplicated for the new frame, but it is
+ * set to NULL.
+ * @returns
+ * This function never returns NULL. The returned duplicate frame must
+ * be released by calling the function sr_koops_frame_free().
+ */
+struct sr_koops_frame *
+sr_koops_frame_dup(struct sr_koops_frame *frame,
+                   bool siblings);
+
+/**
+ * Compares two frames.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_koops_frame_cmp(struct sr_koops_frame *frame1,
+                   struct sr_koops_frame *frame2);
+
+/**
+ * Compares two frames.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_koops_frame_cmp_distance(struct sr_koops_frame *frame1,
+                            struct sr_koops_frame *frame2);
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' frame.  If 'dest' is NULL, it
+ * returns the 'item' frame.
+ */
+struct sr_koops_frame *
+sr_koops_frame_append(struct sr_koops_frame *dest,
+                      struct sr_koops_frame *item);
+
+struct sr_koops_frame *
+sr_koops_frame_prepend(struct sr_koops_frame *dest,
+                       struct sr_koops_frame *item);
+
+struct sr_koops_frame *
+sr_koops_frame_parse(const char **input);
+
+/**
+ * Timestamp may be present in the oops lines.
+ * @example
+ * [123456.654321]
+ * [   65.470000]
+ */
+bool
+sr_koops_skip_timestamp(const char **input);
+
+bool
+sr_koops_parse_address(const char **input, uint64_t *address);
+
+bool
+sr_koops_parse_module_name(const char **input,
+                           char **module_name);
+
+bool
+sr_koops_parse_function(const char **input,
+                        char **function_name,
+                        uint64_t *function_offset,
+                        uint64_t *function_length,
+                        char **module_name);
+
+/**
+ * Returns a textual representation of the frame.
+ * @param frame
+ * It must be a non-NULL pointer.  It's not modified by calling this
+ * function.
+ */
+char *
+sr_koops_frame_to_json(struct sr_koops_frame *frame);
+
+/**
+ * Appends textual representation of the frame to the string buffer dest.
+ */
+void
+sr_koops_frame_append_to_str(struct sr_koops_frame *frame,
+                             struct sr_strbuf *dest);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/koops/stacktrace.h b/include/koops/stacktrace.h
new file mode 100644
index 0000000..580610f
--- /dev/null
+++ b/include/koops/stacktrace.h
@@ -0,0 +1,176 @@
+/*
+    koops_stacktrace.h
+
+    Copyright (C) 2012  ABRT Team
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_KOOPS_STACKTRACE_H
+#define SATYR_KOOPS_STACKTRACE_H
+
+/**
+ * @file
+ * @brief Kernel oops stack trace structure and related algorithms.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+#include <inttypes.h>
+#include <stddef.h>
+
+struct sr_location;
+
+struct sr_koops_stacktrace
+{
+    enum sr_report_type type;
+
+    /**
+     * @brief Version of the kernel.
+     */
+    char *version;
+
+    /**
+     * http://www.mjmwired.net/kernel/Documentation/oops-tracing.txt
+     */
+
+    bool taint_module_proprietary;
+    bool taint_module_out_of_tree;
+    bool taint_forced_module;
+    bool taint_forced_removal;
+    bool taint_smp_unsafe;
+    /** A machine check exception has been raised. */
+    bool taint_mce;
+    /** A process has been found in a bad page state.*/
+    bool taint_page_release;
+    bool taint_userspace;
+    bool taint_died_recently;
+    bool taint_acpi_overridden;
+    bool taint_warning;
+    bool taint_staging_driver;
+    bool taint_firmware_workaround;
+
+    /**
+     * @brief List of loaded modules.
+     *
+     * It might be NULL as it is sometimes not included in a
+     * kerneloops.
+     */
+    char **modules;
+
+    /**
+     * @brief Call trace.  It might be NULL as it is not mandatory.
+     */
+    struct sr_koops_frame *frames;
+};
+
+/**
+ * Creates and initializes a new stack trace structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_koops_stacktrace_free().
+ */
+struct sr_koops_stacktrace *
+sr_koops_stacktrace_new();
+
+/**
+ * Initializes all members of the stacktrace structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a stacktrace structure placed on the
+ * stack.
+ */
+void
+sr_koops_stacktrace_init(struct sr_koops_stacktrace *stacktrace);
+
+/**
+ * Releases the memory held by the stacktrace.
+ * @param stacktrace
+ * If the stacktrace is NULL, no operation is performed.
+ */
+void
+sr_koops_stacktrace_free(struct sr_koops_stacktrace *stacktrace);
+
+/**
+ * Creates a duplicate of a stacktrace.
+ * @param stacktrace
+ * The stacktrace to be copied. It's not modified by this function.
+ * @returns
+ * This function never returns NULL.  The returned duplicate must be
+ * released by calling the function sr_koops_stacktrace_free().
+ */
+struct sr_koops_stacktrace *
+sr_koops_stacktrace_dup(struct sr_koops_stacktrace *stacktrace);
+
+/**
+ * Removes the frame from the stack trace and then deletes it.
+ * @returns
+ * True if the frame was found in the thread and removed and deleted.
+ * False if the frame was not found in the thread.
+ */
+bool
+sr_koops_stacktrace_remove_frame(struct sr_koops_stacktrace *stacktrace,
+                                 struct sr_koops_frame *frame);
+
+/**
+ * Parses a textual kernel oops and puts it into a structure.  If
+ * parsing fails, the input parameter is not changed and NULL is
+ * returned.
+ * @param input
+ * Pointer to the string with the kernel oops. If this function
+ * returns a non-NULL value, the input pointer is modified to point
+ * after the stacktrace that was just parsed.
+ */
+struct sr_koops_stacktrace *
+sr_koops_stacktrace_parse(const char **input,
+                          struct sr_location *location);
+
+char **
+sr_koops_stacktrace_parse_modules(const char **input);
+
+/**
+ * Returns brief, human-readable explanation of the stacktrace.
+ */
+char *
+sr_koops_stacktrace_get_reason(struct sr_koops_stacktrace *stacktrace);
+
+/**
+ * Serializes stacktrace to string.
+ * @returns
+ * Newly allocated memory containing the textual representation of the
+ * provided stacktrace.  Caller should free the memory when it's no
+ * longer needed.
+ */
+char *
+sr_koops_stacktrace_to_json(struct sr_koops_stacktrace *stacktrace);
+
+
+/* TODO: this needs to go in a _private_ header and should not be exported */
+struct sr_taint_flag
+{
+    char letter;
+    size_t member_offset;
+    char *name;
+};
+extern struct sr_taint_flag sr_flags[];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/location.h b/include/location.h
new file mode 100644
index 0000000..94a85c6
--- /dev/null
+++ b/include/location.h
@@ -0,0 +1,161 @@
+/*
+    location.h
+
+    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.
+*/
+#ifndef SATYR_LOCATION_H
+#define SATYR_LOCATION_H
+
+/**
+ * @file
+ * @brief Parser location in input file.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+
+/**
+ * @brief A location of a parser in the input stream.
+ *
+ * A location in the stacktrace file with an attached message.
+ * It's used for error reporting: the line and the column points to
+ * the place where a parser error occurred, and the message explains
+ * what the parser expected and didn't find on that place.
+ */
+struct sr_location
+{
+    /** Starts from 1. */
+    int line;
+    /** Starts from 0. */
+    int column;
+    /**
+     * Error message related to the line and column.  Do not release
+     * the memory this pointer points to.
+     */
+    const char *message;
+};
+
+/**
+ * Initializes all members of the location struct to their default
+ * values.  No memory is allocated or released by this function.
+ */
+void
+sr_location_init(struct sr_location *location);
+
+/**
+ * Compare two locations.
+ * @param location1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param location2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param compare_messages
+ * Indicates whether to compare messages in the locations as well.
+ * @returns
+ * Returns 0 if the locations are same.  Returns negative number if
+ * location1 is found to be 'less' than location2.  Returns positive
+ * number if location1 is found to be 'greater' than location2.
+ *
+ * 'Less' and 'greater' take lines into account first. If a location1
+ * line is lower than location2 line, location1 is considered 'less'
+ * than location2. If the lines are the same, columns are compared.
+ * When compare_messages is true and lines and columns are equal, the
+ * locations' messages are compared according to the lexicographical
+ * order.
+ */
+int
+sr_location_cmp(struct sr_location *location1,
+                struct sr_location *location2,
+                bool compare_messages);
+
+/**
+ * Creates a string representation of location.
+ * User must delete the returned string using free().
+ */
+char *
+sr_location_to_string(struct sr_location *location);
+
+/**
+ * Adds a line and a column to specific location.
+ * @note
+ * If the line is not 1 (meaning the first line), the column in the
+ * location structure is overwritten by the provided add_column value.
+ * Otherwise the add_column value is added to the column member of the
+ * location structure.
+ * @param location
+ * The structure to be modified. It must be a valid pointer.
+ * @param add_line
+ * Starts from 1. It means that if add_line is 1, the line member of the
+ * location structure is not changed.
+ * @param add_column
+ * Starts from 0.
+ */
+void
+sr_location_add(struct sr_location *location,
+                int add_line,
+                int add_column);
+
+/**
+ * Adds a line column pair to another line column pair.
+ * @note
+ * If the add_line is not 1 (meaning the frist line), the column is
+ * overwritten by the provided add_column value.  Otherwise the
+ * add_column value is added to the column.
+ * @param add_line
+ * Starts from 1. It means that if add_line is 1, the line is not
+ * changed.
+ * @param add_column
+ * Starts from 0.
+ */
+void
+sr_location_add_ext(int *line,
+                    int *column,
+                    int add_line,
+                    int add_column);
+
+/**
+ * Updates the line and column of the location by moving "after" the
+ * char c. If c is a newline character, the line number is increased
+ * and the column is set to 0. Otherwise the column is increased by 1.
+ */
+void
+sr_location_eat_char(struct sr_location *location,
+                     char c);
+
+/**
+ * Updates the line and the column by moving "after" the char c. If c
+ * is a newline character, the line number is increased and the column
+ * is set to 0. Otherwise the column is increased.
+ * @param line
+ * Must be a valid pointer.
+ * @param column
+ * Must be a valid pointer.
+ */
+void
+sr_location_eat_char_ext(int *line,
+                         int *column,
+                         char c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/metrics.h b/include/metrics.h
new file mode 100644
index 0000000..9deddf4
--- /dev/null
+++ b/include/metrics.h
@@ -0,0 +1,219 @@
+/*
+    metrics.h
+
+    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.
+*/
+#ifndef SATYR_METRICS_H
+#define SATYR_METRICS_H
+
+/**
+ * @file
+ * @brief Distance between stack trace threads.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+
+struct sr_gdb_frame;
+struct sr_gdb_thread;
+
+/* Jaro-Winkler distance:
+ *
+ * Gets number of matching function names(match_count) from both
+ * threads and number of transpositions in place(trans_count) if the
+ * transpositioned function names are not farther away than
+ * frame_count/2 - 1.  Then computes the Jaro-Winkler distance
+ * according to the formula.  NOTE: The Jaro-Winkler distance is not a
+ * metric distance as it does not satisfy the triangle inequality.
+ * Returns a number between 0 and 1: 0 = no similarity, 1 = similar
+ * threads
+ */
+float
+sr_gdb_thread_jarowinkler_distance(struct sr_gdb_thread *thread1,
+                                   struct sr_gdb_thread *thread2);
+
+
+/* Jaccard distance:
+ *
+ * Gives a number representing the difference of the size of the
+ * intersection and union divided by the size of the union of two
+ * threads.  Function names positions in the thread are not taken into
+ * account.  Returns a number between 0 and 1: 0 = similar threads, 1
+ * = no similarity
+ */
+float
+sr_gdb_thread_jaccard_distance(struct sr_gdb_thread *thread1,
+                               struct sr_gdb_thread *thread2);
+
+
+/* Levenshtein distance:
+ *
+ * Computes the distance of two threads creating a matrix of distances
+ * between all the frames in each thread.  Returns a number
+ * representing how many function names need to be different in one
+ * thread to match all the function names in second thread at each
+ * respective positions or how many function names need to be
+ * different/transpositioned to have a match if the transposition
+ * argument is enabled.  NOTE: With transpositions enabled the
+ * triangle inequality does not hold.  The distance is always between
+ * 0 and n, where n is the frame count of longer thread 0 = similar
+ * threads, n = no similar function names
+ */
+int
+sr_gdb_thread_levenshtein_distance(struct sr_gdb_thread *thread1,
+                                   struct sr_gdb_thread *thread2,
+                                   bool transposition);
+
+/* Levenshtein distance returned with transpositions enabled and
+ * returned in interval [0, 1].
+ */
+float
+sr_gdb_thread_levenshtein_distance_f(struct sr_gdb_thread *thread1,
+                                     struct sr_gdb_thread *thread2);
+
+typedef int (*sr_gdb_frame_cmp_type)(struct sr_gdb_frame*,
+                                     struct sr_gdb_frame*);
+
+/* Following three functions are equivalent to the three above except
+ * that they take frame comparison function as an argument argument
+ */
+float
+sr_gdb_thread_jarowinkler_distance_custom(struct sr_gdb_thread *thread1,
+                                          struct sr_gdb_thread *thread2,
+                                          sr_gdb_frame_cmp_type compare_func);
+
+float
+sr_gdb_thread_jaccard_distance_custom(struct sr_gdb_thread *thread1,
+                                      struct sr_gdb_thread *thread2,
+                                      sr_gdb_frame_cmp_type compare_func);
+
+int
+sr_gdb_thread_levenshtein_distance_custom(struct sr_gdb_thread *thread1,
+                                          struct sr_gdb_thread *thread2,
+                                          bool transposition,
+                                          sr_gdb_frame_cmp_type compare_func);
+
+/**
+ * @brief A distance matrix of stack trace threads.
+ *
+ * The distances are stored in a m-by-n two-dimensional array, where
+ * only entries (i, j) where i < j are actually stored.
+ */
+struct sr_distances
+{
+    int m;
+    int n;
+    float *distances;
+};
+
+/**
+ * Creates and initializes a new distances structure.
+ * @param m
+ * Number of rows.
+ * @param n
+ * Number of columns.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_distances_free().
+ */
+struct sr_distances *
+sr_distances_new(int m, int n);
+
+/**
+ * Creates a duplicate of the distances structure.
+ * @param distances
+ * It must be non-NULL pointer. The structure is not modified by calling
+ * this function.
+ * @returns
+ * This function never returns NULL.
+ */
+struct sr_distances *
+sr_distances_dup(struct sr_distances *distances);
+
+/**
+ * Releases the memory held by the distances structure.
+ * @param distances
+ * If the distances is NULL, no operation is performed.
+ */
+void
+sr_distances_free(struct sr_distances *distances);
+
+/**
+ * Gets the entry (i, j) from the distance matrix.
+ * @param distances
+ * It must be non-NULL pointer.
+ * @param i
+ * Row in the matrix.
+ * @param j
+ * Column in the matrix.
+ * @returns
+ * For entries (i, i) zero distance is returned and values returned for
+ * entries (i, j) and (j, i) are the same.
+ */
+float
+sr_distances_get_distance(struct sr_distances *distances, int i, int j);
+
+/**
+ * Sets the entry (i, j) from the distance matrix.
+ * @param distances
+ * It must be non-NULL pointer.
+ * @param i
+ * Row in the matrix.
+ * @param j
+ * Column in the matrix.
+ * @param d
+ * Distance.
+ */
+void
+sr_distances_set_distance(struct sr_distances *distances,
+                          int i,
+                          int j,
+                          float d);
+
+/**
+ * A function which compares two threads.
+ */
+typedef float (*sr_dist_thread_type)(struct sr_gdb_thread *,
+                                     struct sr_gdb_thread *);
+
+/**
+ * Creates a distances structure by comparing threads.
+ * @param threads
+ * Array of threads. They are not modified by calling this function.
+ * @param m
+ * Compare first m threads from the array with other threads.
+ * @param n
+ * Number of threads in the passed array.
+ * @param dist_func
+ * Distance function which will be used to compare the threads. It's assumed to
+ * be symmetric and return zero distance for equal threads.
+ * @returns
+ * This function never returns NULL.
+ */
+struct sr_distances *
+sr_gdb_threads_compare(struct sr_gdb_thread **threads,
+                       int m, int n,
+                       sr_dist_thread_type dist_func);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/normalize.h b/include/normalize.h
new file mode 100644
index 0000000..c93595f
--- /dev/null
+++ b/include/normalize.h
@@ -0,0 +1,86 @@
+/*
+    normalize.h
+
+    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.
+*/
+#ifndef SATYR_NORMALIZE_H
+#define SATYR_NORMALIZE_H
+
+/**
+ * @file
+ * @brief Normalization of stack traces.
+ *
+ * Normalization changes stack traces with respect to similarity by
+ * removing unnecessary differences.  Normalized stack traces can be
+ * used to compute clusters and similarity of stack traces.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sr_gdb_frame;
+struct sr_gdb_thread;
+struct sr_gdb_stacktrace;
+struct sr_core_frame;
+struct sr_core_thread;
+struct sr_core_stacktrace;
+struct sr_koops_stacktrace;
+
+void
+sr_normalize_gdb_thread(struct sr_gdb_thread *thread);
+
+void
+sr_normalize_gdb_stacktrace(struct sr_gdb_stacktrace *stacktrace);
+
+void
+sr_normalize_koops_stacktrace(struct sr_koops_stacktrace *stacktrace);
+
+// TODO: move to gdb_stacktrace.h
+/**
+ * Checks whether the thread it contains some function used to exit
+ * application.  If a frame with the function is found, it is
+ * returned.  If there are multiple frames with abort function, the
+ * lowest one is returned.
+ * @returns
+ * Returns NULL if such a frame is not found.
+ */
+struct sr_gdb_frame *
+sr_glibc_thread_find_exit_frame(struct sr_gdb_thread *thread);
+
+// TODO: move to metrics.h
+/**
+ * Renames unknown function names ("??") that are between the same
+ * function names to be treated as similar in later comparison.
+ * Leaves unpair unknown functions unchanged.
+ */
+void
+sr_normalize_gdb_paired_unknown_function_names(struct sr_gdb_thread *thread1,
+                                               struct sr_gdb_thread *thread2);
+
+// TODO: merge into normalization or something else
+/**
+ * Remove frames which are not interesting in comparison with other threads.
+ */
+void
+sr_gdb_normalize_optimize_thread(struct sr_gdb_thread *thread);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/operating_system.h b/include/operating_system.h
new file mode 100644
index 0000000..a2f5e2c
--- /dev/null
+++ b/include/operating_system.h
@@ -0,0 +1,60 @@
+/*
+    operating_system.h
+
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_OPERATING_SYSTEM_H
+#define SATYR_OPERATING_SYSTEM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <stdbool.h>
+
+struct sr_operating_system
+{
+    char *name;
+    char *version;
+    char *architecture;
+    /* Uptime in seconds. */
+    uint64_t uptime;
+};
+
+struct sr_operating_system *
+sr_operating_system_new();
+
+void
+sr_operating_system_init(struct sr_operating_system *operating_system);
+
+void
+sr_operating_system_free(struct sr_operating_system *operating_system);
+
+char *
+sr_operating_system_to_json(struct sr_operating_system *operating_system);
+
+bool
+sr_operating_system_parse_etc_system_release(const char *etc_system_release,
+                                             char **name,
+                                             char **version);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/python/frame.h b/include/python/frame.h
new file mode 100644
index 0000000..a02a6b1
--- /dev/null
+++ b/include/python/frame.h
@@ -0,0 +1,188 @@
+/*
+    python_frame.h
+
+    Copyright (C) 2012  ABRT Team
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_PYTHON_FRAME_H
+#define SATYR_PYTHON_FRAME_H
+
+/**
+ * @file
+ * @brief Python frame structure and related algorithms.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdbool.h>
+#include <stdint.h>
+
+struct sr_location;
+struct sr_strbuf;
+
+struct sr_python_frame
+{
+    enum sr_report_type type;
+
+    bool special_file;
+
+    char *file_name;
+
+    uint32_t file_line;
+
+    bool special_function;
+
+    char *function_name;
+
+    char *line_contents;
+
+    struct sr_python_frame *next;
+};
+
+/**
+ * Creates and initializes a new frame structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_python_frame_free().
+ */
+struct sr_python_frame *
+sr_python_frame_new();
+
+/**
+ * Initializes all members of the frame structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a frame structure placed on the
+ * stack.
+ */
+void
+sr_python_frame_init(struct sr_python_frame *frame);
+
+/**
+ * Releases the memory held by the frame. The frame siblings are not
+ * released.
+ * @param frame
+ * If the frame is NULL, no operation is performed.
+ */
+void
+sr_python_frame_free(struct sr_python_frame *frame);
+
+/**
+ * Creates a duplicate of the frame.
+ * @param frame
+ * It must be non-NULL pointer. The frame is not modified by calling
+ * this function.
+ * @param siblings
+ * Whether to duplicate also siblings referenced by frame->next.  If
+ * false, frame->next is not duplicated for the new frame, but it is
+ * set to NULL.
+ * @returns
+ * This function never returns NULL. The returned duplicate frame must
+ * be released by calling the function sr_python_frame_free().
+ */
+struct sr_python_frame *
+sr_python_frame_dup(struct sr_python_frame *frame,
+                    bool siblings);
+
+/**
+ * Compares two python frames.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_python_frame_cmp(struct sr_python_frame *frame1,
+                    struct sr_python_frame *frame2);
+
+/**
+ * Compares two python frames.
+ * @param frame1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param frame2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the frames are same.  Returns negative number if
+ * frame1 is found to be 'less' than frame2.  Returns positive number
+ * if frame1 is found to be 'greater' than frame2.
+ */
+int
+sr_python_frame_cmp_distance(struct sr_python_frame *frame1,
+                             struct sr_python_frame *frame2);
+
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' frame.  If 'dest' is NULL, it
+ * returns the 'item' frame.
+ */
+struct sr_python_frame *
+sr_python_frame_append(struct sr_python_frame *dest,
+                       struct sr_python_frame *item);
+
+/**
+ * If the input contains a complete frame, this function parses the
+ * frame text, returns it in a structure, and moves the input pointer
+ * after the frame.  If the input does not contain proper, complete
+ * frame, the function does not modify input and returns NULL.
+ * @returns
+ * Allocated pointer with a frame structure. The pointer should be
+ * released by sr_python_frame_free().
+ * @param location
+ * The caller must provide a pointer to an instance of sr_location
+ * here.  When this function returns NULL, the structure will contain
+ * the error line, column, and message.  The line and column members
+ * of the location are gradually increased as the parser handles the
+ * input, so the location should be initialized before calling this
+ * function to get reasonable values.
+ */
+struct sr_python_frame *
+sr_python_frame_parse(const char **input,
+                      struct sr_location *location);
+
+/**
+ * Returns a textual representation of the frame.
+ * @param frame
+ * It must be a non-NULL pointer.  It's not modified by calling this
+ * function.
+ */
+char *
+sr_python_frame_to_json(struct sr_python_frame *frame);
+
+/**
+ * Appends textual representation of the frame to the string buffer dest.
+ */
+void
+sr_python_frame_append_to_str(struct sr_python_frame *frame,
+                              struct sr_strbuf *dest);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/python/stacktrace.h b/include/python/stacktrace.h
new file mode 100644
index 0000000..22c9f02
--- /dev/null
+++ b/include/python/stacktrace.h
@@ -0,0 +1,119 @@
+/*
+    python_stacktrace.h
+
+    Copyright (C) 2012  ABRT Team
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_PYTHON_STACKTRACE_H
+#define SATYR_PYTHON_STACKTRACE_H
+
+/**
+ * @file
+ * @brief Python stack trace structure and related algorithms.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <stdint.h>
+
+struct sr_python_frame;
+struct sr_location;
+
+struct sr_python_stacktrace
+{
+    enum sr_report_type type;
+
+    /* Exception class name. */
+    char *exception_name;
+
+    struct sr_python_frame *frames;
+};
+
+/**
+ * Creates and initializes a new stacktrace structure.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_python_stacktrace_free().
+ */
+struct sr_python_stacktrace *
+sr_python_stacktrace_new();
+
+/**
+ * Initializes all members of the stacktrace structure to their default
+ * values.  No memory is released, members are simply overwritten.
+ * This is useful for initializing a stacktrace structure placed on the
+ * stack.
+ */
+void
+sr_python_stacktrace_init(struct sr_python_stacktrace *stacktrace);
+
+/**
+ * Releases the memory held by the stacktrace and its frames.
+ * @param stacktrace
+ * If the stacktrace is NULL, no operation is performed.
+ */
+void
+sr_python_stacktrace_free(struct sr_python_stacktrace *stacktrace);
+
+/**
+ * Creates a duplicate of the stacktrace.
+ * @param stacktrace
+ * The stacktrace to be copied. It's not modified by this function.
+ * @returns
+ * This function never returns NULL.  The returned duplicate must be
+ * released by calling the function sr_python_stacktrace_free().
+ */
+struct sr_python_stacktrace *
+sr_python_stacktrace_dup(struct sr_python_stacktrace *stacktrace);
+
+/**
+ * Parses a textual Python stacktrace and puts it into a structure.
+ * If parsing fails, the input parameter is not changed and NULL is
+ * returned.
+ * @param input
+ * Pointer to the string with the Python stack trace. If this function
+ * returns a non-NULL value, the input pointer is modified to point
+ * after the stacktrace that was just parsed.
+ */
+struct sr_python_stacktrace *
+sr_python_stacktrace_parse(const char **input,
+                           struct sr_location *location);
+
+/**
+ * Returns brief, human-readable explanation of the stacktrace.
+ */
+char *
+sr_python_stacktrace_get_reason(struct sr_python_stacktrace *stacktrace);
+
+/**
+ * Serializes stacktrace to string.
+ * @returnes
+ * Newly allocated memory containing the textual representation of the
+ * provided stacktrace.  Caller should free the memory when it's no
+ * longer needed.
+ */
+char *
+sr_python_stacktrace_to_json(struct sr_python_stacktrace *stacktrace);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/report.h b/include/report.h
new file mode 100644
index 0000000..634c6e5
--- /dev/null
+++ b/include/report.h
@@ -0,0 +1,70 @@
+/*
+    report.h
+
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_REPORT_H
+#define SATYR_REPORT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+#include <inttypes.h>
+#include <stdbool.h>
+
+struct sr_report
+{
+    uint32_t report_version;
+    enum sr_report_type report_type;
+
+    char *reporter_name;
+    char *reporter_version;
+
+    // This is the real user id, not effective.
+    bool user_root;
+    bool user_local;
+
+    struct sr_operating_system *operating_system;
+
+    char *component_name;
+    struct sr_rpm_package *rpm_packages;
+
+    struct sr_python_stacktrace *python_stacktrace;
+    struct sr_koops_stacktrace *koops_stacktrace;
+    struct sr_core_stacktrace *core_stacktrace;
+    struct sr_java_stacktrace *java_stacktrace;
+};
+
+struct sr_report *
+sr_report_new();
+
+void
+sr_report_init(struct sr_report *report);
+
+void
+sr_report_free(struct sr_report *report);
+
+char *
+sr_report_to_json(struct sr_report *report);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/report_type.h b/include/report_type.h
new file mode 100644
index 0000000..8df81a2
--- /dev/null
+++ b/include/report_type.h
@@ -0,0 +1,44 @@
+/*
+    report_type.h
+
+    Copyright (C) 2013  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.
+*/
+#ifndef SATYR_REPORT_TYPE_H
+#define SATYR_REPORT_TYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum sr_report_type
+{
+    SR_REPORT_INVALID = 0,
+    SR_REPORT_CORE,
+    SR_REPORT_PYTHON,
+    SR_REPORT_KERNELOOPS,
+    SR_REPORT_JAVA,
+    SR_REPORT_GDB,
+
+    /* Keep this the last entry. */
+    SR_REPORT_NUM
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/rpm.h b/include/rpm.h
new file mode 100644
index 0000000..41f81e7
--- /dev/null
+++ b/include/rpm.h
@@ -0,0 +1,220 @@
+/*
+    rpm.h
+
+    Copyright (C) 2012  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.
+*/
+#ifndef SATYR_RPM_H
+#define SATYR_RPM_H
+
+/**
+ * @file
+ * @brief RPM-related structures and utilities.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+#include <inttypes.h>
+
+/* XXX: Should be moved to separated header once we support more package types.
+ */
+enum sr_package_role
+{
+    /* The role the package has in the problem is either unknown or
+     * irrelevant.
+     */
+    SR_ROLE_UNKNOWN = 0,
+
+    /* The packages contains the executable or script the execution of which
+     * caused the problem to manifest.
+     */
+    SR_ROLE_AFFECTED
+};
+
+struct sr_rpm_consistency
+{
+    char *path;
+    bool owner_changed;
+    bool group_changed;
+    bool mode_changed;
+    bool md5_mismatch;
+    bool size_changed;
+    bool major_number_changed;
+    bool minor_number_changed;
+    bool symlink_changed;
+    bool modification_time_changed;
+    struct sr_rpm_consistency *next;
+};
+
+struct sr_rpm_package
+{
+    char *name;
+    uint32_t epoch;
+    char *version;
+    char *release;
+    char *architecture;
+    uint64_t install_time;
+    enum sr_package_role role;
+    struct sr_rpm_consistency *consistency;
+    struct sr_rpm_package *next;
+};
+
+struct sr_rpm_package *
+sr_rpm_package_new();
+
+void
+sr_rpm_package_init(struct sr_rpm_package *package);
+
+void
+sr_rpm_package_free(struct sr_rpm_package *package,
+                    bool recursive);
+
+/**
+ * Compares two packages.
+ * @param package1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param package2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the packages are same.  Returns negative number if
+ * package1 is found to be 'less' than package2.  Returns positive
+ * number if package1 is found to be 'greater' than package2.
+ */
+int
+sr_rpm_package_cmp(struct sr_rpm_package *package1,
+                   struct sr_rpm_package *package2);
+
+/**
+ * Compares two packages by their name, version and release.
+ * @param package1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param package2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the packages are same.  Returns negative number if
+ * package1 is found to be 'less' than package2.  Returns positive
+ * number if package1 is found to be 'greater' than package2.
+ */
+int
+sr_rpm_package_cmp_nvr(struct sr_rpm_package *package1,
+                       struct sr_rpm_package *package2);
+
+/**
+ * Compares two packages by their name, epoch, version, release and
+ * architecture.
+ * @param package1
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @param package2
+ * It must be non-NULL pointer. It's not modified by calling this
+ * function.
+ * @returns
+ * Returns 0 if the packages are same.  Returns negative number if
+ * package1 is found to be 'less' than package2.  Returns positive
+ * number if package1 is found to be 'greater' than package2.
+ */
+int
+sr_rpm_package_cmp_nevra(struct sr_rpm_package *package1,
+                         struct sr_rpm_package *package2);
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' package.  If 'dest' is NULL, it
+ * returns the 'item' package.
+ */
+struct sr_rpm_package *
+sr_rpm_package_append(struct sr_rpm_package *dest,
+                      struct sr_rpm_package *item);
+
+/**
+ * Returns the number of packages in the list.
+ */
+int
+sr_rpm_package_count(struct sr_rpm_package *packages);
+
+struct sr_rpm_package *
+sr_rpm_package_sort(struct sr_rpm_package *packages);
+
+struct sr_rpm_package *
+sr_rpm_package_uniq(struct sr_rpm_package *packages);
+
+struct sr_rpm_package *
+sr_rpm_package_get_by_name(const char *name,
+                           char **error_message);
+
+struct sr_rpm_package *
+sr_rpm_package_get_by_path(const char *path,
+                           char **error_message);
+
+char *
+sr_rpm_package_to_json(struct sr_rpm_package *package,
+                       bool recursive);
+
+bool
+sr_rpm_package_parse_nvr(const char *text,
+                         char **name,
+                         char **version,
+                         char **release);
+
+bool
+sr_rpm_package_parse_nevra(const char *text,
+                           char **name,
+                           uint32_t *epoch,
+                           char **version,
+                           char **release,
+                           char **architecture);
+
+struct sr_rpm_consistency *
+sr_rpm_consistency_new();
+
+void
+sr_rpm_consistency_init(struct sr_rpm_consistency *consistency);
+
+void
+sr_rpm_consistency_free(struct sr_rpm_consistency *consistency,
+                        bool recursive);
+
+int
+sr_rpm_consistency_cmp(struct sr_rpm_consistency *consistency1,
+                       struct sr_rpm_consistency *consistency2);
+
+int
+sr_rpm_consistency_cmp_recursive(struct sr_rpm_consistency *consistency1,
+                                 struct sr_rpm_consistency *consistency2);
+
+/**
+ * Appends 'item' at the end of the list 'dest'.
+ * @returns
+ * This function returns the 'dest' consistency info.  If 'dest' is
+ * NULL, it returns the 'item' consistency info.
+ */
+struct sr_rpm_consistency *
+sr_rpm_consistency_append(struct sr_rpm_consistency *dest,
+                          struct sr_rpm_consistency *item);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/stacktrace.h b/include/stacktrace.h
new file mode 100644
index 0000000..c611e73
--- /dev/null
+++ b/include/stacktrace.h
@@ -0,0 +1,87 @@
+/*
+    stacktrace.h
+
+    Copyright (C) 2013  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.
+*/
+#ifndef SATYR_STACKTRACE_H
+#define SATYR_STACKTRACE_H
+
+/**
+ * Functions declared here work with all stacktrace types:
+ * * sr_core_stacktrace
+ * * sr_python_stacktrace
+ * * sr_koops_stacktrace
+ * * sr_java_stacktrace
+ * * sr_gdb_stacktrace
+ * You may need to explicitly cast the pointer to struct sr_stacktrace in order
+ * to avoid compiler warning.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+
+struct sr_stacktrace
+{
+    enum sr_report_type type;
+};
+
+/**
+ * Parses the stacktrace pointed to by input. You need to provide the correct
+ * stacktrace type in the first parameter.
+ */
+struct sr_stacktrace *
+sr_stacktrace_parse(enum sr_report_type type, const char **input, char **error_message);
+
+/**
+ * Returns short textual representation of given stacktrace. At most max_frames
+ * are printed. Caller needs to free the result using free() afterwards.
+ */
+char *
+sr_stacktrace_to_short_text(struct sr_stacktrace *stacktrace, int max_frames);
+
+/**
+ * Returns the thread structure that (probably) caused the crash.
+ */
+struct sr_thread *
+sr_stacktrace_find_crash_thread(struct sr_stacktrace *stacktrace);
+
+/**
+ * Convert stacktrace to json and return it as text.
+ */
+char *
+sr_stacktrace_to_json(struct sr_stacktrace *stacktrace);
+
+/**
+ * Returns brief, human-readable explanation of the stacktrace.
+ */
+char *
+sr_stacktrace_get_reason(struct sr_stacktrace *stacktrace);
+
+/**
+ * Releases all the memory associated with the stacktrace pointer.
+ */
+void
+sr_stacktrace_free(struct sr_stacktrace *stacktrace);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/strbuf.h b/include/strbuf.h
new file mode 100644
index 0000000..1dfd864
--- /dev/null
+++ b/include/strbuf.h
@@ -0,0 +1,159 @@
+/*
+    strbuf.h - a string buffer
+
+    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.
+*/
+#ifndef SATYR_STRBUF_H
+#define SATYR_STRBUF_H
+
+/**
+ * @file
+ * @brief A string buffer structure and related algorithms.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdarg.h>
+#include "utils.h"
+
+/**
+ * @brief A resizable string buffer.
+ */
+struct sr_strbuf
+{
+    /**
+     * Size of the allocated buffer. Always > 0.
+     */
+    int alloc;
+    /**
+     * Length of the string, without the ending \0.
+     */
+    int len;
+    char *buf;
+};
+
+/**
+ * Creates and initializes a new string buffer.
+ * @returns
+ * It never returns NULL. The returned pointer must be released by
+ * calling the function sr_strbuf_free().
+ */
+struct sr_strbuf *
+sr_strbuf_new();
+
+/**
+ * Initializes all members of the strbuf structure to their default
+ * values. No memory is released, members are simply overritten. This
+ * is useful for initializing a strbuf structure placed on the stack.
+ */
+void
+sr_strbuf_init(struct sr_strbuf *strbuf);
+
+/**
+ * Releases the memory held by the string buffer.
+ * @param strbuf
+ * If the strbuf is NULL, no operation is performed.
+ */
+void
+sr_strbuf_free(struct sr_strbuf *strbuf);
+
+/**
+ * Releases the strbuf, but not the internal buffer.  The internal
+ * string buffer is returned.  Caller is responsible to release the
+ * returned memory using free().
+ */
+char *
+sr_strbuf_free_nobuf(struct sr_strbuf *strbuf);
+
+/**
+ * The string content is set to an empty string, erasing any previous
+ * content and leaving its length at 0 characters.
+ */
+void
+sr_strbuf_clear(struct sr_strbuf *strbuf);
+
+/**
+ * Ensures that the buffer can be extended by num characters
+ * without dealing with malloc/realloc.
+ */
+void
+sr_strbuf_grow(struct sr_strbuf *strbuf, int num);
+
+/**
+ * The current content of the string buffer is extended by adding a
+ * character c at its end.
+ */
+struct sr_strbuf *
+sr_strbuf_append_char(struct sr_strbuf *strbuf,
+                      char c);
+
+/**
+ * The current content of the string buffer is extended by adding a
+ * string str at its end.
+ */
+struct sr_strbuf *
+sr_strbuf_append_str(struct sr_strbuf *strbuf,
+                     const char *str);
+
+/**
+ * The current content of the string buffer is extended by inserting a
+ * string str at its beginning.
+ */
+struct sr_strbuf *
+sr_strbuf_prepend_str(struct sr_strbuf *strbuf,
+                      const char *str);
+
+/**
+ * The current content of the string buffer is extended by adding a
+ * sequence of data formatted as the format argument specifies.
+ */
+struct sr_strbuf *
+sr_strbuf_append_strf(struct sr_strbuf *strbuf,
+                      const char *format, ...) __sr_printf(2, 3);
+
+/**
+ * Same as sr_strbuf_append_strf except that va_list is used instead of
+ * variable number of arguments.
+ */
+struct sr_strbuf *
+sr_strbuf_append_strfv(struct sr_strbuf *strbuf,
+                       const char *format, va_list p);
+
+/**
+ * The current content of the string buffer is extended by inserting a
+ * sequence of data formatted as the format argument specifies at the
+ * buffer beginning.
+ */
+struct sr_strbuf *
+sr_strbuf_prepend_strf(struct sr_strbuf *strbuf,
+                       const char *format, ...) __sr_printf(2, 3);
+
+/**
+ * Same as sr_strbuf_prepend_strf except that va_list is used instead of
+ * variable number of arguments.
+ */
+struct sr_strbuf *
+sr_strbuf_prepend_strfv(struct sr_strbuf *strbuf,
+                        const char *format, va_list p);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/thread.h b/include/thread.h
new file mode 100644
index 0000000..7694bd3
--- /dev/null
+++ b/include/thread.h
@@ -0,0 +1,73 @@
+/*
+    thread.h
+
+    Copyright (C) 2013  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.
+*/
+#ifndef SATYR_THREAD_H
+#define SATYR_THREAD_H
+
+/**
+ * Functions declared here work with all thread types. Furthermore, for problem
+ * types that do not have a thread structure because they are always
+ * single-threaded, you can pass the stacktrace structure directly:
+ * * sr_core_thread
+ * * sr_python_stacktrace
+ * * sr_koops_stacktrace
+ * * sr_java_thread
+ * * sr_gdb_thread
+ * You may need to explicitly cast the pointer to struct sr_thread in order to
+ * avoid compiler warning.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "report_type.h"
+
+struct sr_thread
+{
+   enum sr_report_type type;
+};
+
+/**
+ * Returns pointer to the first frame in thread.
+ */
+struct sr_frame *
+sr_thread_frames(struct sr_thread *thread);
+
+/**
+ * Compares two threads. Returns 0 on equality. Threads of distinct type are
+ * always unequal.
+ */
+int
+sr_thread_frame_count(struct sr_thread *thread);
+
+int
+sr_thread_cmp(struct sr_thread *t1, struct sr_thread *t2);
+
+/**
+ * Next thread in linked list (same as reading the "next" structure member).
+ */
+struct sr_thread *
+sr_thread_next(struct sr_thread *thread);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/utils.h b/include/utils.h
new file mode 100644
index 0000000..9dff404
--- /dev/null
+++ b/include/utils.h
@@ -0,0 +1,392 @@
+/*
+    utils.h
+
+    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.
+*/
+#ifndef SATYR_UTILS_H
+#define SATYR_UTILS_H
+
+/**
+ * @file
+ * @brief Various utility functions, macros and variables that do not
+ * fit elsewhere.
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <assert.h>
+
+#define SR_lower "abcdefghijklmnopqrstuvwxyz"
+#define SR_upper "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+#define SR_alpha SR_lower SR_upper
+#define SR_space " \t\r\n\v\f"
+#define SR_digit "0123456789"
+#define SR_alnum SR_alpha SR_digit
+
+#define __sr_printf(x, y) __attribute__((format(printf, (x), (y))))
+
+#define SR_DISPATCH(type, method) \
+    (assert((type > SR_REPORT_INVALID) && (type) < SR_REPORT_NUM && dtable[type].method), \
+    dtable[type].method)
+
+#define SR_NEXT_FUNC(name, abstract_t, concrete_t)       \
+    static abstract_t *                                  \
+    name(abstract_t *node)                               \
+    {                                                    \
+        return (abstract_t *)((concrete_t *)node)->next; \
+    }                                                    \
+
+/**
+ * Debugging output to stdout while parsing.
+ * Default value is false.
+ */
+extern bool
+sr_debug_parser;
+
+/**
+ * Never returns NULL.
+ */
+void *
+sr_malloc(size_t size);
+
+/**
+ * Never returns NULL.
+ */
+void *
+sr_mallocz(size_t size);
+
+/**
+ * Never returns NULL.
+ */
+void *
+sr_realloc(void *ptr, size_t size);
+
+/**
+ * Never returns NULL.
+ */
+char *
+sr_vasprintf(const char *format, va_list p);
+
+/**
+ * Never returns NULL.
+ */
+char *
+sr_asprintf(const char *format, ...) __sr_printf(1, 2);
+
+/**
+ * Never returns NULL.
+ */
+char *
+sr_strdup(const char *s);
+
+/**
+ * Never returns NULL.
+ */
+char *
+sr_strndup(const char *s, size_t n);
+
+void
+sr_struniq(char **strings, size_t *size);
+
+/**
+ * A strcmp() variant that works also with NULL parameters.  NULL is
+ * considered to be less than a string.
+ */
+int
+sr_strcmp0(const char *s1, const char *s2);
+
+/**
+ * A strchr() variant providing line and column in the string s
+ * indicating where the char c was found.
+ * @param line
+ * Starts from 1.  Its value is valid only when this function does not
+ * return NULL.
+ * @param column
+ * Starts from 0.  Its value is valid only when this function does not
+ * return NULL.
+ */
+char *
+sr_strchr_location(const char *s, int c, int *line, int *column);
+
+/**
+ * A strstr() variant providing line and column of the haystick
+ * indicating where the needle was found.
+ * @param line
+ * Starts from 1.  Its value is valid only when this function does not
+ * return NULL.
+ * @param column
+ * Starts from 0.  Its value is valid only when this function does not
+ * return NULL.
+ */
+char *
+sr_strstr_location(const char *haystack,
+                   const char *needle,
+                   int *line,
+                   int *column);
+
+/**
+ * A strspn() variant providing line and column of the string s which
+ * corresponds to the returned length.
+ * @param line
+ * Starts from 1.
+ * @param column
+ * Starts from 0.
+ */
+size_t
+sr_strspn_location(const char *s,
+                   const char *accept,
+                   int *line,
+                   int *column);
+
+/**
+ * Loads file contents to a string.
+ * @returns
+ * File contents. If file opening/reading fails, NULL is returned.
+ */
+char *
+sr_file_to_string(const char *filename,
+                  char **error_message);
+
+bool
+sr_string_to_file(const char *filename,
+                  char *contents,
+                  char **error_message);
+
+/**
+ * If the input contains character c in the current positon, move the
+ * input pointer after the character, and return true. Otherwise do
+ * not modify the input and return false.
+ */
+bool
+sr_skip_char(const char **input, char c);
+
+/**
+ * If the input contains one of allowed characters, move
+ * the input pointer after that character, and return true.
+ * Otherwise do not modify the input and return false.
+ */
+bool
+sr_skip_char_limited(const char **input, const char *allowed);
+
+/**
+ * If the input contains one of allowed characters, store
+ * the character to the result, move the input pointer after
+ * that character, and return true. Otherwise do not modify
+ * the input and return false.
+ */
+bool
+sr_parse_char_limited(const char **input,
+                      const char *allowed,
+                      char *result);
+
+/**
+ * If the input contains the character c one or more times, update it
+ * so that the characters are skipped. Returns the number of characters
+ * skipped, thus zero if **input does not contain c.
+ */
+int
+sr_skip_char_sequence(const char **input, char c);
+
+/**
+ * If the input contains one or more characters from string chars,
+ * move the input pointer after the sequence. Otherwise do not modify
+ * the input.
+ * @returns
+ * The number of characters skipped.
+ */
+int
+sr_skip_char_span(const char **input, const char *chars);
+
+/**
+ * If the input contains one or more characters from string chars,
+ * move the input pointer after the sequence. Otherwise do not modify
+ * the input.
+ * @param line
+ * Starts from 1. Corresponds to the returned number.
+ * @param column
+ * Starts from 0. Corresponds to the returned number.
+ * @returns
+ * The number of characters skipped.
+ */
+int
+sr_skip_char_span_location(const char **input,
+                           const char *chars,
+                           int *line,
+                           int *column);
+
+/**
+ * If the input contains one or more characters from string accept,
+ * create a string from this sequence and store it to the result, move
+ * the input pointer after the sequence, and return the lenght of the
+ * sequence.  Otherwise do not modify the input and return 0.
+ *
+ * If this function returns nonzero value, the caller is responsible
+ * to free the result.
+ */
+int
+sr_parse_char_span(const char **input,
+                   const char *accept,
+                   char **result);
+
+/**
+ * If the input contains one or more characters which are not
+ * presentin string reject, move the input pointer after the
+ * sequence. Otherwise do not modify the input.
+ * @returns
+ * The number of characters skipped.
+ */
+int
+sr_skip_char_cspan(const char **input, const char *reject);
+
+/**
+ * If the input contains characters which are not in string reject,
+ * create a string from this sequence and store it to the result,
+ * move the input pointer after the sequence, and return true.
+ * Otherwise do not modify the input and return false.
+ *
+ * If this function returns true, the caller is responsible to
+ * free the result.
+ */
+bool
+sr_parse_char_cspan(const char **input,
+                    const char *reject,
+                    char **result);
+
+/**
+ * If the input contains the string, move the input pointer after
+ * the sequence. Otherwise do not modify the input.
+ * @returns
+ * Number of characters skipped. 0 if the input does not contain the
+ * string.
+ */
+int
+sr_skip_string(const char **input, const char *string);
+
+/**
+ * If the input contains the string, copy the string to result,
+ * move the input pointer after the string, and return true.
+ * Otherwise do not modify the input and return false.
+ *
+ * If this function returns true, the caller is responsible to free
+ * the result.
+ */
+bool
+sr_parse_string(const char **input, const char *string, char **result);
+
+/**
+ * If the input contains digit 0-9, return it as a character
+ * and move the input pointer after it. Otherwise return
+ * '\0' and do not modify the input.
+ */
+char
+sr_parse_digit(const char **input);
+
+/**
+ * If the input contains [0-9]+, move the input pointer
+ * after the number.
+ * @returns
+ * The number of skipped characters. 0 if input does not start with a
+ * digit.
+ */
+int
+sr_skip_uint(const char **input);
+
+/**
+ * If the input contains [0-9]+, parse it, move the input pointer
+ * after the number.
+ * @returns
+ * Number of parsed characters. 0 if input does not contain a number.
+ */
+int
+sr_parse_uint32(const char **input, uint32_t *result);
+
+int
+sr_parse_uint64(const char **input, uint64_t *result);
+
+/**
+ * If the input contains [0-9a-f]+, move the input pointer
+ * after that.
+ * @returns
+ * The number of characters processed from input. 0 if the input does
+ * not contain a hexadecimal number.
+ */
+int
+sr_skip_hexadecimal_uint(const char **input);
+
+/**
+ * If the input contains 0x[0-9a-f]+, move the input pointer
+ * after that.
+ * @returns
+ * The number of characters processed from input. 0 if the input does
+ * not contain a hexadecimal number.
+ */
+int
+sr_skip_hexadecimal_0xuint(const char **input);
+
+/**
+ * If the input contains [0-9a-f]+, parse the number, and move the
+ * input pointer after it.  Otherwise do not modify the input.
+ * @returns
+ * The number of characters read from input. 0 if the input does not
+ * contain a hexadecimal number.
+ */
+int
+sr_parse_hexadecimal_uint64(const char **input, uint64_t *result);
+
+/**
+ * If the input contains 0x[0-9a-f]+, parse the number, and move the
+ * input pointer after it.  Otherwise do not modify the input.
+ * @returns
+ * The number of characters read from input. 0 if the input does not
+ * contain a hexadecimal number.
+ */
+int
+sr_parse_hexadecimal_0xuint64(const char **input, uint64_t *result);
+
+char *
+sr_skip_whitespace(const char *s);
+
+char *
+sr_skip_non_whitespace(const char *s);
+
+/**
+ * Emit a string of hex representation of bytes.
+ */
+char *
+sr_bin2hex(char *dst, const char *str, int count);
+
+char *
+sr_indent(const char *input, int spaces);
+
+char *
+sr_indent_except_first_line(const char *input, int spaces);
+
+char *
+sr_build_path(const char *first_element, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1024e32..c3ed3ea 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,46 +1,11 @@
-pkginclude_HEADERS = \
-	abrt.h \
+lib_LTLIBRARIES = libsatyr.la
+libsatyr_la_SOURCES = \
 	callgraph.h \
 	cluster.h \
-	core_fingerprint.h \
-	core_frame.h \
-	core_stacktrace.h \
-	core_thread.h \
-	core_unwind.h \
-	deb.h \
 	disasm.h \
-	distance.h \
 	elves.h \
-	gdb_frame.h \
-	gdb_sharedlib.h \
-	gdb_stacktrace.h \
-	gdb_thread.h \
-	java_frame.h \
-	java_thread.h \
-	java_stacktrace.h \
-	json.h \
-	koops_frame.h \
-	koops_stacktrace.h \
-	location.h \
-	metrics.h \
-	normalize.h \
-	operating_system.h \
-	python_frame.h \
-	python_stacktrace.h \
-	report.h \
-	rpm.h \
 	sha1.h \
-	strbuf.h \
 	unstrip.h \
-	utils.h \
-	stacktrace.h \
-	thread.h \
-	frame.h \
-	report_type.h
-
-lib_LTLIBRARIES = libsatyr.la
-libsatyr_la_SOURCES = \
-	$(pkginclude_HEADERS) \
 	abrt.c \
 	callgraph.c \
 	cluster.c \
@@ -81,7 +46,7 @@ libsatyr_la_SOURCES = \
 	thread.c \
 	frame.c
 
-libsatyr_la_CFLAGS = -Wall -std=gnu99 -D_GNU_SOURCE $(GLIB_CFLAGS)
+libsatyr_la_CFLAGS = -Wall -std=gnu99 -D_GNU_SOURCE -I$(top_srcdir)/include $(GLIB_CFLAGS)
 libsatyr_la_LDFLAGS = -version-info 1:0:0 $(GLIB_LIBS)
 
 if HAVE_LIBOPCODES
diff --git a/lib/abrt.c b/lib/abrt.c
index 87d25b2..b3e4a3a 100644
--- a/lib/abrt.c
+++ b/lib/abrt.c
@@ -22,12 +22,12 @@
 #include "utils.h"
 #include "rpm.h"
 #include "operating_system.h"
-#include "core_unwind.h"
-#include "core_stacktrace.h"
-#include "core_fingerprint.h"
-#include "python_stacktrace.h"
-#include "koops_stacktrace.h"
-#include "java_stacktrace.h"
+#include "core/unwind.h"
+#include "core/stacktrace.h"
+#include "core/fingerprint.h"
+#include "python/stacktrace.h"
+#include "koops/stacktrace.h"
+#include "java/stacktrace.h"
 #include "json.h"
 #include "location.h"
 #include <stdio.h>
diff --git a/lib/abrt.h b/lib/abrt.h
deleted file mode 100644
index 5ff2a60..0000000
--- a/lib/abrt.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-    abrt.h
-
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_ABRT_H
-#define SATYR_ABRT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-
-bool
-sr_abrt_print_report_from_dir(const char *directory,
-                              char **error_message);
-
-bool
-sr_abrt_create_core_stacktrace(const char *directory,
-                               bool hash_fingerprints,
-                               char **error_message);
-
-struct sr_rpm_package *
-sr_abrt_parse_dso_list(const char *text);
-
-struct sr_rpm_package *
-sr_abrt_rpm_packages_from_dir(const char *directory,
-                              char **error_message);
-
-struct sr_operating_system *
-sr_abrt_operating_system_from_dir(const char *directory,
-                                  char **error_message);
-
-struct sr_report *
-sr_abrt_report_from_dir(const char *directory,
-                        char **error_message);
-
-enum sr_report_type
-sr_abrt_type_from_analyzer(const char *analyzer);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/core_fingerprint.c b/lib/core_fingerprint.c
index 461c953..5e52c30 100644
--- a/lib/core_fingerprint.c
+++ b/lib/core_fingerprint.c
@@ -17,10 +17,10 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "core_fingerprint.h"
-#include "core_stacktrace.h"
-#include "core_frame.h"
-#include "core_thread.h"
+#include "core/fingerprint.h"
+#include "core/stacktrace.h"
+#include "core/frame.h"
+#include "core/thread.h"
 #include "utils.h"
 #include "strbuf.h"
 #include "elves.h"
diff --git a/lib/core_fingerprint.h b/lib/core_fingerprint.h
deleted file mode 100644
index e32f249..0000000
--- a/lib/core_fingerprint.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-    core_fingerprint.h
-
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_CORE_FINGERPRINT_H
-#define SATYR_CORE_FINGERPRINT_H
-
-/**
- * @file
- * @brief Fingerprint algorithm for core stack traces.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-
-struct sr_core_stacktrace;
-struct sr_core_thread;
-
-bool
-sr_core_fingerprint_generate(struct sr_core_stacktrace *stacktrace,
-                             char **error_message);
-
-bool
-sr_core_fingerprint_generate_for_binary(struct sr_core_thread *thread,
-                                        const char *binary_path,
-                                        char **error_message);
-
-void
-sr_core_fingerprint_hash(struct sr_core_stacktrace *stacktrace);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SATYR_CORE_FINGERPRINT_H
diff --git a/lib/core_frame.c b/lib/core_frame.c
index 0f9485e..37d2b8b 100644
--- a/lib/core_frame.c
+++ b/lib/core_frame.c
@@ -17,7 +17,7 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "core_frame.h"
+#include "core/frame.h"
 #include "utils.h"
 #include "strbuf.h"
 #include "json.h"
diff --git a/lib/core_frame.h b/lib/core_frame.h
deleted file mode 100644
index c7817db..0000000
--- a/lib/core_frame.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
-    core_frame.h
-
-    Copyright (C) 2011, 2012  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.
-*/
-#ifndef SATYR_CORE_FRAME_H
-#define SATYR_CORE_FRAME_H
-
-/**
- * @file
- * @brief Single frame of core stack trace thread.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <inttypes.h>
-#include <stdbool.h>
-
-struct sr_strbuf;
-struct sr_location;
-struct sr_json_value;
-
-/**
- * @brief A function call on call stack of a core dump.
- */
-struct sr_core_frame
-{
-    enum sr_report_type type;
-
-    /** Address of the machine code in memory.  This is useful only
-     * when build_id is not present for some reason.  For example,
-     * this might be a null dereference (address is 0) or calling a
-     * method from null class pointer (address is a low number --
-     * offset to the class).
-     *
-     * Some programs generate machine code during runtime (JavaScript
-     * engines, JVM, the Gallium llvmpipe driver).
-     */
-    uint64_t address;
-
-    /** Build id of the ELF binary.  It might be NULL if the frame
-     * does not point to memory with code.
-     */
-    char *build_id;
-    // in ELF section
-    uint64_t build_id_offset;
-    // function name
-    char *function_name;
-    // so or executable
-    char *file_name;
-    /** Fingerprint of the function contents, optionally hashed */
-    char *fingerprint;
-
-    /** Is the fingerprint hashed or raw? */
-    bool fingerprint_hashed;
-
-    /**
-     * A sibling frame residing below this one, or NULL if this is the
-     * last frame in the parent thread.
-     */
-    struct sr_core_frame *next;
-};
-
-/**
- * Creates and initializes a new frame structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_core_frame_free().
- */
-struct sr_core_frame *
-sr_core_frame_new();
-
-/**
- * Initializes all members of the frame structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a frame structure placed on the
- * stack.
- */
-void
-sr_core_frame_init(struct sr_core_frame *frame);
-
-/**
- * Releases the memory held by the frame. The frame siblings are not
- * released.
- * @param frame
- * If the frame is NULL, no operation is performed.
- */
-void
-sr_core_frame_free(struct sr_core_frame *frame);
-
-/**
- * Creates a duplicate of the frame.
- * @param frame
- * It must be non-NULL pointer. The frame is not modified by calling
- * this function.
- * @param siblings
- * Whether to duplicate also siblings referenced by frame->next.  If
- * false, frame->next is not duplicated for the new frame, but it is
- * set to NULL.
- * @returns
- * This function never returns NULL. If the returned duplicate is not
- * shallow, it must be released by calling the function
- * sr_gdb_frame_free().
- */
-struct sr_core_frame *
-sr_core_frame_dup(struct sr_core_frame *frame,
-                  bool siblings);
-
-/**
- * Checks whether the frame represents a call of function with certain
- * function name.
- * @param frame
- *   A stack trace frame.
- * @param ...
- *   Names of executables or shared libaries that should contain the
- *   function name.  The list needs to be terminated by NULL.  Just
- *   NULL will cause ANY file name to match and succeed.  The name
- *   of file is searched as a substring.
- * @returns
- *   True if the frame corresponds to a function with function_name,
- *   residing in a specified executable or shared binary.
- */
-bool
-sr_core_frame_calls_func(struct sr_core_frame *frame,
-                         const char *function_name,
-                         ...);
-
-/**
- * Compares two frames.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_core_frame_cmp(struct sr_core_frame *frame1,
-                  struct sr_core_frame *frame2);
-
-/**
- * Compares two frames for thread distance calculations.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_core_frame_cmp_distance(struct sr_core_frame *frame1,
-                           struct sr_core_frame *frame2);
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' frame.  If 'dest' is NULL, it
- * returns the 'item' frame.
- */
-struct sr_core_frame *
-sr_core_frame_append(struct sr_core_frame *dest,
-                     struct sr_core_frame *item);
-
-struct sr_core_frame *
-sr_core_frame_from_json(struct sr_json_value *root,
-                        char **error_message);
-
-/**
- * Returns a textual representation of the frame.
- * @param frame
- * It must be a non-NULL pointer.  It's not modified by calling this
- * function.
- */
-char *
-sr_core_frame_to_json(struct sr_core_frame *frame);
-
-/**
- * Appends textual representation of the frame to the string buffer dest.
- */
-void
-sr_core_frame_append_to_str(struct sr_core_frame *frame,
-                            struct sr_strbuf *dest);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/core_stacktrace.c b/lib/core_stacktrace.c
index a97deba..c0978d4 100644
--- a/lib/core_stacktrace.c
+++ b/lib/core_stacktrace.c
@@ -17,12 +17,12 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "core_stacktrace.h"
-#include "core_frame.h"
-#include "core_thread.h"
-#include "gdb_stacktrace.h"
-#include "gdb_frame.h"
-#include "gdb_thread.h"
+#include "core/stacktrace.h"
+#include "core/frame.h"
+#include "core/thread.h"
+#include "gdb/stacktrace.h"
+#include "gdb/frame.h"
+#include "gdb/thread.h"
 #include "location.h"
 #include "normalize.h"
 #include "utils.h"
diff --git a/lib/core_stacktrace.h b/lib/core_stacktrace.h
deleted file mode 100644
index 765bdec..0000000
--- a/lib/core_stacktrace.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
-    core_stacktrace.h
-
-    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.
-*/
-#ifndef SATYR_CORE_STACKTRACE_H
-#define SATYR_CORE_STACKTRACE_H
-
-/**
- * @file
- * @brief A stack trace of a core dump.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <inttypes.h>
-
-struct sr_core_thread;
-struct sr_location;
-struct sr_json_value;
-
-/**
- * @brief A stack trace of a core dump.
- */
-struct sr_core_stacktrace
-{
-    enum sr_report_type type;
-
-    /** Signal number. */
-    uint16_t signal;
-
-    char *executable;
-
-    /**
-     * @brief Thread responsible for the crash.
-     *
-     * It might be NULL if the crash thread is not detected.
-     */
-    struct sr_core_thread *crash_thread;
-
-    struct sr_core_thread *threads;
-};
-
-/**
- * Creates and initializes a new stacktrace structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_core_stacktrace_free().
- */
-struct sr_core_stacktrace *
-sr_core_stacktrace_new();
-
-/**
- * Initializes all members of the stacktrace structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a stacktrace structure placed on the
- * stack.
- */
-void
-sr_core_stacktrace_init(struct sr_core_stacktrace *stacktrace);
-
-/**
- * Releases the memory held by the stacktrace, its threads and frames.
- * @param stacktrace
- * If the stacktrace is NULL, no operation is performed.
- */
-void
-sr_core_stacktrace_free(struct sr_core_stacktrace *stacktrace);
-
-/**
- * Creates a duplicate of the stacktrace.
- * @param stacktrace
- * The stacktrace to be copied. It's not modified by this function.
- * @returns
- * This function never returns NULL.  The returned duplicate must be
- * released by calling the function sr_core_stacktrace_free().
- */
-struct sr_core_stacktrace *
-sr_core_stacktrace_dup(struct sr_core_stacktrace *stacktrace);
-
-/**
- * Returns a number of threads in the stacktrace.
- * @param stacktrace
- * It's not modified by calling this function.
- */
-int
-sr_core_stacktrace_get_thread_count( struct sr_core_stacktrace *stacktrace);
-
-struct sr_core_thread *
-sr_core_stacktrace_find_crash_thread(struct sr_core_stacktrace *stacktrace);
-
-/**
- * @note
- * Stacktrace can be serialized to JSON string via
- * sr_core_stacktrace_to_json().
- */
-struct sr_core_stacktrace *
-sr_core_stacktrace_from_json(struct sr_json_value *root,
-                             char **error_message);
-
-struct sr_core_stacktrace *
-sr_core_stacktrace_from_json_text(const char *text,
-                                  char **error_message);
-
-/**
- * Returns brief, human-readable explanation of the stacktrace.
- */
-char *
-sr_core_stacktrace_get_reason(struct sr_core_stacktrace *stacktrace);
-
-/**
- * Serializes stacktrace to string.
- * @returns
- * Newly allocated memory containing the textual representation of the
- * provided stacktrace.  Caller should free the memory when it's no
- * longer needed.
- */
-char *
-sr_core_stacktrace_to_json(struct sr_core_stacktrace *stacktrace);
-
-struct sr_core_stacktrace *
-sr_core_stacktrace_create(const char *gdb_stacktrace_text,
-                          const char *unstrip_text,
-                          const char *executable_path);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/core_thread.c b/lib/core_thread.c
index ee126d6..a48a3c3 100644
--- a/lib/core_thread.c
+++ b/lib/core_thread.c
@@ -17,8 +17,8 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "core_thread.h"
-#include "core_frame.h"
+#include "core/thread.h"
+#include "core/frame.h"
 #include "utils.h"
 #include "strbuf.h"
 #include "json.h"
diff --git a/lib/core_thread.h b/lib/core_thread.h
deleted file mode 100644
index 23bfd59..0000000
--- a/lib/core_thread.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-    core_thread.h
-
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_CORE_THREAD_H
-#define SATYR_CORE_THREAD_H
-
-/**
- * @file
- * @brief Single thread of execution of a core stack trace.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-#include <inttypes.h>
-
-struct sr_core_frame;
-struct sr_strbuf;
-struct sr_location;
-struct sr_json_value;
-
-/**
- * @brief A thread of execution on call stack of a core dump.
- */
-struct sr_core_thread
-{
-    enum sr_report_type type;
-
-    /** Thread id. */
-    int64_t id;
-
-    /**
-     * Thread's frames, starting from the top of the stack.
-     */
-    struct sr_core_frame *frames;
-
-    /**
-     * A sibling thread, or NULL if this is the last thread in a
-     * stacktrace.
-     */
-    struct sr_core_thread *next;
-};
-
-/**
- * Creates and initializes a new frame structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_core_thread_free().
- */
-struct sr_core_thread *
-sr_core_thread_new();
-
-/**
- * Initializes all members of the thread to default values.
- * No memory is released, members are simply overwritten.
- * This is useful for initializing a thread structure placed on the
- * stack.
- */
-void
-sr_core_thread_init(struct sr_core_thread *thread);
-
-/**
- * Releases the memory held by the thread. The thread siblings are not
- * released.  Thread frames are released.
- * @param thread
- * If thread is NULL, no operation is performed.
- */
-void
-sr_core_thread_free(struct sr_core_thread *thread);
-
-/**
- * Creates a duplicate of the thread.
- * @param thread
- * It must be non-NULL pointer. The thread is not modified by calling
- * this function.
- * @param siblings
- * Whether to duplicate also siblings referenced by thread->next. If
- * false, thread->next is not duplicated for the new frame, but it is
- * set to NULL.
- */
-struct sr_core_thread *
-sr_core_thread_dup(struct sr_core_thread *thread,
-                   bool siblings);
-
-/**
- * Compares two threads. When comparing the threads, it compares also
- * their frames, including the frame numbers.
- * @returns
- * Returns 0 if the threads are same.  Returns negative number if t1
- * is found to be 'less' than t2.  Returns positive number if t1 is
- * found to be 'greater' than t2.
- */
-int
-sr_core_thread_cmp(struct sr_core_thread *thread1,
-                   struct sr_core_thread *thread2);
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' thread.  If 'dest' is NULL, it
- * returns the 'item' frame.
- */
-struct sr_core_thread *
-sr_core_thread_append(struct sr_core_thread *dest,
-                      struct sr_core_thread *item);
-
-struct sr_core_frame *
-sr_core_thread_find_exit_frame(struct sr_core_thread *thread);
-
-struct sr_core_thread *
-sr_core_thread_from_json(struct sr_json_value *root,
-                         char **error_message);
-
-char *
-sr_core_thread_to_json(struct sr_core_thread *thread,
-                       bool is_crash_thread);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/core_unwind.c b/lib/core_unwind.c
index 5abc40b..342f94c 100644
--- a/lib/core_unwind.c
+++ b/lib/core_unwind.c
@@ -17,7 +17,7 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "core_unwind.h"
+#include "core/unwind.h"
 #include "utils.h"
 #include "config.h"
 
diff --git a/lib/core_unwind.h b/lib/core_unwind.h
deleted file mode 100644
index 55af5a5..0000000
--- a/lib/core_unwind.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-    core_unwind.h
-
-    Copyright (C) 2010, 2011, 2012  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.
-*/
-#ifndef SATYR_CORE_UNWIND_H
-#define SATYR_CORE_UNWIND_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct sr_core_stacktrace;
-
-struct sr_core_stacktrace *
-sr_parse_coredump(const char *coredump_filename,
-                  const char *executable_filename,
-                  char **error_message);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/core_unwind_elfutils.c b/lib/core_unwind_elfutils.c
index 0fb9fc0..8978c57 100644
--- a/lib/core_unwind_elfutils.c
+++ b/lib/core_unwind_elfutils.c
@@ -18,9 +18,9 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 #include "utils.h"
-#include "core_frame.h"
-#include "core_thread.h"
-#include "core_stacktrace.h"
+#include "core/frame.h"
+#include "core/thread.h"
+#include "core/stacktrace.h"
 #include "config.h"
 
 #if (defined HAVE_LIBELF_H && defined HAVE_GELF_H && defined HAVE_LIBELF && defined HAVE_LIBDW && defined HAVE_ELFUTILS_LIBDWFL_H && defined HAVE_DWFL_FRAME_STATE_CORE)
diff --git a/lib/core_unwind_libunwind.c b/lib/core_unwind_libunwind.c
index 8f4664b..9f295b1 100644
--- a/lib/core_unwind_libunwind.c
+++ b/lib/core_unwind_libunwind.c
@@ -18,9 +18,9 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 #include "utils.h"
-#include "core_frame.h"
-#include "core_thread.h"
-#include "core_stacktrace.h"
+#include "core/frame.h"
+#include "core/thread.h"
+#include "core/stacktrace.h"
 #include "config.h"
 
 #if (defined HAVE_LIBELF_H && defined HAVE_GELF_H && defined HAVE_LIBELF && defined HAVE_LIBDW && defined HAVE_ELFUTILS_LIBDWFL_H && defined HAVE_DWFL_FRAME_STATE_CORE)
diff --git a/lib/deb.h b/lib/deb.h
deleted file mode 100644
index f32e888..0000000
--- a/lib/deb.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-    deb.h
-
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_DEB_H
-#define SATYR_DEB_H
-
-/**
- * @file
- * @brief Deb-related structures and utilities.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-
-struct sr_deb_package
-{
-    struct sr_deb_package *next;
-};
-
-void
-sr_deb_package_free(struct sr_deb_package *package, bool recursive);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/distance.c b/lib/distance.c
index 521494d..ce40aba 100644
--- a/lib/distance.c
+++ b/lib/distance.c
@@ -18,16 +18,16 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 #include "distance.h"
-#include "gdb_thread.h"
-#include "gdb_frame.h"
-#include "core_thread.h"
-#include "core_frame.h"
-#include "java_thread.h"
-#include "java_frame.h"
-#include "koops_stacktrace.h"
-#include "koops_frame.h"
-#include "python_stacktrace.h"
-#include "python_frame.h"
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "core/thread.h"
+#include "core/frame.h"
+#include "java/thread.h"
+#include "java/frame.h"
+#include "koops/stacktrace.h"
+#include "koops/frame.h"
+#include "python/stacktrace.h"
+#include "python/frame.h"
 #include "thread.h"
 #include <stdlib.h>
 
diff --git a/lib/distance.h b/lib/distance.h
deleted file mode 100644
index 356c715..0000000
--- a/lib/distance.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
-    distance.h
-
-    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.
-*/
-#ifndef SATYR_DISTANCE_H
-#define SATYR_DISTANCE_H
-
-/**
- * @file
- * @brief Distance between stack trace threads.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-
-struct sr_gdb_frame;
-struct sr_gdb_thread;
-struct sr_core_frame;
-struct sr_core_thread;
-struct sr_java_frame;
-struct sr_java_thread;
-struct sr_koops_frame;
-struct sr_koops_stacktrace;
-struct sr_python_frame;
-struct sr_python_stacktrace;
-
-enum sr_distance_type
-{
-    /* Jaro-Winkler distance:
-     *
-     * Gets number of matching function names(match_count) from both
-     * threads and number of transpositions in place(trans_count) if
-     * the transpositioned function names are not farther away than
-     * frame_count/2 - 1.  Then computes the Jaro-Winkler distance
-     * according to the formula.  NOTE: The Jaro-Winkler distance is
-     * not a metric distance as it does not satisfy the triangle
-     * inequality.  Returns a number between 0 and 1: 0 = no
-     * similarity, 1 = similar threads.
-     */
-    SR_DISTANCE_JARO_WINKLER,
-
-    /* Jaccard distance:
-     *
-     * Gives a number representing the difference of the size of the
-     * intersection and union divided by the size of the union of two
-     * threads.  Function names positions in the thread are not taken
-     * into account.  Returns a number between 0 and 1: 0 = similar
-     * threads, 1 = no similarity.
-     */
-    SR_DISTANCE_JACCARD,
-
-    /* Levenshtein distance:
-     *
-     * Computes the distance of two threads creating a matrix of
-     * distances between all the frames in each thread.  Computes a
-     * number representing how many function names need to be
-     * different in one thread to match all the function names in
-     * second thread at each respective positions or how many function
-     * names need to be different to have a match.  The number is
-     * always between 0 and n, where n is the frame count of longer
-     * thread 0 = similar threads, n = no similar function names.
-     * This is normalized to a result between 0 and 1 that is
-     * returned.
-     */
-    SR_DISTANCE_LEVENSHTEIN,
-
-    /* Damerau-Levenshtein distance:
-     *
-     * Like the Levenshtein distance, but with transpositions. NOTE:
-     * The triangle inequality does not hold.
-     */
-    SR_DISTANCE_DAMERAU_LEVENSHTEIN
-};
-
-float
-sr_distance_gdb(enum sr_distance_type distance_type,
-                struct sr_gdb_thread *thread1,
-                struct sr_gdb_thread *thread2);
-
-float
-sr_distance_core(enum sr_distance_type distance_type,
-                 struct sr_core_thread *thread1,
-                 struct sr_core_thread *thread2);
-
-float
-sr_distance_java(enum sr_distance_type distance_type,
-                 struct sr_java_thread *thread1,
-                 struct sr_java_thread *thread2);
-
-float
-sr_distance_koops(enum sr_distance_type distance_type,
-                  struct sr_koops_stacktrace *stacktrace1,
-                  struct sr_koops_stacktrace *stacktrace2);
-
-float
-sr_distance_python(enum sr_distance_type distance_type,
-                   struct sr_python_stacktrace *stacktrace1,
-                   struct sr_python_stacktrace *stacktrace2);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/frame.c b/lib/frame.c
index 9d563d8..da4f070 100644
--- a/lib/frame.c
+++ b/lib/frame.c
@@ -23,11 +23,11 @@
 #include "strbuf.h"
 #include "frame.h"
 
-#include "gdb_frame.h"
-#include "core_frame.h"
-#include "python_frame.h"
-#include "koops_frame.h"
-#include "java_frame.h"
+#include "gdb/frame.h"
+#include "core/frame.h"
+#include "python/frame.h"
+#include "koops/frame.h"
+#include "java/frame.h"
 
 #include <stdio.h>
 
diff --git a/lib/frame.h b/lib/frame.h
deleted file mode 100644
index bb23419..0000000
--- a/lib/frame.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-    frame.h
-
-    Copyright (C) 2013  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.
-*/
-#ifndef SATYR_FRAME_H
-#define SATYR_FRAME_H
-
-/**
- * Functions declared here work with all frame types, i.e.
- * * sr_core_frame
- * * sr_python_frame
- * * sr_koops_frame
- * * sr_java_frame
- * * sr_gdb_frame
- * You may need to explicitly cast the pointer to struct sr_frame in order to
- * avoid compiler warning.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-
-struct sr_strbuf;
-
-struct sr_frame
-{
-   enum sr_report_type type;
-};
-
-/**
- * Return the next frame linked from this frame (corresponds to reading the
- * "next" struct member).
- */
-struct sr_frame *
-sr_frame_next(struct sr_frame *frame);
-
-/**
- * Appends textual representation of the frame to buffer strbuf.
- */
-void
-sr_frame_append_to_str(struct sr_frame *frame, struct sr_strbuf *strbuf);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/gdb_frame.c b/lib/gdb_frame.c
index 259b572..630e9a2 100644
--- a/lib/gdb_frame.c
+++ b/lib/gdb_frame.c
@@ -17,7 +17,7 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "gdb_frame.h"
+#include "gdb/frame.h"
 #include "utils.h"
 #include "strbuf.h"
 #include "location.h"
diff --git a/lib/gdb_frame.h b/lib/gdb_frame.h
deleted file mode 100644
index 756b458..0000000
--- a/lib/gdb_frame.h
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
-    gdb_frame.h
-
-    Copyright (C) 2010, 2011, 2012  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.
-*/
-#ifndef SATYR_GDB_FRAME_H
-#define SATYR_GDB_FRAME_H
-
-/**
- * @file
- * @brief Single frame of GDB stack trace thread.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-struct sr_strbuf;
-struct sr_location;
-
-/**
- * @brief A function call of a GDB-produced stack trace.
- *
- * A frame representing a function call or a signal handler on a call
- * stack of a thread.
- */
-struct sr_gdb_frame
-{
-    enum sr_report_type type;
-
-    /**
-     * A function name or NULL. If it's NULL, signal_handler_called is
-     * true.
-     */
-    char *function_name;
-
-    /**
-     * A function type, or NULL if it isn't present.
-     */
-    char *function_type;
-
-    /**
-     * A frame number in a thread. It does not necessarily show the
-     * actual position in the thread, as this number is set by the
-     * parser and never updated.
-     */
-    uint32_t number;
-
-    /**
-     * The name of the source file containing the function definition,
-     * or the name of the binary file (.so) with the binary code of
-     * the function, or NULL.
-     */
-    char *source_file;
-
-    /**
-     * A line number in the source file, determining the position of
-     * the function definition, or -1 when unknown.
-     */
-    uint32_t source_line;
-
-    /**
-     * Signal handler was called on this frame.
-     */
-    bool signal_handler_called;
-
-    /**
-     * The function address in the computer memory, or -1 when the
-     * address is unknown. Address is unknown when the frame
-     * represents inlined function.
-     */
-    uint64_t address;
-
-    /**
-     * A library name or NULL.
-     */
-    char *library_name;
-
-    /**
-     * A sibling frame residing below this one, or NULL if this is the
-     * last frame in the parent thread.
-     */
-    struct sr_gdb_frame *next;
-};
-
-/**
- * Creates and initializes a new frame structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_gdb_frame_free().
- */
-struct sr_gdb_frame *
-sr_gdb_frame_new();
-
-/**
- * Initializes all members of the frame structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a frame structure placed on the
- * stack.
- */
-void
-sr_gdb_frame_init(struct sr_gdb_frame *frame);
-
-/**
- * Releases the memory held by the frame. The frame siblings are not
- * released.
- * @param frame
- * If the frame is NULL, no operation is performed.
- */
-void
-sr_gdb_frame_free(struct sr_gdb_frame *frame);
-
-/**
- * Creates a duplicate of the frame.
- * @param frame
- * It must be non-NULL pointer. The frame is not modified by calling
- * this function.
- * @param siblings
- * Whether to duplicate also siblings referenced by frame->next.  If
- * false, frame->next is not duplicated for the new frame, but it is
- * set to NULL.
- * @returns
- * This function never returns NULL. The returned duplicate frame must
- * be released by calling the function sr_gdb_frame_free().
- */
-struct sr_gdb_frame *
-sr_gdb_frame_dup(struct sr_gdb_frame *frame,
-                 bool siblings);
-
-/**
- * Checks whether the frame represents a call of function with certain
- * function name.
- * @param frame
- *   A stack trace frame.
- * @param ...
- *   Names of source files or shared libaries that should contain the
- *   function name.  The list needs to be terminated by NULL.  Just
- *   NULL can be provided, and source file cannot be present in order
- *   to succeed.  An empty string will cause ANY source file to match
- *   and succeed.  The name of source file is searched as a substring.
- * @returns
- *   True if the frame corresponds to a function with function_name,
- *   residing in a source file.
- */
-bool
-sr_gdb_frame_calls_func(struct sr_gdb_frame *frame,
-                        const char *function_name,
-                        ...);
-
-/**
- * Compares two frames.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param compare_number
- * Indicates whether to include the frame numbers in the
- * comparsion. If set to false, the frame numbers are ignored.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_gdb_frame_cmp(struct sr_gdb_frame *frame1,
-                 struct sr_gdb_frame *frame2,
-                 bool compare_number);
-
-/**
- * Compares two frames, but only by their function and library names.
- * Two unknown functions ("??") are assumed to be different and unknown
- * library names to be the same.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_gdb_frame_cmp_distance(struct sr_gdb_frame *frame1,
-                          struct sr_gdb_frame *frame2);
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' frame.  If 'dest' is NULL, it
- * returns the 'item' frame.
- */
-struct sr_gdb_frame *
-sr_gdb_frame_append(struct sr_gdb_frame *dest,
-                    struct sr_gdb_frame *item);
-
-/**
- * Appends the textual representation of the frame to the string
- * buffer.
- * @param frame
- * It must be a non-NULL pointer.  It's not modified by calling this
- * function.
- */
-void
-sr_gdb_frame_append_to_str(struct sr_gdb_frame *frame,
-                           struct sr_strbuf *dest,
-                           bool verbose);
-
-/**
- * If the input contains a complete frame, this function parses the
- * frame text, returns it in a structure, and moves the input pointer
- * after the frame.  If the input does not contain proper, complete
- * frame, the function does not modify input and returns NULL.
- * @returns
- * Allocated pointer with a frame structure. The pointer should be
- * released by sr_gdb_frame_free().
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  When this function returns NULL, the structure will contain
- * the error line, column, and message.  The line and column members
- * of the location are gradually increased as the parser handles the
- * input, so the location should be initialized before calling this
- * function to get reasonable values.
- */
-struct sr_gdb_frame *
-sr_gdb_frame_parse(const char **input,
-                   struct sr_location *location);
-
-/**
- * If the input contains a proper frame start section, parse the frame
- * number, and move the input pointer after this section. Otherwise do
- * not modify input.
- * @returns
- * The number of characters parsed from input. 0 if the input does not
- * contain a frame start.
- * @code
- * "#1 "
- * "#255  "
- * @endcode
- */
-int
-sr_gdb_frame_parse_frame_start(const char **input,
-                               uint32_t *number);
-
-/**
- * Parses C++ operator on input.  Supports even 'operator new[]' and
- * 'operator delete[]'.
- * @param target
- * The parsed operator name is appened to the string buffer provided,
- * if an operator is found. Otherwise the string buffer is not
- * changed.
- * @returns
- * The number of characters parsed from input. 0 if the input does not
- * contain operator.
- */
-int
-sr_gdb_frame_parseadd_operator(const char **input,
-                               struct sr_strbuf *target);
-
-/**
- * Parses a part of function name from the input.
- * @param target
- * Pointer to a non-allocated pointer. This function will set the
- * pointer to newly allocated memory containing the name chunk, if it
- * returns positive, nonzero value.
- * @returns
- * The number of characters parsed from input. 0 if the input does not
- * contain a part of function name.
- */
-int
-sr_gdb_frame_parse_function_name_chunk(const char **input,
-                                       bool space_allowed,
-                                       char **target);
-
-/**
- * If the input buffer contains part of function name containing
- * braces, for example "(anonymous namespace)", parse it, append the
- * contents to target and move input after the braces.  Otherwise do
- * not modify the input and the target.
- * @returns
- * The number of characters parsed from input. 0 if the input does not
- * contain a braced part of function name.
- */
-int
-sr_gdb_frame_parse_function_name_braces(const char **input,
-                                        char **target);
-
-/**
- * @returns
- * The number of characters parsed from input. 0 if the input does not
- * contain a template part of function name.
- */
-int
-sr_gdb_frame_parse_function_name_template(const char **input,
-                                          char **target);
-
-/**
- * Parses the function name, which is a part of the frame header, from
- * the input. If the frame header contains also the function type,
- * it's also parsed.
- * @param function_name
- * A pointer pointing to an uninitialized pointer. This function
- * allocates a string and sets the pointer to it if it parses the
- * function name from the input successfully.  The memory returned
- * this way must be released by the caller using the function free().
- * If this function returns true, this pointer is guaranteed to be
- * non-NULL.
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  The line and column members of the location are gradually
- * increased as the parser handles the input, so the location should
- * be initialized before calling this function to get reasonable
- * values.  When this function returns false (an error occurred), the
- * structure will contain the error line, column, and message.
- * @returns
- * True if the input stream contained a function name, which has been
- * parsed. False otherwise.
- */
-bool
-sr_gdb_frame_parse_function_name(const char **input,
-                                 char **function_name,
-                                 char **function_type,
-                                 struct sr_location *location);
-
-/**
- * Skips function arguments which are a part of the frame header, in
- * the input stream.
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  The line and column members of the location are gradually
- * increased as the parser handles the input, so the location should
- * be initialized before calling this function to get reasonable
- * values.  When this function returns false (an error occurred), the
- * structure will contain the error line, column, and message.
- */
-bool
-sr_gdb_frame_skip_function_args(const char **input,
-                                struct sr_location *location);
-
-/**
- * If the input contains proper function call, parse the function
- * name and store it to result, move the input pointer after whole
- * function call, and return true. Otherwise do not modify the input
- * and return false.
- *
- * If this function returns true, the caller is responsible to free
- * the the function_name.
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  The line and column members of the location are gradually
- * increased as the parser handles the input, so the location should
- * be initialized before calling this function to get reasonable
- * values.  When this function returns false (an error occurred), the
- * structure will contain the error line, column, and message.
- */
-bool
-sr_gdb_frame_parse_function_call(const char **input,
-                                 char **function_name,
-                                 char **function_type,
-                                 struct sr_location *location);
-
-/**
- * If the input contains address and function call, parse them, move
- * the input pointer after this sequence, and return true.
- * Otherwise do not modify the input and return false.
- *
- * If this function returns true, the caller is responsible to free
- * the parameter function.
- *
- * @code
- * 0x000000322160e7fd in fsync ()
- * 0x000000322222987a in write_to_temp_file (
- * filename=0x18971b0 "/home/jfclere/.recently-used.xbel",
- * contents=<value optimized out>, length=29917, error=0x7fff3cbe4110)
- * @endcode
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  The line and column members of the location are gradually
- * increased as the parser handles the input, so the location should
- * be initialized before calling this function to get reasonable
- * values.  When this function returns false (an error occurred), the
- * structure will contain the error line, column, and message.
- */
-bool
-sr_gdb_frame_parse_address_in_function(const char **input,
-                                       uint64_t *address,
-                                       char **function_name,
-                                       char **function_type,
-                                       struct sr_location *location);
-
-/**
- * If the input contains sequence "from path/to/file:fileline" or "at
- * path/to/file:fileline", parse it, move the input pointer after this
- * sequence and return true. Otherwise do not modify the input and
- * return false.
- *
- * The ':' followed by line number is optional. If it is not present,
- * the fileline is set to -1.
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  The line and column members of the location are gradually
- * increased as the parser handles the input, so the location should
- * be initialized before calling this function to get reasonable
- * values.  When this function returns false (an error occurred), the
- * structure will contain the error line, column, and message.
- */
-bool
-sr_gdb_frame_parse_file_location(const char **input,
-                                 char **file,
-                                 uint32_t *file_line,
-                                 struct sr_location *location);
-
-/**
- * If the input contains proper frame header, this function
- * parses the frame header text, moves the input pointer
- * after the frame header, and returns a frame struct.
- * If the input does not contain proper frame header, this function
- * returns NULL and does not modify input.
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  The line and column members of the location are gradually
- * increased as the parser handles the input, so the location should
- * be initialized before calling this function to get reasonable
- * values.  When this function returns false (an error occurred), the
- * structure will contain the error line, column, and message.
- * @returns
- * Newly created frame struct or NULL. The returned frame struct
- * should be released by sr_gdb_frame_free().
- */
-struct sr_gdb_frame *
-sr_gdb_frame_parse_header(const char **input,
-                          struct sr_location *location);
-
-/**
- * Removes first num chars from function name in the frame if it begins
- * with the prefix.
- */
-void
-sr_gdb_frame_remove_func_prefix(struct sr_gdb_frame *frame,
-                                const char *prefix,
-                                int num);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/gdb_sharedlib.c b/lib/gdb_sharedlib.c
index 96df115..4b66c01 100644
--- a/lib/gdb_sharedlib.c
+++ b/lib/gdb_sharedlib.c
@@ -17,7 +17,7 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "gdb_sharedlib.h"
+#include "gdb/sharedlib.h"
 #include "utils.h"
 #include "strbuf.h"
 #include <ctype.h>
diff --git a/lib/gdb_sharedlib.h b/lib/gdb_sharedlib.h
deleted file mode 100644
index d19ee04..0000000
--- a/lib/gdb_sharedlib.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-    gdb_sharedlib.h
-
-    Copyright (C) 2011, 2012  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.
-*/
-#ifndef SATYR_GDB_SHAREDLIB_H
-#define SATYR_GDB_SHAREDLIB_H
-
-/**
- * @file
- * @brief Shared library information as produced by GDB.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-#include <inttypes.h>
-
-enum
-{
-    SYMS_OK,
-    SYMS_WRONG,
-    SYMS_NOT_FOUND,
-};
-
-/**
- * @brief A shared library memory location as reported by GDB.
- */
-struct sr_gdb_sharedlib
-{
-    uint64_t from;
-    uint64_t to;
-    int symbols;
-    char *soname;
-    struct sr_gdb_sharedlib *next;
-};
-
-/**
- * Creates and initializes a new sharedlib structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_gdb_sharedlib_free().
- */
-struct sr_gdb_sharedlib *
-sr_gdb_sharedlib_new();
-
-/**
- * Initializes all members of the sharedlib to default values.  No
- * memory is released, members are simply overwritten.  This is useful
- * for initializing a sharedlib structure placed on the stack.
- */
-void
-sr_gdb_sharedlib_init(struct sr_gdb_sharedlib *sharedlib);
-
-/**
- * Releases the memory held by the sharedlib.  Sharedlibs referenced
- * by .next are not released.
- * @param sharedlib
- * If sharedlib is NULL, no operation is performed.
- */
-void
-sr_gdb_sharedlib_free(struct sr_gdb_sharedlib *sharedlib);
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' sharedlib.  If 'dest' is NULL, it
- * returns the 'item' sharedlib.
- */
-struct sr_gdb_sharedlib *
-sr_gdb_sharedlib_append(struct sr_gdb_sharedlib *dest,
-                        struct sr_gdb_sharedlib *item);
-
-/**
- * Creates a duplicate of the sharedlib structure.
- * @param sharedlib
- * Structure to be duplicated.
- * @param siblings
- * Whether to duplicate a single structure or whole list.
- * @returns
- * Never returns NULL. Returns the duplicated structure
- * or the first structure in the duplicated list.
- */
-struct sr_gdb_sharedlib *
-sr_gdb_sharedlib_dup(struct sr_gdb_sharedlib *sharedlib,
-                     bool siblings);
-
-/**
- * Returns the number of sharedlibs in the list.
- */
-int
-sr_gdb_sharedlib_count(struct sr_gdb_sharedlib *sharedlib);
-
-/**
- * Finds whether the address belongs to some sharedlib
- * from the list starting by 'first'.
- * @returns
- * Pointer to an existing structure or NULL if not found.
- */
-struct sr_gdb_sharedlib *
-sr_gdb_sharedlib_find_address(struct sr_gdb_sharedlib *first,
-                              uint64_t address);
-
-/**
- * Parses the output of GDB's 'info sharedlib' command.
- * @param input
- * String representing the stacktrace.
- * @returns
- * First element of the list of loaded libraries.
- */
-struct sr_gdb_sharedlib *
-sr_gdb_sharedlib_parse(const char *input);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/gdb_stacktrace.c b/lib/gdb_stacktrace.c
index 11cceb6..0fe2faa 100644
--- a/lib/gdb_stacktrace.c
+++ b/lib/gdb_stacktrace.c
@@ -17,10 +17,10 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "gdb_stacktrace.h"
-#include "gdb_thread.h"
-#include "gdb_frame.h"
-#include "gdb_sharedlib.h"
+#include "gdb/stacktrace.h"
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "gdb/sharedlib.h"
 #include "utils.h"
 #include "strbuf.h"
 #include "location.h"
diff --git a/lib/gdb_stacktrace.h b/lib/gdb_stacktrace.h
deleted file mode 100644
index f7eff36..0000000
--- a/lib/gdb_stacktrace.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
-    gdb_stacktrace.h
-
-    Copyright (C) 2012  ABRT Team
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_GDB_STACKTRACE_H
-#define SATYR_GDB_STACKTRACE_H
-
-/**
- * @file
- * @brief Stack trace as produced by GDB.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-
-struct sr_gdb_thread;
-struct sr_gdb_frame;
-struct sr_location;
-
-/**
- * @brief A stack trace produced by GDB.
- *
- * A stacktrace obtained at the time of a program crash, consisting of
- * several threads which contains frames.
- *
- * This structure represents a stacktrace as produced by the GNU
- * Debugger.
- */
-struct sr_gdb_stacktrace
-{
-    enum sr_report_type type;
-
-    struct sr_gdb_thread *threads;
-
-    /**
-     * The frame where the crash happened according to debugger.  It
-     * might be that we can not tell to which thread this frame
-     * belongs, because some threads end with mutually
-     * indistinguishable frames.
-     */
-    struct sr_gdb_frame *crash;
-
-    /**
-     * Shared libraries loaded at the moment of crash.
-     */
-    struct sr_gdb_sharedlib *libs;
-};
-
-/**
- * Creates and initializes a new stack trace structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_gdb_stacktrace_free().
- */
-struct sr_gdb_stacktrace *
-sr_gdb_stacktrace_new();
-
-/**
- * Initializes all members of the stacktrace structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a stacktrace structure placed on the
- * stack.
- */
-void
-sr_gdb_stacktrace_init(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Releases the memory held by the stacktrace, its threads, frames,
- * shared libraries.
- * @param stacktrace
- * If the stacktrace is NULL, no operation is performed.
- */
-void
-sr_gdb_stacktrace_free(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Creates a duplicate of a stacktrace.
- * @param stacktrace
- * The stacktrace to be copied. It's not modified by this function.
- * @returns
- * This function never returns NULL.  The returned duplicate must be
- * released by calling the function sr_gdb_stacktrace_free().
- */
-struct sr_gdb_stacktrace *
-sr_gdb_stacktrace_dup(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Returns a number of threads in the stacktrace.
- * @param stacktrace
- * It's not modified by calling this function.
- */
-int
-sr_gdb_stacktrace_get_thread_count(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Removes all threads from the stacktrace and deletes them, except the
- * one provided as a parameter.
- * @param thread
- * This function does not check whether the thread is a member of the
- * stacktrace.  If it's not, all threads are removed from the stacktrace
- * and then deleted.
- */
-void
-sr_gdb_stacktrace_remove_threads_except_one(struct sr_gdb_stacktrace *stacktrace,
-                                            struct sr_gdb_thread *thread);
-
-/**
- * Searches all threads and tries to find the one that caused the
- * crash.  It might return NULL if the thread cannot be determined.
- * @param stacktrace
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- */
-struct sr_gdb_thread *
-sr_gdb_stacktrace_find_crash_thread(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Remove frames from the bottom of threads in the stacktrace, until
- * all threads have at most 'depth' frames.
- * @param stacktrace
- * Must be non-NULL pointer.
- */
-void
-sr_gdb_stacktrace_limit_frame_depth(struct sr_gdb_stacktrace *stacktrace,
-                                    int depth);
-
-/**
- * Evaluates the quality of the stacktrace. The quality is the ratio of
- * the number of frames with function name fully known to the number
- * of all frames.  This function does not take into account that some
- * frames are more important than others.
- * @param stacktrace
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * A number between 0 and 1. 0 means the lowest quality, 1 means full
- * stacktrace is known (all function names are known).
- */
-float
-sr_gdb_stacktrace_quality_simple(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Evaluates the quality of the stacktrace. The quality is determined
- * depending on the ratio of frames with function name fully known to
- * all frames.
- * @param stacktrace
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * A number between 0 and 1. 0 means the lowest quality, 1 means full
- * stacktrace is known.  The returned value takes into account that the
- * thread which caused the crash is more important than the other
- * threads, and the frames around the crash frame are more important
- * than distant frames.
- */
-float
-sr_gdb_stacktrace_quality_complex(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Returns textual representation of the stacktrace.
- * @param stacktrace
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * This function never returns NULL. The caller is responsible for
- * releasing the returned memory using function free().
- */
-char *
-sr_gdb_stacktrace_to_text(struct sr_gdb_stacktrace *stacktrace,
-                          bool verbose);
-
-/**
- * Analyzes the stacktrace to get the frame where a crash occurred.
- * @param stacktrace
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * The returned value must be released by calling sr_gdb_frame_free()
- * when it's no longer needed, because it is a deep copy of the crash
- * frame from the stacktrace.  NULL is returned if the crash frame is
- * not found.
- */
-struct sr_gdb_frame *
-sr_gdb_stacktrace_get_crash_frame(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Calculates the duplication hash string of the stacktrace.
- * @param stacktrace
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * This function never returns NULL. The caller is responsible for
- * releasing the returned memory using function free().
- */
-char *
-sr_gdb_stacktrace_get_duplication_hash(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Parses a textual stack trace and puts it into a structure.  If
- * parsing fails, the input parameter is not changed and NULL is
- * returned.
- * @code
- * struct sr_location location;
- * sr_location_init(&location);
- * char *input = "...";
- * struct sr_gdb_stacktrace *stacktrace;
- * stacktrace = sr_gdb_stacktrace_parse(input, location);
- * if (!stacktrace)
- * {
- *   fprintf(stderr,
- *           "Failed to parse the stacktrace.\n"
- *           "Line %d, column %d: %s\n",
- *           location.line,
- *           location.column,
- *           location.message);
- *   exit(-1);
- * }
- * sr_gdb_stacktrace_free(stacktrace);
- * @endcode
- * @param input
- * Pointer to the string with the stacktrace. If this function returns
- * a non-NULL value, this pointer is modified to point after the
- * stacktrace that was just parsed.
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  The line and column members of the location are gradually
- * increased as the parser handles the input, so the location should
- * be initialized by sr_location_init() before calling this function
- * to get reasonable values.  When this function returns false (an
- * error occurred), the structure will contain the error line, column,
- * and message.
- * @returns
- * A newly allocated stacktrace structure or NULL. A stacktrace struct
- * is returned when at least one thread was parsed from the input and
- * no error occurred. The returned structure should be released by
- * sr_gdb_stacktrace_free().
- */
-struct sr_gdb_stacktrace *
-sr_gdb_stacktrace_parse(const char **input,
-                        struct sr_location *location);
-
-/**
- * Parse stacktrace header if it is available in the stacktrace.  The
- * header usually contains frame where the program crashed.
- * @param input
- * Pointer that will be moved to point behind the header if the header
- * is successfully detected and parsed.
- * @param frame
- * If this function succeeds and returns true, *frame contains the
- * crash frame that is usually a part of the header. If no frame is
- * detected in the header, *frame is set to NULL.
- * @code
- * [New Thread 11919]
- * [New Thread 11917]
- * Core was generated by `evince file:///tmp/Factura04-05-2010.pdf'.
- * Program terminated with signal 8, Arithmetic exception.
- * #0  0x000000322a2362b9 in repeat (image=<value optimized out>,
- *     mask=<value optimized out>, mask_bits=<value optimized out>)
- *     at pixman-bits-image.c:145
- * 145     pixman-bits-image.c: No such file or directory.
- *         in pixman-bits-image.c
- * @endcode
- */
-bool
-sr_gdb_stacktrace_parse_header(const char **input,
-                               struct sr_gdb_frame **frame,
-                               struct sr_location *location);
-
-/**
- * Set library names in all frames in the stacktrace according to the
- * the sharedlib data.
- */
-void
-sr_gdb_stacktrace_set_libnames(struct sr_gdb_stacktrace *stacktrace);
-
-/**
- * Return short text representation of the crash thread.  The trace is
- * normalized and functions without names (signal handlers) are removed.
- * @param stacktrace
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param max_frames
- * The maximum number of frames in the returned crash thread.
- * Superfluous frames are not included in the output.
- * @returns
- * Brief text representation of the crash thread suitable for being part of a
- * bugzilla comment. The string is allocated by the function and must be freed
- * using the free() function.
- */
-char *
-sr_gdb_stacktrace_to_short_text(struct sr_gdb_stacktrace *stacktrace,
-                                int max_frames);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/gdb_thread.c b/lib/gdb_thread.c
index 1dc3a1f..c01c32a 100644
--- a/lib/gdb_thread.c
+++ b/lib/gdb_thread.c
@@ -17,9 +17,9 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "gdb_thread.h"
-#include "gdb_frame.h"
-#include "gdb_sharedlib.h"
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "gdb/sharedlib.h"
 #include "normalize.h"
 #include "location.h"
 #include "utils.h"
diff --git a/lib/gdb_thread.h b/lib/gdb_thread.h
deleted file mode 100644
index f601b8f..0000000
--- a/lib/gdb_thread.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
-    gdb_thread.h
-
-    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.
-*/
-#ifndef SATYR_GDB_THREAD_H
-#define SATYR_GDB_THREAD_H
-
-/**
- * @file
- * @brief Single thread of execution of GDB stack trace.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-struct sr_gdb_frame;
-struct sr_strbuf;
-struct sr_location;
-struct sr_gdb_sharedlib;
-
-/**
- * @brief A thread of execution of a GDB-produced stack trace.
- *
- * Represents a thread containing frames.
- */
-struct sr_gdb_thread
-{
-    enum sr_report_type type;
-
-    uint32_t number;
-
-    /**
-     * Thread's frames, starting from the top of the stack.
-     */
-    struct sr_gdb_frame *frames;
-
-    /**
-     * A sibling thread, or NULL if this is the last thread in a
-     * stacktrace.
-     */
-    struct sr_gdb_thread *next;
-};
-
-/**
- * Creates and initializes a new frame structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_gdb_thread_free().
- */
-struct sr_gdb_thread *
-sr_gdb_thread_new();
-
-/**
- * Initializes all members of the thread to default values.
- * No memory is released, members are simply overwritten.
- * This is useful for initializing a thread structure placed on the
- * stack.
- */
-void
-sr_gdb_thread_init(struct sr_gdb_thread *thread);
-
-/**
- * Releases the memory held by the thread. The thread siblings are not
- * released.
- * @param thread
- * If thread is NULL, no operation is performed.
- */
-void
-sr_gdb_thread_free(struct sr_gdb_thread *thread);
-
-/**
- * Creates a duplicate of the thread.
- * @param thread
- * It must be non-NULL pointer. The thread is not modified by calling
- * this function.
- * @param siblings
- * Whether to duplicate also siblings referenced by thread->next. If
- * false, thread->next is not duplicated for the new frame, but it is
- * set to NULL.
- */
-struct sr_gdb_thread *
-sr_gdb_thread_dup(struct sr_gdb_thread *thread,
-                  bool siblings);
-
-/**
- * Compares two threads. When comparing the threads, it compares also
- * their frames, including the frame numbers.
- * @returns
- * Returns 0 if the threads are same.  Returns negative number if t1
- * is found to be 'less' than t2.  Returns positive number if t1 is
- * found to be 'greater' than t2.
- */
-int
-sr_gdb_thread_cmp(struct sr_gdb_thread *thread1,
-                  struct sr_gdb_thread *thread2);
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' thread.
- */
-struct sr_gdb_thread *
-sr_gdb_thread_append(struct sr_gdb_thread *dest,
-                     struct sr_gdb_thread *item);
-
-/**
- * Counts the number of 'good' frames and the number of all frames in
- * a thread. Good means that the function name is known (so it's not
- * just '??').
- * @param ok_count
- * @param all_count
- * Not zeroed. This function just adds the numbers to ok_count and
- * all_count.
- */
-void
-sr_gdb_thread_quality_counts(struct sr_gdb_thread *thread,
-                             int *ok_count,
-                             int *all_count);
-
-/**
- * Returns the quality of the thread. The quality is the ratio of the
- * number of frames with function name fully known to the number of
- * all frames.  This function does not take into account that some
- * frames are more important than others.
- * @param thread
- * Must be a non-NULL pointer. It's not modified in this function.
- * @returns
- * A number between 0 and 1. 0 means the lowest quality, 1 means full
- * thread stacktrace is known. If the thread contains no frames, this
- * function returns 1.
- */
-float
-sr_gdb_thread_quality(struct sr_gdb_thread *thread);
-
-/**
- * Removes the frame from the thread and then deletes it.
- * @returns
- * True if the frame was found in the thread and removed and deleted.
- * False if the frame was not found in the thread.
- */
-bool
-sr_gdb_thread_remove_frame(struct sr_gdb_thread *thread,
-                           struct sr_gdb_frame *frame);
-
-/**
- * Removes all the frames from the thread that are above certain
- * frame.
- * @returns
- * True if the frame was found, and all the frames that were above the
- * frame in the thread were removed from the thread and then deleted.
- * False if the frame was not found in the thread.
- */
-bool
-sr_gdb_thread_remove_frames_above(struct sr_gdb_thread *thread,
-                                  struct sr_gdb_frame *frame);
-
-/**
- * Keeps only the top n frames in the thread.
- */
-void
-sr_gdb_thread_remove_frames_below_n(struct sr_gdb_thread *thread,
-                                    int n);
-
-/**
- * Appends a textual representation of 'thread' to the 'str'.
- */
-void
-sr_gdb_thread_append_to_str(struct sr_gdb_thread *thread,
-                            struct sr_strbuf *dest,
-                            bool verbose);
-
-/**
- * If the input contains proper thread with frames, parse the thread,
- * move the input pointer after the thread, and return a structure
- * representing the thread.  Otherwise to not modify the input pointer
- * and return NULL.
- * @param location
- * The caller must provide a pointer to struct sr_location here.  The
- * line and column members are gradually increased as the parser
- * handles the input, keep this in mind to get reasonable values.
- * When this function returns NULL (an error occurred), the structure
- * will contain the error line, column, and message.
- * @returns
- * NULL or newly allocated structure, which should be released by
- * calling sr_gdb_thread_free().
- */
-struct sr_gdb_thread *
-sr_gdb_thread_parse(const char **input,
-                    struct sr_location *location);
-
-/**
- * If the input contains a LWP section in form of "(LWP [0-9]+), move
- * the input pointer after this section. Otherwise do not modify
- * input.
- * @returns
- * The number of characters parsed from input. 0 if the input does not
- * contain a LWP section.
- */
-int
-sr_gdb_thread_skip_lwp(const char **input);
-
-/**
- * Create a thread from function and library names.
- * @param input
- * String containing function names and library names separated
- * by space, one frame per line.
- * @returns
- * Newly allocated structure, which should be released by
- * calling sr_gdb_thread_free().
- */
-struct sr_gdb_thread *
-sr_gdb_thread_parse_funs(const char *input);
-
-/**
- * Prepare a string representing thread which contains just the function
- * and library names. This can be used to store only data necessary for
- * comparison.
- * @returns
- * Newly allocated string, which should be released by
- * calling free(). The string can be parsed by sr_gdb_thread_parse_funs().
- */
-char *
-sr_gdb_thread_format_funs(struct sr_gdb_thread *thread);
-
-/**
- * Set library names in all frames in the thread according to the
- * the sharedlib data.
- */
-void
-sr_gdb_thread_set_libnames(struct sr_gdb_thread *thread,
-                           struct sr_gdb_sharedlib *libs);
-
-/**
- * Return copy of the thread optimized for comparison.
- */
-struct sr_gdb_thread *
-sr_gdb_thread_get_optimized(struct sr_gdb_thread *thread,
-                            struct sr_gdb_sharedlib *libs, int max_frames);
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/java_frame.c b/lib/java_frame.c
index 0ae7134..9580138 100644
--- a/lib/java_frame.c
+++ b/lib/java_frame.c
@@ -18,7 +18,7 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "java_frame.h"
+#include "java/frame.h"
 #include "strbuf.h"
 #include "location.h"
 #include "utils.h"
diff --git a/lib/java_frame.h b/lib/java_frame.h
deleted file mode 100644
index b1be1c9..0000000
--- a/lib/java_frame.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
-    java_frame.h
-
-    Copyright (C) 2012  ABRT Team
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_JAVA_FRAME_H
-#define SATYR_JAVA_FRAME_H
-
-/**
- * @file
- * @brief java frame structure and related algorithms.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-struct sr_strbuf;
-struct sr_location;
-
-struct sr_java_frame
-{
-    enum sr_report_type type;
-
-    /**
-     * FQDN - Fully qualified domain name. Can be NULL.
-     *
-     * Method:
-     *   <Namespace>.<Type>.<Function name>
-     *
-     * Exception:
-     *   <Namespace>.<Type>
-     */
-    char *name;
-
-    /**
-     * A Java file. Can be NULL.
-     * (Always NULL if frame is exception)
-     */
-    char *file_name;
-
-    /**
-     * Line no. in the Java file. 0 is used when file_line is missing.
-     * (Always 0 if frame is exception)
-     */
-    uint32_t file_line;
-
-    /**
-     * A path to jar file or class file. Can be NULL.
-     * (Always NULL if frame is exception)
-     */
-    char *class_path;
-
-    /**
-     * True if method is native.
-     * (Always false if frame is exception)
-     */
-    bool is_native;
-
-    /**
-     * True if frame is exception.
-     */
-    bool is_exception;
-
-    /**
-     * Exception message. Can be NULL.
-     * (Always NULL if frame is NOT exception).
-     */
-    char *message;
-
-    struct sr_java_frame *next;
-};
-
-/**
- * Creates and initializes a new frame structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_java_frame_free().
- */
-struct sr_java_frame *
-sr_java_frame_new();
-
-/**
- * Creates and initializes a new exception in frame structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_java_frame_free().
- */
-struct sr_java_frame *
-sr_java_frame_new_exception();
-
-/**
- * Initializes all members of the frame structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a frame structure placed on the
- * stack.
- */
-void
-sr_java_frame_init(struct sr_java_frame *frame);
-
-/**
- * Releases the memory held by the frame. The frame siblings are not
- * released.
- * @param frame
- * If the frame is NULL, no operation is performed.
- */
-void
-sr_java_frame_free(struct sr_java_frame *frame);
-
-/**
- * Releases the memory held by the frame all its siblings.
- * @param frame
- * If the frame is NULL, no operation is performed.
- */
-void
-sr_java_frame_free_full(struct sr_java_frame *frame);
-
-/**
- * Gets a number of frame in list.
- * @param frame
- * If the frame is NULL, no operation is performed.
- * @returns
- * A number of frames.
- */
-struct sr_java_frame *
-sr_java_frame_get_last(struct sr_java_frame *frame);
-
-/**
- * Creates a duplicate of the frame.
- * @param frame
- * It must be non-NULL pointer. The frame is not modified by calling
- * this function.
- * @param siblings
- * Whether to duplicate also siblings referenced by frame->next.  If
- * false, frame->next is not duplicated for the new frame, but it is
- * set to NULL.
- * @returns
- * This function never returns NULL. The returned duplicate frame must
- * be released by calling the function sr_java_frame_free().
- */
-struct sr_java_frame *
-sr_java_frame_dup(struct sr_java_frame *frame,
-                  bool siblings);
-
-/**
- * Compares two frames.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_java_frame_cmp(struct sr_java_frame *frame1,
-                  struct sr_java_frame *frame2);
-
-/**
- * Compares two frames.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_java_frame_cmp_distance(struct sr_java_frame *frame1,
-                           struct sr_java_frame *frame2);
-
-
-/**
- * Appends the textual representation of the frame to the string
- * buffer.
- * @param frame
- * It must be a non-NULL pointer.  It's not modified by calling this
- * function.
- */
-void
-sr_java_frame_append_to_str(struct sr_java_frame *frame,
-                            struct sr_strbuf *dest);
-
-/**
- * If the input contains proper exception with frames, parse the exception,
- * move the input pointer after the exception, and return a structure
- * representing the exception. Otherwise to not modify the input pointer
- * and return NULL.
- * @param location
- * The caller must provide a pointer to struct sr_location here.  The
- * line and column members are gradually increased as the parser
- * handles the input, keep this in mind to get reasonable values.
- * When this function returns NULL (an error occurred), the structure
- * will contain the error line, column, and message.
- * @returns
- * NULL or newly allocated structure, which should be released by
- * calling sr_java_frame_free().
- */
-
-struct sr_java_frame *
-sr_java_frame_parse_exception(const char **input,
-                              struct sr_location *location);
-
-/**
- * If the input contains a complete frame, this function parses the
- * frame text, returns it in a structure, and moves the input pointer
- * after the frame.  If the input does not contain proper, complete
- * frame, the function does not modify input and returns NULL.
- * @returns
- * Allocated pointer with a frame structure. The pointer should be
- * released by sr_java_frame_free().
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  When this function returns NULL, the structure will contain
- * the error line, column, and message.  The line and column members
- * of the location are gradually increased as the parser handles the
- * input, so the location should be initialized before calling this
- * function to get reasonable values.
- */
-struct sr_java_frame *
-sr_java_frame_parse(const char **input,
-                    struct sr_location *location);
-
-/**
- * Returns a textual representation of the frame.
- * @param frame
- * It must be a non-NULL pointer.  It's not modified by calling this
- * function.
- */
-char *
-sr_java_frame_to_json(struct sr_java_frame *frame);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/java_stacktrace.c b/lib/java_stacktrace.c
index fa8af06..e05c0c6 100644
--- a/lib/java_stacktrace.c
+++ b/lib/java_stacktrace.c
@@ -18,9 +18,9 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "java_stacktrace.h"
-#include "java_thread.h"
-#include "java_frame.h"
+#include "java/stacktrace.h"
+#include "java/thread.h"
+#include "java/frame.h"
 #include "utils.h"
 #include "strbuf.h"
 #include <stdio.h>
diff --git a/lib/java_stacktrace.h b/lib/java_stacktrace.h
deleted file mode 100644
index ef16918..0000000
--- a/lib/java_stacktrace.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-    java_stacktrace.h
-
-    Copyright (C) 2012  ABRT Team
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_JAVA_STACKTRACE_H
-#define SATYR_JAVA_STACKTRACE_H
-
-/**
- * @file
- * @brief java stack trace structure and related algorithms.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct sr_java_thread;
-struct sr_location;
-
-#include "report_type.h"
-#include <stdint.h>
-
-struct sr_java_stacktrace
-{
-    enum sr_report_type type;
-
-    /**
-     * Threads of stack trace. Always non-NULL.
-     */
-    struct sr_java_thread *threads;
-};
-
-/**
- * Creates and initializes a new stacktrace structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_java_stacktrace_free().
- */
-struct sr_java_stacktrace *
-sr_java_stacktrace_new();
-
-/**
- * Initializes all members of the stacktrace structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a stacktrace structure placed on the
- * stack.
- */
-void
-sr_java_stacktrace_init(struct sr_java_stacktrace *stacktrace);
-
-/**
- * Releases the memory held by the stacktrace and its frames.
- * @param stacktrace
- * If the stacktrace is NULL, no operation is performed.
- */
-void
-sr_java_stacktrace_free(struct sr_java_stacktrace *stacktrace);
-
-/**
- * Creates a duplicate of the stacktrace.
- * @param stacktrace
- * The stacktrace to be copied. It's not modified by this function.
- * @returns
- * This function never returns NULL.  The returned duplicate must be
- * released by calling the function sr_java_stacktrace_free().
- */
-struct sr_java_stacktrace *
-sr_java_stacktrace_dup(struct sr_java_stacktrace *stacktrace);
-
-/**
- * Compares two stacktraces.
- * @returns
- * Returns 0 if the stacktraces are same.  Returns negative number if t1
- * is found to be 'less' than t2.  Returns positive number if t1 is
- * found to be 'greater' than t2.
- */
-int
-sr_java_stacktrace_cmp(struct sr_java_stacktrace *stacktrace1,
-                       struct sr_java_stacktrace *stacktrace2);
-
-/**
- * Parses a textual stack trace and puts it into a structure.  If
- * parsing fails, the input parameter is not changed and NULL is
- * returned.
- * @param input
- * Pointer to the string with the stacktrace. If this function returns
- * a non-NULL value, this pointer is modified to point after the
- * stacktrace that was just parsed.
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  The line and column members of the location are gradually
- * increased as the parser handles the input, so the location should
- * be initialized by sr_location_init() before calling this function
- * to get reasonable values.  When this function returns false (an
- * error occurred), the structure will contain the error line, column,
- * and message.
- * @returns
- * A newly allocated stacktrace structure or NULL. A stacktrace struct
- * is returned when at least one thread was parsed from the input and
- * no error occurred. The returned structure should be released by
- * sr_java_stacktrace_free().
- */
-struct sr_java_stacktrace *
-sr_java_stacktrace_parse(const char **input,
-                         struct sr_location *location);
-
-/**
- * Returns brief, human-readable explanation of the stacktrace.
- */
-char *
-sr_java_stacktrace_get_reason(struct sr_java_stacktrace *stacktrace);
-
-/**
- * Serializes stacktrace to string.
- * @returnes
- * Newly allocated memory containing the textual representation of the
- * provided stacktrace.  Caller should free the memory when it's no
- * longer needed.
- */
-char *
-sr_java_stacktrace_to_json(struct sr_java_stacktrace *stacktrace);
-
-struct sr_java_thread *
-sr_java_find_crash_thread(struct sr_java_stacktrace *stacktrace);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/java_thread.c b/lib/java_thread.c
index fbc7bc3..c578e74 100644
--- a/lib/java_thread.c
+++ b/lib/java_thread.c
@@ -18,8 +18,8 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "java_thread.h"
-#include "java_frame.h"
+#include "java/thread.h"
+#include "java/frame.h"
 #include "location.h"
 #include "utils.h"
 #include "strbuf.h"
diff --git a/lib/java_thread.h b/lib/java_thread.h
deleted file mode 100644
index 0fd8c6e..0000000
--- a/lib/java_thread.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
-    java_thread.h
-
-    Copyright (C) 2012  ABRT Team
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_JAVA_THREAD_H
-#define SATYR_JAVA_THREAD_H
-
-/**
- * @file
- * @brief Single thread of execution of JAVA stack trace.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-struct sr_java_frame;
-struct sr_strbuf;
-struct sr_location;
-
-/**
- * @brief A thread of execution of a JAVA-produced stack trace.
- *
- * Represents a thread containing frames.
- */
-struct sr_java_thread
-{
-    enum sr_report_type type;
-
-    /**
-     * Thread name. Can be NULL
-     */
-    char *name;
-
-    /**
-     * Thread's exceptiopn. Can be NULL
-     */
-    struct sr_java_frame *frames;
-
-    /**
-     * A sibling thread, or NULL if this is the last thread in a
-     * stacktrace.
-     */
-    struct sr_java_thread *next;
-};
-
-/**
- * Creates and initializes a new frame structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_java_thread_free().
- */
-struct sr_java_thread *
-sr_java_thread_new();
-
-/**
- * Initializes all members of the thread to default values.
- * No memory is released, members are simply overwritten.
- * This is useful for initializing a thread structure placed on the
- * stack.
- */
-void
-sr_java_thread_init(struct sr_java_thread *thread);
-
-/**
- * Releases the memory held by the thread. The thread siblings are not
- * released.
- * @param thread
- * If thread is NULL, no operation is performed.
- */
-void
-sr_java_thread_free(struct sr_java_thread *thread);
-
-/**
- * Creates a duplicate of the thread.
- * @param thread
- * It must be non-NULL pointer. The thread is not modified by calling
- * this function.
- * @param siblings
- * Whether to duplicate also siblings referenced by thread->next. If
- * false, thread->next is not duplicated for the new exception, but it is
- * set to NULL.
- */
-struct sr_java_thread *
-sr_java_thread_dup(struct sr_java_thread *thread,
-                   bool siblings);
-
-/**
- * Compares two threads. When comparing the threads, it compares also
- * their frames.
- * @returns
- * Returns 0 if the threads are same.  Returns negative number if t1
- * is found to be 'less' than t2.  Returns positive number if t1 is
- * found to be 'greater' than t2.
- */
-int
-sr_java_thread_cmp(struct sr_java_thread *thread1,
-                   struct sr_java_thread *thread2);
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' thread.
- */
-struct sr_java_thread *
-sr_java_thread_append(struct sr_java_thread *dest,
-                      struct sr_java_thread *item);
-
-/**
- * Counts the number of 'good' frames and the number of all frames in
- * a thread. Good means that the function name is known (so it's not
- * just '??').
- * @param ok_count
- * @param all_count
- * Not zeroed. This function just adds the numbers to ok_count and
- * all_count.
- */
-void
-sr_java_thread_quality_counts(struct sr_java_thread *thread,
-                              int *ok_count,
-                              int *all_count);
-
-/**
- * Returns the quality of the thread. The quality is the ratio of the
- * number of frames with function name fully known to the number of
- * all frames.  This function does not take into account that some
- * frames are more important than others.
- * @param thread
- * Must be a non-NULL pointer. It's not modified in this function.
- * @returns
- * A number between 0 and 1. 0 means the lowest quality, 1 means full
- * thread stacktrace is known. If the thread contains no frames, this
- * function returns 1.
- */
-float
-sr_java_thread_quality(struct sr_java_thread *thread);
-
-/**
- * Removes the frame from the thread and then deletes it.
- * @returns
- * True if the frame was found in the thread and removed and deleted.
- * False if the frame was not found in the thread.
- */
-bool
-sr_java_thread_remove_frame(struct sr_java_thread *thread,
-                            struct sr_java_frame *frame);
-
-/**
- * Removes all the frames from the thread that are above certain
- * frame.
- * @returns
- * True if the frame was found, and all the frames that were above the
- * frame in the thread were removed from the thread and then deleted.
- * False if the frame was not found in the thread.
- */
-bool
-sr_java_thread_remove_frames_above(struct sr_java_thread *thread,
-                                   struct sr_java_frame *frame);
-
-/**
- * Keeps only the top n frames in the thread.
- */
-void
-sr_java_thread_remove_frames_below_n(struct sr_java_thread *thread,
-                                     int n);
-
-/**
- * Appends a textual representation of 'thread' to the 'str'.
- */
-void
-sr_java_thread_append_to_str(struct sr_java_thread *thread,
-                             struct sr_strbuf *dest);
-
-/**
- * If the input contains proper thread with frames, parse the thread,
- * move the input pointer after the thread, and return a structure
- * representing the thread.  Otherwise to not modify the input pointer
- * and return NULL.
- * @param location
- * The caller must provide a pointer to struct sr_location here.  The
- * line and column members are gradually increased as the parser
- * handles the input, keep this in mind to get reasonable values.
- * When this function returns NULL (an error occurred), the structure
- * will contain the error line, column, and message.
- * @returns
- * NULL or newly allocated structure, which should be released by
- * calling sr_java_thread_free().
- */
-struct sr_java_thread *
-sr_java_thread_parse(const char **input,
-                     struct sr_location *location);
-
-/**
- * Prepare a string representing thread which contains just the function
- * and library names. This can be used to store only data necessary for
- * comparison.
- * @returns
- * Newly allocated string, which should be released by
- * calling free().
- */
-char *
-sr_java_thread_format_funs(struct sr_java_thread *thread);
-
-char *
-sr_java_thread_to_json(struct sr_java_thread *thread);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/json.h b/lib/json.h
deleted file mode 100644
index 99370df..0000000
--- a/lib/json.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-    json.h
-
-    Copyright (C) 2012  James McLaughlin et al.
-    https://github.com/udp/json-parser
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions
-    are met:
-
-    1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-
-    2. Redistributions in binary form must reproduce the above
-    copyright notice, this list of conditions and the following
-    disclaimer in the documentation and/or other materials provided
-    with the distribution.
-
-    THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
-    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-    PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR
-    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-    USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-    AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-    POSSIBILITY OF SUCH DAMAGE.
-*/
-#ifndef SATYR_JSON_H
-#define SATYR_JSON_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct sr_location;
-struct sr_strbuf;
-
-struct sr_json_settings
-{
-   unsigned long max_memory;
-   int settings;
-};
-
-#define SR_JSON_RELAXED_COMMAS 1
-
-enum sr_json_type
-{
-   SR_JSON_NONE,
-   SR_JSON_OBJECT,
-   SR_JSON_ARRAY,
-   SR_JSON_INTEGER,
-   SR_JSON_DOUBLE,
-   SR_JSON_STRING,
-   SR_JSON_BOOLEAN,
-   SR_JSON_NULL
-};
-
-extern const struct sr_json_value
-sr_json_value_none;
-
-struct sr_json_value
-{
-   struct sr_json_value *parent;
-   enum sr_json_type type;
-
-   union
-   {
-      int boolean;
-      long long integer;
-      double dbl;
-
-      struct
-      {
-         unsigned length;
-
-          /* null terminated */
-         char *ptr;
-      } string;
-
-      struct
-      {
-         unsigned length;
-
-         struct
-         {
-            char *name;
-            struct sr_json_value *value;
-         } *values;
-
-      } object;
-
-      struct
-      {
-         unsigned length;
-         struct sr_json_value **values;
-      } array;
-   } u;
-
-   union
-   {
-      struct sr_json_value *next_alloc;
-      void *object_mem;
-   } _reserved;
-};
-
-struct sr_json_value *
-sr_json_parse(const char *json);
-
-struct sr_json_value *
-sr_json_parse_ex(struct sr_json_settings *settings,
-                 const char *json,
-                 struct sr_location *location);
-
-void
-sr_json_value_free(struct sr_json_value *value);
-
-char *
-sr_json_escape(const char *text);
-
-struct sr_strbuf*
-sr_json_append_escaped(struct sr_strbuf *strbuf, const char *str);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif
diff --git a/lib/koops_frame.c b/lib/koops_frame.c
index eb1677b..15d6473 100644
--- a/lib/koops_frame.c
+++ b/lib/koops_frame.c
@@ -17,7 +17,7 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "koops_frame.h"
+#include "koops/frame.h"
 #include "utils.h"
 #include "strbuf.h"
 #include "json.h"
diff --git a/lib/koops_frame.h b/lib/koops_frame.h
deleted file mode 100644
index 269fb73..0000000
--- a/lib/koops_frame.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
-    koops_frame.h
-
-    Copyright (C) 2012  ABRT Team
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_KOOPS_FRAME_H
-#define SATYR_KOOPS_FRAME_H
-
-/**
- * @file
- * @brief Kernel oops stack frame.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-struct sr_strbuf;
-
-/**
- * @brief Kernel oops stack frame.
- */
-struct sr_koops_frame
-{
-    enum sr_report_type type;
-
-    /**
-     * Address of the function in memory.  It is set to 0 when the
-     * address is not available.  In such a case, function_name is
-     * available.
-     */
-    uint64_t address;
-
-    /**
-     * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=arch/x86/kernel/dumpstack.c
-     * printk_address(unsigned long address, int reliable)
-     */
-    bool reliable;
-
-    /**
-     * Might be NULL.  If it is null, address must be set.
-     */
-    char *function_name;
-
-    uint64_t function_offset;
-
-    uint64_t function_length;
-
-    /**
-     * Might be NULL.
-     */
-    char *module_name;
-
-    /**
-     * It is set to 0 when the address is not available.
-     */
-    uint64_t from_address;
-
-    /**
-     * Might be NULL.
-     */
-    char *from_function_name;
-
-    uint64_t from_function_offset;
-
-    uint64_t from_function_length;
-
-    /**
-     * Might be NULL.
-     */
-    char *from_module_name;
-
-    struct sr_koops_frame *next;
-};
-
-/**
- * Creates and initializes a new frame structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_koops_frame_free().
- */
-struct sr_koops_frame *
-sr_koops_frame_new();
-
-/**
- * Initializes all members of the frame structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a frame structure placed on the
- * stack.
- */
-void
-sr_koops_frame_init(struct sr_koops_frame *frame);
-
-/**
- * Releases the memory held by the frame. The frame siblings are not
- * released.
- * @param frame
- * If the frame is NULL, no operation is performed.
- */
-void
-sr_koops_frame_free(struct sr_koops_frame *frame);
-
-/**
- * Creates a duplicate of the frame.
- * @param frame
- * It must be non-NULL pointer. The frame is not modified by calling
- * this function.
- * @param siblings
- * Whether to duplicate also siblings referenced by frame->next.  If
- * false, frame->next is not duplicated for the new frame, but it is
- * set to NULL.
- * @returns
- * This function never returns NULL. The returned duplicate frame must
- * be released by calling the function sr_koops_frame_free().
- */
-struct sr_koops_frame *
-sr_koops_frame_dup(struct sr_koops_frame *frame,
-                   bool siblings);
-
-/**
- * Compares two frames.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_koops_frame_cmp(struct sr_koops_frame *frame1,
-                   struct sr_koops_frame *frame2);
-
-/**
- * Compares two frames.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_koops_frame_cmp_distance(struct sr_koops_frame *frame1,
-                            struct sr_koops_frame *frame2);
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' frame.  If 'dest' is NULL, it
- * returns the 'item' frame.
- */
-struct sr_koops_frame *
-sr_koops_frame_append(struct sr_koops_frame *dest,
-                      struct sr_koops_frame *item);
-
-struct sr_koops_frame *
-sr_koops_frame_prepend(struct sr_koops_frame *dest,
-                       struct sr_koops_frame *item);
-
-struct sr_koops_frame *
-sr_koops_frame_parse(const char **input);
-
-/**
- * Timestamp may be present in the oops lines.
- * @example
- * [123456.654321]
- * [   65.470000]
- */
-bool
-sr_koops_skip_timestamp(const char **input);
-
-bool
-sr_koops_parse_address(const char **input, uint64_t *address);
-
-bool
-sr_koops_parse_module_name(const char **input,
-                           char **module_name);
-
-bool
-sr_koops_parse_function(const char **input,
-                        char **function_name,
-                        uint64_t *function_offset,
-                        uint64_t *function_length,
-                        char **module_name);
-
-/**
- * Returns a textual representation of the frame.
- * @param frame
- * It must be a non-NULL pointer.  It's not modified by calling this
- * function.
- */
-char *
-sr_koops_frame_to_json(struct sr_koops_frame *frame);
-
-/**
- * Appends textual representation of the frame to the string buffer dest.
- */
-void
-sr_koops_frame_append_to_str(struct sr_koops_frame *frame,
-                             struct sr_strbuf *dest);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/koops_stacktrace.c b/lib/koops_stacktrace.c
index 822d99a..c9a249a 100644
--- a/lib/koops_stacktrace.c
+++ b/lib/koops_stacktrace.c
@@ -17,8 +17,8 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "koops_stacktrace.h"
-#include "koops_frame.h"
+#include "koops/stacktrace.h"
+#include "koops/frame.h"
 #include "utils.h"
 #include "json.h"
 #include "strbuf.h"
diff --git a/lib/koops_stacktrace.h b/lib/koops_stacktrace.h
deleted file mode 100644
index 580610f..0000000
--- a/lib/koops_stacktrace.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-    koops_stacktrace.h
-
-    Copyright (C) 2012  ABRT Team
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_KOOPS_STACKTRACE_H
-#define SATYR_KOOPS_STACKTRACE_H
-
-/**
- * @file
- * @brief Kernel oops stack trace structure and related algorithms.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-#include <inttypes.h>
-#include <stddef.h>
-
-struct sr_location;
-
-struct sr_koops_stacktrace
-{
-    enum sr_report_type type;
-
-    /**
-     * @brief Version of the kernel.
-     */
-    char *version;
-
-    /**
-     * http://www.mjmwired.net/kernel/Documentation/oops-tracing.txt
-     */
-
-    bool taint_module_proprietary;
-    bool taint_module_out_of_tree;
-    bool taint_forced_module;
-    bool taint_forced_removal;
-    bool taint_smp_unsafe;
-    /** A machine check exception has been raised. */
-    bool taint_mce;
-    /** A process has been found in a bad page state.*/
-    bool taint_page_release;
-    bool taint_userspace;
-    bool taint_died_recently;
-    bool taint_acpi_overridden;
-    bool taint_warning;
-    bool taint_staging_driver;
-    bool taint_firmware_workaround;
-
-    /**
-     * @brief List of loaded modules.
-     *
-     * It might be NULL as it is sometimes not included in a
-     * kerneloops.
-     */
-    char **modules;
-
-    /**
-     * @brief Call trace.  It might be NULL as it is not mandatory.
-     */
-    struct sr_koops_frame *frames;
-};
-
-/**
- * Creates and initializes a new stack trace structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_koops_stacktrace_free().
- */
-struct sr_koops_stacktrace *
-sr_koops_stacktrace_new();
-
-/**
- * Initializes all members of the stacktrace structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a stacktrace structure placed on the
- * stack.
- */
-void
-sr_koops_stacktrace_init(struct sr_koops_stacktrace *stacktrace);
-
-/**
- * Releases the memory held by the stacktrace.
- * @param stacktrace
- * If the stacktrace is NULL, no operation is performed.
- */
-void
-sr_koops_stacktrace_free(struct sr_koops_stacktrace *stacktrace);
-
-/**
- * Creates a duplicate of a stacktrace.
- * @param stacktrace
- * The stacktrace to be copied. It's not modified by this function.
- * @returns
- * This function never returns NULL.  The returned duplicate must be
- * released by calling the function sr_koops_stacktrace_free().
- */
-struct sr_koops_stacktrace *
-sr_koops_stacktrace_dup(struct sr_koops_stacktrace *stacktrace);
-
-/**
- * Removes the frame from the stack trace and then deletes it.
- * @returns
- * True if the frame was found in the thread and removed and deleted.
- * False if the frame was not found in the thread.
- */
-bool
-sr_koops_stacktrace_remove_frame(struct sr_koops_stacktrace *stacktrace,
-                                 struct sr_koops_frame *frame);
-
-/**
- * Parses a textual kernel oops and puts it into a structure.  If
- * parsing fails, the input parameter is not changed and NULL is
- * returned.
- * @param input
- * Pointer to the string with the kernel oops. If this function
- * returns a non-NULL value, the input pointer is modified to point
- * after the stacktrace that was just parsed.
- */
-struct sr_koops_stacktrace *
-sr_koops_stacktrace_parse(const char **input,
-                          struct sr_location *location);
-
-char **
-sr_koops_stacktrace_parse_modules(const char **input);
-
-/**
- * Returns brief, human-readable explanation of the stacktrace.
- */
-char *
-sr_koops_stacktrace_get_reason(struct sr_koops_stacktrace *stacktrace);
-
-/**
- * Serializes stacktrace to string.
- * @returns
- * Newly allocated memory containing the textual representation of the
- * provided stacktrace.  Caller should free the memory when it's no
- * longer needed.
- */
-char *
-sr_koops_stacktrace_to_json(struct sr_koops_stacktrace *stacktrace);
-
-
-/* TODO: this needs to go in a _private_ header and should not be exported */
-struct sr_taint_flag
-{
-    char letter;
-    size_t member_offset;
-    char *name;
-};
-extern struct sr_taint_flag sr_flags[];
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/location.h b/lib/location.h
deleted file mode 100644
index 94a85c6..0000000
--- a/lib/location.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-    location.h
-
-    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.
-*/
-#ifndef SATYR_LOCATION_H
-#define SATYR_LOCATION_H
-
-/**
- * @file
- * @brief Parser location in input file.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-
-/**
- * @brief A location of a parser in the input stream.
- *
- * A location in the stacktrace file with an attached message.
- * It's used for error reporting: the line and the column points to
- * the place where a parser error occurred, and the message explains
- * what the parser expected and didn't find on that place.
- */
-struct sr_location
-{
-    /** Starts from 1. */
-    int line;
-    /** Starts from 0. */
-    int column;
-    /**
-     * Error message related to the line and column.  Do not release
-     * the memory this pointer points to.
-     */
-    const char *message;
-};
-
-/**
- * Initializes all members of the location struct to their default
- * values.  No memory is allocated or released by this function.
- */
-void
-sr_location_init(struct sr_location *location);
-
-/**
- * Compare two locations.
- * @param location1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param location2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param compare_messages
- * Indicates whether to compare messages in the locations as well.
- * @returns
- * Returns 0 if the locations are same.  Returns negative number if
- * location1 is found to be 'less' than location2.  Returns positive
- * number if location1 is found to be 'greater' than location2.
- *
- * 'Less' and 'greater' take lines into account first. If a location1
- * line is lower than location2 line, location1 is considered 'less'
- * than location2. If the lines are the same, columns are compared.
- * When compare_messages is true and lines and columns are equal, the
- * locations' messages are compared according to the lexicographical
- * order.
- */
-int
-sr_location_cmp(struct sr_location *location1,
-                struct sr_location *location2,
-                bool compare_messages);
-
-/**
- * Creates a string representation of location.
- * User must delete the returned string using free().
- */
-char *
-sr_location_to_string(struct sr_location *location);
-
-/**
- * Adds a line and a column to specific location.
- * @note
- * If the line is not 1 (meaning the first line), the column in the
- * location structure is overwritten by the provided add_column value.
- * Otherwise the add_column value is added to the column member of the
- * location structure.
- * @param location
- * The structure to be modified. It must be a valid pointer.
- * @param add_line
- * Starts from 1. It means that if add_line is 1, the line member of the
- * location structure is not changed.
- * @param add_column
- * Starts from 0.
- */
-void
-sr_location_add(struct sr_location *location,
-                int add_line,
-                int add_column);
-
-/**
- * Adds a line column pair to another line column pair.
- * @note
- * If the add_line is not 1 (meaning the frist line), the column is
- * overwritten by the provided add_column value.  Otherwise the
- * add_column value is added to the column.
- * @param add_line
- * Starts from 1. It means that if add_line is 1, the line is not
- * changed.
- * @param add_column
- * Starts from 0.
- */
-void
-sr_location_add_ext(int *line,
-                    int *column,
-                    int add_line,
-                    int add_column);
-
-/**
- * Updates the line and column of the location by moving "after" the
- * char c. If c is a newline character, the line number is increased
- * and the column is set to 0. Otherwise the column is increased by 1.
- */
-void
-sr_location_eat_char(struct sr_location *location,
-                     char c);
-
-/**
- * Updates the line and the column by moving "after" the char c. If c
- * is a newline character, the line number is increased and the column
- * is set to 0. Otherwise the column is increased.
- * @param line
- * Must be a valid pointer.
- * @param column
- * Must be a valid pointer.
- */
-void
-sr_location_eat_char_ext(int *line,
-                         int *column,
-                         char c);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/metrics.c b/lib/metrics.c
index 512ca97..40fa87a 100644
--- a/lib/metrics.c
+++ b/lib/metrics.c
@@ -17,8 +17,8 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "gdb_thread.h"
-#include "gdb_frame.h"
+#include "gdb/thread.h"
+#include "gdb/frame.h"
 #include "utils.h"
 #include "metrics.h"
 #include "normalize.h"
diff --git a/lib/metrics.h b/lib/metrics.h
deleted file mode 100644
index 9deddf4..0000000
--- a/lib/metrics.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-    metrics.h
-
-    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.
-*/
-#ifndef SATYR_METRICS_H
-#define SATYR_METRICS_H
-
-/**
- * @file
- * @brief Distance between stack trace threads.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-
-struct sr_gdb_frame;
-struct sr_gdb_thread;
-
-/* Jaro-Winkler distance:
- *
- * Gets number of matching function names(match_count) from both
- * threads and number of transpositions in place(trans_count) if the
- * transpositioned function names are not farther away than
- * frame_count/2 - 1.  Then computes the Jaro-Winkler distance
- * according to the formula.  NOTE: The Jaro-Winkler distance is not a
- * metric distance as it does not satisfy the triangle inequality.
- * Returns a number between 0 and 1: 0 = no similarity, 1 = similar
- * threads
- */
-float
-sr_gdb_thread_jarowinkler_distance(struct sr_gdb_thread *thread1,
-                                   struct sr_gdb_thread *thread2);
-
-
-/* Jaccard distance:
- *
- * Gives a number representing the difference of the size of the
- * intersection and union divided by the size of the union of two
- * threads.  Function names positions in the thread are not taken into
- * account.  Returns a number between 0 and 1: 0 = similar threads, 1
- * = no similarity
- */
-float
-sr_gdb_thread_jaccard_distance(struct sr_gdb_thread *thread1,
-                               struct sr_gdb_thread *thread2);
-
-
-/* Levenshtein distance:
- *
- * Computes the distance of two threads creating a matrix of distances
- * between all the frames in each thread.  Returns a number
- * representing how many function names need to be different in one
- * thread to match all the function names in second thread at each
- * respective positions or how many function names need to be
- * different/transpositioned to have a match if the transposition
- * argument is enabled.  NOTE: With transpositions enabled the
- * triangle inequality does not hold.  The distance is always between
- * 0 and n, where n is the frame count of longer thread 0 = similar
- * threads, n = no similar function names
- */
-int
-sr_gdb_thread_levenshtein_distance(struct sr_gdb_thread *thread1,
-                                   struct sr_gdb_thread *thread2,
-                                   bool transposition);
-
-/* Levenshtein distance returned with transpositions enabled and
- * returned in interval [0, 1].
- */
-float
-sr_gdb_thread_levenshtein_distance_f(struct sr_gdb_thread *thread1,
-                                     struct sr_gdb_thread *thread2);
-
-typedef int (*sr_gdb_frame_cmp_type)(struct sr_gdb_frame*,
-                                     struct sr_gdb_frame*);
-
-/* Following three functions are equivalent to the three above except
- * that they take frame comparison function as an argument argument
- */
-float
-sr_gdb_thread_jarowinkler_distance_custom(struct sr_gdb_thread *thread1,
-                                          struct sr_gdb_thread *thread2,
-                                          sr_gdb_frame_cmp_type compare_func);
-
-float
-sr_gdb_thread_jaccard_distance_custom(struct sr_gdb_thread *thread1,
-                                      struct sr_gdb_thread *thread2,
-                                      sr_gdb_frame_cmp_type compare_func);
-
-int
-sr_gdb_thread_levenshtein_distance_custom(struct sr_gdb_thread *thread1,
-                                          struct sr_gdb_thread *thread2,
-                                          bool transposition,
-                                          sr_gdb_frame_cmp_type compare_func);
-
-/**
- * @brief A distance matrix of stack trace threads.
- *
- * The distances are stored in a m-by-n two-dimensional array, where
- * only entries (i, j) where i < j are actually stored.
- */
-struct sr_distances
-{
-    int m;
-    int n;
-    float *distances;
-};
-
-/**
- * Creates and initializes a new distances structure.
- * @param m
- * Number of rows.
- * @param n
- * Number of columns.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_distances_free().
- */
-struct sr_distances *
-sr_distances_new(int m, int n);
-
-/**
- * Creates a duplicate of the distances structure.
- * @param distances
- * It must be non-NULL pointer. The structure is not modified by calling
- * this function.
- * @returns
- * This function never returns NULL.
- */
-struct sr_distances *
-sr_distances_dup(struct sr_distances *distances);
-
-/**
- * Releases the memory held by the distances structure.
- * @param distances
- * If the distances is NULL, no operation is performed.
- */
-void
-sr_distances_free(struct sr_distances *distances);
-
-/**
- * Gets the entry (i, j) from the distance matrix.
- * @param distances
- * It must be non-NULL pointer.
- * @param i
- * Row in the matrix.
- * @param j
- * Column in the matrix.
- * @returns
- * For entries (i, i) zero distance is returned and values returned for
- * entries (i, j) and (j, i) are the same.
- */
-float
-sr_distances_get_distance(struct sr_distances *distances, int i, int j);
-
-/**
- * Sets the entry (i, j) from the distance matrix.
- * @param distances
- * It must be non-NULL pointer.
- * @param i
- * Row in the matrix.
- * @param j
- * Column in the matrix.
- * @param d
- * Distance.
- */
-void
-sr_distances_set_distance(struct sr_distances *distances,
-                          int i,
-                          int j,
-                          float d);
-
-/**
- * A function which compares two threads.
- */
-typedef float (*sr_dist_thread_type)(struct sr_gdb_thread *,
-                                     struct sr_gdb_thread *);
-
-/**
- * Creates a distances structure by comparing threads.
- * @param threads
- * Array of threads. They are not modified by calling this function.
- * @param m
- * Compare first m threads from the array with other threads.
- * @param n
- * Number of threads in the passed array.
- * @param dist_func
- * Distance function which will be used to compare the threads. It's assumed to
- * be symmetric and return zero distance for equal threads.
- * @returns
- * This function never returns NULL.
- */
-struct sr_distances *
-sr_gdb_threads_compare(struct sr_gdb_thread **threads,
-                       int m, int n,
-                       sr_dist_thread_type dist_func);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/normalize.c b/lib/normalize.c
index 754da54..9582a5f 100644
--- a/lib/normalize.c
+++ b/lib/normalize.c
@@ -18,11 +18,11 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 #include "normalize.h"
-#include "gdb_frame.h"
-#include "gdb_thread.h"
-#include "gdb_stacktrace.h"
-#include "koops_frame.h"
-#include "koops_stacktrace.h"
+#include "gdb/frame.h"
+#include "gdb/thread.h"
+#include "gdb/stacktrace.h"
+#include "koops/frame.h"
+#include "koops/stacktrace.h"
 #include "utils.h"
 #include <string.h>
 #include <assert.h>
diff --git a/lib/normalize.h b/lib/normalize.h
deleted file mode 100644
index c93595f..0000000
--- a/lib/normalize.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-    normalize.h
-
-    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.
-*/
-#ifndef SATYR_NORMALIZE_H
-#define SATYR_NORMALIZE_H
-
-/**
- * @file
- * @brief Normalization of stack traces.
- *
- * Normalization changes stack traces with respect to similarity by
- * removing unnecessary differences.  Normalized stack traces can be
- * used to compute clusters and similarity of stack traces.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct sr_gdb_frame;
-struct sr_gdb_thread;
-struct sr_gdb_stacktrace;
-struct sr_core_frame;
-struct sr_core_thread;
-struct sr_core_stacktrace;
-struct sr_koops_stacktrace;
-
-void
-sr_normalize_gdb_thread(struct sr_gdb_thread *thread);
-
-void
-sr_normalize_gdb_stacktrace(struct sr_gdb_stacktrace *stacktrace);
-
-void
-sr_normalize_koops_stacktrace(struct sr_koops_stacktrace *stacktrace);
-
-// TODO: move to gdb_stacktrace.h
-/**
- * Checks whether the thread it contains some function used to exit
- * application.  If a frame with the function is found, it is
- * returned.  If there are multiple frames with abort function, the
- * lowest one is returned.
- * @returns
- * Returns NULL if such a frame is not found.
- */
-struct sr_gdb_frame *
-sr_glibc_thread_find_exit_frame(struct sr_gdb_thread *thread);
-
-// TODO: move to metrics.h
-/**
- * Renames unknown function names ("??") that are between the same
- * function names to be treated as similar in later comparison.
- * Leaves unpair unknown functions unchanged.
- */
-void
-sr_normalize_gdb_paired_unknown_function_names(struct sr_gdb_thread *thread1,
-                                               struct sr_gdb_thread *thread2);
-
-// TODO: merge into normalization or something else
-/**
- * Remove frames which are not interesting in comparison with other threads.
- */
-void
-sr_gdb_normalize_optimize_thread(struct sr_gdb_thread *thread);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/operating_system.h b/lib/operating_system.h
deleted file mode 100644
index a2f5e2c..0000000
--- a/lib/operating_system.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-    operating_system.h
-
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_OPERATING_SYSTEM_H
-#define SATYR_OPERATING_SYSTEM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <inttypes.h>
-#include <stdbool.h>
-
-struct sr_operating_system
-{
-    char *name;
-    char *version;
-    char *architecture;
-    /* Uptime in seconds. */
-    uint64_t uptime;
-};
-
-struct sr_operating_system *
-sr_operating_system_new();
-
-void
-sr_operating_system_init(struct sr_operating_system *operating_system);
-
-void
-sr_operating_system_free(struct sr_operating_system *operating_system);
-
-char *
-sr_operating_system_to_json(struct sr_operating_system *operating_system);
-
-bool
-sr_operating_system_parse_etc_system_release(const char *etc_system_release,
-                                             char **name,
-                                             char **version);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/python_frame.c b/lib/python_frame.c
index ecc9f76..4f43ad4 100644
--- a/lib/python_frame.c
+++ b/lib/python_frame.c
@@ -17,7 +17,7 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "python_frame.h"
+#include "python/frame.h"
 #include "utils.h"
 #include "location.h"
 #include "strbuf.h"
diff --git a/lib/python_frame.h b/lib/python_frame.h
deleted file mode 100644
index a02a6b1..0000000
--- a/lib/python_frame.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
-    python_frame.h
-
-    Copyright (C) 2012  ABRT Team
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_PYTHON_FRAME_H
-#define SATYR_PYTHON_FRAME_H
-
-/**
- * @file
- * @brief Python frame structure and related algorithms.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-struct sr_location;
-struct sr_strbuf;
-
-struct sr_python_frame
-{
-    enum sr_report_type type;
-
-    bool special_file;
-
-    char *file_name;
-
-    uint32_t file_line;
-
-    bool special_function;
-
-    char *function_name;
-
-    char *line_contents;
-
-    struct sr_python_frame *next;
-};
-
-/**
- * Creates and initializes a new frame structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_python_frame_free().
- */
-struct sr_python_frame *
-sr_python_frame_new();
-
-/**
- * Initializes all members of the frame structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a frame structure placed on the
- * stack.
- */
-void
-sr_python_frame_init(struct sr_python_frame *frame);
-
-/**
- * Releases the memory held by the frame. The frame siblings are not
- * released.
- * @param frame
- * If the frame is NULL, no operation is performed.
- */
-void
-sr_python_frame_free(struct sr_python_frame *frame);
-
-/**
- * Creates a duplicate of the frame.
- * @param frame
- * It must be non-NULL pointer. The frame is not modified by calling
- * this function.
- * @param siblings
- * Whether to duplicate also siblings referenced by frame->next.  If
- * false, frame->next is not duplicated for the new frame, but it is
- * set to NULL.
- * @returns
- * This function never returns NULL. The returned duplicate frame must
- * be released by calling the function sr_python_frame_free().
- */
-struct sr_python_frame *
-sr_python_frame_dup(struct sr_python_frame *frame,
-                    bool siblings);
-
-/**
- * Compares two python frames.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_python_frame_cmp(struct sr_python_frame *frame1,
-                    struct sr_python_frame *frame2);
-
-/**
- * Compares two python frames.
- * @param frame1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param frame2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the frames are same.  Returns negative number if
- * frame1 is found to be 'less' than frame2.  Returns positive number
- * if frame1 is found to be 'greater' than frame2.
- */
-int
-sr_python_frame_cmp_distance(struct sr_python_frame *frame1,
-                             struct sr_python_frame *frame2);
-
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' frame.  If 'dest' is NULL, it
- * returns the 'item' frame.
- */
-struct sr_python_frame *
-sr_python_frame_append(struct sr_python_frame *dest,
-                       struct sr_python_frame *item);
-
-/**
- * If the input contains a complete frame, this function parses the
- * frame text, returns it in a structure, and moves the input pointer
- * after the frame.  If the input does not contain proper, complete
- * frame, the function does not modify input and returns NULL.
- * @returns
- * Allocated pointer with a frame structure. The pointer should be
- * released by sr_python_frame_free().
- * @param location
- * The caller must provide a pointer to an instance of sr_location
- * here.  When this function returns NULL, the structure will contain
- * the error line, column, and message.  The line and column members
- * of the location are gradually increased as the parser handles the
- * input, so the location should be initialized before calling this
- * function to get reasonable values.
- */
-struct sr_python_frame *
-sr_python_frame_parse(const char **input,
-                      struct sr_location *location);
-
-/**
- * Returns a textual representation of the frame.
- * @param frame
- * It must be a non-NULL pointer.  It's not modified by calling this
- * function.
- */
-char *
-sr_python_frame_to_json(struct sr_python_frame *frame);
-
-/**
- * Appends textual representation of the frame to the string buffer dest.
- */
-void
-sr_python_frame_append_to_str(struct sr_python_frame *frame,
-                              struct sr_strbuf *dest);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/python_stacktrace.c b/lib/python_stacktrace.c
index 6659f02..bdc162b 100644
--- a/lib/python_stacktrace.c
+++ b/lib/python_stacktrace.c
@@ -17,8 +17,8 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "python_stacktrace.h"
-#include "python_frame.h"
+#include "python/stacktrace.h"
+#include "python/frame.h"
 #include "location.h"
 #include "utils.h"
 #include "json.h"
diff --git a/lib/python_stacktrace.h b/lib/python_stacktrace.h
deleted file mode 100644
index 22c9f02..0000000
--- a/lib/python_stacktrace.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-    python_stacktrace.h
-
-    Copyright (C) 2012  ABRT Team
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_PYTHON_STACKTRACE_H
-#define SATYR_PYTHON_STACKTRACE_H
-
-/**
- * @file
- * @brief Python stack trace structure and related algorithms.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <stdint.h>
-
-struct sr_python_frame;
-struct sr_location;
-
-struct sr_python_stacktrace
-{
-    enum sr_report_type type;
-
-    /* Exception class name. */
-    char *exception_name;
-
-    struct sr_python_frame *frames;
-};
-
-/**
- * Creates and initializes a new stacktrace structure.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_python_stacktrace_free().
- */
-struct sr_python_stacktrace *
-sr_python_stacktrace_new();
-
-/**
- * Initializes all members of the stacktrace structure to their default
- * values.  No memory is released, members are simply overwritten.
- * This is useful for initializing a stacktrace structure placed on the
- * stack.
- */
-void
-sr_python_stacktrace_init(struct sr_python_stacktrace *stacktrace);
-
-/**
- * Releases the memory held by the stacktrace and its frames.
- * @param stacktrace
- * If the stacktrace is NULL, no operation is performed.
- */
-void
-sr_python_stacktrace_free(struct sr_python_stacktrace *stacktrace);
-
-/**
- * Creates a duplicate of the stacktrace.
- * @param stacktrace
- * The stacktrace to be copied. It's not modified by this function.
- * @returns
- * This function never returns NULL.  The returned duplicate must be
- * released by calling the function sr_python_stacktrace_free().
- */
-struct sr_python_stacktrace *
-sr_python_stacktrace_dup(struct sr_python_stacktrace *stacktrace);
-
-/**
- * Parses a textual Python stacktrace and puts it into a structure.
- * If parsing fails, the input parameter is not changed and NULL is
- * returned.
- * @param input
- * Pointer to the string with the Python stack trace. If this function
- * returns a non-NULL value, the input pointer is modified to point
- * after the stacktrace that was just parsed.
- */
-struct sr_python_stacktrace *
-sr_python_stacktrace_parse(const char **input,
-                           struct sr_location *location);
-
-/**
- * Returns brief, human-readable explanation of the stacktrace.
- */
-char *
-sr_python_stacktrace_get_reason(struct sr_python_stacktrace *stacktrace);
-
-/**
- * Serializes stacktrace to string.
- * @returnes
- * Newly allocated memory containing the textual representation of the
- * provided stacktrace.  Caller should free the memory when it's no
- * longer needed.
- */
-char *
-sr_python_stacktrace_to_json(struct sr_python_stacktrace *stacktrace);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/report.c b/lib/report.c
index ce6b3fb..6258855 100644
--- a/lib/report.c
+++ b/lib/report.c
@@ -22,10 +22,10 @@
 #include "config.h"
 #include "utils.h"
 #include "json.h"
-#include "koops_stacktrace.h"
-#include "core_stacktrace.h"
-#include "python_stacktrace.h"
-#include "java_stacktrace.h"
+#include "koops/stacktrace.h"
+#include "core/stacktrace.h"
+#include "python/stacktrace.h"
+#include "java/stacktrace.h"
 #include "operating_system.h"
 #include "rpm.h"
 #include "strbuf.h"
diff --git a/lib/report.h b/lib/report.h
deleted file mode 100644
index 634c6e5..0000000
--- a/lib/report.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-    report.h
-
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_REPORT_H
-#define SATYR_REPORT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-#include <inttypes.h>
-#include <stdbool.h>
-
-struct sr_report
-{
-    uint32_t report_version;
-    enum sr_report_type report_type;
-
-    char *reporter_name;
-    char *reporter_version;
-
-    // This is the real user id, not effective.
-    bool user_root;
-    bool user_local;
-
-    struct sr_operating_system *operating_system;
-
-    char *component_name;
-    struct sr_rpm_package *rpm_packages;
-
-    struct sr_python_stacktrace *python_stacktrace;
-    struct sr_koops_stacktrace *koops_stacktrace;
-    struct sr_core_stacktrace *core_stacktrace;
-    struct sr_java_stacktrace *java_stacktrace;
-};
-
-struct sr_report *
-sr_report_new();
-
-void
-sr_report_init(struct sr_report *report);
-
-void
-sr_report_free(struct sr_report *report);
-
-char *
-sr_report_to_json(struct sr_report *report);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/report_type.h b/lib/report_type.h
deleted file mode 100644
index 8df81a2..0000000
--- a/lib/report_type.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-    report_type.h
-
-    Copyright (C) 2013  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.
-*/
-#ifndef SATYR_REPORT_TYPE_H
-#define SATYR_REPORT_TYPE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum sr_report_type
-{
-    SR_REPORT_INVALID = 0,
-    SR_REPORT_CORE,
-    SR_REPORT_PYTHON,
-    SR_REPORT_KERNELOOPS,
-    SR_REPORT_JAVA,
-    SR_REPORT_GDB,
-
-    /* Keep this the last entry. */
-    SR_REPORT_NUM
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/rpm.h b/lib/rpm.h
deleted file mode 100644
index 41f81e7..0000000
--- a/lib/rpm.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
-    rpm.h
-
-    Copyright (C) 2012  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.
-*/
-#ifndef SATYR_RPM_H
-#define SATYR_RPM_H
-
-/**
- * @file
- * @brief RPM-related structures and utilities.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-#include <inttypes.h>
-
-/* XXX: Should be moved to separated header once we support more package types.
- */
-enum sr_package_role
-{
-    /* The role the package has in the problem is either unknown or
-     * irrelevant.
-     */
-    SR_ROLE_UNKNOWN = 0,
-
-    /* The packages contains the executable or script the execution of which
-     * caused the problem to manifest.
-     */
-    SR_ROLE_AFFECTED
-};
-
-struct sr_rpm_consistency
-{
-    char *path;
-    bool owner_changed;
-    bool group_changed;
-    bool mode_changed;
-    bool md5_mismatch;
-    bool size_changed;
-    bool major_number_changed;
-    bool minor_number_changed;
-    bool symlink_changed;
-    bool modification_time_changed;
-    struct sr_rpm_consistency *next;
-};
-
-struct sr_rpm_package
-{
-    char *name;
-    uint32_t epoch;
-    char *version;
-    char *release;
-    char *architecture;
-    uint64_t install_time;
-    enum sr_package_role role;
-    struct sr_rpm_consistency *consistency;
-    struct sr_rpm_package *next;
-};
-
-struct sr_rpm_package *
-sr_rpm_package_new();
-
-void
-sr_rpm_package_init(struct sr_rpm_package *package);
-
-void
-sr_rpm_package_free(struct sr_rpm_package *package,
-                    bool recursive);
-
-/**
- * Compares two packages.
- * @param package1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param package2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the packages are same.  Returns negative number if
- * package1 is found to be 'less' than package2.  Returns positive
- * number if package1 is found to be 'greater' than package2.
- */
-int
-sr_rpm_package_cmp(struct sr_rpm_package *package1,
-                   struct sr_rpm_package *package2);
-
-/**
- * Compares two packages by their name, version and release.
- * @param package1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param package2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the packages are same.  Returns negative number if
- * package1 is found to be 'less' than package2.  Returns positive
- * number if package1 is found to be 'greater' than package2.
- */
-int
-sr_rpm_package_cmp_nvr(struct sr_rpm_package *package1,
-                       struct sr_rpm_package *package2);
-
-/**
- * Compares two packages by their name, epoch, version, release and
- * architecture.
- * @param package1
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @param package2
- * It must be non-NULL pointer. It's not modified by calling this
- * function.
- * @returns
- * Returns 0 if the packages are same.  Returns negative number if
- * package1 is found to be 'less' than package2.  Returns positive
- * number if package1 is found to be 'greater' than package2.
- */
-int
-sr_rpm_package_cmp_nevra(struct sr_rpm_package *package1,
-                         struct sr_rpm_package *package2);
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' package.  If 'dest' is NULL, it
- * returns the 'item' package.
- */
-struct sr_rpm_package *
-sr_rpm_package_append(struct sr_rpm_package *dest,
-                      struct sr_rpm_package *item);
-
-/**
- * Returns the number of packages in the list.
- */
-int
-sr_rpm_package_count(struct sr_rpm_package *packages);
-
-struct sr_rpm_package *
-sr_rpm_package_sort(struct sr_rpm_package *packages);
-
-struct sr_rpm_package *
-sr_rpm_package_uniq(struct sr_rpm_package *packages);
-
-struct sr_rpm_package *
-sr_rpm_package_get_by_name(const char *name,
-                           char **error_message);
-
-struct sr_rpm_package *
-sr_rpm_package_get_by_path(const char *path,
-                           char **error_message);
-
-char *
-sr_rpm_package_to_json(struct sr_rpm_package *package,
-                       bool recursive);
-
-bool
-sr_rpm_package_parse_nvr(const char *text,
-                         char **name,
-                         char **version,
-                         char **release);
-
-bool
-sr_rpm_package_parse_nevra(const char *text,
-                           char **name,
-                           uint32_t *epoch,
-                           char **version,
-                           char **release,
-                           char **architecture);
-
-struct sr_rpm_consistency *
-sr_rpm_consistency_new();
-
-void
-sr_rpm_consistency_init(struct sr_rpm_consistency *consistency);
-
-void
-sr_rpm_consistency_free(struct sr_rpm_consistency *consistency,
-                        bool recursive);
-
-int
-sr_rpm_consistency_cmp(struct sr_rpm_consistency *consistency1,
-                       struct sr_rpm_consistency *consistency2);
-
-int
-sr_rpm_consistency_cmp_recursive(struct sr_rpm_consistency *consistency1,
-                                 struct sr_rpm_consistency *consistency2);
-
-/**
- * Appends 'item' at the end of the list 'dest'.
- * @returns
- * This function returns the 'dest' consistency info.  If 'dest' is
- * NULL, it returns the 'item' consistency info.
- */
-struct sr_rpm_consistency *
-sr_rpm_consistency_append(struct sr_rpm_consistency *dest,
-                          struct sr_rpm_consistency *item);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/stacktrace.c b/lib/stacktrace.c
index e7182b6..0f22e58 100644
--- a/lib/stacktrace.c
+++ b/lib/stacktrace.c
@@ -26,11 +26,11 @@
 #include "stacktrace.h"
 #include "thread.h"
 
-#include "gdb_stacktrace.h"
-#include "core_stacktrace.h"
-#include "python_stacktrace.h"
-#include "koops_stacktrace.h"
-#include "java_stacktrace.h"
+#include "gdb/stacktrace.h"
+#include "core/stacktrace.h"
+#include "python/stacktrace.h"
+#include "koops/stacktrace.h"
+#include "java/stacktrace.h"
 
 #include <stdlib.h>
 
diff --git a/lib/stacktrace.h b/lib/stacktrace.h
deleted file mode 100644
index c611e73..0000000
--- a/lib/stacktrace.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-    stacktrace.h
-
-    Copyright (C) 2013  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.
-*/
-#ifndef SATYR_STACKTRACE_H
-#define SATYR_STACKTRACE_H
-
-/**
- * Functions declared here work with all stacktrace types:
- * * sr_core_stacktrace
- * * sr_python_stacktrace
- * * sr_koops_stacktrace
- * * sr_java_stacktrace
- * * sr_gdb_stacktrace
- * You may need to explicitly cast the pointer to struct sr_stacktrace in order
- * to avoid compiler warning.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-
-struct sr_stacktrace
-{
-    enum sr_report_type type;
-};
-
-/**
- * Parses the stacktrace pointed to by input. You need to provide the correct
- * stacktrace type in the first parameter.
- */
-struct sr_stacktrace *
-sr_stacktrace_parse(enum sr_report_type type, const char **input, char **error_message);
-
-/**
- * Returns short textual representation of given stacktrace. At most max_frames
- * are printed. Caller needs to free the result using free() afterwards.
- */
-char *
-sr_stacktrace_to_short_text(struct sr_stacktrace *stacktrace, int max_frames);
-
-/**
- * Returns the thread structure that (probably) caused the crash.
- */
-struct sr_thread *
-sr_stacktrace_find_crash_thread(struct sr_stacktrace *stacktrace);
-
-/**
- * Convert stacktrace to json and return it as text.
- */
-char *
-sr_stacktrace_to_json(struct sr_stacktrace *stacktrace);
-
-/**
- * Returns brief, human-readable explanation of the stacktrace.
- */
-char *
-sr_stacktrace_get_reason(struct sr_stacktrace *stacktrace);
-
-/**
- * Releases all the memory associated with the stacktrace pointer.
- */
-void
-sr_stacktrace_free(struct sr_stacktrace *stacktrace);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/strbuf.h b/lib/strbuf.h
deleted file mode 100644
index 1dfd864..0000000
--- a/lib/strbuf.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
-    strbuf.h - a string buffer
-
-    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.
-*/
-#ifndef SATYR_STRBUF_H
-#define SATYR_STRBUF_H
-
-/**
- * @file
- * @brief A string buffer structure and related algorithms.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdarg.h>
-#include "utils.h"
-
-/**
- * @brief A resizable string buffer.
- */
-struct sr_strbuf
-{
-    /**
-     * Size of the allocated buffer. Always > 0.
-     */
-    int alloc;
-    /**
-     * Length of the string, without the ending \0.
-     */
-    int len;
-    char *buf;
-};
-
-/**
- * Creates and initializes a new string buffer.
- * @returns
- * It never returns NULL. The returned pointer must be released by
- * calling the function sr_strbuf_free().
- */
-struct sr_strbuf *
-sr_strbuf_new();
-
-/**
- * Initializes all members of the strbuf structure to their default
- * values. No memory is released, members are simply overritten. This
- * is useful for initializing a strbuf structure placed on the stack.
- */
-void
-sr_strbuf_init(struct sr_strbuf *strbuf);
-
-/**
- * Releases the memory held by the string buffer.
- * @param strbuf
- * If the strbuf is NULL, no operation is performed.
- */
-void
-sr_strbuf_free(struct sr_strbuf *strbuf);
-
-/**
- * Releases the strbuf, but not the internal buffer.  The internal
- * string buffer is returned.  Caller is responsible to release the
- * returned memory using free().
- */
-char *
-sr_strbuf_free_nobuf(struct sr_strbuf *strbuf);
-
-/**
- * The string content is set to an empty string, erasing any previous
- * content and leaving its length at 0 characters.
- */
-void
-sr_strbuf_clear(struct sr_strbuf *strbuf);
-
-/**
- * Ensures that the buffer can be extended by num characters
- * without dealing with malloc/realloc.
- */
-void
-sr_strbuf_grow(struct sr_strbuf *strbuf, int num);
-
-/**
- * The current content of the string buffer is extended by adding a
- * character c at its end.
- */
-struct sr_strbuf *
-sr_strbuf_append_char(struct sr_strbuf *strbuf,
-                      char c);
-
-/**
- * The current content of the string buffer is extended by adding a
- * string str at its end.
- */
-struct sr_strbuf *
-sr_strbuf_append_str(struct sr_strbuf *strbuf,
-                     const char *str);
-
-/**
- * The current content of the string buffer is extended by inserting a
- * string str at its beginning.
- */
-struct sr_strbuf *
-sr_strbuf_prepend_str(struct sr_strbuf *strbuf,
-                      const char *str);
-
-/**
- * The current content of the string buffer is extended by adding a
- * sequence of data formatted as the format argument specifies.
- */
-struct sr_strbuf *
-sr_strbuf_append_strf(struct sr_strbuf *strbuf,
-                      const char *format, ...) __sr_printf(2, 3);
-
-/**
- * Same as sr_strbuf_append_strf except that va_list is used instead of
- * variable number of arguments.
- */
-struct sr_strbuf *
-sr_strbuf_append_strfv(struct sr_strbuf *strbuf,
-                       const char *format, va_list p);
-
-/**
- * The current content of the string buffer is extended by inserting a
- * sequence of data formatted as the format argument specifies at the
- * buffer beginning.
- */
-struct sr_strbuf *
-sr_strbuf_prepend_strf(struct sr_strbuf *strbuf,
-                       const char *format, ...) __sr_printf(2, 3);
-
-/**
- * Same as sr_strbuf_prepend_strf except that va_list is used instead of
- * variable number of arguments.
- */
-struct sr_strbuf *
-sr_strbuf_prepend_strfv(struct sr_strbuf *strbuf,
-                        const char *format, va_list p);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/thread.c b/lib/thread.c
index 87691e2..c2cc2ca 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -23,11 +23,11 @@
 #include "thread.h"
 #include "frame.h"
 
-#include "gdb_thread.h"
-#include "core_thread.h"
-#include "python_stacktrace.h"
-#include "koops_stacktrace.h"
-#include "java_thread.h"
+#include "gdb/thread.h"
+#include "core/thread.h"
+#include "python/stacktrace.h"
+#include "koops/stacktrace.h"
+#include "java/thread.h"
 
 #include <stdio.h>
 
diff --git a/lib/thread.h b/lib/thread.h
deleted file mode 100644
index 7694bd3..0000000
--- a/lib/thread.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-    thread.h
-
-    Copyright (C) 2013  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.
-*/
-#ifndef SATYR_THREAD_H
-#define SATYR_THREAD_H
-
-/**
- * Functions declared here work with all thread types. Furthermore, for problem
- * types that do not have a thread structure because they are always
- * single-threaded, you can pass the stacktrace structure directly:
- * * sr_core_thread
- * * sr_python_stacktrace
- * * sr_koops_stacktrace
- * * sr_java_thread
- * * sr_gdb_thread
- * You may need to explicitly cast the pointer to struct sr_thread in order to
- * avoid compiler warning.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "report_type.h"
-
-struct sr_thread
-{
-   enum sr_report_type type;
-};
-
-/**
- * Returns pointer to the first frame in thread.
- */
-struct sr_frame *
-sr_thread_frames(struct sr_thread *thread);
-
-/**
- * Compares two threads. Returns 0 on equality. Threads of distinct type are
- * always unequal.
- */
-int
-sr_thread_frame_count(struct sr_thread *thread);
-
-int
-sr_thread_cmp(struct sr_thread *t1, struct sr_thread *t2);
-
-/**
- * Next thread in linked list (same as reading the "next" structure member).
- */
-struct sr_thread *
-sr_thread_next(struct sr_thread *thread);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/utils.h b/lib/utils.h
deleted file mode 100644
index 9dff404..0000000
--- a/lib/utils.h
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
-    utils.h
-
-    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.
-*/
-#ifndef SATYR_UTILS_H
-#define SATYR_UTILS_H
-
-/**
- * @file
- * @brief Various utility functions, macros and variables that do not
- * fit elsewhere.
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <assert.h>
-
-#define SR_lower "abcdefghijklmnopqrstuvwxyz"
-#define SR_upper "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-#define SR_alpha SR_lower SR_upper
-#define SR_space " \t\r\n\v\f"
-#define SR_digit "0123456789"
-#define SR_alnum SR_alpha SR_digit
-
-#define __sr_printf(x, y) __attribute__((format(printf, (x), (y))))
-
-#define SR_DISPATCH(type, method) \
-    (assert((type > SR_REPORT_INVALID) && (type) < SR_REPORT_NUM && dtable[type].method), \
-    dtable[type].method)
-
-#define SR_NEXT_FUNC(name, abstract_t, concrete_t)       \
-    static abstract_t *                                  \
-    name(abstract_t *node)                               \
-    {                                                    \
-        return (abstract_t *)((concrete_t *)node)->next; \
-    }                                                    \
-
-/**
- * Debugging output to stdout while parsing.
- * Default value is false.
- */
-extern bool
-sr_debug_parser;
-
-/**
- * Never returns NULL.
- */
-void *
-sr_malloc(size_t size);
-
-/**
- * Never returns NULL.
- */
-void *
-sr_mallocz(size_t size);
-
-/**
- * Never returns NULL.
- */
-void *
-sr_realloc(void *ptr, size_t size);
-
-/**
- * Never returns NULL.
- */
-char *
-sr_vasprintf(const char *format, va_list p);
-
-/**
- * Never returns NULL.
- */
-char *
-sr_asprintf(const char *format, ...) __sr_printf(1, 2);
-
-/**
- * Never returns NULL.
- */
-char *
-sr_strdup(const char *s);
-
-/**
- * Never returns NULL.
- */
-char *
-sr_strndup(const char *s, size_t n);
-
-void
-sr_struniq(char **strings, size_t *size);
-
-/**
- * A strcmp() variant that works also with NULL parameters.  NULL is
- * considered to be less than a string.
- */
-int
-sr_strcmp0(const char *s1, const char *s2);
-
-/**
- * A strchr() variant providing line and column in the string s
- * indicating where the char c was found.
- * @param line
- * Starts from 1.  Its value is valid only when this function does not
- * return NULL.
- * @param column
- * Starts from 0.  Its value is valid only when this function does not
- * return NULL.
- */
-char *
-sr_strchr_location(const char *s, int c, int *line, int *column);
-
-/**
- * A strstr() variant providing line and column of the haystick
- * indicating where the needle was found.
- * @param line
- * Starts from 1.  Its value is valid only when this function does not
- * return NULL.
- * @param column
- * Starts from 0.  Its value is valid only when this function does not
- * return NULL.
- */
-char *
-sr_strstr_location(const char *haystack,
-                   const char *needle,
-                   int *line,
-                   int *column);
-
-/**
- * A strspn() variant providing line and column of the string s which
- * corresponds to the returned length.
- * @param line
- * Starts from 1.
- * @param column
- * Starts from 0.
- */
-size_t
-sr_strspn_location(const char *s,
-                   const char *accept,
-                   int *line,
-                   int *column);
-
-/**
- * Loads file contents to a string.
- * @returns
- * File contents. If file opening/reading fails, NULL is returned.
- */
-char *
-sr_file_to_string(const char *filename,
-                  char **error_message);
-
-bool
-sr_string_to_file(const char *filename,
-                  char *contents,
-                  char **error_message);
-
-/**
- * If the input contains character c in the current positon, move the
- * input pointer after the character, and return true. Otherwise do
- * not modify the input and return false.
- */
-bool
-sr_skip_char(const char **input, char c);
-
-/**
- * If the input contains one of allowed characters, move
- * the input pointer after that character, and return true.
- * Otherwise do not modify the input and return false.
- */
-bool
-sr_skip_char_limited(const char **input, const char *allowed);
-
-/**
- * If the input contains one of allowed characters, store
- * the character to the result, move the input pointer after
- * that character, and return true. Otherwise do not modify
- * the input and return false.
- */
-bool
-sr_parse_char_limited(const char **input,
-                      const char *allowed,
-                      char *result);
-
-/**
- * If the input contains the character c one or more times, update it
- * so that the characters are skipped. Returns the number of characters
- * skipped, thus zero if **input does not contain c.
- */
-int
-sr_skip_char_sequence(const char **input, char c);
-
-/**
- * If the input contains one or more characters from string chars,
- * move the input pointer after the sequence. Otherwise do not modify
- * the input.
- * @returns
- * The number of characters skipped.
- */
-int
-sr_skip_char_span(const char **input, const char *chars);
-
-/**
- * If the input contains one or more characters from string chars,
- * move the input pointer after the sequence. Otherwise do not modify
- * the input.
- * @param line
- * Starts from 1. Corresponds to the returned number.
- * @param column
- * Starts from 0. Corresponds to the returned number.
- * @returns
- * The number of characters skipped.
- */
-int
-sr_skip_char_span_location(const char **input,
-                           const char *chars,
-                           int *line,
-                           int *column);
-
-/**
- * If the input contains one or more characters from string accept,
- * create a string from this sequence and store it to the result, move
- * the input pointer after the sequence, and return the lenght of the
- * sequence.  Otherwise do not modify the input and return 0.
- *
- * If this function returns nonzero value, the caller is responsible
- * to free the result.
- */
-int
-sr_parse_char_span(const char **input,
-                   const char *accept,
-                   char **result);
-
-/**
- * If the input contains one or more characters which are not
- * presentin string reject, move the input pointer after the
- * sequence. Otherwise do not modify the input.
- * @returns
- * The number of characters skipped.
- */
-int
-sr_skip_char_cspan(const char **input, const char *reject);
-
-/**
- * If the input contains characters which are not in string reject,
- * create a string from this sequence and store it to the result,
- * move the input pointer after the sequence, and return true.
- * Otherwise do not modify the input and return false.
- *
- * If this function returns true, the caller is responsible to
- * free the result.
- */
-bool
-sr_parse_char_cspan(const char **input,
-                    const char *reject,
-                    char **result);
-
-/**
- * If the input contains the string, move the input pointer after
- * the sequence. Otherwise do not modify the input.
- * @returns
- * Number of characters skipped. 0 if the input does not contain the
- * string.
- */
-int
-sr_skip_string(const char **input, const char *string);
-
-/**
- * If the input contains the string, copy the string to result,
- * move the input pointer after the string, and return true.
- * Otherwise do not modify the input and return false.
- *
- * If this function returns true, the caller is responsible to free
- * the result.
- */
-bool
-sr_parse_string(const char **input, const char *string, char **result);
-
-/**
- * If the input contains digit 0-9, return it as a character
- * and move the input pointer after it. Otherwise return
- * '\0' and do not modify the input.
- */
-char
-sr_parse_digit(const char **input);
-
-/**
- * If the input contains [0-9]+, move the input pointer
- * after the number.
- * @returns
- * The number of skipped characters. 0 if input does not start with a
- * digit.
- */
-int
-sr_skip_uint(const char **input);
-
-/**
- * If the input contains [0-9]+, parse it, move the input pointer
- * after the number.
- * @returns
- * Number of parsed characters. 0 if input does not contain a number.
- */
-int
-sr_parse_uint32(const char **input, uint32_t *result);
-
-int
-sr_parse_uint64(const char **input, uint64_t *result);
-
-/**
- * If the input contains [0-9a-f]+, move the input pointer
- * after that.
- * @returns
- * The number of characters processed from input. 0 if the input does
- * not contain a hexadecimal number.
- */
-int
-sr_skip_hexadecimal_uint(const char **input);
-
-/**
- * If the input contains 0x[0-9a-f]+, move the input pointer
- * after that.
- * @returns
- * The number of characters processed from input. 0 if the input does
- * not contain a hexadecimal number.
- */
-int
-sr_skip_hexadecimal_0xuint(const char **input);
-
-/**
- * If the input contains [0-9a-f]+, parse the number, and move the
- * input pointer after it.  Otherwise do not modify the input.
- * @returns
- * The number of characters read from input. 0 if the input does not
- * contain a hexadecimal number.
- */
-int
-sr_parse_hexadecimal_uint64(const char **input, uint64_t *result);
-
-/**
- * If the input contains 0x[0-9a-f]+, parse the number, and move the
- * input pointer after it.  Otherwise do not modify the input.
- * @returns
- * The number of characters read from input. 0 if the input does not
- * contain a hexadecimal number.
- */
-int
-sr_parse_hexadecimal_0xuint64(const char **input, uint64_t *result);
-
-char *
-sr_skip_whitespace(const char *s);
-
-char *
-sr_skip_non_whitespace(const char *s);
-
-/**
- * Emit a string of hex representation of bytes.
- */
-char *
-sr_bin2hex(char *dst, const char *str, int count);
-
-char *
-sr_indent(const char *input, int spaces);
-
-char *
-sr_indent_except_first_line(const char *input, int spaces);
-
-char *
-sr_build_path(const char *first_element, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/python/Makefile.am b/python/Makefile.am
index a710e18..8387aef 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -38,7 +38,8 @@ _satyr_la_SOURCES = \
 
 _satyr_la_CPPFLAGS = \
     -DLOCALSTATEDIR='"$(localstatedir)"' \
-    -I.. \
+    -I../include \
+    -I../lib \
     $(PYTHON_CFLAGS) \
     -D_GNU_SOURCE \
     -Wall -Wwrite-strings \
diff --git a/python/py_cluster.c b/python/py_cluster.c
index ede8516..3050a71 100644
--- a/python/py_cluster.c
+++ b/python/py_cluster.c
@@ -1,7 +1,7 @@
 #include "py_cluster.h"
 #include "py_metrics.h"
-#include "lib/strbuf.h"
-#include "lib/cluster.h"
+#include "strbuf.h"
+#include "cluster.h"
 
 #define dendrogram_doc "satyr.Dendrogram - a dendrogram created by clustering algorithm\n"
 
diff --git a/python/py_common.c b/python/py_common.c
index a326b3e..66835d0 100644
--- a/python/py_common.c
+++ b/python/py_common.c
@@ -20,7 +20,7 @@
 
 #include "py_common.h"
 
-#include "lib/utils.h"
+#include "utils.h"
 
 /*
  * Generic getters/setters that accept a struct getset_offsets as the data
diff --git a/python/py_gdb_frame.c b/python/py_gdb_frame.c
index 48b027e..e052294 100644
--- a/python/py_gdb_frame.c
+++ b/python/py_gdb_frame.c
@@ -22,10 +22,10 @@
 
 #include <inttypes.h>
 
-#include "lib/location.h"
-#include "lib/strbuf.h"
-#include "lib/utils.h"
-#include "lib/gdb_frame.h"
+#include "location.h"
+#include "strbuf.h"
+#include "utils.h"
+#include "gdb/frame.h"
 
 #define frame_doc "satyr.GdbFrame - class representing a frame in a thread\n" \
                   "Usage:\n" \
diff --git a/python/py_gdb_sharedlib.c b/python/py_gdb_sharedlib.c
index da66c79..03d937a 100644
--- a/python/py_gdb_sharedlib.c
+++ b/python/py_gdb_sharedlib.c
@@ -1,7 +1,7 @@
 #include "py_common.h"
 #include "py_gdb_sharedlib.h"
-#include "lib/gdb_sharedlib.h"
-#include "lib/utils.h"
+#include "gdb/sharedlib.h"
+#include "utils.h"
 
 #define sharedlib_doc "satyr.GdbSharedlib - class representing a shared library loaded at the moment of crash"
 
diff --git a/python/py_gdb_stacktrace.c b/python/py_gdb_stacktrace.c
index 4a269c4..d2f3a5d 100644
--- a/python/py_gdb_stacktrace.c
+++ b/python/py_gdb_stacktrace.c
@@ -2,12 +2,12 @@
 #include "py_gdb_thread.h"
 #include "py_gdb_frame.h"
 #include "py_gdb_sharedlib.h"
-#include "lib/strbuf.h"
-#include "lib/gdb_stacktrace.h"
-#include "lib/gdb_thread.h"
-#include "lib/gdb_sharedlib.h"
-#include "lib/location.h"
-#include "lib/normalize.h"
+#include "strbuf.h"
+#include "gdb/stacktrace.h"
+#include "gdb/thread.h"
+#include "gdb/sharedlib.h"
+#include "location.h"
+#include "normalize.h"
 
 #define stacktrace_doc "satyr.GdbStacktrace - class representing a stacktrace\n" \
                       "Usage:\n" \
diff --git a/python/py_gdb_thread.c b/python/py_gdb_thread.c
index 3f47043..711d196 100644
--- a/python/py_gdb_thread.c
+++ b/python/py_gdb_thread.c
@@ -1,10 +1,10 @@
 #include "py_common.h"
 #include "py_gdb_thread.h"
 #include "py_gdb_frame.h"
-#include "lib/strbuf.h"
-#include "lib/gdb_thread.h"
-#include "lib/gdb_frame.h"
-#include "lib/location.h"
+#include "strbuf.h"
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "location.h"
 
 #define thread_doc "satyr.GdbThread - class representing a thread in a stacktrace\n" \
                    "Usage:\n" \
diff --git a/python/py_java_frame.c b/python/py_java_frame.c
index d923fb5..ccbbb04 100644
--- a/python/py_java_frame.c
+++ b/python/py_java_frame.c
@@ -19,10 +19,10 @@
 */
 #include "py_common.h"
 #include "py_java_frame.h"
-#include "lib/location.h"
-#include "lib/strbuf.h"
-#include "lib/utils.h"
-#include "lib/java_frame.h"
+#include "location.h"
+#include "strbuf.h"
+#include "utils.h"
+#include "java/frame.h"
 
 #define frame_doc "satyr.JavaFrame - class representing a java frame\n" \
                   "Usage:\n" \
diff --git a/python/py_java_stacktrace.c b/python/py_java_stacktrace.c
index d51ec49..71167e2 100644
--- a/python/py_java_stacktrace.c
+++ b/python/py_java_stacktrace.c
@@ -1,12 +1,12 @@
 #include "py_java_stacktrace.h"
 #include "py_java_thread.h"
 #include "py_java_frame.h"
-#include "lib/strbuf.h"
-#include "lib/java_stacktrace.h"
-#include "lib/java_thread.h"
-#include "lib/location.h"
-#include "lib/normalize.h"
-#include "lib/stacktrace.h"
+#include "strbuf.h"
+#include "java/stacktrace.h"
+#include "java/thread.h"
+#include "location.h"
+#include "normalize.h"
+#include "stacktrace.h"
 
 #define stacktrace_doc "satyr.JavaStacktrace - class representing a java stacktrace\n" \
                       "Usage:\n" \
diff --git a/python/py_java_thread.c b/python/py_java_thread.c
index dc3bd5f..c960e37 100644
--- a/python/py_java_thread.c
+++ b/python/py_java_thread.c
@@ -1,11 +1,11 @@
 #include "py_common.h"
 #include "py_java_thread.h"
 #include "py_java_frame.h"
-#include "lib/strbuf.h"
-#include "lib/java_thread.h"
-#include "lib/java_frame.h"
-#include "lib/location.h"
-#include "lib/utils.h"
+#include "strbuf.h"
+#include "java/thread.h"
+#include "java/frame.h"
+#include "location.h"
+#include "utils.h"
 
 #define thread_doc "satyr.JavaThread - class representing a thread in a stacktrace\n" \
                    "Usage:\n" \
diff --git a/python/py_koops_frame.c b/python/py_koops_frame.c
index a7fc9b7..092fb78 100644
--- a/python/py_koops_frame.c
+++ b/python/py_koops_frame.c
@@ -22,10 +22,10 @@
 
 #include <inttypes.h>
 
-#include "lib/location.h"
-#include "lib/strbuf.h"
-#include "lib/utils.h"
-#include "lib/koops_frame.h"
+#include "location.h"
+#include "strbuf.h"
+#include "utils.h"
+#include "koops/frame.h"
 
 #define frame_doc "satyr.KerneloopsFrame - class representing a frame in a kerneloops\n" \
                   "Usage:\n" \
diff --git a/python/py_koops_stacktrace.c b/python/py_koops_stacktrace.c
index 301aaf2..5a14066 100644
--- a/python/py_koops_stacktrace.c
+++ b/python/py_koops_stacktrace.c
@@ -1,12 +1,12 @@
 #include "py_koops_frame.h"
 #include "py_koops_stacktrace.h"
 #include "py_common.h"
-#include "lib/strbuf.h"
-#include "lib/koops_frame.h"
-#include "lib/koops_stacktrace.h"
-#include "lib/location.h"
-#include "lib/normalize.h"
-#include "lib/stacktrace.h"
+#include "strbuf.h"
+#include "koops/frame.h"
+#include "koops/stacktrace.h"
+#include "location.h"
+#include "normalize.h"
+#include "stacktrace.h"
 
 #define stacktrace_doc "satyr.Kerneloops - class representing a kerneloops stacktrace\n" \
                       "Usage:\n" \
diff --git a/python/py_metrics.c b/python/py_metrics.c
index a52a505..b733b3b 100644
--- a/python/py_metrics.c
+++ b/python/py_metrics.c
@@ -1,7 +1,7 @@
 #include "py_metrics.h"
 #include "py_gdb_thread.h"
-#include "lib/strbuf.h"
-#include "lib/metrics.h"
+#include "strbuf.h"
+#include "metrics.h"
 
 #define distances_doc "satyr.Distances - class representing distances between objects\n" \
                       "Usage:\n" \
diff --git a/python/py_module.c b/python/py_module.c
index 4eb3505..32fd313 100644
--- a/python/py_module.c
+++ b/python/py_module.c
@@ -13,7 +13,7 @@
 #include "py_java_stacktrace.h"
 #include "py_metrics.h"
 
-#include "lib/gdb_sharedlib.h"
+#include "gdb/sharedlib.h"
 
 static PyMethodDef
 module_methods[]=
diff --git a/python/py_python_frame.c b/python/py_python_frame.c
index 24013a7..3ba156d 100644
--- a/python/py_python_frame.c
+++ b/python/py_python_frame.c
@@ -19,10 +19,10 @@
 */
 #include "py_common.h"
 #include "py_python_frame.h"
-#include "lib/location.h"
-#include "lib/strbuf.h"
-#include "lib/utils.h"
-#include "lib/python_frame.h"
+#include "location.h"
+#include "strbuf.h"
+#include "utils.h"
+#include "python/frame.h"
 
 #define frame_doc "satyr.PythonFrame - class representing a python frame\n" \
                   "Usage:\n" \
diff --git a/python/py_python_stacktrace.c b/python/py_python_stacktrace.c
index 4514f3b..e35b0fa 100644
--- a/python/py_python_stacktrace.c
+++ b/python/py_python_stacktrace.c
@@ -1,13 +1,13 @@
 #include "py_common.h"
 #include "py_python_frame.h"
 #include "py_python_stacktrace.h"
-#include "lib/utils.h"
-#include "lib/strbuf.h"
-#include "lib/python_frame.h"
-#include "lib/python_stacktrace.h"
-#include "lib/location.h"
-#include "lib/normalize.h"
-#include "lib/stacktrace.h"
+#include "utils.h"
+#include "strbuf.h"
+#include "python/frame.h"
+#include "python/stacktrace.h"
+#include "location.h"
+#include "normalize.h"
+#include "stacktrace.h"
 
 #define stacktrace_doc "satyr.PythonStacktrace - class representing a python stacktrace\n" \
                       "Usage:\n" \
diff --git a/satyr.c b/satyr.c
index d241291..572ec3c 100644
--- a/satyr.c
+++ b/satyr.c
@@ -17,18 +17,18 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "lib/gdb_stacktrace.h"
-#include "lib/gdb_thread.h"
-#include "lib/gdb_frame.h"
-#include "lib/utils.h"
-#include "lib/location.h"
-#include "lib/strbuf.h"
-#include "lib/metrics.h"
-#include "lib/cluster.h"
-#include "lib/normalize.h"
-#include "lib/report.h"
-#include "lib/abrt.h"
-#include "lib/config.h"
+#include "gdb/stacktrace.h"
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "utils.h"
+#include "location.h"
+#include "strbuf.h"
+#include "metrics.h"
+#include "cluster.h"
+#include "normalize.h"
+#include "report.h"
+#include "abrt.h"
+#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/tests/abrt.at b/tests/abrt.at
index 8f16c98..6a67a89 100644
--- a/tests/abrt.at
+++ b/tests/abrt.at
@@ -7,8 +7,8 @@ AT_BANNER([ABRT])
 ## ---------------------- ##
 AT_TESTFUN([sr_abrt_parse_dso_list],
 [[
-#include <lib/abrt.h>
-#include <lib/rpm.h>
+#include "abrt.h"
+#include "rpm.h"
 #include <assert.h>
 
 int
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 3e56a92..a29e28f 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/tests -I$abs_top_builddir/include -I$abs_top_builddir/lib -D_GNU_SOURCE"
 
 # Are special link options needed?
 LDFLAGS="@LDFLAGS@ $abs_top_builddir/lib/libsatyr.la"
diff --git a/tests/cluster.at b/tests/cluster.at
index b018320..ad0ddb7 100644
--- a/tests/cluster.at
+++ b/tests/cluster.at
@@ -2,8 +2,8 @@ AT_BANNER([Clustering])
 
 AT_TESTFUN([sr_distances_cluster_objects],
 [
-#include <lib/metrics.h>
-#include <lib/cluster.h>
+#include "metrics.h"
+#include "cluster.h"
 #include <assert.h>
 #include <stdio.h>
 
@@ -71,8 +71,8 @@ main()
 
 AT_TESTFUN([sr_dendrogram_cut],
 [
-#include <lib/metrics.h>
-#include <lib/cluster.h>
+#include "metrics.h"
+#include "cluster.h"
 #include <assert.h>
 #include <stdio.h>
 
diff --git a/tests/core_frame.at b/tests/core_frame.at
index 09c3e31..2f19885 100644
--- a/tests/core_frame.at
+++ b/tests/core_frame.at
@@ -8,8 +8,8 @@ AT_BANNER([Core frames])
 
 AT_TESTFUN([sr_core_frame_dup],
 [[
-#include <lib/core_frame.h>
-#include <lib/utils.h>
+#include "core/frame.h"
+#include "utils.h"
 #include <assert.h>
 
 int
@@ -64,8 +64,8 @@ main(void)
 
 AT_TESTFUN([sr_core_frame_to_json],
 [[
-#include <lib/core_frame.h>
-#include <lib/utils.h>
+#include "core/frame.h"
+#include "utils.h"
 #include <assert.h>
 
 int
@@ -100,9 +100,9 @@ main(void)
 
 AT_TESTFUN([sr_core_frame_abstract_functions],
 [[
-#include <lib/core_frame.h>
-#include <lib/strbuf.h>
-#include <lib/frame.h>
+#include "core/frame.h"
+#include "strbuf.h"
+#include "frame.h"
 #include <assert.h>
 
 int
diff --git a/tests/core_stacktrace.at b/tests/core_stacktrace.at
index f1716a0..3f372fa 100644
--- a/tests/core_stacktrace.at
+++ b/tests/core_stacktrace.at
@@ -8,10 +8,10 @@ AT_BANNER([Core stacktraces])
 
 AT_TESTFUN([sr_core_stacktrace_to_json],
 [[
-#include <lib/core_stacktrace.h>
-#include <lib/core_thread.h>
-#include <lib/core_frame.h>
-#include <lib/utils.h>
+#include "core/stacktrace.h"
+#include "core/thread.h"
+#include "core/frame.h"
+#include "utils.h"
 #include <assert.h>
 #include <signal.h>
 
@@ -122,11 +122,11 @@ main(void)
 
 AT_TESTFUN([sr_core_stacktrace_from_json],
 [[
-#include <lib/core_stacktrace.h>
-#include <lib/core_thread.h>
-#include <lib/core_frame.h>
-#include <lib/utils.h>
-#include <lib/report_type.h>
+#include "core/stacktrace.h"
+#include "core/thread.h"
+#include "core/frame.h"
+#include "utils.h"
+#include "report_type.h"
 #include <assert.h>
 #include <signal.h>
 
diff --git a/tests/core_thread.at b/tests/core_thread.at
index 65cf670..171ac55 100644
--- a/tests/core_thread.at
+++ b/tests/core_thread.at
@@ -8,9 +8,9 @@ AT_BANNER([Core threads])
 
 AT_TESTFUN([sr_core_thread_to_json],
 [[
-#include <lib/core_thread.h>
-#include <lib/core_frame.h>
-#include <lib/utils.h>
+#include "core/thread.h"
+#include "core/frame.h"
+#include "utils.h"
 #include <assert.h>
 
 int
@@ -66,10 +66,10 @@ main(void)
 
 AT_TESTFUN([sr_core_thread_abstract_functions],
 [[
-#include <lib/core_thread.h>
-#include <lib/core_frame.h>
-#include <lib/utils.h>
-#include <lib/thread.h>
+#include "core/thread.h"
+#include "core/frame.h"
+#include "utils.h"
+#include "thread.h"
 #include <assert.h>
 
 int
diff --git a/tests/gdb_frame.at b/tests/gdb_frame.at
index 9c7e560..71ed61f 100644
--- a/tests/gdb_frame.at
+++ b/tests/gdb_frame.at
@@ -7,8 +7,8 @@ AT_BANNER([GDB frames])
 ## ---------------- ##
 AT_TESTFUN([sr_gdb_frame_dup],
 [[
-#include <lib/gdb_frame.h>
-#include <lib/utils.h>
+#include "gdb/frame.h"
+#include "utils.h"
 #include <assert.h>
 
 int
@@ -62,7 +62,7 @@ main(void)
 ## ------------------------------ ##
 AT_TESTFUN([sr_gdb_frame_parse_frame_start],
 [[
-#include <lib/gdb_frame.h>
+#include "gdb/frame.h"
 #include <assert.h>
 
 /**
@@ -111,8 +111,8 @@ main(void)
 ## ------------------------------- ##
 AT_TESTFUN([sr_gdb_frame_parseadd_operator],
 [[
-#include <lib/gdb_frame.h>
-#include <lib/strbuf.h>
+#include "gdb/frame.h"
+#include "strbuf.h"
 #include <assert.h>
 #include <string.h>
 
@@ -156,9 +156,9 @@ main(void)
 ## --------------------------------- ##
 AT_TESTFUN([sr_gdb_frame_parse_function_name],
 [[
-#include <lib/gdb_frame.h>
-#include <lib/utils.h>
-#include <lib/location.h>
+#include "gdb/frame.h"
+#include "utils.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -220,8 +220,8 @@ main(void)
 
 AT_TESTFUN([sr_gdb_frame_skip_function_args],
 [[
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
+#include "gdb/frame.h"
+#include "location.h"
 #include <assert.h>
 
 static void
@@ -267,8 +267,8 @@ main(void)
 ## -------------------------------- ##
 AT_TESTFUN([sr_gdb_frame_parse_function_call],
 [[
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
+#include "gdb/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -374,8 +374,8 @@ main(void)
 ## -------------------------------------- ##
 AT_TESTFUN([sr_gdb_frame_parse_address_in_function],
 [[
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
+#include "gdb/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -433,8 +433,8 @@ main(void)
 
 AT_TESTFUN([sr_gdb_frame_parse_file_location],
 [[
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
+#include "gdb/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -497,8 +497,8 @@ main(void)
 ## ------------------------- ##
 AT_TESTFUN([sr_gdb_frame_parse_header],
 [[
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
+#include "gdb/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -590,8 +590,8 @@ main(void)
 
 AT_TESTFUN([sr_gdb_frame_parse],
 [[
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
+#include "gdb/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/tests/gdb_sharedlib.at b/tests/gdb_sharedlib.at
index 19cdd57..53a5e9d 100644
--- a/tests/gdb_sharedlib.at
+++ b/tests/gdb_sharedlib.at
@@ -7,8 +7,8 @@ AT_BANNER([GDB sharedlib])
 ## ---------------------- ##
 AT_TESTFUN([sr_gdb_sharedlib_parse],
 [[
-#include <lib/gdb_sharedlib.h>
-#include <lib/utils.h>
+#include "gdb/sharedlib.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -34,8 +34,8 @@ main(void)
 ## ---------------------- ##
 AT_TESTFUN([sr_gdb_sharedlib_count],
 [[
-#include <lib/gdb_sharedlib.h>
-#include <lib/utils.h>
+#include "gdb/sharedlib.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -58,7 +58,7 @@ main(void)
 ## ----------------------- ##
 AT_TESTFUN([sr_gdb_sharedlib_append],
 [[
-#include <lib/gdb_sharedlib.h>
+#include "gdb/sharedlib.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -84,8 +84,8 @@ main(void)
 ## ----------------------------- ##
 AT_TESTFUN([sr_gdb_sharedlib_find_address],
 [[
-#include <lib/gdb_sharedlib.h>
-#include <lib/utils.h>
+#include "gdb/sharedlib.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
diff --git a/tests/gdb_stacktrace.at b/tests/gdb_stacktrace.at
index 93ad288..fd0fe8d 100644
--- a/tests/gdb_stacktrace.at
+++ b/tests/gdb_stacktrace.at
@@ -7,8 +7,8 @@ AT_BANNER([GDB stacktraces])
 ## ------------------------------------------- ##
 AT_TESTFUN([sr_gdb_stacktrace_remove_threads_except_one],
 [[
-#include <lib/gdb_stacktrace.h>
-#include <lib/gdb_thread.h>
+#include "gdb/stacktrace.h"
+#include "gdb/thread.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -61,11 +61,11 @@ main(void)
 ## ----------------------------------- ##
 AT_TESTFUN([sr_gdb_stacktrace_find_crash_thread],
 [
-#include <lib/gdb_stacktrace.h>
-#include <lib/gdb_thread.h>
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "gdb/stacktrace.h"
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 #include <string.h>
 
@@ -111,11 +111,11 @@ main(void)
 ## ----------------------------------- ##
 AT_TESTFUN([sr_gdb_stacktrace_limit_frame_depth],
 [[
-#include <lib/gdb_stacktrace.h>
-#include <lib/gdb_thread.h>
-#include <lib/location.h>
-#include <lib/utils.h>
-#include <lib/thread.h>
+#include "gdb/stacktrace.h"
+#include "gdb/thread.h"
+#include "location.h"
+#include "utils.h"
+#include "thread.h"
 #include <assert.h>
 
 int
@@ -151,10 +151,10 @@ main(void)
 ## --------------------------------- ##
 AT_TESTFUN([sr_gdb_stacktrace_quality_complex],
 [[
-#include <lib/gdb_stacktrace.h>
-#include <lib/gdb_thread.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "gdb/stacktrace.h"
+#include "gdb/thread.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 
 int
@@ -180,11 +180,11 @@ main(void)
 ## --------------------------------- ##
 AT_TESTFUN([sr_gdb_stacktrace_get_crash_frame],
 [[
-#include <lib/gdb_stacktrace.h>
-#include <lib/gdb_thread.h>
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "gdb/stacktrace.h"
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdio.h>
 
diff --git a/tests/gdb_thread.at b/tests/gdb_thread.at
index f25d35e..3d3a316 100644
--- a/tests/gdb_thread.at
+++ b/tests/gdb_thread.at
@@ -7,10 +7,10 @@ AT_BANNER([GDB threads])
 ## -------------------------- ##
 AT_TESTFUN([sr_gdb_thread_remove_frame],
 [[
-#include <lib/gdb_thread.h>
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -72,10 +72,10 @@ main(void)
 ## --------------------------------- ##
 AT_TESTFUN([sr_gdb_thread_remove_frames_above],
 [[
-#include <lib/gdb_thread.h>
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -138,10 +138,10 @@ main(void)
 ## ----------------------------------- ##
 AT_TESTFUN([sr_gdb_thread_remove_frames_below_n],
 [[
-#include <lib/gdb_thread.h>
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -205,9 +205,9 @@ main(void)
 ## ------------------- ##
 AT_TESTFUN([sr_gdb_thread_parse],
 [[
-#include <lib/gdb_thread.h>
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -304,9 +304,9 @@ main(void)
 ## ----------------------------- ##
 AT_TESTFUN([sr_gdb_thread_parse-locations],
 [[
-#include <lib/gdb_thread.h>
-#include <lib/gdb_frame.h>
-#include <lib/location.h>
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -374,7 +374,7 @@ main(void)
 ## ---------------------- ##
 AT_TESTFUN([sr_gdb_thread_skip_lwp],
 [[
-#include <lib/gdb_thread.h>
+#include "gdb/thread.h"
 #include <assert.h>
 #include <stdlib.h>
 
diff --git a/tests/java_frame.at b/tests/java_frame.at
index 041d011..00738be 100644
--- a/tests/java_frame.at
+++ b/tests/java_frame.at
@@ -7,8 +7,8 @@ AT_BANNER([Java frames])
 ## ----------------- ##
 AT_TESTFUN([sr_java_frame_cmp],
 [[
-#include <lib/java_frame.h>
-#include <lib/utils.h>
+#include "java/frame.h"
+#include "utils.h"
 #include <assert.h>
 
 int
@@ -86,8 +86,8 @@ main(void)
 ## ----------------- ##
 AT_TESTFUN([sr_java_frame_dup],
 [[
-#include <lib/java_frame.h>
-#include <lib/utils.h>
+#include "java/frame.h"
+#include "utils.h"
 #include <assert.h>
 
 int
@@ -185,10 +185,10 @@ main(void)
 
 AT_TESTFUN([sr_java_frame_append_to_str],
 [[
-#include <lib/java_frame.h>
-#include <lib/strbuf.h>
-#include <lib/utils.h>
-#include <lib/frame.h>
+#include "java/frame.h"
+#include "strbuf.h"
+#include "utils.h"
+#include "frame.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -274,10 +274,10 @@ main(void)
 
 AT_TESTFUN([sr_java_frame_parse],
 [[
-#include <lib/java_frame.h>
-#include <lib/location.h>
-#include <lib/strbuf.h>
-#include <lib/utils.h>
+#include "java/frame.h"
+#include "location.h"
+#include "strbuf.h"
+#include "utils.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -496,16 +496,16 @@ main(void)
 
 AT_TESTFUN([sr_java_frame_parse_exception],
 [[
-#include <lib/java_frame.h>
-#include <lib/location.h>
-#include <lib/strbuf.h>
-#include <lib/utils.h>
+#include "java/frame.h"
+#include "location.h"
+#include "strbuf.h"
+#include "utils.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 static void
 check(char *input,
diff --git a/tests/java_stacktrace.at b/tests/java_stacktrace.at
index 1a31bb5..d38074c 100644
--- a/tests/java_stacktrace.at
+++ b/tests/java_stacktrace.at
@@ -7,14 +7,14 @@ AT_BANNER([Java stacktrace])
 ## ---------------------- ##
 AT_TESTFUN([sr_java_stacktrace_cmp],
 [[
-#include <lib/java_stacktrace.h>
-#include <lib/java_thread.h>
-#include <lib/java_frame.h>
+#include "java/stacktrace.h"
+#include "java/thread.h"
+#include "java/frame.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 int
 main(void)
@@ -44,15 +44,15 @@ main(void)
 ## ---------------------- ##
 AT_TESTFUN([sr_java_stacktrace_dup],
 [[
-#include <lib/java_stacktrace.h>
-#include <lib/java_thread.h>
-#include <lib/java_frame.h>
-#include <lib/location.h>
+#include "java/stacktrace.h"
+#include "java/thread.h"
+#include "java/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 int
 main(void)
@@ -76,15 +76,15 @@ main(void)
 ## ------------------------ ##
 AT_TESTFUN([sr_java_stacktrace_parse],
 [[
-#include <lib/java_stacktrace.h>
-#include <lib/java_thread.h>
-#include <lib/java_frame.h>
-#include <lib/location.h>
+#include "java/stacktrace.h"
+#include "java/thread.h"
+#include "java/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 static void
 check(char *input,
@@ -129,9 +129,9 @@ main(void)
 ## ------------------------- ##
 AT_TESTFUN([sr_java_stacktrace_reason],
 [[
-#include <lib/java_stacktrace.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "java/stacktrace.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 
 int main(void)
diff --git a/tests/java_testcases.c b/tests/java_testcases.c
index 00b87b5..d679b7d 100644
--- a/tests/java_testcases.c
+++ b/tests/java_testcases.c
@@ -1,7 +1,7 @@
-#include "lib/java_stacktrace.h"
-#include "lib/java_thread.h"
-#include "lib/java_frame.h"
-#include "lib/utils.h"
+#include "java/stacktrace.h"
+#include "java/thread.h"
+#include "java/frame.h"
+#include "utils.h"
 
 #define XYZ_JTC_UT_STACKTRACE "java.lang.RuntimeException: java.lang.NullPointerException: null\n"\
 "\tat SimpleTest.throwNullPointerException(SimpleTest.java:36)\n"\
diff --git a/tests/java_thread.at b/tests/java_thread.at
index 1d80b2c..52450c9 100644
--- a/tests/java_thread.at
+++ b/tests/java_thread.at
@@ -7,14 +7,14 @@ AT_BANNER([Java threads])
 ## ------------------ ##
 AT_TESTFUN([sr_java_thread_cmp],
 [[
-#include <lib/java_thread.h>
-#include <lib/java_frame.h>
-#include <lib/location.h>
+#include "java/thread.h"
+#include "java/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 int
 main(void)
@@ -52,14 +52,14 @@ main(void)
 ## ------------------ ##
 AT_TESTFUN([sr_java_thread_dup],
 [[
-#include <lib/java_thread.h>
-#include <lib/java_frame.h>
-#include <lib/location.h>
+#include "java/thread.h"
+#include "java/frame.h"
+#include "location.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 int
 main(void)
@@ -81,13 +81,13 @@ main(void)
 ## --------------------------- ##
 AT_TESTFUN([sr_java_thread_remove_frame],
 [[
-#include <lib/java_frame.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "java/frame.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 int
 main(void)
@@ -126,13 +126,13 @@ main(void)
 ## ---------------------------------- ##
 AT_TESTFUN([sr_java_thread_remove_frames_above],
 [[
-#include <lib/java_frame.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "java/frame.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 int
 main(void)
@@ -172,13 +172,13 @@ main(void)
 ## ------------------------------------ ##
 AT_TESTFUN([sr_java_thread_remove_frames_below_n],
 [[
-#include <lib/java_frame.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "java/frame.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 int
 main(void)
@@ -220,15 +220,15 @@ main(void)
 ## -------------------- ##
 AT_TESTFUN([sr_java_thread_parse],
 [[
-#include <lib/java_thread.h>
-#include <lib/java_frame.h>
-#include <lib/location.h>
-#include <lib/strbuf.h>
+#include "java/thread.h"
+#include "java/frame.h"
+#include "location.h"
+#include "strbuf.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <tests/java_testcases.c>
+#include "java_testcases.c"
 
 static void
 check(const char *input,
diff --git a/tests/koops_frame.at b/tests/koops_frame.at
index fb93276..46c0d86 100644
--- a/tests/koops_frame.at
+++ b/tests/koops_frame.at
@@ -8,7 +8,7 @@ AT_BANNER([Kerneloops frames])
 
 AT_TESTFUN([sr_koops_skip_timestamp],
 [[
-#include <lib/koops_frame.h>
+#include "koops/frame.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -44,7 +44,7 @@ main(void)
 
 AT_TESTFUN([sr_koops_parse_address],
 [[
-#include <lib/koops_frame.h>
+#include "koops/frame.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -81,7 +81,7 @@ main(void)
 
 AT_TESTFUN([sr_koops_parse_module_name],
 [[
-#include <lib/koops_frame.h>
+#include "koops/frame.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -123,7 +123,7 @@ main(void)
 
 AT_TESTFUN([sr_koops_parse_function],
 [[
-#include <lib/koops_frame.h>
+#include "koops/frame.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -177,7 +177,7 @@ main(void)
 
 AT_TESTFUN([sr_koops_frame_parse],
 [[
-#include <lib/koops_frame.h>
+#include "koops/frame.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -249,7 +249,7 @@ main(void)
 
 AT_TESTFUN([sr_koops_frame_to_json],
 [[
-#include <lib/koops_frame.h>
+#include "koops/frame.h"
 #include <assert.h>
 #include <stdlib.h>
 
diff --git a/tests/koops_stacktrace.at b/tests/koops_stacktrace.at
index 336cbee..86e694f 100644
--- a/tests/koops_stacktrace.at
+++ b/tests/koops_stacktrace.at
@@ -7,7 +7,7 @@ AT_BANNER([Kerneloops stacktraces])
 ## --------------------------------- ##
 AT_TESTFUN([sr_koops_stacktrace_parse_modules],
 [[
-#include <lib/koops_stacktrace.h>
+#include "koops/stacktrace.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -96,11 +96,11 @@ main(void)
 
 AT_TESTFUN([sr_koops_stacktrace_parse],
 [[
-#include <lib/koops_stacktrace.h>
-#include <lib/koops_frame.h>
-#include <lib/location.h>
-#include <lib/utils.h>
-#include <lib/thread.h>
+#include "koops/stacktrace.h"
+#include "koops/frame.h"
+#include "location.h"
+#include "utils.h"
+#include "thread.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -234,9 +234,9 @@ main(void)
 ## --------------------------- ##
 AT_TESTFUN([sr_koops_stacktrace_to_json],
 [[
-#include <lib/koops_stacktrace.h>
-#include <lib/location.h>
-#include <lib/utils.h>
+#include "koops/stacktrace.h"
+#include "location.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
diff --git a/tests/metrics.at b/tests/metrics.at
index af6625b..5656ef0 100644
--- a/tests/metrics.at
+++ b/tests/metrics.at
@@ -2,13 +2,13 @@ AT_BANNER([Metrics])
 
 m4_define([UTILS],
 [#include <stdarg.h>
-#include <lib/gdb_thread.h>
-#include <lib/gdb_frame.h>
-#include <lib/utils.h>
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "utils.h"
 #include <stdlib.h>
 #include <assert.h>
-#include <lib/metrics.h>
-#include <lib/normalize.h>
+#include "metrics.h"
+#include "normalize.h"
 
 static struct sr_gdb_thread *
 create_thread(int count, ...)
diff --git a/tests/normalize.at b/tests/normalize.at
index 8033a69..4038ec8 100644
--- a/tests/normalize.at
+++ b/tests/normalize.at
@@ -4,11 +4,11 @@ AT_BANNER([Normalization])
 
 m4_define([UTILS],
 [#include <stdarg.h>
-#include <lib/gdb_thread.h>
-#include <lib/gdb_frame.h>
-#include <lib/utils.h>
-#include <lib/metrics.h>
-#include <lib/normalize.h>
+#include "gdb/thread.h"
+#include "gdb/frame.h"
+#include "utils.h"
+#include "metrics.h"
+#include "normalize.h"
 #include <stdlib.h>
 #include <assert.h>
 
@@ -47,10 +47,10 @@ create_thread(int count, ...)
 # frame if they have address 0x0000 and function ??.
 AT_TESTFUN([sr_normalize_gdb_thread_removes_zeroes],
 [[
-#include <lib/normalize.h>
-#include <lib/gdb_frame.h>
-#include <lib/gdb_thread.h>
-#include <lib/utils.h>
+#include "normalize.h"
+#include "gdb/frame.h"
+#include "gdb/thread.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdlib.h>
 
diff --git a/tests/operating_system.at b/tests/operating_system.at
index 5370c10..063f4c9 100644
--- a/tests/operating_system.at
+++ b/tests/operating_system.at
@@ -7,8 +7,8 @@ AT_BANNER([Operating system])
 ## -------------------------------------------- ##
 AT_TESTFUN([sr_operating_system_parse_etc_system_release],
 [[
-#include <lib/operating_system.h>
-#include <lib/utils.h>
+#include "operating_system.h"
+#include "utils.h"
 #include <stdio.h>
 #include <assert.h>
 
diff --git a/tests/rpm.at b/tests/rpm.at
index ce2302d..fffff65 100644
--- a/tests/rpm.at
+++ b/tests/rpm.at
@@ -7,7 +7,7 @@ AT_BANNER([RPM])
 ## ------------------------- ##
 AT_TESTFUN([sr_rpm_package_parse_nvr],
 [[
-#include <lib/rpm.h>
+#include "rpm.h"
 #include <assert.h>
 
 int
@@ -32,7 +32,7 @@ main(void)
 ## --------------------------- ##
 AT_TESTFUN([sr_rpm_package_parse_nevra],
 [[
-#include <lib/rpm.h>
+#include "rpm.h"
 #include <assert.h>
 #include <stdint.h>
 
@@ -85,8 +85,8 @@ main(void)
 ## ------------------- ##
 AT_TESTFUN([sr_rpm_package_uniq],
 [[
-#include <lib/rpm.h>
-#include <lib/utils.h>
+#include "rpm.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdint.h>
 
@@ -189,8 +189,8 @@ main(void)
 ## -------------------- ##
 AT_TESTFUN([sr_rpm_package_uniq3],
 [[
-#include <lib/rpm.h>
-#include <lib/utils.h>
+#include "rpm.h"
+#include "utils.h"
 #include <assert.h>
 #include <stdint.h>
 
diff --git a/tests/strbuf.at b/tests/strbuf.at
index 80ddf8e..bb2c43c 100644
--- a/tests/strbuf.at
+++ b/tests/strbuf.at
@@ -7,7 +7,7 @@ AT_BANNER([String buffer])
 ## --------------------- ##
 AT_TESTFUN([sr_strbuf_append_char],
 [[
-#include <lib/strbuf.h>
+#include "strbuf.h"
 #include <assert.h>
 
 int
@@ -36,7 +36,7 @@ main(void)
 ## -------------------- ##
 AT_TESTFUN([sr_strbuf_append_str],
 [[
-#include <lib/strbuf.h>
+#include "strbuf.h"
 #include <assert.h>
 
 /* Test appending strings of certain length. 'len' must be < 50. */
diff --git a/tests/utils.at b/tests/utils.at
index 7c3f99b..6d94197 100644
--- a/tests/utils.at
+++ b/tests/utils.at
@@ -8,7 +8,7 @@ AT_BANNER([Utils])
 
 AT_TESTFUN([sr_strcmp0],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -28,7 +28,7 @@ int main(void)
 
 AT_TESTFUN([sr_strchr_location],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -64,7 +64,7 @@ int main(void)
 
 AT_TESTFUN([sr_strstr_location],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -104,7 +104,7 @@ int main(void)
 
 AT_TESTFUN([sr_strspn_location],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -137,7 +137,7 @@ int main(void)
 
 AT_TESTFUN([sr_skip_char],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -154,7 +154,7 @@ int main(void)
 
 AT_TESTFUN([sr_skip_char_limited],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -172,7 +172,7 @@ int main(void)
 
 AT_TESTFUN([sr_parse_char_limited],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -209,7 +209,7 @@ int main(void)
 
 AT_TESTFUN([sr_skip_char_sequence],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -227,7 +227,7 @@ int main(void)
 
 AT_TESTFUN([sr_skip_char_span],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -249,7 +249,7 @@ int main(void)
 
 AT_TESTFUN([sr_skip_char_span_location],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -283,7 +283,7 @@ int main(void)
 
 AT_TESTFUN([sr_parse_char_span],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -307,7 +307,7 @@ int main(void)
 
 AT_TESTFUN([sr_parse_char_cspan],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -331,7 +331,7 @@ int main(void)
 
 AT_TESTFUN([sr_skip_string],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -351,7 +351,7 @@ int main(void)
 
 AT_TESTFUN([sr_parse_string],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -371,7 +371,7 @@ int main(void)
 
 AT_TESTFUN([sr_skip_uint],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -388,7 +388,7 @@ int main(void)
 
 AT_TESTFUN([sr_parse_uint32],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 #include <stdint.h>
 int main(void)
@@ -408,7 +408,7 @@ int main(void)
 
 AT_TESTFUN([sr_skip_hexadecimal_0xuint],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 int main(void)
 {
@@ -425,7 +425,7 @@ int main(void)
 
 AT_TESTFUN([sr_parse_hexadecimal_0xuint64],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 #include <stdint.h>
 int main(void)
@@ -449,7 +449,7 @@ int main(void)
 
 AT_TESTFUN([sr_indent],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 #include <stdint.h>
 int main(void)
@@ -467,7 +467,7 @@ int main(void)
 
 AT_TESTFUN([sr_struniq],
 [[
-#include <lib/utils.h>
+#include "utils.h"
 #include <assert.h>
 void do_check(char **in, size_t inlen, char **out, size_t outlen)
 {
@@ -508,8 +508,8 @@ int main(void)
 
 AT_TESTFUN([sr_sha1_hash],
 [[
-#include <lib/sha1.h>
-#include <lib/utils.h>
+#include "sha1.h"
+#include "utils.h"
 #include <assert.h>
 #include <string.h>
 
-- 
1.7.11.7



More information about the Crash-catcher mailing list