void-packages/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvcrash-execinfo.patch

51 lines
1.3 KiB
Diff
Raw Normal View History

2015-09-24 01:39:14 +00:00
--- utils/wvcrash.cc.old 2015-09-22 01:51:19.515241821 -0400
+++ utils/wvcrash.cc 2015-09-22 01:53:44.101443017 -0400
@@ -28,7 +28,10 @@
// FIXME: this file mostly only works in Linux
#ifdef __linux
+#ifdef HAVE_EXECINFO_H
# include <execinfo.h>
+#endif
+
#include <unistd.h>
#ifdef __USE_GNU
@@ -268,8 +271,10 @@
}
wr(fd, "\nBacktrace:\n");
+#ifdef HAVE_EXECINFO_H
backtrace_symbols_fd(trace,
backtrace(trace, sizeof(trace)/sizeof(trace[0])), fd);
+#endif
if (pid > 0)
{
@@ -451,6 +456,7 @@
* ctx.ContextFlags = CONTEXT_FULL;
* GetThreadContext(hThread, &ctx);
*/
+#ifdef HAVE_EXECINFO_H
int backtrace(CONTEXT &ctx)
{
HANDLE hProcess = (HANDLE)GetCurrentProcess();
@@ -521,6 +527,7 @@
return 1;
}
+#endif
static void exception_desc(FILE *file, unsigned exception,
@@ -588,7 +595,9 @@
fprintf(stderr, "Exception 0x%08X:\n ", info->exception);
exception_desc(stderr, info->exception, info->data1, info->data2);
fprintf(stderr, "\n at instruction 0x%08X in thread 0x%08X\n", info->ip, GetCurrentThreadId());
+#ifdef HAVE_EXECINFO_H
backtrace(*pExceptionPointers->ContextRecord);
+#endif
fprintf(stderr, "--------------------------------------------------------\n");