CBS_SE_Exception Class Reference

Converts systems exceptions into C++ exceptions. More...

Inheritance diagram for CBS_SE_Exception:

Inheritance graph
[legend]
Collaboration diagram for CBS_SE_Exception:

Collaboration graph
[legend]
List of all members.

Public Types

enum  BS_SE_EX_CRASH_INFO {
  BS_SE_EX_NONE = 0x0000, BS_SE_EX_APPEND = 0x0001, BS_SE_EX_LOG_TASK_LIST = 0x0002, BS_SE_EX_LOG_MODULES = 0x0004,
  BS_SE_EX_LOG_REGISTERS = 0x0008, BS_SE_EX_LOG_DISASSEMBLY = 0x0010, BS_SE_EX_LOG_STACK_TRACE = 0x0020, BS_SE_EX_LOG_STACK_ROW = 0x0040,
  BS_SE_EX_LOG_SYMBOL_TABLE = 0x0080 , BS_SE_EX_LOG_DEFAULT
}
typedef CBS_SE_Exception::_BS_SE_EXCEPTION_DETAIL BS_SE_EXCEPTION_DETAIL
 A structure to save exception details.
typedef CBS_SE_Exception::_BS_SE_EXCEPTION_DETAILLPBS_SE_EXCEPTION_DETAIL
 A structure to save exception details.

Public Member Functions

 DECLARE_BS_GENERAL_DRIVE_FUNCTIONS (CBS_SE_Exception, CBS_Exception)
 DECLARE_DLL_OPERATORS (CBS_SE_Exception::BS_SE_EX_CRASH_INFO, GSUPPORT_IMP_EXP_DECL)
 DECLARE_STATIC_SET_GET_MODE (CBS_SE_Exception::BS_SE_EX_CRASH_INFO, m_SECrashInfo, SECrashInfo)
virtual void FreeResources (BOOL bFromDestructor=FALSE)
virtual DWORD GetErrorMessage (LPTSTR lpMessage, DWORD dwBufLen)
CONTEXT * GetExceptionContext ()
LPBS_SE_EXCEPTION_DETAIL GetExceptionDeteil ()
LPCTSTR GetLongExceptionString ()
unsigned int GetSeNumber ()
LPCTSTR GetShortExceptionString ()
virtual CBS_Trace::BS_TRACE_MODE GetTraceOutput ()
virtual BOOL IsContinuable ()

Static Public Member Functions

LPCSTR GetCrashFile ()
DWORD GetNumberOfInstructions ()
BOOL SetCrashFile (LPCTSTR lpCrashFile)
DWORD SetNumberOfInstructions (DWORD dwInstructions)

Detailed Description

Converts systems exceptions into C++ exceptions.

Author:
Dror Otmi
Date:
12.07.2003
Version:
V 1.0 Initial version This class provides a way to handle WIN32 exceptions (C Structured Exceptions) as C++ typed exceptions. In other words, all system exceptions such as 'ACCESS_VIOLATION' or 'INT_DIVIDE_BY_ZERO' will be caught here, and thrown as a C++ exception where an object of this class is passed to the application catch block.


Member Enumeration Documentation

enum CBS_SE_Exception::BS_SE_EX_CRASH_INFO
 

A mask with flags for generating the crash file after an exception was caught.

Enumeration values:
BS_SE_EX_NONE  Do nothing.
BS_SE_EX_APPEND  Append the generated file to the existing file (if one exists).
BS_SE_EX_LOG_TASK_LIST  Add the task list to the generated file.
BS_SE_EX_LOG_MODULES  Add the modules list to the generated file.
BS_SE_EX_LOG_REGISTERS  Add the registers content to the generated file.
BS_SE_EX_LOG_DISASSEMBLY  Add the disassembly information to the generated file.
BS_SE_EX_LOG_STACK_TRACE  Add the stack trace information to the generated file.
BS_SE_EX_LOG_STACK_ROW  Add the row stack content to the generated file.
BS_SE_EX_LOG_SYMBOL_TABLE  Add the symbol table to the generated file (not recommended, it is relative big and takes a long time).
BS_SE_EX_LOG_DEFAULT  The default setting.


Member Function Documentation

CBS_SE_Exception::DECLARE_BS_GENERAL_DRIVE_FUNCTIONS CBS_SE_Exception  ,
CBS_Exception 
 

Declares LPCTSTR GetClassName( ), virtual LPCTSTR GetBaseClassName( ) and BOOL IsKindOf( LPCTSTR pCmp ) for CBS_SE_Exception.

CBS_SE_Exception::DECLARE_DLL_OPERATORS CBS_SE_Exception::BS_SE_EX_CRASH_INFO  ,
GSUPPORT_IMP_EXP_DECL 
 

Declares the operators &=, |=, & and | for the enum member CBS_SE_Exception::BS_SE_EX_CRASH_INFO in order to avoid compiler error (or casting).

CBS_SE_Exception::DECLARE_STATIC_SET_GET_MODE CBS_SE_Exception::BS_SE_EX_CRASH_INFO  ,
m_SECrashInfo  ,
SECrashInfo 
 

