diff --git a/plugins/tracers/Makefile.am b/plugins/tracers/Makefile.am index 9114447177..d52bb28ba7 100644 --- a/plugins/tracers/Makefile.am +++ b/plugins/tracers/Makefile.am @@ -28,8 +28,7 @@ libgstcoretracers_la_CFLAGS = $(GST_OBJ_CFLAGS) \ -DGST_USE_UNSTABLE_API libgstcoretracers_la_LIBADD = \ $(GST_PRINTF_LA) \ - $(GST_OBJ_LIBS) \ - $(UNWIND_LIBS) + $(GST_OBJ_LIBS) libgstcoretracers_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstcoretracers_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) diff --git a/plugins/tracers/gstleaks.c b/plugins/tracers/gstleaks.c index fe9c295583..e31031d96a 100644 --- a/plugins/tracers/gstleaks.c +++ b/plugins/tracers/gstleaks.c @@ -32,17 +32,6 @@ # include "config.h" #endif -#ifdef HAVE_UNWIND -/* No need for remote debugging so turn on the 'local only' optimizations in - * libunwind */ -#define UNW_LOCAL_ONLY -#include -#endif /* HAVE_UNWIND */ - -#ifdef HAVE_BACKTRACE -#include -#endif /* HAVE_BACKTRACE */ - #include "gstleaks.h" #ifdef G_OS_UNIX @@ -215,81 +204,6 @@ mini_object_weak_cb (gpointer data, GstMiniObject * object) handle_object_destroyed (self, object); } -#ifdef HAVE_UNWIND -#define BT_NAME_SIZE 256 -static gchar * -generate_unwind_trace (void) -{ - unw_context_t ctx; - unw_cursor_t cursor; - GString *trace; - - if (unw_getcontext (&ctx)) - return NULL; - - if (unw_init_local (&cursor, &ctx)) - return NULL; - - trace = g_string_new (NULL); - while (unw_step (&cursor) > 0) { - char name[BT_NAME_SIZE]; - unw_word_t offp; - int ret; - - ret = unw_get_proc_name (&cursor, name, BT_NAME_SIZE, &offp); - /* -UNW_ENOMEM is returned if name has been truncated */ - if (ret != 0 && ret != -UNW_ENOMEM) - break; - - g_string_append_printf (trace, "%s\n", name); - } - - return g_string_free (trace, FALSE); -} -#endif /* HAVE_UNWIND */ - -#ifdef HAVE_BACKTRACE -#define BT_BUF_SIZE 100 -static gchar * -generate_backtrace_trace (void) -{ - int j, nptrs; - void *buffer[BT_BUF_SIZE]; - char **strings; - GString *trace; - - trace = g_string_new (NULL); - nptrs = backtrace (buffer, BT_BUF_SIZE); - - strings = backtrace_symbols (buffer, nptrs); - if (!strings) - return NULL; - - for (j = 0; j < nptrs; j++) - g_string_append_printf (trace, "%s\n", strings[j]); - - return g_string_free (trace, FALSE); -} -#endif /* HAVE_BACKTRACE */ - -static gchar * -generate_trace (void) -{ - gchar *trace = NULL; - -#ifdef HAVE_UNWIND - trace = generate_unwind_trace (); - if (trace) - return trace; -#endif /* HAVE_UNWIND */ - -#ifdef HAVE_BACKTRACE - trace = generate_backtrace_trace (); -#endif /* HAVE_BACKTRACE */ - - return trace; -} - static void handle_object_created (GstLeaksTracer * self, gpointer object, GType type, gboolean gobject) @@ -307,7 +221,7 @@ handle_object_created (GstLeaksTracer * self, gpointer object, GType type, GST_OBJECT_LOCK (self); if (self->log_stack_trace) { - trace = generate_trace (); + trace = gst_debug_get_stack_trace (); } g_hash_table_insert (self->objects, object, trace); @@ -350,7 +264,7 @@ gst_leaks_tracer_init (GstLeaksTracer * self) gchar *trace; /* Test if we can retrieve backtrace */ - trace = generate_trace (); + trace = gst_debug_get_stack_trace (); if (trace) { self->log_stack_trace = TRUE; g_free (trace); diff --git a/plugins/tracers/meson.build b/plugins/tracers/meson.build index 0cc9a57f99..b66d47d345 100644 --- a/plugins/tracers/meson.build +++ b/plugins/tracers/meson.build @@ -16,7 +16,7 @@ gst_tracers = library('gstcoretracers', gst_tracers_sources, c_args : tracers_args, include_directories : [configinc], - dependencies : [gst_dep, unwind_dep], + dependencies : [gst_dep], link_with : printf_lib, install : true, install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),