Rockthesmurf
Advanced Member
Something I do in MacOSX builds of our engine (which I reckon would probably work on *nix including Pandora):
static const bool kUseExceptionHandler = true;
void handler(int sig)
{
void *array[ 16 ];
size_t size;
// get void*'s for all entries on the stack
size = backtrace(array, PiArraySize( array ) );
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd( array, size, 2 );
exit( 1 );
}
int main( int argc, char ** argv )
{
if ( kUseExceptionHandler )
{
signal(SIGSEGV, handler);
signal(SIGBUS, handler);
}
// Etc.
}
Which means if a crash occurs, the callstack is dumped out, you can then use addr2line to see what the crash was (just be sure to keep non stripped versions of the build around that you can match up to the version being run). Just thought I'd mention it on the off chance it is helpful and you hadn't already thought of it.
static const bool kUseExceptionHandler = true;
void handler(int sig)
{
void *array[ 16 ];
size_t size;
// get void*'s for all entries on the stack
size = backtrace(array, PiArraySize( array ) );
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd( array, size, 2 );
exit( 1 );
}
int main( int argc, char ** argv )
{
if ( kUseExceptionHandler )
{
signal(SIGSEGV, handler);
signal(SIGBUS, handler);
}
// Etc.
}
Which means if a crash occurs, the callstack is dumped out, you can then use addr2line to see what the crash was (just be sure to keep non stripped versions of the build around that you can match up to the version being run). Just thought I'd mention it on the off chance it is helpful and you hadn't already thought of it.