From: Thibault Saunier Date: Thu, 26 Jan 2017 16:35:27 +0000 (+0000) Subject: info: Check libunwind return codes X-Git-Tag: 1.12.0~98 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94da8f5d8dbc9308abaec5b1c450c4c39d452e21;p=platform%2Fupstream%2Fgstreamer.git info: Check libunwind return codes --- diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 4696f9e..5a29d7e 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -2661,6 +2661,7 @@ append_debug_info (GString * trace, Dwfl * dwfl, const void *ip) static gchar * generate_unwind_trace (GstStackTraceFlags flags) { + gint unret; unw_context_t uc; unw_cursor_t cursor; gboolean use_libunwind = TRUE; @@ -2677,15 +2678,31 @@ generate_unwind_trace (GstStackTraceFlags flags) dwfl = dwfl_begin (&callbacks); #endif /* HAVE_DW */ - unw_getcontext (&uc); - unw_init_local (&cursor, &uc); + unret = unw_getcontext (&uc); + if (unret) { + GST_DEBUG ("Could not get libunwind context (%d)", unret); + + goto done; + } + unret = unw_init_local (&cursor, &uc); + if (unret) { + GST_DEBUG ("Could not init libunwind context (%d)", unret); + + goto done; + } while (unw_step (&cursor) > 0) { #ifdef HAVE_DW if (dwfl) { unw_word_t ip; - unw_get_reg (&cursor, UNW_REG_IP, &ip); + unret = unw_get_reg (&cursor, UNW_REG_IP, &ip); + if (unret) { + GST_DEBUG ("libunwind could read frame info (%d)", unret); + + goto done; + } + if (append_debug_info (trace, dwfl, (void *) (ip - 4))) { use_libunwind = FALSE; g_string_append (trace, ")\n"); @@ -2703,6 +2720,7 @@ generate_unwind_trace (GstStackTraceFlags flags) } } +done: #ifdef HAVE_DW if (dwfl) dwfl_end (dwfl);