home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
misc
/
enote
/
source.lha
/
source
/
debugma.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-10
|
1KB
|
43 lines
#ifndef DWR_DEBUGMA_H
#define DWR_DEBUGMA_H
#ifndef DWR_MEMORY_H
#include "memory.h"
#endif
typedef struct DebugMemABlock{
VOID (*AllocRA)();
ULONG Size;
struct DebugMemABlock *Succ;
struct DebugMemABlock *Pred;
UBYTE Block[1];
} DMABLK;
extern VOID MemError(DMABLK *Allocation);
/*
If memory.a is assembled with 'DEBUG' defined, every allocated block
will contain some debug info. There are 4 bytes more allocated behind
the block from which the first is filled with 0xaa. Somewhere before
the block, the return address of the allocating routine is stored. If
the 0xaa-byte is trashed, MemError() is called with the offending
block.
You could define MemError as follows:
VOID MemError(DMABLK *Allocation)
{
char *BlockEnd;
BlockEnd=&Allocation->Block[Allocation->Size-31];
(*Allocation->AllocRA)(0L);
}
Put a breakpoint in this function, examine BlockEnd to look at the
nature of the trash. Follow the call into the allocating function,
but stop there because the environt is wrong (quit or reboot).
*/
#endif