My Project
Loading...
Searching...
No Matches
Macros | Functions | Variables
omDebug.c File Reference
#include <limits.h>
#include <string.h>
#include "omConfig.h"
#include "omalloc.h"
#include "omDebug.h"
#include "omReturn.h"

Go to the source code of this file.

Macros

#define OM_CLFL   check_level OM_FL_KOMMA OM_FL
 
#define MAX(a, b)   (a > b ? a : b)
 
#define MIN(a, b)   (a < b ? a : b)
 

Functions

static void * __omDebugAlloc (void *size_bin, omTrackFlags_t flags, char track, OM_FLR_DECL)
 
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)
 
static void __omDebugFree (void *addr, void *size_bin, omTrackFlags_t flags, OM_FLR_DECL)
 
omError_t omTestAddrBin (void *addr, omBin bin, int check_level)
 
omError_t omTestBinAddrSize (void *addr, size_t size, int check_level)
 
omError_t omTestAddrSize (void *addr, size_t size, int check_level)
 
omError_t omTestBinAddr (void *addr, int check_level)
 
omError_t omTestAddr (void *addr, int check_level)
 
omError_t omtestAddrSize (void *addr, size_t size, int check_level)
 
omError_t omtestAddr (void *addr, int check_level)
 
omError_t omTestAddrAlignedBin (void *addr, omBin bin, int check_level)
 
omError_t omTestAddrAlignedSize (void *addr, size_t size, int check_level)
 
omError_t omTestAddrAligned (void *addr, int check_level)
 
omError_t omtestAddrAlignedSize (void *addr, size_t size, int check_level)
 
omError_t omtestAddrAligned (void *addr, int check_level)
 
omError_t omTestBin (omBin bin, int check_level)
 
omError_t omTestMemory (int check_level)
 
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 _omDebugAddr (void *addr, void *bin_size, omTrackFlags_t flags, OM_CFL_DECL)
 
omError_t _omDebugMemory (OM_CFL_DECL)
 
omError_t _omDebugBin (omBin bin, OM_CFL_DECL)
 
static omBin omGetOrigSpecBinOfAddr (void *addr)
 
void omFreeKeptAddrFromBin (omBin bin)
 
void omFreeKeptAddr ()
 

Variables

void * om_KeptAddr = NULL
 
static unsigned long om_NumberOfKeptAddrs = 0
 
void * om_LastKeptAddr = NULL
 
void * om_AlwaysKeptAddrs = NULL
 

Macro Definition Documentation

◆ MAX

#define MAX (   a,
  b 
)    (a > b ? a : b)

Definition at line 100 of file omDebug.c.

◆ MIN

#define MIN (   a,
  b 
)    (a < b ? a : b)

Definition at line 102 of file omDebug.c.

◆ OM_CLFL

#define OM_CLFL   check_level OM_FL_KOMMA OM_FL

Definition at line 39 of file omDebug.c.

Function Documentation

◆ __omDebugAlloc()

static void * __omDebugAlloc ( void *  size_bin,
omTrackFlags_t  flags,
char  track,
OM_FLR_DECL   
)
static

Definition at line 304 of file omDebug.c.

