00001 #ifndef CLASSLIB_SYSAPI_DEBUG_AIDS_H
00002 # define CLASSLIB_SYSAPI_DEBUG_AIDS_H
00003
00004
00005
00006 # include "classlib/sysapi/system.h"
00007
00008 # include <cctype>
00009 # include <cstdio>
00010 # include <cstdlib>
00011 # include <iostream>
00012 # include <iomanip>
00013
00014 # ifdef _WIN32
00015 # include <windows.h>
00016 # include <winnt.h>
00017 # include <imagehlp.h>
00018
00019 # else
00020 # include <unistd.h>
00021 # include <sys/wait.h>
00022 # if HAVE_BACKTRACE_SYMBOLS_FD // GNU
00023 # include <execinfo.h>
00024 # include <sys/uio.h>
00025 # endif
00026 # if HAVE_DLADDR // Linux, Solaris
00027 # include <dlfcn.h>
00028 # endif
00029 # if HAVE_EXCEPTION_H
00030
00031
00032
00033 # if defined __KCC && defined __sgi
00034 # include </usr/include/exception.h>
00035 # elif defined __sgi
00036 # include <exception.h>
00037 # endif
00038 # endif
00039 # if HAVE_EXCPT_H // IRIX
00040 # include <excpt.h>
00041 # undef try // Defined on SGI to structured exception handling goop
00042 # undef catch // Defined on SGI to structured exception handling goop
00043 # endif
00044 # if HAVE_RLD_INTERFACE_H // Tru64 (IRIX)
00045 # include <rld_interface.h>
00046 # endif
00047 # if HAVE_PDSC_H // Tru64
00048 # include <pdsc.h>
00049 # endif
00050 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) // GCC 3.4+ C++ ABI
00051 # include <sys/uio.h>
00052 # endif
00053 # endif
00054
00055
00056
00057
00058 # ifdef _WIN32
00059 # define STDERR_HANDLE GetStdHandle (STD_ERROR_HANDLE)
00060 # else
00061 # define STDERR_HANDLE STDERR_FILENO
00062 # endif
00063
00064
00065
00066
00067 # ifdef _WIN32
00068 # define MYWRITE(fd,data,n) do { DWORD written; WriteFile(fd,data,n,\
00069 &written,0); } while (0)
00070 # else
00071 # define MYWRITE(fd,data,n) write(fd,data,n)
00072 # endif
00073
00074
00075 # define MYWRITELIT(fd,str) MYWRITE(fd,str,sizeof(str)-1)
00076
00077
00078
00079
00080
00081 #if HAVE_BACKTRACE_SYMBOLS_FD
00082
00084 static const int MAX_BACKTRACE_DEPTH = 128;
00085 #endif
00086
00087
00088
00089
00090
00091
00092 #endif // CLASSLIB_SYSAPI_DEBUG_AIDS_H