CMS 3D CMS Logo

DebugAids.h

Go to the documentation of this file.
00001 #ifndef CLASSLIB_SYSAPI_DEBUG_AIDS_H
00002 # define CLASSLIB_SYSAPI_DEBUG_AIDS_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
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 //#  include <io.h>
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     // This is yucky.  KCC's <exception.h> that has nothing to do with the
00031     // header we are looking for (it redirect to <exception>).  This ugly
00032     // workaround allows us to find the (IRIX) header we are looking for.
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 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00056 
00057 // Windows doesn't have this, so fake a suitable substitute
00058 # ifdef _WIN32
00059 #  define STDERR_HANDLE GetStdHandle (STD_ERROR_HANDLE)
00060 # else
00061 #  define STDERR_HANDLE STDERR_FILENO
00062 # endif
00063 
00064 // Define a suitable wrapper to write to system file descriptors.
00065 // This is needed because on Windows we are using HANDLEs, not the
00066 // compiler's crippled posixy interface.
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 // Helper to write literals
00075 # define MYWRITELIT(fd,str) MYWRITE(fd,str,sizeof(str)-1)
00076 
00077 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00078 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00079 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00080 
00081 #if HAVE_BACKTRACE_SYMBOLS_FD
00082 
00084 static const int MAX_BACKTRACE_DEPTH = 128;
00085 #endif
00086 
00087 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00088 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00089 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00090 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00091 
00092 #endif // CLASSLIB_SYSAPI_DEBUG_AIDS_H

Generated on Tue Jun 9 17:38:52 2009 for CMSSW by  doxygen 1.5.4