Commit 3f14ac41 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Print backtrace in vlc_pthread_fatal

parent 234a17d0
......@@ -83,6 +83,10 @@ static inline unsigned long vlc_threadid (void)
return v.i;
}
#ifdef __GLIBC__
# include <execinfo.h>
#endif
/*****************************************************************************
* vlc_thread_fatal: Report an error from the threading layer
*****************************************************************************
......@@ -100,7 +104,11 @@ void vlc_pthread_fatal (const char *action, int error,
#ifdef __GLIBC__
/* Avoid the strerror_r() prototype brain damage in glibc */
errno = error;
fprintf (stderr, " Error message: %m\n");
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;
......@@ -118,9 +126,9 @@ void vlc_pthread_fatal (const char *action, int error,
break;
}
fprintf (stderr, " Error message: %s\n", msg);
fflush (stderr);
#endif
fflush (stderr);
abort ();
}
#else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment