Skip to content

Commit

Permalink
use libunwind on mac instead of execinfo backtrace
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Jan 6, 2013
1 parent 53872cd commit 52f3db5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2704,6 +2704,9 @@ extern "C" void jl_init_codegen(void)
options.NoFramePointerElimNonLeaf = true;
#ifdef __MINGW32__
options.StackAlignmentOverride = 16;
#endif
#ifdef __APPLE__
options.JITExceptionHandling = 1;
#endif
jl_ExecutionEngine = EngineBuilder(jl_Module)
.setEngineKind(EngineKind::JIT)
Expand Down
16 changes: 2 additions & 14 deletions src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#include <errno.h>
#include "julia.h"
#include "builtin_proto.h"
#if defined(__APPLE__)
#include <execinfo.h>
#elif defined(__WIN32__)
#if defined(__WIN32__)
#include <Winbase.h>
#include <malloc.h>
#else
Expand Down Expand Up @@ -413,11 +411,7 @@ static void init_task(jl_task_t *t)
}
#endif

#if defined(__APPLE__) || defined(__WIN32__)
#define MAX_BT_SIZE 1023
#else
#define MAX_BT_SIZE 80000
#endif

static ptrint_t bt_data[MAX_BT_SIZE+1];
static size_t bt_size = 0;
Expand Down Expand Up @@ -451,13 +445,7 @@ DLLEXPORT jl_value_t *jl_get_backtrace()
return (jl_value_t*)a;
}

#if defined(__APPLE__)
// stacktrace using execinfo
static void record_backtrace(void)
{
bt_size = backtrace((void**)bt_data, MAX_BT_SIZE);
}
#elif defined(__WIN32__)
#if defined(__WIN32__)
static void record_backtrace(void)
{
/** MINGW does not have the necessary declarations for linking CaptureStackBackTrace*/
Expand Down

0 comments on commit 52f3db5

Please sign in to comment.