Amulets & Armor  v1.02
Open Source Game
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions | Variables
DEBUG

Debug Call Stack System. More...

Macros

#define DEBUG_NO_TIME   0
 
#define HEAP_CHECK_LESS_OFTEN   100
 
#define HEAP_CHECK_ON_ENTER_TOO   0
 
#define MAX_TIME_SLOTS   100
 

Functions

T_void DebugAddRoutine (T_byte8 *p_routineName, T_byte8 *p_filename, T_word16 lineNum)
 
T_void DebugAddRoutine (const char *p_routineName, const char *p_filename, long lineNum)
 
T_void DebugCompareCheck (T_byte8 *str, T_byte8 *p_file, T_word16 line)
 
T_void DebugFail (T_byte8 *p_msg, T_byte8 *p_file, T_word16 line)
 
T_void DebugFail (const char *p_msg, const char *p_file, long line)
 
T_void DebugGetCaller (T_byte8 **filename, T_word16 *line)
 
T_void DebugGetCaller (const char **filename, long *line)
 
const char * DebugGetCallerFile (T_void)
 
const char * DebugGetCallerName (T_void)
 
const char * DebugGetLastCalled (T_void)
 
T_void DebugHeapOff (T_void)
 
T_void DebugHeapOn (T_void)
 
T_void DebugRemoveRoutine (T_void)
 
T_void DebugStop (T_void)
 
T_void DebugTime (T_word16 timeSlot)
 
T_void IDebugReportTimeSlots (T_void)
 

Variables

const char * G_CallStack [DEBUG_MAX_STACK_DEPTH]
 
const char * G_CallStackFile [DEBUG_MAX_STACK_DEPTH]
 
T_word16 G_CallStackLine [DEBUG_MAX_STACK_DEPTH]
 
T_word32 G_CallStackTime [DEBUG_MAX_STACK_DEPTH]
 
T_word16 G_CallStackTimeSlot [DEBUG_MAX_STACK_DEPTH]
 
T_word32 G_TimeSlots [MAX_TIME_SLOTS]
 

Detailed Description

Debug Call Stack System.

Debug Call Stack System for Borland C.

Debugging routines to help with working on the code without a debugger. It tracks stacks so when a problem occurs a call stack can be output.

See Also
http://www.amuletsandarmor.com/AALicense.txt

Debugging routines to help with working on the code without a debugger. It tracks stacks so when a problem occurs a call stack can be output. This is the Borland C (or Turbo-C) version.

See Also
http://www.amuletsandarmor.com/AALicense.txt

Macro Definition Documentation

#define DEBUG_NO_TIME   0
#define HEAP_CHECK_LESS_OFTEN   100
#define HEAP_CHECK_ON_ENTER_TOO   0
#define MAX_TIME_SLOTS   100

Function Documentation

T_void DebugAddRoutine ( T_byte8 p_routineName,
T_byte8 p_filename,
T_word16  lineNum 
)

DebugAddRoutine is NOT called directly. It is called by the use of the macro "DebugRoutine." DebugRoutine is used to declare that the program is entering a section of code that needs to be debugged. The name of the routine is added to a call stack and will be removed later by DebugRemoveRoutine.

NOTE: The current system only allows DEBUG_MAX_STACK_DEPTH levels of calling. Should you go deeper, this routine will create an error. Also, this stack is only coherent as long as calls are made in each functions.

Parameters
p_routineName– String to add to call stack p_routineName is not NULL.
p_filename– String of source filename
lineNum– Source line number
T_void DebugAddRoutine ( const char *  p_routineName,
const char *  p_filename,
long  lineNum 
)

DebugAddRoutine is NOT called directly. It is called by the use of the macro "DebugRoutine." DebugRoutine is used to declare that the program is entering a section of code that needs to be debugged. The name of the routine is added to a call stack and will be removed later by DebugRemoveRoutine.

NOTE: The current system only allows DEBUG_MAX_STACK_DEPTH levels of calling. Should you go deeper, this routine will create an error. Also, this stack is only coherent as long as calls are made in each functions.

Parameters
p_routineName– String to add to call stack p_routineName is not NULL.
p_filename– String of source filename
lineNum– Source line number
T_void DebugCompareCheck ( T_byte8 str,
T_byte8 p_file,
T_word16  line 
)

DebugCompareCheck determines if the routine you are in is equal to the name you have given it. If not, failure occurs.

T_void DebugFail ( T_byte8 p_msg,
T_byte8 p_file,
T_word16  line 
)

Debug Fail is called when a DebugCheck macro finds an illegal assumption. It will call this routine and expect the system to print out the error messages both to the screen and to an "ERROR.LOG." A list of routines is also printed out.

NOTE: This current version does not change to text mode.

Parameters
p_msg– Message as to why it died/failed
p_file– Name of file it died in
line– Line number where failure occured All of the above are assumed to be valid pointers.
Returns
File containing explanation I'm assuming that we can still open a file and do a dump.
T_void DebugFail ( const char *  p_msg,
const char *  p_file,
long  line 
)

Debug Fail is called when a DebugCheck macro finds an illegal assumption. It will call this routine and expect the system to print out the error messages both to the screen and to an "ERROR.LOG." A list of routines is also printed out.

NOTE: This current version does not change to text mode.

Parameters
p_msg– Message as to why it died/failed
p_file– Name of file it died in
line– Line number where failure occured All of the above are assumed to be valid pointers.
Returns
File containing explanation I'm assuming that we can still open a file and do a dump.
T_void DebugGetCaller ( T_byte8 **  filename,
T_word16 line 
)
T_void DebugGetCaller ( const char **  filename,
long *  line 
)
const char* DebugGetCallerFile ( T_void  )
const char* DebugGetCallerName ( T_void  )
const char* DebugGetLastCalled ( T_void  )
T_void DebugHeapOff ( T_void  )

DebugHeapOff turns off heap checking after each routine is called (actually for each "DebugEnd" statement executed). The heap is checked for consistency and bombs with an error message if corrupted.

T_void DebugHeapOn ( T_void  )

DebugHeapOn turns on heap checking after each routine is called (actually for each "DebugEnd" statement executed). The heap is checked for consistency and bombs with an error message if corrupted.

T_void DebugRemoveRoutine ( T_void  )

DebugRemoveRoutine is not called directly. It is called by the macro "DebugEnd" which is used at the end of a debugged routine. This routine removes the text that was added to the calling stack by "DebugAddRoutine" (called via DebugRoutine).

NOTE: None that I know of.

T_void DebugStop ( T_void  )
T_void DebugTime ( T_word16  timeSlot)
T_void IDebugReportTimeSlots ( T_void  )

Variable Documentation

const char* G_CallStack[DEBUG_MAX_STACK_DEPTH]
const char* G_CallStackFile[DEBUG_MAX_STACK_DEPTH]
T_word16 G_CallStackLine[DEBUG_MAX_STACK_DEPTH]
T_word32 G_CallStackTime[DEBUG_MAX_STACK_DEPTH]
T_word16 G_CallStackTimeSlot[DEBUG_MAX_STACK_DEPTH]
T_word32 G_TimeSlots[MAX_TIME_SLOTS]