Loading...
Searching...
No Matches
omDebug.h File Reference

Go to the source code of this file.

## Macros

#define | omIsTrackAddr(addr)
#define | omIsTrackAddrPage(page)
#define | omIsNormalBinPageAddr(addr)
#define | omIsBinAddrTrackAddr(addr)
#define | OM_FBIN 1 /* size_bin is bin */
#define | OM_FSIZE 2 /* size_bin is size */
#define | OM_FUSED 4 /* is in use, if set */
#define | OM_FKEPT 8 /* had been freed, if set */
#define | OM_FSTATIC 16 /* if set, considered to be static, i.e. never be freed */
#define | OM_FZERO 32 /* for Alloc0 */
#define | OM_FALIGN 64 /* for AllocAligned */
#define | OM_FSLOPPY 128 /* be sloppy about arguments */
#define | OM_FBINADDR 256 /* addr is bin addr */
#define | OM_FKEEP 512 /* addr is never really freed */
#define | OM_FMAX 1024 - OM_FBIN - OM_FUSED
#define | omGetUsedBlocksOfPage(page)
#define | omIsStaticTrackAddr(addr)
#define | omCheckReturn(cond)
#define | omCheckReturnError(cond, error)
#define | omCheckReturnCorrupted(cond)
#define | omAddrCheckReturn(cond)
#define | omAddrCheckReturnError(cond, error)
#define | omAddrCheckReturnCorrupted(cond)

## Typedefs

typedef unsigned short | omTrackFlags_t

## Functions

void * | _omDebugAlloc (void *size_bin, omTrackFlags_t flags, OM_CTFL_DECL)
void * | _omDebugRealloc (void *old_addr, void *old_size_bin, void *new_size_bin, omTrackFlags_t old_flags, omTrackFlags_t new_flags, OM_CTFL_DECL)
void | _omDebugFree (void *addr, void *size_bin, omTrackFlags_t flags, OM_CFL_DECL)
void * | _omDebugMemDup (void *addr, omTrackFlags_t flags, OM_CTFL_DECL)
char * | _omDebugStrDup (const char *addr, OM_TFL_DECL)
omError_t | _omDebugBin (omBin bin, OM_CFL_DECL)
omError_t | _omDebugMemory (OM_CFL_DECL)
omError_t | _omDebugAddr (void *addr, void *bin_size, omTrackFlags_t flags, OM_CFL_DECL)
void | omFreeKeptAddr ()
void | omPrintUsedAddrs (FILE *fd, int max_frames)
void | omPrintUsedTrackAddrs (FILE *fd, int max_frames)
void | omMarkAsStaticAddr (void *addr)
void | omMarkMemoryAsStatic ()
void | omUnMarkAsStaticAddr (void *addr)
void | omUnMarkMemoryAsStatic ()
void | omFreeKeptAddrFromBin (omBin bin)
omError_t | omCheckPtr (const void *ptr, omError_t report, OM_FLR_DECL)
omError_t | _omCheckAddr (void *addr, void *size_bin, omTrackFlags_t flags, char check, omError_t report, OM_FLR_DECL)
omError_t | omDoCheckBinAddr (void *addr, void *bin_size, omTrackFlags_t flags, char level, omError_t report, OM_FLR_DECL)
omError_t | _omCheckBin (omBin bin, int normal_bin, char check, omError_t report, OM_FLR_DECL)
omError_t | _omCheckMemory (char check, omError_t report, OM_FLR_DECL)
omError_t | omReportAddrError (omError_t error, omError_t report, void *addr, void *bin_size, omTrackFlags_t flags, OM_FLR_DECL, const char *fmt,...)
omError_t | omDoCheckBin (omBin bin, int normal_bin, char level, omError_t report, OM_FLR_DECL)
void | omIterateTroughAddrs (int normal, int track, void(*CallBackUsed)(void *), void(*CallBackFree)(void *))
void | omIterateTroughBinAddrs (omBin bin, void(*CallBackUsed)(void *), void(*CallBackFree)(void *))
omError_t | omDoCheckAddr (void *addr, void *bin_size, omTrackFlags_t flags, char level, omError_t report, OM_FLR_DECL)
int | omIsInKeptAddrList (void *addr)
void * | omAddr_2_OutAddr (void *addr)
int | omIsKnownMemoryRegion (omBinPageRegion region)
omError_t | omCheckBinPageRegion (omBinPageRegion region, int level, omError_t report, OM_FLR_DECL)
omError_t | omCheckBinPageRegions (int level, omError_t report, OM_FLR_DECL)
omBinPageRegion | omFindRegionOfAddr (void *addr)
int | omIsAddrOnFreeBinPage (void *addr)

## Variables

void * | om_KeptAddr
void * | om_LastKeptAddr
unsigned long | om_MaxAddr
unsigned long | om_MinAddr
void * | om_AlwaysKeptAddrs

## Macro Definition Documentation

## OM_FALIGN

#define OM_FALIGN 64 /* for AllocAligned */

Definition at line 38 of file omDebug.h.

## OM_FBIN

#define OM_FBIN 1 /* size_bin is bin */

Definition at line 32 of file omDebug.h.

## OM_FBINADDR

#define OM_FBINADDR 256 /* addr is bin addr */

Definition at line 40 of file omDebug.h.

## OM_FKEEP

#define OM_FKEEP 512 /* addr is never really freed */

Definition at line 41 of file omDebug.h.

## OM_FKEPT

#define OM_FKEPT 8 /* had been freed, if set */

Definition at line 35 of file omDebug.h.

## OM_FMAX

#define OM_FMAX 1024 - OM_FBIN - OM_FUSED

Definition at line 44 of file omDebug.h.

## OM_FSIZE

#define OM_FSIZE 2 /* size_bin is size */

Definition at line 33 of file omDebug.h.

## OM_FSLOPPY

#define OM_FSLOPPY 128 /* be sloppy about arguments */

Definition at line 39 of file omDebug.h.

## OM_FSTATIC

#define OM_FSTATIC 16 /* if set, considered to be static, i.e. never be freed */

Definition at line 36 of file omDebug.h.

## OM_FUSED

#define OM_FUSED 4 /* is in use, if set */

Definition at line 34 of file omDebug.h.

## OM_FZERO

#define OM_FZERO 32 /* for Alloc0 */

Definition at line 37 of file omDebug.h.

## omAddrCheckReturn

#define omAddrCheckReturn | ( |  | cond | ) |

Value:
do \
{ \
omError_t _status = cond; \
if (_status && (_status != omError_MaxError)) \
{ \
_omPrintAddrInfo(stderr, _status, addr, bin_size, flags, 10, " occurred for"); \
return _status; \
} \
} while (0)
omError_MaxError
@ omError_MaxError
Definition omError.h:42
omError_t
enum omError_e omError_t
Definition omError.h:44
flags
int status int void size_t count const char int flags
Definition si_signals.h:83

Definition at line 176 of file omDebug.h.

#define omAddrCheckReturn(cond) \
do \
{ \
omError_t _status = cond; \
if (_status && (_status != omError_MaxError)) \
{ \
_omPrintAddrInfo(stderr, _status, addr, bin_size, flags, 10, " occurred for"); \
return _status; \
} \
} while (0)

## omAddrCheckReturnCorrupted

#define omAddrCheckReturnCorrupted | ( |  | cond | ) |

Value:
omAddrCheckReturnError(cond, omError_MemoryCorrupted)
omAddrCheckReturnError
#define omAddrCheckReturnError(cond, error)
Definition omDebug.h:186
omError_MemoryCorrupted
@ omError_MemoryCorrupted
Definition omError.h:21

Definition at line 188 of file omDebug.h.

#define omAddrCheckReturnCorrupted(cond) \
omAddrCheckReturnError(cond, omError_MemoryCorrupted)

## omAddrCheckReturnError

#define omAddrCheckReturnError | ( |  | cond,
|  |  | error )

Value:
do {if (cond) return omReportAddrError(error, report, addr, bin_size, flags, OM_FLR_VAL, "");} while (0)
error
#define error(a)
Definition mpr_numeric.cc:966
omReportAddrError
omError_t omReportAddrError(omError_t error, omError_t report, void *addr, void *bin_size, omTrackFlags_t flags, OM_FLR_DECL, const char *fmt,...)
Definition omDebugCheck.c:394

Definition at line 186 of file omDebug.h.

#define omAddrCheckReturnError(cond, error) \
do {if (cond) return omReportAddrError(error, report, addr, bin_size, flags, OM_FLR_VAL, "");} while (0)

## omCheckReturn

#define omCheckReturn | ( |  | cond | ) |

Value:
do {omError_t _status = cond; if (_status) return _status;} while (0)

Definition at line 170 of file omDebug.h.

#define omCheckReturn(cond) \
do {omError_t _status = cond; if (_status) return _status;} while (0)

## omCheckReturnCorrupted

#define omCheckReturnCorrupted | ( |  | cond | ) |

Value:
omCheckReturnError(cond, omError_MemoryCorrupted)
omCheckReturnError
#define omCheckReturnError(cond, error)
Definition omDebug.h:172

Definition at line 174 of file omDebug.h.

#define omCheckReturnCorrupted(cond) \
omCheckReturnError(cond, omError_MemoryCorrupted)

## omCheckReturnError

#define omCheckReturnError | ( |  | cond,
|  |  | error )

Value:
do {if (cond) return omReportError(error, report, OM_FLR_VAL, "");} while (0)
omReportError
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
Definition omError.c:80

Definition at line 172 of file omDebug.h.

#define omCheckReturnError(cond, error) \
do {if (cond) return omReportError(error, report, OM_FLR_VAL, "");} while (0)

## omGetUsedBlocksOfPage

#define omGetUsedBlocksOfPage | ( |  | page | ) |

Value:
(page->used_blocks)

Definition at line 88 of file omDebug.h.

## omIsBinAddrTrackAddr

#define omIsBinAddrTrackAddr | ( |  | addr | ) |

Value:
0

Definition at line 15 of file omDebug.h.

## omIsNormalBinPageAddr

#define omIsNormalBinPageAddr | ( |  | addr | ) |

Value:
omIsBinPageAddr(addr)
omIsBinPageAddr
#define omIsBinPageAddr(addr)
Definition omBinPage.h:68

Definition at line 14 of file omDebug.h.

## omIsStaticTrackAddr

#define omIsStaticTrackAddr | ( |  | addr | ) |

Value:
0

Definition at line 150 of file omDebug.h.

## omIsTrackAddr

#define omIsTrackAddr | ( |  | addr | ) |

Value:
0

Definition at line 12 of file omDebug.h.

## omIsTrackAddrPage

#define omIsTrackAddrPage | ( |  | page | ) |

Value:
0

Definition at line 13 of file omDebug.h.

## Typedef Documentation

## omTrackFlags_t

typedef unsigned short omTrackFlags_t

Definition at line 45 of file omDebug.h.

## Function Documentation

## _omCheckAddr()

