IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5344


Ignore:
Timestamp:
Oct 15, 2005, 1:26:13 PM (21 years ago)
Author:
eugene
Message:

added info about prev and next entries on corruption

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libohana/src/ohana_allocate.c

    r5273 r5344  
    189189void ohana_memcheck_func (int allmemory) {
    190190
    191   int i, header;
     191  int i, j, next, prev, header;
    192192  size_t *marker;
    193193  char top, bottom;
     
    211211    if ((top == 'N') && (bottom == 'N')) continue;
    212212    if (!header) {
    213       fprintf (stderr, "         Nmem bot top file            line\n");
     213      fprintf (stderr, "         Nmem start end file            line\n");
    214214      header = TRUE;
    215215    }
    216     fprintf (stderr, "corrupt:  %3d  %c   %c  %-15s %3d\n", i, bottom, top, memlist[i].file, memlist[i].line);
     216      fprintf (stderr, "corrupt:  %3d   %c    %c  %-15s %3d\n", i, bottom, top, memlist[i].file, memlist[i].line);
     217    prev = next = -1;
     218    for (j = 0; j < Nmemlist; j++) {
     219      if (memlist[j].ptr < memlist[i].ptr) {
     220        if (prev == -1) prev = j;
     221        if (memlist[j].ptr > memlist[prev].ptr) prev = j;
     222      }
     223      if (memlist[j].ptr > memlist[i].ptr) {
     224        if (next == -1) next = j;
     225        if (memlist[j].ptr < memlist[next].ptr) next = j;
     226      }
     227    }     
     228    if (prev == -1) {
     229      fprintf (stderr, "no previous memory block\n");
     230    } else {
     231      fprintf (stderr, "prev:     %3d           %-15s %3d\n", prev, memlist[prev].file, memlist[prev].line);
     232    }
     233    if (next == -1) {
     234      fprintf (stderr, "no next memory block\n");
     235    } else {
     236      fprintf (stderr, "next:     %3d           %-15s %3d\n", next, memlist[next].file, memlist[next].line);
     237    }
    217238    abort ();
    218239  }
Note: See TracChangeset for help on using the changeset viewer.