[vlc-commits] commit: Add small backtrace ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sun Apr 11 17:45:39 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 11 18:45:24 2010 +0300| [028bcb00daff59a19b16bc7ce3d76b7355528664] | committer: Rémi Denis-Courmont 

Add small backtrace

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=028bcb00daff59a19b16bc7ce3d76b7355528664
---

 bin/override.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/bin/override.c b/bin/override.c
index 1eabda0..c98ff81 100644
--- a/bin/override.c
+++ b/bin/override.c
@@ -42,14 +42,27 @@ void vlc_enable_override (void)
 #include <stdlib.h>
 #include <dlfcn.h>
 #include <pthread.h>
+#ifdef HAVE_EXECINFO_H
+# include <execinfo.h>
+#endif
 
 static void vlogbug (const char *level, const char *func, const char *fmt,
                      va_list ap)
 {
+#ifdef HAVE_BACKTRACE
+    const size_t framec = 8;
+    void *framev[framec];
+
+    backtrace (framev, framec);
+#endif
     flockfile (stderr);
     fprintf (stderr, "%s: call to %s(", level, func);
     vfprintf (stderr, fmt, ap);
     fputs (")\n", stderr);
+    fflush (stderr);
+#ifdef HAVE_BACKTRACE
+    backtrace_symbols_fd (framev + 2, framec - 2, fileno (stderr));
+#endif
     funlockfile (stderr);
 }
 



More information about the vlc-commits mailing list