Merge pull request #350 from lasergnu/stacktrace

Many platforms don't support backtraces. Fix compile for Solaris platform
This commit is contained in:
Daniel Marjamäki 2014-06-28 07:34:01 +02:00
commit 660f8c720d
2 changed files with 5 additions and 2 deletions

View File

@ -32,7 +32,7 @@
#include <algorithm>
#include <climits>
#if !defined(NO_UNIX_SIGNAL_HANDLING) && defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__)
#if !defined(NO_UNIX_SIGNAL_HANDLING) && defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) && !defined(__SVR4)
#define USE_UNIX_SIGNAL_HANDLING
#include <execinfo.h>
#include <cxxabi.h>
@ -237,7 +237,7 @@ static const char *signal_name(int signo)
*/
static void print_stacktrace(FILE* f, bool demangling)
{
#if defined(__GNUC__)
#if defined(USE_UNIX_SIGNAL_SUPPORT)
void *array[32]= {0}; // the less resources the better...
const int depth = backtrace(array, (int)GetArrayLength(array));
char **symbolstrings = backtrace_symbols(array, depth);

View File

@ -20,6 +20,9 @@
#include "cppcheck.h"
#include "cppcheckexecutor.h"
#include <iostream>
#ifdef __SVR4 // Solaris
#include <sys/loadavg.h>
#endif
#ifdef THREADING_MODEL_FORK
#include <algorithm>
#include <sys/select.h>