Use posh typedefs.

Enable stacktraces on OS X.
This commit is contained in:
castano 2010-09-20 06:58:20 +00:00
parent 276c608f26
commit 19f872161e
6 changed files with 35 additions and 11 deletions

View File

@ -40,7 +40,6 @@
# include <sys/types.h> # include <sys/types.h>
# include <sys/sysctl.h> // sysctl # include <sys/sysctl.h> // sysctl
# include <sys/ucontext.h> # include <sys/ucontext.h>
# undef HAVE_EXECINFO_H
# if defined(HAVE_EXECINFO_H) // only after OSX 10.5 # if defined(HAVE_EXECINFO_H) // only after OSX 10.5
# include <execinfo.h> // backtrace # include <execinfo.h> // backtrace
# if NV_CC_GNUC // defined(HAVE_CXXABI_H) # if NV_CC_GNUC // defined(HAVE_CXXABI_H)
@ -267,7 +266,7 @@ namespace
#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) // NV_OS_LINUX || NV_OS_DARWIN #elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) // NV_OS_LINUX || NV_OS_DARWIN
#if defined(HAVE_EXECINFO_H) // NV_OS_LINUX #if defined(HAVE_EXECINFO_H)
static bool hasStackTrace() { static bool hasStackTrace() {
#if NV_OS_DARWIN #if NV_OS_DARWIN
@ -586,12 +585,14 @@ void NV_CDECL nvDebugPrint(const char *msg, ...)
/// Dump debug info. /// Dump debug info.
void debug::dumpInfo() void debug::dumpInfo()
{ {
#if NV_OS_WIN32 || (defined(HAVE_SIGNAL_H) && defined(HAVE_EXECIINFO_H))
if (hasStackTrace()) if (hasStackTrace())
{ {
void * trace[64]; void * trace[64];
int size = backtrace(trace, 64); int size = backtrace(trace, 64);
printStackTrace(trace, size, 1); printStackTrace(trace, size, 1);
} }
#endif
} }

View File

@ -2,8 +2,8 @@
#error "Do not include this file directly." #error "Do not include this file directly."
#endif #endif
#include <stdint.h> // uint8_t, int8_t, ... //#include <stdint.h> // uint8_t, int8_t, ...
#include <cstddef> // size_t, NULL //#include <cstddef> // size_t, NULL
// Function linkage // Function linkage
#define DLL_IMPORT #define DLL_IMPORT
@ -51,7 +51,7 @@
#define restrict __restrict__ #define restrict __restrict__
/*
// Type definitions // Type definitions
typedef uint8_t uint8; typedef uint8_t uint8;
typedef int8_t int8; typedef int8_t int8;
@ -67,3 +67,4 @@ typedef int64_t int64;
// Aliases // Aliases
typedef uint32 uint; typedef uint32 uint;
*/

View File

@ -2,7 +2,7 @@
#error "Do not include this file directly." #error "Do not include this file directly."
#endif #endif
#include <cstddef> // size_t, NULL //#include <cstddef> // size_t, NULL
// Function linkage // Function linkage
#define DLL_IMPORT #define DLL_IMPORT
@ -51,7 +51,7 @@
#define restrict __restrict__ #define restrict __restrict__
/*
// Type definitions // Type definitions
typedef unsigned char uint8; typedef unsigned char uint8;
typedef signed char int8; typedef signed char int8;
@ -67,3 +67,5 @@ typedef signed long long int64;
// Aliases // Aliases
typedef uint32 uint; typedef uint32 uint;
*/

View File

@ -2,7 +2,7 @@
#error "Do not include this file directly." #error "Do not include this file directly."
#endif #endif
#include <cstddef> // size_t, NULL //#include <cstddef> // size_t, NULL
// Function linkage // Function linkage
#define DLL_IMPORT __declspec(dllimport) #define DLL_IMPORT __declspec(dllimport)
@ -45,7 +45,7 @@
#define restrict __restrict__ #define restrict __restrict__
/*
// Type definitions // Type definitions
typedef unsigned char uint8; typedef unsigned char uint8;
typedef signed char int8; typedef signed char int8;
@ -61,3 +61,5 @@ typedef signed long long int64;
// Aliases // Aliases
typedef uint32 uint; typedef uint32 uint;
*/

View File

@ -44,6 +44,7 @@
#define NV_NOINLINE __declspec(noinline) #define NV_NOINLINE __declspec(noinline)
/*
// Type definitions // Type definitions
typedef unsigned char uint8; typedef unsigned char uint8;
typedef signed char int8; typedef signed char int8;
@ -59,7 +60,7 @@ typedef signed __int64 int64;
// Aliases // Aliases
typedef uint32 uint; typedef uint32 uint;
*/
// Unwanted VC++ warnings to disable. // Unwanted VC++ warnings to disable.
/* /*

View File

@ -102,6 +102,23 @@
#define NV_ENDIAN_STRING POSH_ENDIAN_STRING #define NV_ENDIAN_STRING POSH_ENDIAN_STRING
// Type definitions:
typedef posh_u8_t uint8;
typedef posh_i8_t int8;
typedef posh_u16_t uint16;
typedef posh_i16_t int16;
typedef posh_u32_t uint32;
typedef posh_i32_t int32;
typedef posh_u64_t uint64;
typedef posh_i64_t int64;
// Aliases
typedef uint32 uint;
// Version string: // Version string:
#define NV_VERSION_STRING \ #define NV_VERSION_STRING \
NV_OS_STRING "/" NV_CC_STRING "/" NV_CPU_STRING"/" \ NV_OS_STRING "/" NV_CC_STRING "/" NV_CPU_STRING"/" \
@ -152,7 +169,7 @@
#define NV_UNUSED(a) ((a)=(a)) #define NV_UNUSED(a) ((a)=(a))
/// Null index. @@ Move this somewhere else... it's only used by nvmesh. /// Null index. @@ Move this somewhere else... it's only used by nvmesh.
const unsigned int NIL = unsigned int(~0); //const unsigned int NIL = unsigned int(~0);
/// Null pointer. /// Null pointer.
#ifndef NULL #ifndef NULL