medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e66af9caeea0cb86410d2b3ba6454cb32311f13f
parent d424f16fd3016919b1eab127b52b064d53a4fa86
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Aug 16 12:05:39 +0200

Split platform_backtrace implementations into their own files

Diffstat:
linuxdarwin_backtrace.cc | 11+++++++++++
platform_backtrace.h | 10++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/linuxdarwin_backtrace.cc b/linuxdarwin_backtrace.cc @@ -0,0 +1,11 @@ +#include <unistd.h> +#include <execinfo.h> + +#include "intrinsics.h" +#include "platform_backtrace.h" + +inline void print_backtrace() { + void * stack[ 128 ]; + const int stack_size = backtrace( stack, array_count( stack ) ); + backtrace_symbols_fd( stack, stack_size, STDERR_FILENO ); +} diff --git a/platform_backtrace.h b/platform_backtrace.h @@ -0,0 +1,10 @@ +#ifndef _PLATFORM_BACKTRACE_H_ +#define _PLATFORM_BACKTRACE_H_ + +void print_backtrace(); + +#if defined(__linux__) || defined(__APPLE__) +#include "linuxdarwin_backtrace.cc" +#endif + +#endif // _PLATFORM_BACKTRACE_H_