core/vul/vul_debug.h

Go to the documentation of this file.
00001 // This is core/vul/vul_debug.h
00002 #ifndef vul_debug_h_
00003 #define vul_debug_h_
00004 
00005 //:
00006 // \file
00007 // \author Ian Scott
00008 
00009 
00010 //: Dump a core file.
00011 // \param filename can have up to one "%d" option, which will be given a different index number
00012 // on each core dump.
00013 void vul_debug_core_dump(const char * filename);
00014 
00015 
00016 //: Force a core dump whilst inside a Structured Exception Handler in a windows program.
00017 // To get a core dump from a Windows structured exceptions
00018 // \verbatim
00019 // void main()
00020 // {
00021 //   __try
00022 //   {
00023 //     // Rest of program
00024 //   }
00025 //   __except(vul_debug_core_dump2(filename, GetExceptionInformation()))
00026 //   {}
00027 // }
00028 // \endverbatim
00029 // \param filename can have up to one "%d" option, which will be given a different index number
00030 // on each core dump.
00031 void vul_debug_core_dump_in_windows_se(const char * filename,
00032                                        void* pep);
00033 #include <vcl_config_compiler.h>
00034 
00035 #if VCL_HAS_EXCEPTIONS
00036 # include <vcl_exception.h>
00037 //: A translated structured exception.
00038 class vul_debug_windows_structured_exception : public vcl_exception
00039 {
00040   void * ex_ptr_;
00041  public:
00042   //: Windows structured exception code.
00043   unsigned code() const;
00044   //: Related execution address.
00045   void *address() const;
00046   virtual const char *what( ) const throw();
00047   vul_debug_windows_structured_exception(void * ex_ptr) : ex_ptr_(ex_ptr) {}
00048   virtual ~vul_debug_windows_structured_exception() throw() {}
00049 };
00050 #else
00051 class vul_debug_windows_structured_exception {};
00052 #endif //  VCL_HAS_EXCEPTIONS
00053 
00054 //: Setup the system to core dump and throw a C++ exception on detection of a Structured Exception
00055 // The system will throw vul_debug_windows_structured_exception.
00056 // You must compile your code with /EHa to get the compiler to correctly handle SEs.
00057 // \param filename can have up to one "%d" option, which will be given a different index number
00058 // on each core dump.
00059 void vul_debug_set_coredump_and_throw_on_windows_se(const char * filename);
00060 
00061 //: Setup the system to core dump and throw a C++ exception on detection of out of memory.
00062 // The system will throw vcl_bad_alloc. 
00063 // \param filename can have up to one "%d" option, which will be given a different index number
00064 // on each core dump.
00065 void vul_debug_set_coredump_and_throw_on_out_of_memory(const char * filename);
00066 
00067 
00068 #endif // vul_debug_h_

Generated on Tue Dec 2 05:08:47 2008 for core/vul by  doxygen 1.5.1