[vlc-devel] commit: libvlccore: Also print a backtrace on Mac OS X. (Pierre d' Herbemont )
git version control
git at videolan.org
Fri May 30 18:02:11 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Fri May 30 18:03:10 2008 +0200| [84207844e7c0a51fbe16693ead8698c1db0e1b4f]
libvlccore: Also print a backtrace on Mac OS X.
Note: We may want to check that at configure time.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=84207844e7c0a51fbe16693ead8698c1db0e1b4f
---
src/misc/objects.c | 4 ++--
src/misc/threads.c | 12 +++++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/misc/objects.c b/src/misc/objects.c
index e717aaf..9de7769 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -1488,7 +1488,7 @@ static void ListChildren( vlc_list_t *p_list, vlc_object_t *p_this, int i_type )
}
#ifndef NDEBUG
-# ifdef __GLIBC__
+# if defined(__GLIBC__) || defined(__APPLE__)
# include <execinfo.h>
# endif
@@ -1547,7 +1547,7 @@ void vlc_refcheck (vlc_object_t *obj)
obj->psz_object_type);
fflush (stderr);
-#ifdef __GLIBC__
+#if defined(__GLIBC__) || defined(__APPLE__)
void *stack[20];
int stackdepth = backtrace (stack, sizeof (stack) / sizeof (stack[0]));
backtrace_symbols_fd (stack, stackdepth, 2);
diff --git a/src/misc/threads.c b/src/misc/threads.c
index 42c1112..c68dab7 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -83,7 +83,7 @@ static inline unsigned long vlc_threadid (void)
return v.i;
}
-#ifdef __GLIBC__
+#if defined(__GLIBC__) || defined(__APPLE__)
# include <execinfo.h>
#endif
@@ -105,10 +105,6 @@ void vlc_pthread_fatal (const char *action, int error,
/* Avoid the strerror_r() prototype brain damage in glibc */
errno = error;
dprintf (2, " Error message: %m at:\n");
-
- void *stack[20];
- int len = backtrace (stack, sizeof (stack) / sizeof (stack[0]));
- backtrace_symbols_fd (stack, len, 2);
#else
char buf[1000];
const char *msg;
@@ -129,6 +125,12 @@ void vlc_pthread_fatal (const char *action, int error,
fflush (stderr);
#endif
+#if defined(__GLIBC__) || defined(__APPLE__)
+ void *stack[20];
+ int len = backtrace (stack, sizeof (stack) / sizeof (stack[0]));
+ backtrace_symbols_fd (stack, len, 2);
+#endif
+
abort ();
}
#else
More information about the vlc-devel
mailing list