23 #ifndef SATYR_COMPAT_H_
24 #define SATYR_COMPAT_H_
31 #include <satyr/core_frame.h>
32 #include <satyr/core_stacktrace.h>
33 #include <satyr/core_thread.h>
34 #include <satyr/distance.h>
35 #include <satyr/gdb_frame.h>
36 #include <satyr/gdb_stacktrace.h>
37 #include <satyr/location.h>
38 #include <satyr/metrics.h>
39 #include <satyr/normalize.h>
40 #include <satyr/sha1.h>
41 #include <satyr/utils.h>
43 #define BACKTRACE_DUP_THRESHOLD 0.3
48 #include <btparser/frame.h>
49 #include <btparser/thread.h>
50 #include <btparser/normalize.h>
51 #include <btparser/metrics.h>
52 #include <btparser/core-backtrace.h>
53 #include <btparser/backtrace.h>
54 #include <btparser/frame.h>
55 #include <btparser/location.h>
58 #define BACKTRACE_DUP_THRESHOLD 2
61 #define sr_core_stacktrace btp_thread
62 #define sr_core_thread btp_thread
63 #define sr_thread_get_frame_count btp_thread_get_frame_count
67 SR_DISTANCE_DAMERAU_LEVENSHTEIN
74 struct sr_core_stacktrace *
75 sr_core_stacktrace_from_json_text(
const char *text,
78 struct btp_thread *thread = btp_load_core_backtrace(text);
81 *error_message = xstrdup(
82 "Failed to parse backtrace, considering it not duplicate");
85 return btp_load_core_backtrace(text);
88 struct sr_core_thread *
89 sr_core_stacktrace_find_crash_thread(
struct sr_core_stacktrace *stacktrace)
95 sr_core_thread_get_frame_count(
struct sr_core_thread *thread)
97 return btp_thread_get_frame_count(thread);
101 sr_distance_core(
enum sr_distance_type distance_type,
102 struct sr_core_thread *thread1,
103 struct sr_core_thread *thread2)
105 return btp_thread_levenshtein_distance_custom(thread1, thread2,
true,
106 btp_core_backtrace_frame_cmp);
110 sr_core_stacktrace_free(
struct sr_core_stacktrace *stacktrace)
112 btp_free_core_backtrace(stacktrace);
116 #define sr_location btp_location
117 #define sr_gdb_stacktrace btp_backtrace
118 #define sr_gdb_frame btp_frame
121 sr_location_init(
struct sr_location *location)
123 btp_location_init(location);
126 struct sr_gdb_stacktrace *
127 sr_gdb_stacktrace_parse(
const char **input,
128 struct sr_location *location)
130 return btp_backtrace_parse(input, location);
134 sr_gdb_stacktrace_get_duplication_hash(
struct sr_gdb_stacktrace *stacktrace)
136 return btp_backtrace_get_duplication_hash(stacktrace);
140 sr_gdb_stacktrace_quality_complex(
struct sr_gdb_stacktrace *stacktrace)
142 return btp_backtrace_quality_complex(stacktrace);
145 struct sr_gdb_frame *
146 sr_gdb_stacktrace_get_crash_frame(
struct sr_gdb_stacktrace *stacktrace)
148 return btp_backtrace_get_crash_frame(stacktrace);
152 sr_gdb_frame_free(
struct sr_gdb_frame *frame)
154 btp_frame_free(frame);
158 sr_gdb_stacktrace_free(
struct sr_gdb_stacktrace *stacktrace)
160 btp_backtrace_free(stacktrace);