Browse Source

Enable stack trace on Mac

tags/v1.0.0
Andrew Belt 6 years ago
parent
commit
16e723fd99
1 changed files with 2 additions and 4 deletions
  1. +2
    -4
      src/system.cpp

+ 2
- 4
src/system.cpp View File

@@ -4,7 +4,7 @@
#include <dirent.h> #include <dirent.h>
#include <sys/stat.h> #include <sys/stat.h>


#if defined ARCH_LIN
#if defined ARCH_LIN || defined ARCH_MAC
#include <pthread.h> #include <pthread.h>
#include <sched.h> #include <sched.h>
#include <execinfo.h> // for backtrace and backtrace_symbols #include <execinfo.h> // for backtrace and backtrace_symbols
@@ -119,7 +119,7 @@ std::string getStackTrace() {
void *stack[stackLen]; void *stack[stackLen];
std::string s; std::string s;


#if defined ARCH_LIN
#if defined ARCH_LIN || defined ARCH_MAC
stackLen = backtrace(stack, stackLen); stackLen = backtrace(stack, stackLen);
char **strings = backtrace_symbols(stack, stackLen); char **strings = backtrace_symbols(stack, stackLen);


@@ -127,8 +127,6 @@ std::string getStackTrace() {
s += string::f("%d: %s\n", stackLen - i - 1, strings[i]); s += string::f("%d: %s\n", stackLen - i - 1, strings[i]);
} }
free(strings); free(strings);
#elif defined ARCH_MAC
// TODO
#elif defined ARCH_WIN #elif defined ARCH_WIN
HANDLE process = GetCurrentProcess(); HANDLE process = GetCurrentProcess();
SymInitialize(process, NULL, true); SymInitialize(process, NULL, true);


Loading…
Cancel
Save