305{
306 void* o_addr;
307
308#ifdef OM_HAVE_TRACK
309 if (track > 0)
310 {
311 o_addr = omAllocTrackAddr(size_bin, flags, track, OM_FLR_VAL);
312 }
313 else
314#endif
315 {
316 if (flags & OM_FBIN)
317 {
318 omBin bin = (omBin) size_bin;
319
320 if (flags & OM_FZERO)
321 __omTypeAlloc0Bin(void*, o_addr, bin);
322 else
323 __omTypeAllocBin(void*, o_addr, bin);
324 }
325 else
326 {
327 size_t o_size = (flags & OM_FBIN ? ((omBin)size_bin)->sizeW << LOG_SIZEOF_LONG : (size_bin != NULL ? (size_t) size_bin: 1));
328 if (flags & OM_FZERO)
329 {
330#ifdef OM_ALIGNMENT_NEEDS_WORK
331 if (flags & OM_FALIGN)
332 __omTypeAlloc0Aligned(void*, o_addr, o_size);
333 else
334#endif
335 __omTypeAlloc0(void*, o_addr, o_size);
336 }
337 else
338 {
339#ifdef OM_ALIGNMENT_NEEDS_WORK
340 if (flags & OM_FALIGN)
341 __omTypeAllocAligned(void*, o_addr, o_size);
342 else
343#endif
344 __omTypeAlloc(void*, o_addr, o_size);
345 }
346 }
347 }
348
349 return o_addr;
350}
#define __omTypeAlloc0Bin(type, addr, bin)
#define __omTypeAllocBin(type, addr, bin)
#define __omTypeAlloc0(type, addr, size)
#define __omTypeAlloc(type, addr, size)
#define __omTypeAllocAligned
#define __omTypeAlloc0Aligned
#define OM_FALIGN
Definition: omDebug.h:38
#define OM_FZERO
Definition: omDebug.h:37
#define OM_FBIN
Definition: omDebug.h:32
#define NULL
Definition: omList.c:12
omBin_t * omBin
Definition: omStructs.h:12
int status int void size_t count int const void size_t count const char int flags
Definition: si_signals.h:73

◆ __omDebugFree()

static void __omDebugFree ( void *  addr,
void *  size_bin,
omTrackFlags_t  flags,
OM_FLR_DECL   
)
static

Definition at line 465 of file omDebug.c.

466{
467 omBin bin = NULL;
468
469 if (addr == NULL || ((flags & OM_FSIZE) && size_bin == NULL)) return;
470 if (om_Opts.Keep > 0)
471 {
472#ifdef OM_HAVE_TRACK
473 if (omIsTrackAddr(addr))
474 addr = omMarkAsFreeTrackAddr(addr, 1, &flags, OM_FLR_VAL);
475#endif
476 bin = omGetOrigSpecBinOfAddr(addr);
477 if (bin != NULL)
478 {
479 omSpecBin s_bin = omFindInGList(om_SpecBin, next, bin, (unsigned long) bin);
480 omAssume(s_bin != NULL);
481 (s_bin->ref)++;
482 }
483
484 if (flags & OM_FKEEP)
485 {
486 *((void**) addr) = om_AlwaysKeptAddrs;
487 om_AlwaysKeptAddrs = addr;
488 return;
489 }
490
492 {
497 *((void**) om_LastKeptAddr) = addr;
498 om_LastKeptAddr = addr;
499 *((void**) addr) = NULL;
500 }
501 else
502 {
504 om_LastKeptAddr = addr;
505 om_KeptAddr = addr;
506 *((void**) om_LastKeptAddr) = NULL;
507 }
508
509 if (om_NumberOfKeptAddrs > om_Opts.Keep)
510 {
512 omError_MemoryCorrupted, OM_FLR_VAL);
513 addr = om_KeptAddr;
514 if (addr!=NULL) om_KeptAddr = *((void**) addr);
516 if (status != omError_NoError) return;
517 }
518 else
519 return;
520
521 bin = omGetOrigSpecBinOfAddr(addr);
522 }
523
524#ifdef OM_HAVE_TRACK
525 if (omIsTrackAddr(addr))
526 {
527 omMarkAsFreeTrackAddr(addr, 0, &flags, OM_FLR_VAL);
528 omFreeTrackAddr(addr);
529 }
530 else
531#endif
532 if (om_Opts.Keep <= 0 && ((flags & OM_FBIN) || (flags & OM_FBINADDR)))
533 __omFreeBinAddr(addr);
534 else if (om_Opts.Keep <= 0 && (flags & OM_FSIZE))
535 __omFreeSize(addr, (size_t) size_bin);
536 else
537 __omFree(addr);
538
539 if (bin != NULL) omUnGetSpecBin(&bin);
540}
ListNode * next
Definition: janet.h:31
#define __omFreeBinAddr(addr)
#define __omFree(addr)
#define __omFreeSize(addr, size)
#define omUnGetSpecBin(bin_ptr)
Definition: omBin.h:14
void * om_AlwaysKeptAddrs
Definition: omDebug.c:31
static omBin omGetOrigSpecBinOfAddr(void *addr)
Definition: omDebug.c:449
static unsigned long om_NumberOfKeptAddrs
Definition: omDebug.c:29
void * om_KeptAddr
Definition: omDebug.c:28
void * om_LastKeptAddr
Definition: omDebug.c:30
#define OM_FBINADDR
Definition: omDebug.h:40
#define OM_FKEPT
Definition: omDebug.h:35
#define OM_FSIZE
Definition: omDebug.h:33
omError_t omDoCheckAddr(void *addr, void *bin_size, omTrackFlags_t flags, char level, omError_t report, OM_FLR_DECL)
Definition: omDebugCheck.c:146
#define omIsTrackAddr(addr)
Definition: omDebug.h:12
#define OM_FKEEP
Definition: omDebug.h:41
#define omAssume(x)
Definition: omError.h:85
@ omError_MemoryCorrupted
Definition: omError.h:21
@ omError_NoError
Definition: omError.h:18
enum omError_e omError_t
Definition: omError.h:44
#define omFindInGList(ptr, next, what, value)
Definition: omList.h:104
omOpts_t om_Opts
Definition: omOpts.c:13
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
omSpecBin om_SpecBin
Definition: om_Alloc.c:20
int * status
Definition: si_signals.h:51

