- Timestamp:
- Sep 14, 2000, 2:59:54 PM (24 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- cb66fa0d8f3235673bb9477eb737a9069010b278
- Parents:
- b4e536263bb0aa911b1f252afe51fd37579eaaa1
- Location:
- omalloc
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
omalloc/omAllocDecl.h
rb4e536 rcba516 4 4 * Author: obachman (Olaf Bachmann) 5 5 * Created: 11/99 6 * Version: $Id: omAllocDecl.h,v 1. 5 2000-08-18 09:05:50obachman Exp $6 * Version: $Id: omAllocDecl.h,v 1.6 2000-09-14 12:59:51 obachman Exp $ 7 7 *******************************************************************/ 8 8 #ifndef OM_ALLOC_DECL_H … … 81 81 #define omDebugBinAddr(addr) _omDebugAddr(addr,NULL,OM_FBINADDR,OM_CFL) 82 82 #define omDebugAddrBin(addr, bin) _omDebugAddr(addr,bin,OM_FBIN,OM_CFL) 83 #define omDebugBinAddrSize(addr, size) _omDebugAddr(addr,(void*)(size),OM_FBINADDR|OM_FSIZE,OM_CFL) 83 84 #define omDebugAddrSize(addr,size) _omDebugAddr(addr,(void*)(size),OM_FSIZE,OM_CFL) 84 85 #define omDebugAddr(addr) _omDebugAddr(addr,NULL, 0, OM_CFL) … … 91 92 #if OM_CHECK > 0 92 93 #define omCheckBinAddr omDebugBinAddr 93 #define omCheckAddrBin omDebugAddrBin 94 #define omCheckAddrBin omDebugAddrBin 95 #define omCheckBinAddrSize omDebugBinAddrSize 94 96 #define omCheckAddrSize omDebugAddrSize 95 97 #define omCheckAddr omDebugAddr … … 297 299 #define omDebugBinAddr(addr) ((void) 0) 298 300 #define omDebugAddrBin(addr,bin) ((void) 0) 301 #define omDebugBinAddrSize(addr,size) ((void) 0) 299 302 #define omDebugAddrSize(addr,size) ((void) 0) 300 303 #define omDebugAddr(addr) ((void) 0) … … 310 313 #define omCheckBinAddr(addr) ((void) 0) 311 314 #define omCheckAddrBin(addr,bin) ((void) 0) 315 #define omCheckBinAddrSize(addr,size) ((void) 0) 312 316 #define omCheckAddrSize(addr,size) ((void) 0) 313 317 #define omCheckAddr(addr) ((void) 0) … … 323 327 omError_t omTestAddrBin(void* addr, omBin bin, int check_level); 324 328 omError_t omTestBinAddr(void* addr, int check_level); 329 omError_t omTestBinAddrSize(void* addr, size_t size, int check_level); 325 330 omError_t omTestAddrSize(void* addr, size_t size, int check_level); 326 331 omError_t omTestAddr(void* addr, int check_level); … … 341 346 #define omTestAddrBin(addr,bin,l) ((void) 0) 342 347 #define omTestBinAddr(addr,l) ((void) 0) 348 #define omTestBinAddrSize(addr,size,l) ((void) 0) 343 349 #define omTestAddrSize(addr,size,l) ((void) 0) 344 350 #define omTestAddr(addr,l) ((void) 0) -
omalloc/omDebug.c
rb4e536 rcba516 4 4 * Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) 5 5 * Created: 7/00 6 * Version: $Id: omDebug.c,v 1. 8 2000-09-12 16:02:18obachman Exp $6 * Version: $Id: omDebug.c,v 1.9 2000-09-14 12:59:52 obachman Exp $ 7 7 *******************************************************************/ 8 8 #include <limits.h> … … 39 39 { 40 40 return _omDebugAddr(addr,bin,OM_FBIN,OM_CLFL); 41 } 42 omError_t omTestBinAddrSize(void* addr, size_t size, int check_level) 43 { 44 return _omDebugAddr(addr,(void*)(size),OM_FSIZE|OM_FBINADDR,OM_CLFL); 41 45 } 42 46 omError_t omTestAddrSize(void* addr, size_t size, int check_level) … … 237 241 } 238 242 while (addr[i] != '\0' && i < size) i++; 243 // there seems to be no way to check if it is really a string 244 #if 0 239 245 if (i == size) 240 246 { … … 242 248 i = size-1; 243 249 } 250 #endif 244 251 ret = __omDebugAlloc((void*)i+1, OM_FSIZE, track, OM_FLR_VAL); 245 252 memcpy(ret, addr, i); -
omalloc/omDebug.h
rb4e536 rcba516 4 4 * Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) 5 5 * Created: 7/00 6 * Version: $Id: omDebug.h,v 1. 8 2000-09-12 16:02:18obachman Exp $6 * Version: $Id: omDebug.h,v 1.9 2000-09-14 12:59:52 obachman Exp $ 7 7 *******************************************************************/ 8 8 #ifndef OM_DEBUG_H … … 179 179 if (_status && _status != omError_MaxError) \ 180 180 { \ 181 omPrintAddrInfo(stderr, _status, addr, bin_size, flags, " occured for"); \181 _omPrintAddrInfo(stderr, _status, addr, bin_size, flags, " occured for"); \ 182 182 return _status; \ 183 183 } \ -
omalloc/omDebugCheck.c
rb4e536 rcba516 4 4 * Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) 5 5 * Created: 11/99 6 * Version: $Id: omDebugCheck.c,v 1. 4 2000-08-18 09:05:52 obachman Exp $6 * Version: $Id: omDebugCheck.c,v 1.5 2000-09-14 12:59:52 obachman Exp $ 7 7 *******************************************************************/ 8 8 #include <limits.h> … … 26 26 static omError_t omDoCheckBinPage(omBinPage page, int normal_page, int level, 27 27 omError_t report, OM_FLR_DECL); 28 static void omPrintAddrInfo(FILE* fd, omError_t error, void* addr, void* bin_size, omTrackFlags_t flags, char* s);28 static void _omPrintAddrInfo(FILE* fd, omError_t error, void* addr, void* bin_size, omTrackFlags_t flags, char* s); 29 29 30 30 … … 199 199 omAddrCheckReturnCorrupted(! omIsKnownTopBin(bin, ! omIsBinAddrTrackAddr(addr))); 200 200 201 if (flags & OM_FBINADDR && flags & OM_FSIZE) 202 omAddrCheckReturnError(bin->sizeW*SIZEOF_LONG != (size_t) bin_size, omError_WrongSize); 203 201 204 if (level > 1) 202 205 { … … 423 426 omReportError(error, report_error, OM_FLR_VAL, fmt, ap); 424 427 425 omPrintAddrInfo(stderr, error, addr, bin_size, flags, " occured for");428 _omPrintAddrInfo(stderr, error, addr, bin_size, flags, " occured for"); 426 429 return om_ErrorStatus; 427 430 } 428 431 429 void omPrintAddrInfo(FILE* fd, omError_t error, void* addr, void* bin_size, omTrackFlags_t flags, char* s)432 void _omPrintAddrInfo(FILE* fd, omError_t error, void* addr, void* bin_size, omTrackFlags_t flags, char* s) 430 433 { 431 434 if (! omCheckPtr(addr, omError_MaxError, OM_FLR)) … … 448 451 fprintf(fd, "%s (invalid) addr: %p\n", s, addr); 449 452 } 453 } 454 455 void omPrintAddrInfo(FILE* fd, void *addr, char* s) 456 { 457 _omPrintAddrInfo(fd, omError_NoError, addr, NULL, 0, s); 450 458 } 451 459 … … 537 545 om_total_used_blocks++; 538 546 om_total_used_size += omSizeOfAddr(addr); 539 omPrintAddrInfo(om_print_used_addr_fd, omError_NoError, addr, NULL, 0, "");547 _omPrintAddrInfo(om_print_used_addr_fd, omError_NoError, addr, NULL, 0, ""); 540 548 fprintf(om_print_used_addr_fd, "\n"); 541 549 } -
omalloc/omDebugTrack.c
rb4e536 rcba516 4 4 * Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) 5 5 * Created: 11/99 6 * Version: $Id: omDebugTrack.c,v 1. 6 2000-09-12 16:02:18obachman Exp $6 * Version: $Id: omDebugTrack.c,v 1.7 2000-09-14 12:59:53 obachman Exp $ 7 7 *******************************************************************/ 8 8 #include <limits.h> … … 453 453 omAddrCheckReturnError((d_addr->flags & OM_FUSED) ^ (flags & OM_FUSED), omError_FreedAddrOrMemoryCorrupted); 454 454 455 if (flags & OM_FBINADDR && flags & OM_FSIZE) 456 omAddrCheckReturnError(omTrackAddr_2_OutSize(d_addr) != (size_t) bin_size, omError_WrongSize); 457 455 458 if (d_addr->track > 2) 456 459 { -
omalloc/omError.h
rb4e536 rcba516 4 4 * Author: obachman (Olaf Bachmann) 5 5 * Created: 11/99 6 * Version: $Id: omError.h,v 1. 4 2000-08-18 09:05:53 obachman Exp $6 * Version: $Id: omError.h,v 1.5 2000-09-14 12:59:53 obachman Exp $ 7 7 *******************************************************************/ 8 8 #ifndef OM_ERROR_H 9 9 #define OM_ERROR_H 10 10 11 #include <stdio.h> 11 12 /******************************************************************* 12 13 * … … 54 55 const char* fmt, ...); 55 56 57 #ifndef OM_NDEBUG 58 extern void omPrintAddrInfo(FILE* fd, void* addr, char* s); 59 #else 60 #define omPrintAddrInfo(fd, addr, s) fprintf(fd, "OM_NDEBUG: no addr info available\n") 61 #endif 62 56 63 /*BEGINPRIVATE*/ 57 64 /******************************************************************* -
omalloc/omRet2Info.c
rb4e536 rcba516 4 4 * Author: obachman (Olaf Bachmann) 5 5 * Created: 11/99 6 * Version: $Id: omRet2Info.c,v 1. 5 2000-09-12 16:02:19obachman Exp $6 * Version: $Id: omRet2Info.c,v 1.6 2000-09-14 12:59:53 obachman Exp $ 7 7 *******************************************************************/ 8 8 #include <stdio.h> … … 25 25 #endif 26 26 27 /* define to also print return addresses in (default) 28 output of omPrintInfo */ 29 /* #define OM_PRINT_RETURN_ADDRESS */ 27 30 static char om_this_prog[MAXPATHLEN] = ""; 28 31 … … 139 142 140 143 i = omBackTrace_2_RetInfo(bt, info, max); 141 return omPrintRetInfo(info, i, fd, " #%i %L in %F\n"); 142 } 143 144 int omPrintCurrentBackTrace(FILE* fd) 144 #ifdef OM_PRINT_RETURN_ADDRESS 145 return omPrintRetInfo(info, i, fd, " #%i at %L in %F ra=%p\n"); 146 #else 147 return omPrintRetInfo(info, i, fd, " #%i at %L in %F\n"); 148 #endif 149 } 150 151 int omPrintCurrentBackTraceMax(FILE* fd, int max) 145 152 { 146 153 int i; 147 154 void* bt[OM_MAX_BACKTRACE_DEPTH]; 148 149 i = omGetBackTrace(bt, 1, OM_MAX_BACKTRACE_DEPTH); 155 if (max > OM_MAX_BACKTRACE_DEPTH) 156 max = OM_MAX_BACKTRACE_DEPTH; 157 if (max <= 0) return 0; 158 i = omGetBackTrace(bt, 1, max); 150 159 return omPrintBackTrace(bt, i, fd); 151 160 } … … 231 240 else 232 241 #endif /* ! OM_INTERNAL_DEBUG */ 242 #ifdef OM_PRINT_RETURN_ADDRESS 233 243 return omPrintRetInfo(info, i, fd, "\n #%i at %L in %F ra=%p"); 244 #else 245 return omPrintRetInfo(info, i, fd, "\n #%i at %L in %F"); 246 #endif 234 247 } 235 248 -
omalloc/omRet2Info.h
rb4e536 rcba516 4 4 * Author: obachman (Olaf Bachmann) 5 5 * Created: 11/99 6 * Version: $Id: omRet2Info.h,v 1. 4 2000-08-16 12:06:11obachman Exp $6 * Version: $Id: omRet2Info.h,v 1.5 2000-09-14 12:59:53 obachman Exp $ 7 7 *******************************************************************/ 8 8 #ifndef OM_RET_2_INFO_H … … 37 37 38 38 int omPrintBackTrace(void** bt, int max, FILE* fd); 39 int omPrintCurrentBackTrace(FILE* fd); 39 #define omPrintCurrentBackTrace(fd) omPrintCurrentBackTraceMax(fd, 1000) 40 int omPrintCurrentBackTraceMax(FILE* fd, int max); 40 41 41 42 int omFilterRetInfo_i(omRetInfo info, int max, int i); … … 72 73 #define omPrintBackTrace(bt,max,fd) ((void)0) 73 74 #define omPrintCurrentBackTrace(fd) ((void)0) 75 #define omPrintCurrentBackTraceMax(fd,max) ((void)0) 74 76 #define omFilterRetInfo_i(info,max,i) ((void)0) 75 77 #define omFilterRetInfo(info, max, cond)((void)0) -
omalloc/omtTest.c
rb4e536 rcba516 259 259 void my_exit() 260 260 { 261 printf("\no tTest Summary: ");261 printf("\nomtTest Summary: "); 262 262 if (errors || missed_errors || used_regions) 263 263 { -
omalloc/omtTestError.c
rb4e536 rcba516 118 118 { 119 119 omDebugAddrSize(cell->addr, OM_MAX_BLOCK_SIZE + 1); 120 spec.MaxSize = 0; 121 spec.MinTrack = 3; 122 spec.NotIsBin = 1; 123 cell = omFindCell(spec); 124 if (cell != NULL) 125 { 126 omDebugAddrSize(cell->addr, GET_SIZE(cell->spec) + SIZEOF_OM_ALIGNMENT); 127 } else printf("cell not found\n"); 120 if (om_ErrorStatus != omError_NoError) 121 { 122 om_ErrorStatus = omError_NoError; 123 spec.MaxSize = 0; 124 spec.MinTrack = 3; 125 spec.NotIsBin = 1; 126 cell = omFindCell(spec); 127 if (cell != NULL) 128 { 129 omDebugAddrSize(cell->addr, GET_SIZE(cell->spec) + SIZEOF_OM_ALIGNMENT); 130 if (om_ErrorStatus != omError_NoError) 131 { 132 om_ErrorStatus = omError_NoError; 133 spec.MaxSize = OM_MAX_BLOCK_SIZE; 134 spec.MinTrack = 0; 135 spec.NotIsBin = 0; 136 cell = omFindCell(spec); 137 if (cell != NULL) 138 omDebugBinAddrSize(cell->addr, GET_SIZE(cell->spec) - 1); 139 else printf("cell not found"); 140 } 141 } 142 else printf("cell not found\n"); 143 } 128 144 } 129 145 else printf("cell not found\n"); … … 319 335 case omError_NotString: 320 336 { 337 /* can only test for NULL string */ 338 #if 0 321 339 spec.MaxSize = OM_MAX_BLOCK_SIZE; 322 340 cell = omFindCell(spec); … … 333 351 else printf("cell not found\n"); 334 352 break; 353 #endif 354 omStrDup(NULL); 335 355 } 336 356 default:
Note: See TracChangeset
for help on using the changeset viewer.