omError_t _omCheckAddr | ( | void * | addr,
|  | void * | size_bin,
|  | omTrackFlags_t | flags,
|  | char | check,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 36 of file omDebugCheck.c.

{
if (check <= 0) return omError_NoError;
if (check > 1)
{
omCheckReturn(check > 2 && _omCheckMemory(check - 2, (report ? report : omError_MemoryCorrupted), OM_FLR_VAL));
omCheckReturn(omIsBinPageAddr(addr) && omDoCheckBin(omGetBinOfAddr(addr), !omIsBinAddrTrackAddr(addr), check-1,
(report ? report : omError_MemoryCorrupted), OM_FLR_VAL));
}
return omDoCheckAddr(addr, size_bin, flags, check, report, OM_FLR_VAL);
}
check
VAR int check
Definition libparse.cc:1106
omGetBinOfAddr
#define omGetBinOfAddr(addr)
Definition omAllocPrivate.h:80
omDoCheckAddr
omError_t omDoCheckAddr(void *addr, void *bin_size, omTrackFlags_t flags, char level, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:146
_omCheckMemory
omError_t _omCheckMemory(char check, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:58
omDoCheckBin
omError_t omDoCheckBin(omBin bin, int normal_bin, char level, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:253
omIsBinAddrTrackAddr
#define omIsBinAddrTrackAddr(addr)
Definition omDebug.h:15
omCheckReturn
#define omCheckReturn(cond)
Definition omDebug.h:170
omError_NoError
@ omError_NoError
Definition omError.h:18

## _omCheckBin()

omError_t _omCheckBin | ( | omBin | bin,
|  | int | normal_bin,
|  | char | check,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 49 of file omDebugCheck.c.

{
if (check <= 0) return omError_NoError;
omCheckReturn(check > 1 && _omCheckMemory(check - 1, (report ? report : omError_MemoryCorrupted), OM_FLR_VAL));
return omDoCheckBin(bin, what_bin, check, report, OM_FLR_VAL);
}

## _omCheckMemory()

omError_t _omCheckMemory | ( | char | check,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 58 of file omDebugCheck.c.

{
int i = 0;
omSpecBin s_bin;
omBin sticky;
if (check <= 0) return omError_NoError;
omCheckReturn(omCheckBinPageRegions(check, report, OM_FLR_VAL));
for (i=0; i<= OM_MAX_BIN_INDEX; i++)
{
omCheckReturn(omDoCheckBin(&om_StaticBin[i], 1, check, report, OM_FLR_VAL));
}
s_bin = om_SpecBin;
omCheckReturn(omCheckGList(s_bin, next, check, omError_MemoryCorrupted, OM_FLR_VAL));
while (s_bin != NULL)
{
omCheckReturn(omDoCheckBin(s_bin->bin, 1, check, report, OM_FLR_VAL));
s_bin = s_bin->next;
}
sticky = om_StickyBins;
omCheckReturn(omCheckGList(sticky, next, check, omError_MemoryCorrupted, OM_FLR_VAL));
while (sticky != NULL)
{
omCheckReturn(omDoCheckBin(sticky, 1, check, report, OM_FLR_VAL));
sticky = sticky->next;
}
#ifdef OM_HAVE_TRACK
for (i=0; i<= OM_MAX_BIN_INDEX; i++)
{
omCheckReturn(omDoCheckBin(&om_StaticTrackBin[i], 0, check, report, OM_FLR_VAL));
}
s_bin = om_SpecTrackBin;
omCheckReturn(omCheckGList(s_bin, next, check, omError_MemoryCorrupted, OM_FLR_VAL));
while (s_bin != NULL)
{
omCheckReturn(omDoCheckBin(s_bin->bin, 0, check, report, OM_FLR_VAL));
s_bin = s_bin->next;
}
#endif
if (check > 1)
{
if (om_KeptAddr != NULL)
{
void* addr = om_KeptAddr;
omCheckReturn(omCheckList(om_KeptAddr, check - 1, (report ? report : omError_KeptAddrListCorrupted), OM_FLR_VAL));
while (addr != NULL)
{
omCheckReturn(omDoCheckAddr(addr, NULL, OM_FKEPT, check, report, OM_FLR_VAL));
addr = *((void**) addr);
}
}
if (om_AlwaysKeptAddrs != NULL)
{
void* addr = om_AlwaysKeptAddrs;
omCheckReturn(omCheckList(om_AlwaysKeptAddrs, check - 1, (report ? report : omError_KeptAddrListCorrupted), OM_FLR_VAL));
while (addr != NULL)
{
omCheckReturn(omDoCheckAddr(addr, NULL, OM_FKEPT, check, report, OM_FLR_VAL));
addr = *((void**) addr);
}
}
}
return omError_NoError;
}
i
int i
Definition cfEzgcd.cc:132
next
ListNode * next
Definition janet.h:31
om_StickyBins
omBin om_StickyBins
Definition omBin.c:374
om_StaticBin
omBin_t om_StaticBin[]
omCheckBinPageRegions
omError_t omCheckBinPageRegions(int level, omError_t report, OM_FLR_DECL)
Definition omBinPage.c:531
om_AlwaysKeptAddrs
void * om_AlwaysKeptAddrs
Definition omDebug.c:31
om_KeptAddr
void * om_KeptAddr
Definition omDebug.c:28
OM_FKEPT
#define OM_FKEPT
Definition omDebug.h:35
omError_KeptAddrListCorrupted
@ omError_KeptAddrListCorrupted
Definition omError.h:36
NULL
#define NULL
Definition omList.c:12
omCheckGList
#define omCheckGList(ptr, next, level, report, OM_FLR_VAL)
Definition omList.h:115
omCheckList
#define omCheckList(ptr, level, report, OM_FLR_VAL)
Definition omList.h:83
omBin
omBin_t * omBin
Definition omStructs.h:12
omSpecBin
omSpecBin_t * omSpecBin
Definition omStructs.h:30
OM_MAX_BIN_INDEX
#define OM_MAX_BIN_INDEX
Definition omTables.h:4
om_SpecBin
omSpecBin om_SpecBin
Definition om_Alloc.c:20

## _omDebugAddr()

omError_t _omDebugAddr | ( | void * | addr,
|  | void * | bin_size,
|  | omTrackFlags_t | flags,
|  | OM_CFL_DECL | )

Definition at line 278 of file omDebug.c.

{
OM_R_DEF;
check = MAX(check,om_Opts.MinCheck);
check = MIN(check,om_Opts.MaxCheck);
return _omCheckAddr(addr, bin_size,
OM_FUSED|flags,check,omError_NoError,OM_FLR_VAL);
}
MIN
#define MIN(a, b)
Definition omDebug.c:102
MAX
#define MAX(a, b)
Definition omDebug.c:100
_omCheckAddr
omError_t _omCheckAddr(void *addr, void *size_bin, omTrackFlags_t flags, char check, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:36
OM_FUSED
#define OM_FUSED
Definition omDebug.h:34
om_Opts
omOpts_t om_Opts
Definition omOpts.c:13

## _omDebugAlloc()

void * _omDebugAlloc | ( | void * | size_bin,
|  | omTrackFlags_t | flags,
|  | OM_CTFL_DECL | )

Definition at line 110 of file omDebug.c.

{
void* addr;
OM_R_DEF;
check = MAX(check, om_Opts.MinCheck);
track = MAX(track, om_Opts.MinTrack);
check = MIN(check, om_Opts.MaxCheck);
track = MIN(track, om_Opts.MaxTrack);
if (check)
{
if (check > 1)
{
if (flags & OM_FBIN)
(void) _omCheckBin((omBin)size_bin, 1, check-1, omError_MemoryCorrupted, OM_FLR_VAL);
else if (check > 2)
{
omAssume(flags & OM_FSIZE);
(void) _omCheckMemory(check-2, omError_MemoryCorrupted, OM_FLR_VAL);
}
}
if (size_bin == NULL && ! (flags & OM_FSLOPPY))
{
omReportError(omError_NullSizeAlloc, omError_NoError, OM_FLR_VAL, "");
}
}
addr = __omDebugAlloc(size_bin, flags, track, OM_FLR_VAL);
#ifdef OM_INTERNAL_DEBUG
(void) _omCheckAddr(addr, size_bin,flags|OM_FUSED,check, omError_InternalBug, OM_FLR);
#endif
return addr;
}
__omDebugAlloc
static void * __omDebugAlloc(void *size_bin, omTrackFlags_t flags, char track, OM_FLR_DECL)
Definition omDebug.c:304
OM_FSLOPPY
#define OM_FSLOPPY
Definition omDebug.h:39
_omCheckBin
omError_t _omCheckBin(omBin bin, int normal_bin, char check, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:49
OM_FSIZE
#define OM_FSIZE
Definition omDebug.h:33
_omCheckMemory
omError_t _omCheckMemory(char check, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:58
OM_FBIN
#define OM_FBIN
Definition omDebug.h:32
omAssume
#define omAssume(x)
Definition omError.h:85
omError_NullSizeAlloc
@ omError_NullSizeAlloc
Definition omError.h:33
omError_InternalBug
@ omError_InternalBug
Definition omError.h:20

## _omDebugBin()

omError_t _omDebugBin | ( | omBin | bin,
|  | OM_CFL_DECL | )

Definition at line 293 of file omDebug.c.

{
OM_R_DEF;
return _omCheckBin(bin, 1, MAX(check, om_Opts.MinCheck), omError_NoError,OM_FLR_VAL);
}

## _omDebugFree()

void _omDebugFree | ( | void * | addr,
|  | void * | size_bin,
|  | omTrackFlags_t | flags,
|  | OM_CFL_DECL | )

Definition at line 182 of file omDebug.c.

{
OM_R_DEF;
check = MAX(check, om_Opts.MinCheck);
check = MIN(check, om_Opts.MaxCheck);
if (check && _omCheckAddr(addr, size_bin, flags|OM_FUSED, check, omError_NoError, OM_FLR_VAL)) return;
__omDebugFree(addr,size_bin,flags, OM_FLR_VAL);
#ifdef OM_INTERNAL_DEBUG
if (flags & OM_FBIN)
(void) _omCheckBin((omBin)size_bin, 1, check-1,omError_InternalBug, OM_FLR);
else
(void) _omCheckMemory(check-2,omError_InternalBug,OM_FLR);
#endif
}
__omDebugFree
static void __omDebugFree(void *addr, void *size_bin, omTrackFlags_t flags, OM_FLR_DECL)
Definition omDebug.c:465

## _omDebugMemDup()

void * _omDebugMemDup | ( | void * | addr,
|  | omTrackFlags_t | flags,
|  | OM_CTFL_DECL | )

Definition at line 201 of file omDebug.c.

{
void* ret;
size_t sizeW;
OM_R_DEF;
check = MAX(check, om_Opts.MinCheck);
track = MAX(track, om_Opts.MinTrack);
check = MIN(check, om_Opts.MaxCheck);
track = MIN(track, om_Opts.MaxTrack);
if (check & _omCheckAddr(addr, 0, OM_FUSED, check, omError_NoError, OM_FLR_VAL))
{
return NULL;
}
else
{
sizeW = omSizeWOfAddr(addr);
}
ret = __omDebugAlloc((void*) (sizeW << LOG_SIZEOF_LONG), OM_FSIZE | flags, track, OM_FLR_VAL);
omMemcpyW(ret, addr, sizeW);
#ifdef OM_INTERNAL_DEBUG
(void) _omCheckAddr(ret, (void*) (sizeW << LOG_SIZEOF_LONG),OM_FUSED|OM_FSIZE,
check, omError_InternalBug, OM_FLR);
#endif
return ret;
}
omMemcpyW
#define omMemcpyW(p1, p2, l)
Definition omMemOps.h:29
omSizeWOfAddr
#define omSizeWOfAddr(P)
Definition xalloc.h:223

## _omDebugMemory()

omError_t _omDebugMemory | ( | OM_CFL_DECL |  | ) |

Definition at line 286 of file omDebug.c.

{
OM_R_DEF;
check = MAX(check,om_Opts.MinCheck);
check = MIN(check,om_Opts.MaxCheck);
return _omCheckMemory(check, omError_NoError,OM_FLR_VAL);
}

## _omDebugRealloc()

void * _omDebugRealloc | ( | void * | old_addr,
|  | void * | old_size_bin,
|  | void * | new_size_bin,
|  | omTrackFlags_t | old_flags,
|  | omTrackFlags_t | new_flags,
|  | OM_CTFL_DECL | )

Definition at line 147 of file omDebug.c.

{
void* new_addr = NULL;
omError_t status = omError_NoError;
OM_R_DEF;
check = MAX(check, om_Opts.MinCheck);
track = MAX(track, om_Opts.MinTrack);
check = MIN(check, om_Opts.MaxCheck);
track = MIN(track, om_Opts.MaxTrack);
if (check)
{
status = _omCheckAddr(old_addr, old_size_bin, old_flags|OM_FUSED, check, omError_NoError, OM_FLR_VAL);
if (status == omError_NoError && check > 1 && new_flags & OM_FBIN)
status = omDoCheckBin((omBin)new_size_bin, 1, check-1, omError_MemoryCorrupted, OM_FLR_VAL);
if (new_size_bin == NULL && !(new_flags & OM_FSLOPPY))
{
omReportError(omError_NullSizeAlloc, omError_NoError, OM_FLR_VAL, "");
new_size_bin = (void*) 1;
}
}
new_addr = __omDebugRealloc(old_addr, old_size_bin, new_size_bin,
status, old_flags, new_flags, track, OM_FLR_VAL);
#ifdef OM_INTERNAL_DEBUG
if (status == omError_NoError)
(void) _omCheckAddr(new_addr, new_size_bin,new_flags|OM_FUSED,check, omError_InternalBug, OM_FLR);
#endif
return new_addr;
}
__omDebugRealloc
static void * __omDebugRealloc(void *old_addr, void *old_size_bin, void *new_size_bin, omError_t old_status, omTrackFlags_t old_flags, omTrackFlags_t new_flags, char track, OM_FLR_DECL)
Definition omDebug.c:352
omDoCheckBin
omError_t omDoCheckBin(omBin bin, int normal_bin, char level, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:253
status
int * status
Definition si_signals.h:61

## _omDebugStrDup()

char * _omDebugStrDup | ( | const char * | addr,
|  | OM_TFL_DECL | )

Definition at line 231 of file omDebug.c.

{
#if 0
unsigned long size;
#endif
unsigned long i=0;
char* ret;
OM_R_DEF;
if (addr == NULL)
{
omReportAddrError(omError_NotString, omError_NoError, (char *)addr, 0, 0, OM_FLR_VAL, "NULL String");
return NULL;
}
track = MAX(track, om_Opts.MinTrack);
track = MIN(track, om_Opts.MaxTrack);
#if 0
// this breaks if SizeOfAddr(addr) > PAGESIZE
if (omIsBinPageAddr(addr))
{
size = omSizeOfAddr(addr);
}
else
{
size = ULONG_MAX;
}
#endif
while ((addr[i] != '\0') /* && (i < size)*/) i++;
// there seems to be no way to check if it is really a string
#if 0
if (i == size)
{
omReportAddrError(omError_NotString, omError_NoError, addr, 0, 0, OM_FLR_VAL, "Not 0 terminated");
i = size-1;
}
#endif
ret = __omDebugAlloc((char*)i+1, OM_FSIZE, track, OM_FLR_VAL);
memcpy(ret, addr, i);
ret[i] = '\0';
#ifdef OM_INTERNAL_DEBUG
(void) _omCheckAddr(ret, (void*)i+1,OM_FUSED|OM_FSIZE,om_Opts.MinCheck, omError_InternalBug, OM_FLR);
#endif
return ret;
}
size
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition cf_ops.cc:600
omSizeOfAddr
size_t omSizeOfAddr(const void *addr)
Definition omAllocSystem.c:110
omError_NotString
@ omError_NotString
Definition omError.h:40

## omAddr_2_OutAddr()

void * omAddr_2_OutAddr | ( | void * | addr | ) |

## omCheckBinPageRegion()

omError_t omCheckBinPageRegion | ( | omBinPageRegion | region,
|  | int | level,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 505 of file omBinPage.c.

{
if (level <= 0) return omError_NoError;
omCheckReturn(omCheckPtr(region, report, OM_FLR_VAL));
omCheckReturnCorrupted(! omIsKnownMemoryRegion(region));
omCheckReturnCorrupted(! omIsAddrPageAligned(region->addr) || ! omIsAddrPageAligned(region->current));
omCheckReturnCorrupted(region->used_pages < 0);
omCheckReturnCorrupted(region->init_pages < 0 || region->init_pages > region->pages);
if (region->init_pages)
{
omCheckReturnCorrupted(! omIsAddrPageAligned(region->init_addr));
omCheckReturnCorrupted(! (region->init_addr >= region->addr
&& region->init_addr <= region->addr + (region->pages -1)*SIZEOF_SYSTEM_PAGE));
omCheckReturnCorrupted(region->init_addr !=
region->addr + (region->pages - region->init_pages)*SIZEOF_SYSTEM_PAGE);
}
omCheckReturn(omCheckList(region->current, level, report, OM_FLR_VAL));
omCheckReturnCorrupted(region->current == NULL && region->used_pages + region->init_pages != region->pages);
omCheckReturnCorrupted(level > 1 &&
omListLength(region->current)+region->used_pages+region->init_pages != region->pages);
return omError_NoError;
}
level
int level(const CanonicalForm &f)
Definition canonicalform.h:331
omIsKnownMemoryRegion
int omIsKnownMemoryRegion(omBinPageRegion region)
Definition omBinPage.c:489
omIsAddrPageAligned
#define omIsAddrPageAligned(addr)
Definition omBinPage.h:16
omCheckPtr
omError_t omCheckPtr(const void *ptr, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:136
omCheckReturnCorrupted
#define omCheckReturnCorrupted(cond)
Definition omDebug.h:174
omListLength
#define omListLength(ptr)
Definition omList.h:62

## omCheckBinPageRegions()

omError_t omCheckBinPageRegions | ( | int | level,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 531 of file omBinPage.c.

{
omBinPageRegion iter = om_CurrentBinPageRegion;
if (level <= 0) return omError_NoError;
if (iter == NULL) return omError_NoError;
omCheckReturnError(om_CurrentBinPageRegion->next != NULL && OM_IS_EMPTY_REGION(om_CurrentBinPageRegion->next),
omError_InternalBug);
omCheckReturnError(om_CurrentBinPageRegion->prev != NULL && ! OM_IS_EMPTY_REGION(om_CurrentBinPageRegion->prev),
omError_InternalBug);
if (level > 1)
{
omBinPageRegion prev_last = (omBinPageRegion) omGListLast(om_CurrentBinPageRegion, prev);
omBinPageRegion next_last = (omBinPageRegion) omGListLast(om_CurrentBinPageRegion, next);
omCheckReturn(omCheckGList(iter, next, level, report, OM_FLR_VAL));
omCheckReturn(omCheckGList(iter, prev, level, report, OM_FLR_VAL));
omCheckReturnCorrupted(omGListLength(prev_last, next)
!=
omGListLength(next_last, prev));
omCheckReturn(omCheckBinPageRegion(om_CurrentBinPageRegion, level - 1, report, OM_FLR_VAL));
iter = om_CurrentBinPageRegion->next;
while (iter)
{
omCheckReturnError(OM_IS_EMPTY_REGION(iter), omError_InternalBug);
omCheckReturn(omCheckBinPageRegion(iter, level - 1, report, OM_FLR_VAL));
iter = iter->next;
}
iter = om_CurrentBinPageRegion->prev;
while (iter)
{
omCheckReturnError( !OM_IS_EMPTY_REGION(iter), omError_InternalBug);
omCheckReturn(omCheckBinPageRegion(iter, level - 1, report, OM_FLR_VAL));
iter = iter->prev;
}
}
return omError_NoError;
}
iter
CFFListIterator iter
Definition facAbsBiFact.cc:54
OM_IS_EMPTY_REGION
#define OM_IS_EMPTY_REGION(region)
Definition omBinPage.c:96
om_CurrentBinPageRegion
static omBinPageRegion om_CurrentBinPageRegion
Definition omBinPage.c:35
omCheckBinPageRegion
omError_t omCheckBinPageRegion(omBinPageRegion region, int level, omError_t report, OM_FLR_DECL)
Definition omBinPage.c:505
omGListLength
#define omGListLength(ptr, next)
Definition omList.h:94
omGListLast
#define omGListLast(ptr, next)
Definition omList.h:96
omBinPageRegion
omBinPageRegion_t * omBinPageRegion
Definition omStructs.h:20

## omCheckPtr()

omError_t omCheckPtr | ( | const void * | ptr,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 136 of file omDebugCheck.c.

{
omCheckReturnError(ptr == NULL, omError_NullAddr);
omCheckReturnError(!OM_IS_ALIGNED(ptr), omError_UnalignedAddr);
omCheckReturnError(((unsigned long) ptr) < om_MinAddr ||
((unsigned long) ptr) >= om_MaxAddr, omError_InvalidRangeAddr);
return omError_NoError;
}
om_MaxAddr
unsigned long om_MaxAddr
Definition omDebugCheck.c:19
om_MinAddr
unsigned long om_MinAddr
Definition omDebugCheck.c:20
omError_NullAddr
@ omError_NullAddr
Definition omError.h:22
omError_UnalignedAddr
@ omError_UnalignedAddr
Definition omError.h:32
omError_InvalidRangeAddr
@ omError_InvalidRangeAddr
Definition omError.h:23

## omDoCheckAddr()

omError_t omDoCheckAddr | ( | void * | addr,
|  | void * | bin_size,
|  | omTrackFlags_t | flags,
|  | char | level,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 146 of file omDebugCheck.c.

{
if (level <= 0) return omError_NoError;
omAssume(! ((flags & OM_FSIZE) && (flags & OM_FBIN)));
if (addr == NULL)
{
omCheckReturnError(!(flags & OM_FSLOPPY), omError_NullAddr);
return omError_NoError;
}
if ((flags & OM_FSIZE) && bin_size == NULL) return omError_NoError;
omAddrCheckReturn(omCheckPtr(addr, report, OM_FLR_VAL));
omAddrCheckReturnError((flags & OM_FALIGN) && !OM_IS_STRICT_ALIGNED(addr), omError_UnalignedAddr);
omAddrCheckReturnError((flags & OM_FBIN) && !omIsKnownTopBin((omBin) bin_size, 1), omError_UnknownBin);
if (omIsBinPageAddr(addr))
{
#ifdef OM_HAVE_TRACK
if (omIsBinAddrTrackAddr(addr))
return omCheckTrackAddr(addr, bin_size, flags, level, report, OM_FLR_VAL);
else
#endif
return omDoCheckBinAddr(addr, bin_size, flags, level, report, OM_FLR_VAL);
}
else
{
return omDoCheckLargeAddr(addr, bin_size, flags, level, report, OM_FLR_VAL);
}
}
omIsKnownTopBin
#define omIsKnownTopBin(bin, normal_bin)
Definition omBin.h:55
omDoCheckLargeAddr
static omError_t omDoCheckLargeAddr(void *addr, void *bin_size, omTrackFlags_t flags, char level, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:179
omCheckPtr
omError_t omCheckPtr(const void *ptr, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:136
omDoCheckBinAddr
omError_t omDoCheckBinAddr(void *addr, void *bin_size, omTrackFlags_t flags, char level, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:198
OM_FALIGN
#define OM_FALIGN
Definition omDebug.h:38
omAddrCheckReturn
#define omAddrCheckReturn(cond)
Definition omDebug.h:176
omError_UnknownBin
@ omError_UnknownBin
Definition omError.h:30

## omDoCheckBin()

omError_t omDoCheckBin | ( | omBin | bin,
|  | int | normal_bin,
|  | char | level,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 253 of file omDebugCheck.c.

{
omBin top_bin = bin;
omCheckReturnError(!omIsKnownTopBin(bin, normal_bin), omError_UnknownBin);
if (! omIsStickyBin(bin))
omCheckReturn(omCheckGList(bin->next, next, level, report, OM_FLR_VAL));
do
{
int where;
omBinPage page;
if (bin->last_page == NULL || bin->current_page == om_ZeroPage)
{
omCheckReturnCorrupted(! (bin->current_page == om_ZeroPage && bin->last_page == NULL));
continue;
}
omCheckReturn(omDoCheckBinPage(bin->current_page, normal_bin, level, report, OM_FLR_VAL));
omCheckReturn(bin->current_page != bin->last_page &&
omDoCheckBinPage(bin->last_page, normal_bin, level, report, OM_FLR_VAL));
omCheckReturnCorrupted(bin->last_page->next != NULL);
if (bin != top_bin)
{
omCheckReturnCorrupted(bin->sizeW != top_bin->sizeW ||
bin->max_blocks != top_bin->max_blocks);
}
if (level <= 1) continue;
if (! omIsStickyBin(bin))
omCheckReturnCorrupted(omFindInGList(bin->next, next, sticky, bin->sticky));
omCheckReturn(omCheckGList(bin->last_page, prev, level-1, report, OM_FLR_VAL));
page = omGListLast(bin->last_page, prev);
omCheckReturn(omCheckGList(page, next, level-1, report, OM_FLR_VAL));
omCheckReturnCorrupted(omGListLength(bin->last_page, prev) != omGListLength(page, next));
omCheckReturnCorrupted(! omIsOnGList(bin->last_page, prev, bin->current_page));
page = bin->last_page;
where = 1;
while (page != NULL)
{
omCheckReturnCorrupted(omGetTopBinOfPage(page) != top_bin);
omCheckReturn(page != bin->last_page && page != bin->current_page &&
omDoCheckBinPage(page, normal_bin, level - 1, report, OM_FLR_VAL));
omCheckReturnCorrupted(page != bin->last_page &&
(page->next == NULL || page->next->prev != page));
omCheckReturnCorrupted(page->prev != NULL && page->prev->next != page);
omCheckReturnCorrupted(omGetStickyOfPage(page) != bin->sticky && bin->sticky < SIZEOF_VOIDP);
omCheckReturnCorrupted(omGetBinOfPage(page) != bin);
if (where == -1)
{
/* we are at the left of current_page,
i.e., page is empty */
omCheckReturnCorrupted(omGetUsedBlocksOfPage(page) != 0 || page->current != NULL);
}
else
{
if (page == bin->current_page)
{
where = -1;
}
else
{
/* we are at the right of current_page,
i.e., page is neither full nor empty */
omCheckReturnCorrupted(page->current == NULL ||
omGetUsedBlocksOfPage(page) == bin->max_blocks - 1);
}
}
page = page->prev;
} /* while (page != NULL) */
} while (!omIsStickyBin(bin) && ((bin = bin->next) != NULL));
return omError_NoError;
}
omGetTopBinOfPage
#define omGetTopBinOfPage(page)
Definition omAllocPrivate.h:65
omGetStickyOfPage
#define omGetStickyOfPage(page)
Definition omAllocPrivate.h:67
omIsStickyBin
#define omIsStickyBin(bin)
Definition omBin.h:33
omDoCheckBinPage
static omError_t omDoCheckBinPage(omBinPage page, int normal_page, int level, omError_t report, OM_FLR_DECL)
Definition omDebugCheck.c:336
omGetUsedBlocksOfPage
#define omGetUsedBlocksOfPage(page)
Definition omDebug.h:88
omGetBinOfPage
OM_INLINE_DECL omBin omGetBinOfPage(omBinPage page)
omFindInGList
#define omFindInGList(ptr, next, what, value)
Definition omList.h:104
omIsOnGList
#define omIsOnGList(ptr, next, addr)
Definition omList.h:100
omBinPage
omBinPage_t * omBinPage
Definition omStructs.h:16
om_ZeroPage
omBinPage_t om_ZeroPage[]
Definition om_Alloc.c:19

## omDoCheckBinAddr()

omError_t omDoCheckBinAddr | ( | void * | addr,
|  | void * | bin_size,
|  | omTrackFlags_t | flags,
|  | char | level,
|  | omError_t | report,
|  | OM_FLR_DECL | )

Definition at line 198 of file omDebugCheck.c.

{
omBinPage page = omGetBinPageOfAddr(addr);
omBinPageRegion region = page->region;
omBin bin = omGetBinOfPage(page);
omAssume(omIsBinPageAddr(addr));
omAssume(! omCheckPtr(addr, 0, OM_FLR));
omAddrCheckReturnCorrupted(! omIsKnownTopBin(bin, ! omIsBinAddrTrackAddr(addr)));
if (flags & OM_FBINADDR && flags & OM_FSIZE)
omAddrCheckReturnError(bin->sizeW*SIZEOF_LONG != (size_t) bin_size, omError_WrongSize);
if (level > 1)
{
omAddrCheckReturnError(omIsAddrOnFreeBinPage(addr), omError_FreedAddr);
omAddrCheckReturnError(omFindRegionOfAddr(addr) != region, omError_FreedAddrOrMemoryCorrupted);
omAddrCheckReturnError(!omIsOnGList(bin->last_page, prev, page), omError_FreedAddrOrMemoryCorrupted);
if (flags & OM_FUSED)
{
omAddrCheckReturnError(omIsOnList(page->current, addr), omError_FreedAddr);
omAddrCheckReturnError((level > 1) && omIsInKeptAddrList(addr), omError_FreedAddr);
}
}
else
{
omAddrCheckReturnError(omCheckPtr(region, omError_MaxError, OM_FLR_VAL), omError_FreedAddrOrMemoryCorrupted);
}
/* Check that addr is aligned within page of bin */
omAddrCheckReturnError((bin->max_blocks >= 1) &&
( ( ( (unsigned long) addr)
- ((unsigned long) page)
- SIZEOF_OM_BIN_PAGE_HEADER)
% (bin->sizeW * SIZEOF_VOIDP)
!= 0), omError_FalseAddr);
/* Check that specified bin or size is correct */
omAddrCheckReturnError((flags & OM_FBIN) && bin_size != NULL
&& ((omBin) bin_size) != omGetTopBinOfAddr(addr), omError_WrongBin);
if ((flags & OM_FSIZE) && (!(flags & OM_FSLOPPY) || (size_t) bin_size > 0))
{
size_t size = (size_t) bin_size;
omAssume(!omIsBinAddrTrackAddr(addr));
omAddrCheckReturnError((bin->sizeW << LOG_SIZEOF_LONG) < OM_ALIGN_SIZE(size), omError_WrongSize);
}
return omError_NoError;
}
omGetTopBinOfAddr
#define omGetTopBinOfAddr(addr)
Definition omAllocPrivate.h:78
SIZEOF_OM_BIN_PAGE_HEADER
#define SIZEOF_OM_BIN_PAGE_HEADER
Definition omAllocPrivate.h:31
omFindRegionOfAddr
omBinPageRegion omFindRegionOfAddr(void *addr)
Definition omBinPage.c:578
omIsAddrOnFreeBinPage
int omIsAddrOnFreeBinPage(void *addr)
Definition omBinPage.c:595
omGetBinPageOfAddr
#define omGetBinPageOfAddr(addr)
Definition omBinPage.h:22
OM_FBINADDR
#define OM_FBINADDR
Definition omDebug.h:40
omAddrCheckReturnCorrupted
#define omAddrCheckReturnCorrupted(cond)
Definition omDebug.h:188
omIsInKeptAddrList
int omIsInKeptAddrList(void *addr)
Definition omDebugTrack.c:743
omError_WrongSize
@ omError_WrongSize
Definition omError.h:26
omError_FreedAddr
@ omError_FreedAddr
Definition omError.h:27
omError_FreedAddrOrMemoryCorrupted
@ omError_FreedAddrOrMemoryCorrupted
Definition omError.h:28
omError_FalseAddr
@ omError_FalseAddr
Definition omError.h:24
omError_WrongBin
@ omError_WrongBin
Definition omError.h:29
omIsOnList
#define omIsOnList(ptr, addr)
Definition omList.h:68

## omFindRegionOfAddr()

omBinPageRegion omFindRegionOfAddr | ( | void * | addr | ) |

Definition at line 578 of file omBinPage.c.

{
omBinPageRegion region = om_CurrentBinPageRegion;
if (region == NULL) return 0;
region = omGListLast(region, prev);
do
{
if ((char *)addr >= region->addr
&& (char *)addr < region->addr + (region->pages)*SIZEOF_SYSTEM_PAGE)
return region;
region = region->next;
}
while (region != NULL);
return NULL;
}

## omFreeKeptAddr()

void omFreeKeptAddr | ( |  | ) |

Definition at line 609 of file omDebug.c.

{
void* next;
omBin bin;
omTrackFlags_t flags;
void* addr = om_KeptAddr;
if (om_LastKeptAddr != NULL)
*((void**) om_LastKeptAddr) = om_AlwaysKeptAddrs;
om_NumberOfKeptAddrs = 0;
om_LastKeptAddr = NULL;
om_AlwaysKeptAddrs = NULL;
om_KeptAddr = NULL;
while (addr != NULL)
{
next = *((void**)addr);
bin = omGetOrigSpecBinOfAddr(addr);
#ifdef OM_HAVE_TRACK
if (omIsTrackAddr(addr))
{
omMarkAsFreeTrackAddr(addr, 0, &flags, OM_FLR);
omFreeTrackAddr(addr);
}
else
#endif
__omFree(addr);
addr = next;
if (bin != NULL) omUnGetSpecBin(&bin);
}
}
__omFree
#define __omFree(addr)
Definition omAllocPrivate.h:298
omUnGetSpecBin
#define omUnGetSpecBin(bin_ptr)
Definition omBin.h:14
omGetOrigSpecBinOfAddr
static omBin omGetOrigSpecBinOfAddr(void *addr)
Definition omDebug.c:449
om_NumberOfKeptAddrs
static unsigned long om_NumberOfKeptAddrs
Definition omDebug.c:29
om_LastKeptAddr
void * om_LastKeptAddr
Definition omDebug.c:30
omTrackFlags_t
unsigned short omTrackFlags_t
Definition omDebug.h:45
omIsTrackAddr
#define omIsTrackAddr(addr)
Definition omDebug.h:12

## omFreeKeptAddrFromBin()

void omFreeKeptAddrFromBin | ( | omBin | bin | ) |

Definition at line 542 of file omDebug.c.

{
void* addr = om_KeptAddr;
void* prev_addr = NULL;
void* next_addr;
omTrackFlags_t flags;
while (addr != NULL)
{
next_addr = *((void**) addr);
if (omIsBinPageAddr(addr) && omGetTopBinOfAddr(addr) == bin)
{
if (prev_addr != NULL)
*((void**) prev_addr) = next_addr;
else
om_KeptAddr = next_addr;
if (addr == om_LastKeptAddr)
om_LastKeptAddr = prev_addr;
om_NumberOfKeptAddrs--;
#ifdef OM_HAVE_TRACK
if (omIsTrackAddr(addr))
{
omMarkAsFreeTrackAddr(addr, 0, &flags, OM_FLR);
omFreeTrackAddr(addr);
}
else
#endif
__omFree(addr);
addr = next_addr;
}
else
{
prev_addr = addr;
addr = next_addr;
}
}
addr = om_AlwaysKeptAddrs;
prev_addr = NULL;
while (addr != NULL)
{
next_addr = *((void**) addr);
if (omIsBinPageAddr(addr) && omGetTopBinOfAddr(addr) == bin)
{
if (prev_addr != NULL)
*((void**) prev_addr) = next_addr;
else
om_AlwaysKeptAddrs = next_addr;
#ifdef OM_HAVE_TRACK
if (omIsTrackAddr(addr))
{
omMarkAsFreeTrackAddr(addr, 0, &flags, OM_FLR);
omFreeTrackAddr(addr);
}
else
#endif
__omFree(addr);
addr = next_addr;
}
else
{
prev_addr = addr;
addr = next_addr;
}
}
}

## omIsAddrOnFreeBinPage()

int omIsAddrOnFreeBinPage | ( | void * | addr | ) |

Definition at line 595 of file omBinPage.c.

{
char *c_addr=(char *)addr;
omBinPageRegion region = om_CurrentBinPageRegion;
if (region == NULL) return 0;
do
{
if (c_addr > region->addr && c_addr < region->addr + (region->pages)*SIZEOF_SYSTEM_PAGE)
{
if (omIsOnList(region->current, omGetPageOfAddr(addr))) return 1;
return 0;
}
region = region->next;
}
while (region != NULL);
return 0;
}
omGetPageOfAddr
#define omGetPageOfAddr(addr)
Definition omBinPage.h:19

## omIsInKeptAddrList()

int omIsInKeptAddrList | ( | void * | addr | ) |

Definition at line 743 of file omDebugTrack.c.

{
void* ptr = om_KeptAddr;
int ret = 0;
#ifdef OM_HAVE_TRACK
if (omIsTrackAddr(addr))
addr = omOutAddr_2_TrackAddr(addr);
#endif
if (om_LastKeptAddr != NULL)
*((void**) om_LastKeptAddr) = om_AlwaysKeptAddrs;
while (ptr != NULL)
{
if (ptr == addr)
{
ret = 1; break;
}
ptr = *((void**) ptr);
}
if (om_LastKeptAddr != NULL)
*((void**) om_LastKeptAddr) = NULL;
return ret;
}

## omIsKnownMemoryRegion()

int omIsKnownMemoryRegion | ( | omBinPageRegion | region | ) |

Definition at line 489 of file omBinPage.c.

{
omBinPageRegion iter = om_CurrentBinPageRegion;
if (region == NULL || iter == NULL) return 0;
iter = omGListLast(om_CurrentBinPageRegion, prev);
do
{
if (region == iter) return 1;
iter = iter->next;
}
while (iter != NULL);
return 0;
}

## omIterateTroughAddrs()

void omIterateTroughAddrs | ( | int | normal,
|  | int | track,
|  | void(* | CallBackUsed )(void *),
|  | void(* | CallBackFree )(void *) )

Definition at line 503 of file omDebugCheck.c.

{
int i;
omSpecBin s_bin;
omBin sticky;
if (normal)
{
for (i=0; i<=OM_MAX_BIN_INDEX; i++)
{
omIterateTroughBinAddrs(&om_StaticBin[i], CallBackUsed, CallBackFree);
}
s_bin = om_SpecBin;
while (s_bin != NULL)
{
omIterateTroughBinAddrs(s_bin->bin, CallBackUsed, CallBackFree);
s_bin = s_bin->next;
}
}
#ifdef OM_HAVE_TRACK
if (track)
{
for (i=0; i<=OM_MAX_BIN_INDEX; i++)
{
omIterateTroughBinAddrs(&om_StaticTrackBin[i], CallBackUsed, CallBackFree);
}
s_bin = om_SpecTrackBin;
while (s_bin != NULL)
{
omIterateTroughBinAddrs(s_bin->bin, CallBackUsed, CallBackFree);
s_bin = s_bin->next;
}
}
#endif
sticky = om_StickyBins;
while (sticky != NULL)
{
omIterateTroughBinAddrs(sticky, CallBackUsed, CallBackFree);
sticky = sticky->next;
}
}
omIterateTroughBinAddrs
void omIterateTroughBinAddrs(omBin bin, void(*CallBackUsed)(void *), void(*CallBackFree)(void *))
Definition omDebugCheck.c:464

## omIterateTroughBinAddrs()

void omIterateTroughBinAddrs | ( | omBin | bin,
|  | void(* | CallBackUsed )(void *),
|  | void(* | CallBackFree )(void *) )

Definition at line 464 of file omDebugCheck.c.

{
omBinPage page;
char* addr;
int is_free;
int i;
do
{
page = bin->last_page;
while (page != NULL)
{
addr = (char*) page + SIZEOF_OM_BIN_PAGE_HEADER;
i = 0;
do
{
is_free = omIsOnList(page->current, addr) != NULL
|| omIsInKeptAddrList(addr);
if (is_free)
{
if (CallBackFree != NULL) CallBackFree(addr);
}
else
{
if (CallBackUsed != NULL) CallBackUsed(addr);
}
addr = (char *)((char**) addr) + bin->sizeW;
i++;
} while (i < bin->max_blocks);
page = page->prev;
}
if (omIsStickyBin(bin))
bin = NULL;
else
bin = bin->next;
} while (bin != NULL);
}

## omMarkAsStaticAddr()

void omMarkAsStaticAddr | ( | void * | addr | ) |

## omMarkMemoryAsStatic()

void omMarkMemoryAsStatic | ( |  | ) |

## omPrintUsedAddrs()

void omPrintUsedAddrs | ( | FILE * | fd,
|  | int | max_frames )

Definition at line 565 of file omDebugCheck.c.

{
om_total_used_size = 0;
om_total_used_blocks = 0;
om_print_used_addr_fd = (fd == NULL ? stdout : fd);
om_print_frames = max;
omIterateTroughAddrs(1, 1, _omPrintUsedAddr, NULL);
fprintf(fd, "UsedAddrs Summary: UsedBlocks:%ld TotalSize:%ld\n",
om_total_used_blocks, (long)om_total_used_size);
}
max
static int max(int a, int b)
Definition fast_mult.cc:264
om_print_used_addr_fd
static FILE * om_print_used_addr_fd
Definition omDebugCheck.c:546
_omPrintUsedAddr
static void _omPrintUsedAddr(void *addr)
Definition omDebugCheck.c:551
om_total_used_size
static size_t om_total_used_size
Definition omDebugCheck.c:547
om_total_used_blocks
static unsigned long om_total_used_blocks
Definition omDebugCheck.c:548
omIterateTroughAddrs
void omIterateTroughAddrs(int normal, int track, void(*CallBackUsed)(void *), void(*CallBackFree)(void *))
Definition omDebugCheck.c:503
om_print_frames
static int om_print_frames
Definition omDebugCheck.c:549
fd
int status int fd
Definition si_signals.h:69

## omPrintUsedTrackAddrs()

void omPrintUsedTrackAddrs | ( | FILE * | fd,
|  | int | max_frames )

Definition at line 576 of file omDebugCheck.c.

{
om_total_used_size = 0;
om_total_used_blocks = 0;
om_print_used_addr_fd = (fd == NULL ? stdout : fd);
om_print_frames = max;
omIterateTroughAddrs(0, 1 , _omPrintUsedAddr, NULL);
fprintf(fd, "UsedTrackAddrs Summary: UsedBlocks:%ld TotalSize:%ld\n",
om_total_used_blocks, (long)om_total_used_size);
}

## omReportAddrError()

omError_t omReportAddrError | ( | omError_t | error,
|  | omError_t | report,
|  | void * | addr,
|  | void * | bin_size,
|  | omTrackFlags_t | flags,
|  | OM_FLR_DECL | ,
|  | const char * | fmt,
|  |  | ... )

Definition at line 394 of file omDebugCheck.c.

{
int max_check, max_track;
va_list ap;
va_start(ap, fmt);
/* reset MaxTrack and MaxCheck to prevent infinite loop, in case
printf allocates memory */
max_check = om_Opts.MaxCheck;
max_track = om_Opts.MaxTrack;
om_Opts.MaxCheck = 0;
om_Opts.MaxTrack = 0;
om_CallErrorHook = 0;
omReportError(error, report_error, OM_FLR_VAL, fmt, ap);
om_CallErrorHook = 1;
if ((error!=omError_NotBinAddr)&&(error!=omError_FreedAddr))
_omPrintAddrInfo(stderr, error, addr, bin_size, flags, 10, " occurred for");
om_Opts.ErrorHook();
om_Opts.MaxCheck = max_check;
om_Opts.MaxTrack = max_track;
return om_ErrorStatus;
}
ap
Definition ap.h:40
_omPrintAddrInfo
static void _omPrintAddrInfo(FILE *fd, omError_t error, void *addr, void *bin_size, omTrackFlags_t flags, int max_frames, const char *s)
Definition omDebugCheck.c:421
om_ErrorStatus
omError_t om_ErrorStatus
Definition omError.c:13
om_CallErrorHook
int om_CallErrorHook
Definition omError.c:77
omError_NotBinAddr
@ omError_NotBinAddr
Definition omError.h:31

## omUnMarkAsStaticAddr()

void omUnMarkAsStaticAddr | ( | void * | addr | ) |

## omUnMarkMemoryAsStatic()

void omUnMarkMemoryAsStatic | ( |  | ) |

## Variable Documentation

## om_AlwaysKeptAddrs

void* om_AlwaysKeptAddrs

extern

Definition at line 31 of file omDebug.c.

## om_KeptAddr

void* om_KeptAddr

extern

Definition at line 28 of file omDebug.c.

## om_LastKeptAddr

void* om_LastKeptAddr

extern

Definition at line 30 of file omDebug.c.

## om_MaxAddr

unsigned long om_MaxAddr

extern

Definition at line 19 of file omDebugCheck.c.

## om_MinAddr

unsigned long om_MinAddr

extern

Definition at line 20 of file omDebugCheck.c.