Exemple #1
0
//load in a tiny sprite file
static void lodSpriteFileRead(char *directory,char *field,void *dataToFillIn)
{
#if LOD_VERBOSE_LEVEL >= 1
    dbgMessagef("\nlodSpriteFileRead: %s", field);
#endif
    dbgFatal(DBG_Loc, "Can't load sprite images yet!");
}
Exemple #2
0
/*-----------------------------------------------------------------------------
    Name        : memInit
    Description : Starts the memory allocation module.  Call before any other
                    functions.
    Inputs      : heapStart - start of heap to use.  Should be aligned on at
                    lease 4-bit boundary.
                  heapSize - size of heap to create
    Outputs     : Global heap set up and (optionally) cleared.
    Return      : OKAY if success.
----------------------------------------------------------------------------*/
sdword memInit(void *heapStart, sdword heapSize)
{
#if MEM_ERROR_CHECKING
    if (memModuleInit == TRUE)
        dbgFatal(DBG_Loc, "Memory module started more than once.");
#endif //MEM_ERROR_CHECKING

    dbgAssert(heapStart != NULL && heapSize > MEM_BlockSize * 20);

#if MEM_VERBOSE_LEVEL >= 1
    dbgMessagef("\nMemory module init.  Heap = 0x%x, Length = %d", heapStart, heapSize);
#endif //MEM_VERBOSE_LEVEL >= 1

    memPool = (ubyte *)(((udword)((ubyte *)heapStart + sizeof(memcookie) - 1)) & (~(sizeof(memcookie) - 1)));
    memPoolLength = heapSize;

    memModuleInit = TRUE;

    return(memReset());
}
/*-----------------------------------------------------------------------------
    Name        : sdDumpAnalyze
    Description : Analyze the stack dump and print out a call stack
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void sdDumpAnalyze(void)
{
    //sdword index;
    sdfunctionlabel *label;
    udword *stackPointer;
    udword iStack;
    udword address;

    //start by finding the reference function
    label = sdLabelFind("_dbgFatalf");
    if (label == NULL)
    {
        dbgFatal(DBG_Loc, "Cannot locate reference label '_dbgFatalf'.");
    }
    sdReferenceOffset = sdReferenceAddress - label->address;

    //now find one of these reference labels so we know how to bias all the loaded label addresses
    iStack = sdDumpLength;
    stackPointer = sdDump;

    while (iStack)
    {
        address = *stackPointer;
        if (address >= sdReferenceOffset)
        {                                                   //if this dword has a chance of being a reference value
            address -= sdReferenceOffset;
            if (address >= minFunctionAddress && address <= maxFunctionAddress)
            {                                               //if it's within the .text address space
                label = sdLabelFindByAddress(address);
                printf("\n+0x%x: %s + 0x%x  (%s)", (udword)stackPointer - (udword)sdDump, label->label, address - label->address, label->module);
            }
        }
        iStack--;
        stackPointer++;
    }
}