Try to fix configuration of un*x signal handling and backtrace support
This commit is contained in:
parent
ab08883332
commit
4d6c17818d
@ -25,21 +25,26 @@
|
|||||||
#include "pathmatch.h"
|
#include "pathmatch.h"
|
||||||
#include "preprocessor.h"
|
#include "preprocessor.h"
|
||||||
#include "threadexecutor.h"
|
#include "threadexecutor.h"
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
#include <climits>
|
||||||
#include <cstdlib> // EXIT_SUCCESS and EXIT_FAILURE
|
#include <cstdlib> // EXIT_SUCCESS and EXIT_FAILURE
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <climits>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#if !defined(NO_UNIX_SIGNAL_HANDLING) && defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) && !defined(__SVR4)
|
#if !defined(NO_UNIX_SIGNAL_HANDLING) && defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__)
|
||||||
#define USE_UNIX_SIGNAL_HANDLING
|
#define USE_UNIX_SIGNAL_HANDLING
|
||||||
#include <execinfo.h>
|
|
||||||
#include <cxxabi.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(NO_UNIX_BACKTRACE_SUPPORT) && defined(USE_UNIX_SIGNAL_HANDLING) && defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__SVR4)
|
||||||
|
#define USE_UNIX_BACKTRACE_SUPPORT
|
||||||
|
#include <cxxabi.h>
|
||||||
|
#include <execinfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define USE_WINDOWS_SEH
|
#define USE_WINDOWS_SEH
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
@ -237,7 +242,7 @@ static const char *signal_name(int signo)
|
|||||||
*/
|
*/
|
||||||
static void print_stacktrace(FILE* f, bool demangling)
|
static void print_stacktrace(FILE* f, bool demangling)
|
||||||
{
|
{
|
||||||
#if defined(USE_UNIX_SIGNAL_SUPPORT)
|
#if defined(USE_UNIX_BACKTRACE_SUPPORT)
|
||||||
void *array[32]= {0}; // the less resources the better...
|
void *array[32]= {0}; // the less resources the better...
|
||||||
const int depth = backtrace(array, (int)GetArrayLength(array));
|
const int depth = backtrace(array, (int)GetArrayLength(array));
|
||||||
char **symbolstrings = backtrace_symbols(array, depth);
|
char **symbolstrings = backtrace_symbols(array, depth);
|
||||||
@ -433,8 +438,7 @@ static int filterException(int code, PEXCEPTION_POINTERS ex)
|
|||||||
switch (ex->ExceptionRecord->ExceptionCode) {
|
switch (ex->ExceptionRecord->ExceptionCode) {
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
fputs("Access violation", f);
|
fputs("Access violation", f);
|
||||||
switch (ex->ExceptionRecord->ExceptionInformation[0])
|
switch (ex->ExceptionRecord->ExceptionInformation[0]) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
fprintf(f, " reading from 0x%x",
|
fprintf(f, " reading from 0x%x",
|
||||||
ex->ExceptionRecord->ExceptionInformation[1]);
|
ex->ExceptionRecord->ExceptionInformation[1]);
|
||||||
@ -489,8 +493,7 @@ static int filterException(int code, PEXCEPTION_POINTERS ex)
|
|||||||
break;
|
break;
|
||||||
case EXCEPTION_IN_PAGE_ERROR:
|
case EXCEPTION_IN_PAGE_ERROR:
|
||||||
fputs("Invalid page access", f);
|
fputs("Invalid page access", f);
|
||||||
switch (ex->ExceptionRecord->ExceptionInformation[0])
|
switch (ex->ExceptionRecord->ExceptionInformation[0]) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
fprintf(f, " reading from 0x%x",
|
fprintf(f, " reading from 0x%x",
|
||||||
ex->ExceptionRecord->ExceptionInformation[1]);
|
ex->ExceptionRecord->ExceptionInformation[1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user