IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10900


Ignore:
Timestamp:
Jan 4, 2007, 11:39:00 AM (19 years ago)
Author:
jhoblitt
Message:

change psMemCheckCorruption() to accept an output param

Location:
branches/jch-memory/psLib/src/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/jch-memory/psLib/src/sys/psMemory.c

    r10899 r10900  
    99*  @author Joshua Hoblitt, University of Hawaii
    1010*
    11 *  @version $Revision: 1.88.2.10 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2007-01-04 21:09:32 $
     11*  @version $Revision: 1.88.2.11 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2007-01-04 21:39:00 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    199199    bool abort_on_error = false;
    200200
    201     if (psMemCheckCorruption(abort_on_error) > 0) {
    202         fprintf(stderr,"Detected memory corruption\n"); // somewhere to set a breakpoint
     201    if (psMemCheckCorruption(stderr, abort_on_error) > 0) {
     202        fprintf(stderr, "Detected memory corruption\n"); // somewhere to set a breakpoint
    203203    }
    204204
     
    322322}
    323323
    324 int psMemCheckCorruption(bool abort_on_error)
     324int psMemCheckCorruption(FILE *output, bool abort_on_error)
    325325{
    326326    psS32 nbad = 0;               // number of bad blocks
     
    333333        if (badMemBlock(memBlock)) {
    334334            nbad++;
     335
     336            fprintf(output,
     337                    "Memory corruption detected in memBlock %lu\n"
     338                    "\tSize %zd\n"
     339                    "\tPosts: %p %p %p\n"
     340                    "\tAllocated at %s (%s:%d) by thread %lu\n",
     341                    memBlock->id,
     342                    memBlock->userMemorySize,
     343                    memBlock->startblock, memBlock->endblock, (memBlock + 1 + memBlock->userMemorySize),
     344                    memBlock->func, memBlock->file, memBlock->lineno, memBlock->tid);
    335345
    336346            if (abort_on_error) {
  • branches/jch-memory/psLib/src/sys/psMemory.h

    r10899 r10900  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.61.2.3 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2007-01-04 21:09:32 $
     14 *  @version $Revision: 1.61.2.4 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2007-01-04 21:39:00 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    320320 */
    321321int psMemCheckCorruption(
    322     bool abort_on_error                ///< Abort on detecting corruption?
     322    FILE *output,                       ///< FILE to write corrupted blocks too
     323    bool abort_on_error                 ///< Abort on detecting corruption?
    323324);
    324325
Note: See TracChangeset for help on using the changeset viewer.