◆ __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   
)
static

Definition at line 352 of file omDebug.c.

355{
356 void* new_addr;
357 size_t old_size = (old_flags & OM_FSIZE ? (size_t) old_size_bin :
358 (omSizeOfAddr(old_addr)));
359 size_t new_size;
360
361 omAssume(new_flags & OM_FSIZE || new_flags & OM_FBIN);
362
363 if (old_addr == NULL || ((old_flags & OM_FSIZE) && old_size_bin == NULL))
364 {
365 new_addr = __omDebugAlloc(new_size_bin, new_flags, track, OM_FLR_VAL);
366 }
367 else if (om_Opts.Keep > 0 || track > 0 || omIsTrackAddr(old_addr) || old_status != omError_NoError ||
368 old_flags & OM_FKEEP || new_flags & OM_FKEEP)
369 {
370 new_addr = __omDebugAlloc(new_size_bin, new_flags, track, OM_FLR_VAL);
371 new_size = omSizeOfAddr(new_addr);
372 old_size = omSizeOfAddr(old_addr);
373
374 memcpy(new_addr, old_addr, (old_size < new_size ? old_size : new_size));
375
376 if ((new_flags & OM_FZERO) && new_size > old_size)
377 memset((char *)new_addr + old_size, 0, new_size - old_size);
378 if (old_status == omError_NoError)
379 __omDebugFree(old_addr, old_size_bin, old_flags, OM_FLR_VAL);
380 }
381 else
382 {
383 if (new_flags & OM_FBIN)
384 {
385 omBin new_bin = (omBin) new_size_bin;
386 omBin old_bin = (omBin) old_size_bin;
387
388 omAssume(old_flags & OM_FBIN);
389 if (new_flags & OM_FZERO)
390 __omTypeRealloc0Bin(old_addr, old_bin, void*, new_addr, new_bin);
391 else
392 __omTypeReallocBin(old_addr, old_bin, void*, new_addr, new_bin);
393 }
394 else
395 {
396 new_size = (size_t) new_size_bin;
397 if (new_size == 0) new_size = 1;
398 omAssume(!(new_flags & OM_FBIN) && !(old_flags & OM_FBIN));
399
400 if (old_flags & OM_FSIZE)
401 {
402 size_t old_size = (size_t) old_size_bin;
403
404 if (new_flags & OM_FZERO)
405 {
406#ifdef OM_ALIGNMENT_NEEDS_WORK
407 if (new_flags & OM_FALIGN)
408 __omTypeRealloc0AlignedSize(old_addr, old_size, void*, new_addr, new_size);
409 else
410#endif
411 __omTypeRealloc0Size(old_addr, old_size, void*, new_addr, new_size);
412 }
413 else
414 {
415#ifdef OM_ALIGNMENT_NEEDS_WORK
416 if (new_flags & OM_FALIGN)
417 __omTypeReallocAlignedSize(old_addr, old_size, void*, new_addr, new_size);
418 else
419#endif
420 __omTypeReallocSize(old_addr, old_size, void*, new_addr, new_size);
421 }
422 }
423 else
424 {
425 if (new_flags & OM_FZERO)
426 {
427#ifdef OM_ALIGNMENT_NEEDS_WORK
428 if (new_flags & OM_FALIGN)
429 __omTypeRealloc0Aligned(old_addr, void*, new_addr, new_size);
430 else
431#endif
432 __omTypeRealloc0(old_addr, void*, new_addr, new_size);
433 }
434 else
435 {
436#ifdef OM_ALIGNMENT_NEEDS_WORK
437 if (new_flags & OM_FALIGN)
438 __omTypeReallocAligned(old_addr, void*, new_addr, new_size);
439 else
440#endif
441 __omTypeRealloc(old_addr, void*, new_addr, new_size);
442 }
443 }
444 }
445 }
446 return new_addr;
447}
#define __omTypeRealloc0Size(old_addr, old_size, new_type, new_addr, new_size)
#define __omTypeReallocBin(old_addr, old_bin, new_type, new_addr, new_bin)
#define __omTypeRealloc0Bin(old_addr, old_bin, new_type, new_addr, new_bin)
#define __omTypeRealloc(old_addr, new_type, new_addr, new_size)
#define __omTypeRealloc0(old_addr, new_type, new_addr, new_size)
#define __omTypeRealloc0Aligned
#define __omTypeReallocSize(old_addr, old_size, new_type, new_addr, new_size)
#define __omTypeRealloc0AlignedSize
#define __omTypeReallocAligned
#define __omTypeReallocAlignedSize
size_t omSizeOfAddr(const void *addr)
static void * __omDebugAlloc(void *size_bin, omTrackFlags_t flags, char track, OM_FLR_DECL)
Definition: omDebug.c:304
static void __omDebugFree(void *addr, void *size_bin, omTrackFlags_t flags, OM_FLR_DECL)
Definition: omDebug.c:465

