summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-03-03 17:29:07 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-03-03 17:29:07 +0000
commitbbea56886e50625353a8ee0541e95dd9753c81be (patch)
tree3826f30e388267d1add5643458c49b78a485d220
parenta2e510417e052cfa37757597dd9875b672644fa2 (diff)
downloadxine-lib-bbea56886e50625353a8ee0541e95dd9753c81be.tar.gz
xine-lib-bbea56886e50625353a8ee0541e95dd9753c81be.tar.bz2
implementing the backtrace function in the header results in the code being included
in every single plugin (possibly multiple times due to inlining) -> move the code to libxineutil seems more sensible CVS patchset: 4327 CVS date: 2003/03/03 17:29:07
-rw-r--r--src/xine-utils/utils.c34
-rw-r--r--src/xine-utils/xineutils.h39
2 files changed, 37 insertions, 36 deletions
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index cf51f5147..828d7d934 100644
--- a/src/xine-utils/utils.c
+++ b/src/xine-utils/utils.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: utils.c,v 1.11 2003/01/12 16:38:08 holstsn Exp $
+ * $Id: utils.c,v 1.12 2003/03/03 17:29:07 mroi Exp $
*
*/
#define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */
@@ -35,6 +35,12 @@
#include <time.h>
#include <sys/types.h>
#include <pthread.h>
+#if HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+#if HAVE_UCONTEXT_H
+#include <ucontext.h>
+#endif
#include "compat.h"
@@ -133,3 +139,29 @@ void xine_usec_sleep(unsigned usec) {
usleep(usec);
#endif
}
+
+
+/* Obtain a backtrace and print it to stdout. */
+void xine_print_trace (void) {
+#if HAVE_BACKTRACE
+ /* Code Taken from GNU C Library manual */
+ void *array[10];
+ size_t size;
+ char **strings;
+ size_t i;
+
+ size = backtrace (array, 10);
+ strings = backtrace_symbols (array, size);
+
+ printf ("Obtained %d stack frames.\n", size);
+
+ for (i = 0; i < size; i++) {
+ printf ("%s\n", strings[i]);
+ }
+ free (strings);
+#elif HAVE_PRINTSTACK
+ printstack(STDOUT_FILENO);
+#else
+ printf("stack backtrace not available.\n");
+#endif
+}
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index a0b7acd52..922164fd3 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xineutils.h,v 1.41 2003/03/02 18:11:37 f1rmb Exp $
+ * $Id: xineutils.h,v 1.42 2003/03/03 17:29:08 mroi Exp $
*
*/
#ifndef XINEUTILS_H
@@ -42,12 +42,6 @@ extern "C" {
#include <stdio.h>
#include <string.h>
-#if HAVE_EXECINFO_H
-#include <execinfo.h>
-#endif
-#if HAVE_UCONTEXT_H
-#include <ucontext.h>
-#endif
#ifdef __SUNPRO_C
#define inline
@@ -796,31 +790,6 @@ extern int v_g_table[256];
extern int v_b_table[256];
-/* Obtain a backtrace and print it to stdout. */
-static inline void print_trace (void) {
-#if HAVE_BACKTRACE
- /* Code Taken from GNU C Library manual */
- void *array[10];
- size_t size;
- char **strings;
- size_t i;
-
- size = backtrace (array, 10);
- strings = backtrace_symbols (array, size);
-
- printf ("Obtained %d stack frames.\n", size);
-
- for (i = 0; i < size; i++) {
- printf ("%s\n", strings[i]);
- }
- free (strings);
-#elif HAVE_PRINTSTACK
- printstack(STDOUT_FILENO);
-#else
- printf("stack backtrace not available.\n");
-#endif
-}
-
/**
* Provide assert like feature with better description of failure
* Thanks to Mark Thomas
@@ -831,7 +800,7 @@ static inline void print_trace (void) {
if (!(exp)) { \
printf("%s:%s:%d: assertion failed. " desc "\n\n", \
__FILE__, __XINE_FUNCTION__, __LINE__, ##args); \
- print_trace(); \
+ xine_print_trace(); \
abort(); \
} \
} while(0)
@@ -848,7 +817,7 @@ static inline void print_trace (void) {
__FILE__, __XINE_FUNCTION__, __LINE__); \
printf(desc, ##args); \
printf("\n\n"); \
- print_trace(); \
+ xine_print_trace(); \
abort(); \
} \
} while(0)
@@ -861,7 +830,7 @@ static inline void print_trace (void) {
__FILE__, __XINE_FUNCTION__, __LINE__); \
printf(__VA_ARGS__); \
printf("\n\n"); \
- print_trace(); \
+ xine_print_trace(); \
abort(); \
} \
} while(0)