Changeset 1b3e854 in mainline for uspace/app/tester/mm/common.c
- Timestamp:
- 2011-05-21T14:29:50Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- faeb7cc
- Parents:
- 955f2a5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/mm/common.c
r955f2a5 r1b3e854 135 135 } 136 136 137 static void check_consistency(const char *loc) 138 { 139 /* Check heap consistency */ 140 void *prob = heap_check(); 141 if (prob != NULL) { 142 TPRINTF("\nError: Heap inconsistency at %p in %s.\n", 143 prob, loc); 144 TSTACKTRACE(); 145 error_flag = true; 146 } 147 } 148 137 149 /** Checked malloc 138 150 * … … 153 165 /* Allocate the chunk of memory */ 154 166 data = malloc(size); 167 check_consistency("checked_malloc"); 155 168 if (data == NULL) 156 169 return NULL; … … 160 173 TPRINTF("\nError: Allocated block overlaps with another " 161 174 "previously allocated block.\n"); 175 TSTACKTRACE(); 162 176 error_flag = true; 163 177 } … … 198 212 if (block->addr == NULL) { 199 213 free(block); 214 check_consistency("alloc_block"); 200 215 return NULL; 201 216 } … … 228 243 /* Free the memory */ 229 244 free(block->addr); 245 check_consistency("free_block (a)"); 230 246 free(block); 247 check_consistency("free_block (b)"); 231 248 } 232 249 … … 257 274 pos < end; pos++) 258 275 *pos = block_expected_value(block, pos); 276 277 check_consistency("fill_block"); 259 278 } 260 279 … … 273 292 if (*pos != block_expected_value(block, pos)) { 274 293 TPRINTF("\nError: Corrupted content of a data block.\n"); 294 TSTACKTRACE(); 275 295 error_flag = true; 276 296 return; … … 296 316 if (entry == NULL) { 297 317 TPRINTF("\nError: Corrupted list of allocated memory blocks.\n"); 318 TSTACKTRACE(); 298 319 error_flag = true; 299 320 } … … 325 346 if (addr == NULL) { 326 347 free(area); 348 check_consistency("map_area (a)"); 327 349 return NULL; 328 350 } … … 331 353 if (area->addr == (void *) -1) { 332 354 free(area); 355 check_consistency("map_area (b)"); 333 356 return NULL; 334 357 } … … 361 384 362 385 free(area); 386 check_consistency("unmap_area"); 363 387 } 364 388 … … 389 413 pos < end; pos++) 390 414 *pos = area_expected_value(area, pos); 391 } 415 416 check_consistency("fill_area"); 417 }
Note:
See TracChangeset
for help on using the changeset viewer.