Declares the folowing members function for manipulating the enum member m_SECrashInfo:

CBS_SE_Exception::BS_SE_EX_CRASH_INFO GetSECrashInfoMode( )
Return the value saved in the member m_SECrashInfo.
BOOL IsSECrashInfoModeSet( CBS_SE_Exception::BS_SE_EX_CRASH_INFO check )
Return TRUE if the setting mode saved in check is on.
CBS_SE_Exception::BS_SE_EX_CRASH_INFO SetSECrashInfoMode( CBS_SE_Exception::BS_SE_EX_CRASH_INFO )
Sets a new crash info mode, returns the old crash info mode.
CBS_SE_Exception::BS_SE_EX_CRASH_INFO AddSECrashInfoMode( CBS_SE_Exception::BS_SE_EX_CRASH_INFO )
Adds a new crash info flag to the member m_SECrashInfo, returns the crash info mode.
CBS_SE_Exception::BS_SE_EX_CRASH_INFO RemoveSECrashInfoMode( CBS_SE_Exception::BS_SE_EX_CRASH_INFO )
Removed a crash info flag from the member m_SECrashInfo, returns the crash info mode.
CBS_SE_Exception::BS_SE_EX_CRASH_INFO SetDefaultSECrashInfoMode()
Sets the default crash info mode to the member m_SECrashInfo, returns the old crash info mode.

void CBS_SE_Exception::FreeResources BOOL  bFromDestructor = FALSE  )  [virtual]
 

Free all the resources allocated by the object.

Parameters:
bFromDestructor if the function is invoked from the destructor, default = FALSE and must be FALSE. Only the destructore should invoke this function with this arguemnt set to TRUE.
Returns:
Nothing.

Reimplemented from CBS_Exception.

LPCSTR CBS_SE_Exception::GetCrashFile  )  [static]
 

See return.

Returns:
The name of the crass file associated with the system exception class.

DWORD CBS_SE_Exception::GetErrorMessage LPTSTR  lpMessage,
DWORD  dwBufLen
[virtual]
 

Format the exception detailed description in lpMessage. This method is invoked from the CBS_Exception::ReportError().

Parameters:
lpMessage The buffer to receive the message.
dwBufLen The lenght in bytes of lpMessage.
Returns:
The number of bytes needed for the whole message. If lpMessage is NULL or not big enough for the whole message, the function will return the number of bytes needed and nothing will be copied to lpMessage.

Reimplemented from CBS_Exception.

CONTEXT * CBS_SE_Exception::GetExceptionContext  ) 
 

See return.

Returns:
The pointer of the exception record of the current object.

CBS_SE_Exception::LPBS_SE_EXCEPTION_DETAIL CBS_SE_Exception::GetExceptionDeteil  ) 
 

See return.

Returns:
A pointer to an LPBS_SE_EXCEPTION_DETAIL with the description of the exception associated with the current object.

LPCTSTR CBS_SE_Exception::GetLongExceptionString  ) 
 

See return.

Returns:
A detailed description of the exception (e.g. "The thread tried to read from or write to a virtual address for which it does not have the appropriate access.").

DWORD CBS_SE_Exception::GetNumberOfInstructions  )  [static]
 

See return.

Returns:
The number of instructions to disassemled before and after the crash point.

unsigned int CBS_SE_Exception::GetSeNumber  ) 
 

See return.

Returns:
The system exception code.

LPCTSTR CBS_SE_Exception::GetShortExceptionString  ) 
 

See return.

Returns:
A short description of the exception (e.g. "Access Violation").

CBS_Trace::BS_TRACE_MODE CBS_SE_Exception::GetTraceOutput  )  [virtual]
 

See return.

Returns:
The trace error level CBS_Trace::BS_REPORT_SYS_EXCEPTION_INFO.

Reimplemented from CBS_Exception.

BOOL CBS_SE_Exception::IsContinuable  )  [virtual]
 

See return.

Returns:
TRUE if the exception is a continuable exception.

Reimplemented from CBS_Exception.

BOOL CBS_SE_Exception::SetCrashFile LPCTSTR  lpCrashFile  )  [static]
 

Sets the name of the crash file to the system exception class.

Parameters:
lpCrashFile The name of the new crash file.
Returns:
TRUE if the name of the file is is valid.
Note:
if lpCrashFile is NULL, the default crash file name, whic is:
YourApplicationPath\YourApplicationName.Crash.log
will be set

DWORD CBS_SE_Exception::SetNumberOfInstructions DWORD  dwInstructions  )  [static]
 

Set the number of instructions before and after the crash point that should be disassemle in the crash report.

Parameters:
dwInstructions The new number of instructions.
Returns:
The old number of instructions.
Bitspot AG


Bitspot AG
Rietlistrasse 1
CH-6345 Neuheim

Bitspot AG Logo

Phone:

+41 41 755 11 22

Fax:

+41 41 755 11 31

e-mail:

mail@bitspot.com

Web:

www.bitspot.com