CXI-Basis-Programmierreferenz / Noch zu dokumentieren /
(siehe auch: Beispielausgabe)
/* CXI3DBG.H - Exception handler for OS/2 and Win32 */
#ifndef _CXI3DBG_H_
#define _CXI3DBG_H_
#include "cxi3sys.h"
#if !defined SYSOS2 && !defined SYSPE
#error cxi3dbg not supported for this operating system
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _CxixExceptionRegistrationRecord
{
struct _CxixExceptionRegistrationRecord *prev;
void (*ExceptionHandler) (void);
}
CxixExceptionRegistrationRecord;
typedef unsigned long int CxixLong;
typedef int (CXIGLOBALFUNC *CxixFatalExitHookFunc) (CxixLong cargo, CxixLong flags, CxixLong whandle, void *reportrec);
typedef int (CXIGLOBALFUNC *CxixDispFunc) (int flags, char *buf, unsigned int len);
typedef CxixLong (CXIGLOBALFUNC *CxixCatchPtr) (void);
typedef struct _CxixFunctionStruct
{
CxixLong Reserved0;
CxixLong VersionNumber;
const char * VersionString;
const char * RevisionString;
CxixLong Reserved7 [4];
CxixLong SizeOfCatchBuffer;
CxixLong Reserved1 [7];
void (CXIGLOBALFUNC *Abort) (void);
int (CXIGLOBALFUNC *RaiseException) (CxixLong exnum, CxixLong p1, CxixLong p2, CxixLong p3, CxixLong p4);
int (CXIGLOBALFUNC *EnableExceptionsGlobal) (void);
int (CXIGLOBALFUNC *DisableExceptionsGlobal)(void);
int (CXIGLOBALFUNC *EnableExceptionHandler) (CxixExceptionRegistrationRecord *r, const char *type, const char *name, const char *fname, CxixLong fline);
int (CXIGLOBALFUNC *DisableExceptionHandler)(CxixExceptionRegistrationRecord *r);
int (CXIGLOBALFUNC *Reserved6) (void *p);
int (CXIGLOBALFUNC *BaseDumpCurrentState) (const char *fname, CxixLong fline, CxixLong userdata, CxixLong options);
CxixLong (CXIGLOBALFUNC *ExceptOptions) (CxixLong set, CxixLong clr);
void (CXIGLOBALFUNC *ExceptLevel) (int lvl);
int (CXIGLOBALFUNC *AddExitMessage) (const char *msg);
int (CXIGLOBALFUNC *RegisterFatalExitHook) (CxixFatalExitHookFunc f, CxixLong cargo, CxixLong options);
int (CXIGLOBALFUNC *HookWriteFunction) (CxixLong whandle, const char *msg);
CxixCatchPtr (CXIGLOBALFUNC *TryCatchInternal) (int op, void *buf);
void (CXIGLOBALFUNC *Reserved2 [10]) (void);
int (CXIGLOBALFUNC *BaseDisassemble) (char *target, const char *source, CxixLong offset, CxixLong options);
int (CXIGLOBALFUNC *Disassemble) (char *target, const char *source, CxixLong offset, CxixLong options);
int (CXIGLOBALFUNC *BaseMemDump) (const char *target, CxixLong options);
int (CXIGLOBALFUNC *MemDump) (const char *target, CxixLong options);
int (CXIGLOBALFUNC *DeMangleCppName) (char *target, const char *source, CxixLong options);
void (CXIGLOBALFUNC *Reserved3 [3]) (void);
void * (CXIGLOBALFUNC *QueryModuleInfo) (CxixLong pmodhandle);
void (CXIGLOBALFUNC *RegisterModuleInfo) (CxixLong pmodhandle, void *pmodinfo);
int (CXIGLOBALFUNC *SetDisplayFunction) (CxixDispFunc f);
CxixDispFunc (CXIGLOBALFUNC *GetDisplayFunction) (int force);
int (CXIGLOBALFUNC *DisplayFunctions [4]) (int flags, char *buf, unsigned int len);
void (CXIGLOBALFUNC *Reserved4 [44]) (void);
CxixLong Reserved5 [28];
}
CxixFunctionStruct;
CXIDECL32 const CxixFunctionStruct * CXIGLOBALFUNC32 CXI3DBG1QUERYFUNCTIONSTRUCT (void);
extern const CxixFunctionStruct CXI3DBG1REFERFUNCTIONSTRUCT;
#ifdef CXI3DBGIBYREFERENCE
#define CXI3DBG CXI3DBG1REFERFUNCTIONSTRUCT
#else
#define CXI3DBG (*CXI3DBG1QUERYFUNCTIONSTRUCT())
#endif
#ifdef __cplusplus
} // end extern "C"
class CxixExceptionHandler
{
CxixExceptionRegistrationRecord r;
public:
CxixExceptionHandler (const char *name, const char *type, const char *fname, CxixLong fline)
{ CXI3DBG.EnableExceptionHandler (&r, name, type, fname, fline); }
~CxixExceptionHandler ()
{ CXI3DBG.DisableExceptionHandler (&r); }
};
#define CxixRegisterName(name,type) \
CxixExceptionHandler __cxixExceptionHandlerInstance (name, type, __FILE__, __LINE__)
#define CxixDeregister()
#else /* __cplusplus */
#define CxixRegisterName(name,type) \
{ CxixExceptionRegistrationRecord __cxixExcRegRecInstance; \
int __cxixExcDummy = CXI3DBG.EnableExceptionHandler \
(&__cxixExcRegRecInstance, name, type, __FILE__, __LINE__)
#define CxixDeregister() \
CXI3DBG.DisableExceptionHandler (&__cxixExcRegRecInstance); \
}
#endif /* __cplusplus */
#define CxixRegister() CxixRegisterName(0,0)
#define cxixRegister() CxixRegisterName(0,0)
#define cxixRegisterName CxixRegisterName
#define cxixDeregister CxixDeregister
#define EnableExceptionHandler CxixRegister()
#define DisableExceptionHandler CxixDeregister()
#define cxixAddExitMessage(s) CXI3DBG.AddExitMessage(s)
#define cxixDumpCurrentState() CXI3DBG.BaseDumpCurrentState(__FILE__,__LINE__,0,0x80000000)
#define cxixDumpCurrentStateLev(n) CXI3DBG.BaseDumpCurrentState(__FILE__,__LINE__,0,0x80000000+(n))
#define cxixDumpCurrentStatePar(u) CXI3DBG.BaseDumpCurrentState(__FILE__,__LINE__,(u),0x80000000)
#define cxixDumpCurrentStateParLev(u,n) CXI3DBG.BaseDumpCurrentState(__FILE__,__LINE__,(u),0x80000000+(n))
#define cxixSetLevelAbsoluteMinimum() CXI3DBG.ExceptLevel(1)
#define cxixSetLevelMinimum() CXI3DBG.ExceptLevel(2)
#define cxixSetLevelStandard() CXI3DBG.ExceptLevel(3)
#define cxixSetLevelMedium() CXI3DBG.ExceptLevel(4)
#define cxixSetLevelExtended() CXI3DBG.ExceptLevel(5)
#define cxixSetLevelMaximum() CXI3DBG.ExceptLevel(6)
#define cxixSetLevelAbsoluteMaximum() CXI3DBG.ExceptLevel(7)
#define cxixOptDisAsmAlways16Bit 0x00000001
#define cxixOptDisAsmAlways32Bit 0x00000002
#define cxixOptDisAsmNoCoprocessor 0x00000040
#define cxixOptDisAsmInsertDollar 0x00000100
#define cxixOptDisAsmInsert0xPrefix 0x00000200
#define cxixOptDisAsmInsertHPostfix 0x00000400
#define cxixOptDumpNoHex 0x00001000
#define cxixOptDumpFullHex 0x00002000
#define cxixOptAllSegments 0x00008000
#define cxixOptForceSegments 0x00010000
#define cxixOptDisAsmAllFrames 0x00040000
#define cxixOptMemoryDump 0x00080000
#define cxixOptAllModules 0x00100000
#define cxixOptAllContext 0x00200000
#define cxixOptAllStackFrames 0x00800000
#define cxixOptNoStackDump 0x01000000
#define cxixOptInternalSystemFlag 0x04000000
#define cxixOptInternalNested 0x08000000
#define cxixBreakPointDefault 0x00000000
#define cxixBreakPointDumpAndExit 0x10000000
#define cxixBreakPointDumpAndContinue 0x20000000
#define cxixBreakPointIgnore 0x30000000
#define cxixBreakPointHandleBySystem 0x40000000
#define cxixHookOptEarly 0x00100000
#define cxixHookOptDeregister 0x00800000
#define cxixHookStateWriteAllowed 0x01000000
#define cxixHookStateRepRecValid 0x02000000
#define cxixHookStateDumpOnly 0x10000000
#define cxixHookStateMayContinue 0x20000000
#define cxixHookReturnDefault 0
#define cxixHookReturnMayContinue 0x20000000
#endif