◆ _omDebugAddr()

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

Definition at line 278 of file omDebug.c.

279{
280 OM_R_DEF;
281 check = MAX(check,om_Opts.MinCheck);
282 check = MIN(check,om_Opts.MaxCheck);
283 return _omCheckAddr(addr, bin_size,
285}
VAR int check
Definition: libparse.cc:1106
#define MIN(a, b)
Definition: omDebug.c:102
#define MAX(a, b)
Definition: omDebug.c:100
omError_t _omCheckAddr(void *addr, void *size_bin, omTrackFlags_t flags, char check, omError_t report, OM_FLR_DECL)
Definition: omDebugCheck.c:36
#define OM_FUSED
Definition: omDebug.h:34

◆ _omDebugAlloc()

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

Definition at line 110 of file omDebug.c.

111{
112 void* addr;
113 OM_R_DEF;
114 check = MAX(check, om_Opts.MinCheck);
115 track = MAX(track, om_Opts.MinTrack);
116 check = MIN(check, om_Opts.MaxCheck);
117 track = MIN(track, om_Opts.MaxTrack);
118
119 if (check)
120 {
121 if (check > 1)
122 {
123 if (flags & OM_FBIN)
124 (void) _omCheckBin((omBin)size_bin, 1, check-1, omError_MemoryCorrupted, OM_FLR_VAL);
125 else if (check > 2)
126 {
128 (void) _omCheckMemory(check-2, omError_MemoryCorrupted, OM_FLR_VAL);
129 }
130 }
131 if (size_bin == NULL && ! (flags & OM_FSLOPPY))
132 {
134 }
135 }
136
137 addr = __omDebugAlloc(size_bin, flags, track, OM_FLR_VAL);
138
139#ifdef OM_INTERNAL_DEBUG
140 (void) _omCheckAddr(addr, size_bin,flags|OM_FUSED,check, omError_InternalBug, OM_FLR);
141#endif
142
143 return addr;
144}
#define OM_FSLOPPY
Definition: omDebug.h:39
omError_t _omCheckBin(omBin bin, int normal_bin, char check, omError_t report, OM_FLR_DECL)
Definition: omDebugCheck.c:49
omError_t _omCheckMemory(char check, omError_t report, OM_FLR_DECL)
Definition: omDebugCheck.c:58
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
Definition: omError.c:80
@ omError_NullSizeAlloc
Definition: omError.h:33
@ omError_InternalBug
Definition: omError.h:20

◆ _omDebugBin()

omError_t _omDebugBin ( omBin  bin,
OM_CFL_DECL   
)

Definition at line 293 of file omDebug.c.

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

◆ _omDebugFree()

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

Definition at line 182 of file omDebug.c.

184{
185 OM_R_DEF;
186 check = MAX(check, om_Opts.MinCheck);
187 check = MIN(check, om_Opts.MaxCheck);
188
189 if (check && _omCheckAddr(addr, size_bin, flags|OM_FUSED, check, omError_NoError, OM_FLR_VAL)) return;
190
191 __omDebugFree(addr,size_bin,flags, OM_FLR_VAL);
192
193#ifdef OM_INTERNAL_DEBUG
194 if (flags & OM_FBIN)
195 (void) _omCheckBin((omBin)size_bin, 1, check-1,omError_InternalBug, OM_FLR);
196 else
198#endif
199}

◆ _omDebugMemDup()

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

Definition at line 201 of file omDebug.c.

202{
203 void* ret;
204 size_t sizeW;
205 OM_R_DEF;
206
207 check = MAX(check, om_Opts.MinCheck);
208 track = MAX(track, om_Opts.MinTrack);
209 check = MIN(check, om_Opts.MaxCheck);
210 track = MIN(track, om_Opts.MaxTrack);
211
212 if (check & _omCheckAddr(addr, 0, OM_FUSED, check, omError_NoError, OM_FLR_VAL))
213 {
214 return NULL;
215 }
216 else
217 {
218 sizeW = omSizeWOfAddr(addr);
219 }
220
221 ret = __omDebugAlloc((void*) (sizeW << LOG_SIZEOF_LONG), OM_FSIZE | flags, track, OM_FLR_VAL);
222 omMemcpyW(ret, addr, sizeW);
223
224#ifdef OM_INTERNAL_DEBUG
225 (void) _omCheckAddr(ret, (void*) (sizeW << LOG_SIZEOF_LONG),OM_FUSED|OM_FSIZE,
226 check, omError_InternalBug, OM_FLR);
227#endif
228 return ret;
229}
#define omMemcpyW(p1, p2, l)
Definition: omMemOps.h:29
#define omSizeWOfAddr(P)
Definition: xalloc.h:223

◆ _omDebugMemory()

omError_t _omDebugMemory ( OM_CFL_DECL  )

Definition at line 286 of file omDebug.c.

287{
288 OM_R_DEF;
289 check = MAX(check,om_Opts.MinCheck);
290 check = MIN(check,om_Opts.MaxCheck);
291 return _omCheckMemory(check, omError_NoError,OM_FLR_VAL);
292}

◆ _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.

149{
150 void* new_addr = NULL;
152 OM_R_DEF;
153 check = MAX(check, om_Opts.MinCheck);
154 track = MAX(track, om_Opts.MinTrack);
155 check = MIN(check, om_Opts.MaxCheck);
156 track = MIN(track, om_Opts.MaxTrack);
157
158 if (check)
159 {
160 status = _omCheckAddr(old_addr, old_size_bin, old_flags|OM_FUSED, check, omError_NoError, OM_FLR_VAL);
161
162 if (status == omError_NoError && check > 1 && new_flags & OM_FBIN)
163 status = omDoCheckBin((omBin)new_size_bin, 1, check-1, omError_MemoryCorrupted, OM_FLR_VAL);
164
165 if (new_size_bin == NULL && !(new_flags & OM_FSLOPPY))
166 {
168 new_size_bin = (void*) 1;
169 }
170 }
171
172 new_addr = __omDebugRealloc(old_addr, old_size_bin, new_size_bin,
173 status, old_flags, new_flags, track, OM_FLR_VAL);
174#ifdef OM_INTERNAL_DEBUG
175 if (status == omError_NoError)
176 (void) _omCheckAddr(new_addr, new_size_bin,new_flags|OM_FUSED,check, omError_InternalBug, OM_FLR);
177#endif
178
179 return new_addr;
180}
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
omError_t omDoCheckBin(omBin bin, int normal_bin, char level, omError_t report, OM_FLR_DECL)
Definition: omDebugCheck.c:253

◆ _omDebugStrDup()

char * _omDebugStrDup ( const char *  addr,
OM_TFL_DECL   
)

Definition at line 231 of file omDebug.c.

232{
233#if 0
234 unsigned long size;
235#endif
236 unsigned long i=0;
237 char* ret;
238 OM_R_DEF;
239
240 if (addr == NULL)
241 {
242 omReportAddrError(omError_NotString, omError_NoError, (char *)addr, 0, 0, OM_FLR_VAL, "NULL String");
243 return NULL;
244 }
245 track = MAX(track, om_Opts.MinTrack);
246 track = MIN(track, om_Opts.MaxTrack);
247
248#if 0
249 // this breaks if SizeOfAddr(addr) > PAGESIZE
250 if (omIsBinPageAddr(addr))
251 {
252 size = omSizeOfAddr(addr);
253 }
254 else
255 {
256 size = ULONG_MAX;
257 }
258#endif
259 while ((addr[i] != '\0') /* && (i < size)*/) i++;
260// there seems to be no way to check if it is really a string
261#if 0
262 if (i == size)
263 {
264 omReportAddrError(omError_NotString, omError_NoError, addr, 0, 0, OM_FLR_VAL, "Not 0 terminated");
265 i = size-1;
266 }
267#endif
268 ret = __omDebugAlloc((char*)i+1, OM_FSIZE, track, OM_FLR_VAL);
269 memcpy(ret, addr, i);
270 ret[i] = '\0';
271
272#ifdef OM_INTERNAL_DEBUG
273 (void) _omCheckAddr(ret, (void*)i+1,OM_FUSED|OM_FSIZE,om_Opts.MinCheck, omError_InternalBug, OM_FLR);
274#endif
275 return ret;
276}
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
int i
Definition: cfEzgcd.cc:132
#define omIsBinPageAddr(addr)
Definition: omBinPage.h:68
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
@ omError_NotString
Definition: omError.h:40

◆ omFreeKeptAddr()

void omFreeKeptAddr ( )

Definition at line 609 of file omDebug.c.

610{
611 void* next;
612 omBin bin;
614 void* addr = om_KeptAddr;
615
616 if (om_LastKeptAddr != NULL)
618
623
624 while (addr != NULL)
625 {
626 next = *((void**)addr);
627 bin = omGetOrigSpecBinOfAddr(addr);
628
629#ifdef OM_HAVE_TRACK
630 if (omIsTrackAddr(addr))
631 {
632 omMarkAsFreeTrackAddr(addr, 0, &flags, OM_FLR);
633 omFreeTrackAddr(addr);
634 }
635 else
636#endif
637 __omFree(addr);
638
639 addr = next;
640 if (bin != NULL) omUnGetSpecBin(&bin);
641 }
642}
unsigned short omTrackFlags_t
Definition: omDebug.h:45

◆ omFreeKeptAddrFromBin()

void omFreeKeptAddrFromBin ( omBin  bin)

Definition at line 542 of file omDebug.c.

543{
544 void* addr = om_KeptAddr;
545 void* prev_addr = NULL;
546 void* next_addr;
548
549 while (addr != NULL)
550 {
551 next_addr = *((void**) addr);
552 if (omIsBinPageAddr(addr) && omGetTopBinOfAddr(addr) == bin)
553 {
554 if (prev_addr != NULL)
555 *((void**) prev_addr) = next_addr;
556 else
557 om_KeptAddr = next_addr;
558 if (addr == om_LastKeptAddr)
559 om_LastKeptAddr = prev_addr;
561#ifdef OM_HAVE_TRACK
562 if (omIsTrackAddr(addr))
563 {
564 omMarkAsFreeTrackAddr(addr, 0, &flags, OM_FLR);
565 omFreeTrackAddr(addr);
566 }
567 else
568#endif
569 __omFree(addr);
570 addr = next_addr;
571 }
572 else
573 {
574 prev_addr = addr;
575 addr = next_addr;
576 }
577 }
578
579 addr = om_AlwaysKeptAddrs;
580 prev_addr = NULL;
581 while (addr != NULL)
582 {
583 next_addr = *((void**) addr);
584 if (omIsBinPageAddr(addr) && omGetTopBinOfAddr(addr) == bin)
585 {
586 if (prev_addr != NULL)
587 *((void**) prev_addr) = next_addr;
588 else
589 om_AlwaysKeptAddrs = next_addr;
590#ifdef OM_HAVE_TRACK
591 if (omIsTrackAddr(addr))
592 {
593 omMarkAsFreeTrackAddr(addr, 0, &flags, OM_FLR);
594 omFreeTrackAddr(addr);
595 }
596 else
597#endif
598 __omFree(addr);
599 addr = next_addr;
600 }
601 else
602 {
603 prev_addr = addr;
604 addr = next_addr;
605 }
606 }
607}
#define omGetTopBinOfAddr(addr)

◆ omGetOrigSpecBinOfAddr()

static omBin omGetOrigSpecBinOfAddr ( void *  addr)
static

Definition at line 449 of file omDebug.c.

450{
451 if (omIsBinPageAddr(addr))
452 {
453#ifdef OM_HAVE_TRACK
454 if (omIsBinAddrTrackAddr(addr)) return omGetOrigSpecBinOfTrackAddr(addr);
455 else
456#endif
457 {
458 omBin bin = omGetTopBinOfAddr(addr);
459 if (omIsSpecBin(bin)) return bin;
460 }
461 }
462 return NULL;
463}
#define omIsSpecBin(bin)
Definition: omBin.h:47
#define omIsBinAddrTrackAddr(addr)
Definition: omDebug.h:15

◆ omTestAddr()

omError_t omTestAddr ( void *  addr,
int  check_level 
)

Definition at line 56 of file omDebug.c.

57{
58 return _omDebugAddr(addr,NULL, 0, OM_CLFL);
59}
#define OM_CLFL
Definition: omDebug.c:39
omError_t _omDebugAddr(void *addr, void *bin_size, omTrackFlags_t flags, OM_CFL_DECL)
Definition: omDebug.c:278

◆ omtestAddr()

omError_t omtestAddr ( void *  addr,
int  check_level 
)

Definition at line 64 of file omDebug.c.

65{
66 return _omDebugAddr(addr,NULL, OM_FSLOPPY, OM_CLFL);
67}

◆ omTestAddrAligned()

omError_t omTestAddrAligned ( void *  addr,
int  check_level 
)

Definition at line 77 of file omDebug.c.

78{
79 return _omDebugAddr(addr,NULL, OM_FALIGN, OM_CLFL);
80}

◆ omtestAddrAligned()

omError_t omtestAddrAligned ( void *  addr,
int  check_level 
)

Definition at line 85 of file omDebug.c.

86{
88}

◆ omTestAddrAlignedBin()

omError_t omTestAddrAlignedBin ( void *  addr,
omBin  bin,
int  check_level 
)

Definition at line 69 of file omDebug.c.

70{
71 return _omDebugAddr(addr,bin,OM_FBIN|OM_FALIGN,OM_CLFL);
72}

◆ omTestAddrAlignedSize()

omError_t omTestAddrAlignedSize ( void *  addr,
size_t  size,
int  check_level 
)

Definition at line 73 of file omDebug.c.

74{
75 return _omDebugAddr(addr,(void*)(size),OM_FSIZE|OM_FALIGN,OM_CLFL);
76}

◆ omtestAddrAlignedSize()

omError_t omtestAddrAlignedSize ( void *  addr,
size_t  size,
int  check_level 
)

Definition at line 81 of file omDebug.c.

82{
84}

◆ omTestAddrBin()

omError_t omTestAddrBin ( void *  addr,
omBin  bin,
int  check_level 
)

Definition at line 40 of file omDebug.c.

41{
42 return _omDebugAddr(addr,bin,OM_FBIN,OM_CLFL);
43}

◆ omTestAddrSize()

omError_t omTestAddrSize ( void *  addr,
size_t  size,
int  check_level 
)

Definition at line 48 of file omDebug.c.

49{
50 return _omDebugAddr(addr,(void*)(size),OM_FSIZE,OM_CLFL);
51}

◆ omtestAddrSize()

omError_t omtestAddrSize ( void *  addr,
size_t  size,
int  check_level 
)

Definition at line 60 of file omDebug.c.

61{
62 return _omDebugAddr(addr,(void*)(size),OM_FSIZE|OM_FSLOPPY,OM_CLFL);
63}

◆ omTestBin()

omError_t omTestBin ( omBin  bin,
int  check_level 
)

Definition at line 90 of file omDebug.c.

91{
92 return _omDebugBin(bin, OM_CLFL);
93}
omError_t _omDebugBin(omBin bin, OM_CFL_DECL)
Definition: omDebug.c:293

◆ omTestBinAddr()

omError_t omTestBinAddr ( void *  addr,
int  check_level 
)

Definition at line 52 of file omDebug.c.

53{
54 return _omDebugAddr(addr,NULL, OM_FBINADDR, OM_CLFL);
55}

◆ omTestBinAddrSize()

omError_t omTestBinAddrSize ( void *  addr,
size_t  size,
int  check_level 
)

Definition at line 44 of file omDebug.c.

45{
46 return _omDebugAddr(addr,(void*)(size),OM_FSIZE|OM_FBINADDR,OM_CLFL);
47}

◆ omTestMemory()

omError_t omTestMemory ( int  check_level)

Definition at line 94 of file omDebug.c.

95{
96 return _omDebugMemory(OM_CLFL);
97}
omError_t _omDebugMemory(OM_CFL_DECL)
Definition: omDebug.c:286

Variable Documentation

◆ om_AlwaysKeptAddrs

void* om_AlwaysKeptAddrs = NULL

Definition at line 31 of file omDebug.c.

◆ om_KeptAddr

void* om_KeptAddr = NULL

Definition at line 28 of file omDebug.c.

◆ om_LastKeptAddr

void* om_LastKeptAddr = NULL

Definition at line 30 of file omDebug.c.

◆ om_NumberOfKeptAddrs

unsigned long om_NumberOfKeptAddrs = 0
static

Definition at line 29 of file omDebug.c.