--- Comment #8 from Sean Kelly <> 2010-02-04 16:38:11 PST 
printstack doesn't exist on OSX, so it has to be faked there (which is pretty
easy to do).  The only trick is that the stack trace integration is line-based
using opApply, so on platforms where backtrace isn't available, the trace
should really be output to a buffer and then parsed for opApply output.  This
might not be possible with printstack though.  In any case, here's some code
I've used to mimic printstack on OSX.  The backtrace_symbols call is what I'd
use for opApply, since it's pretty much exactly what's needed.  If I remember
correctly, backtrace is just a wrapper for some of the stuff in <ucontext.h>.

#if defined(sun) || defined(__sun) || defined(_sun_) || defined(__solaris__)
#   include <ucontext.h>
#elif defined(__APPLE__)
#   include <execinfo.h>

    int printstack( int fd )
        void* callstack[128];
        int   frames = backtrace( callstack, 128 );
        backtrace_symbols_fd( callstack, frames, fd );

        char** strs = backtrace_symbols( callstack, frames );
        for( i = 0; i < frames; ++i )
            fprintf( fd, "%s\n", strs[i] );
        free( strs );
        return 0;
    int printstack( int fd )
        return 0;

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to