int32_t Debugger::traceDataStore(SymTableNodePtr id, TypePtr idType, StackItemPtr target, TypePtr targetType) { //SymTableNodePtr idPtr = debugModule->findSymbol(strParam1); //if (!idPtr) { // print("Unknown identifier in current scope.\n"); // return; // } // char message[255]; // sprintSymbolValue(message, idPtr); // print(message); // } if(id->info && ((WatchPtr)id->info)->store) { char valString[255]; sprintDataValue(valString, target, targetType); if(idType->form == FRM_ARRAY) sprintf(message, "STORE: (%d) %s [%d] -> %s[#] = %s\n", module->getId(), module->getName(), execLineNumber, id->name, valString); //else if (idType->form == FRM_RECORD) // sprintf(message, "STORE AT LINE %d - %s.# = %s\n", execLineNumber, id->name, valString); else sprintf(message, "STORE: (%d) %s [%d] -> %s = %s\n", module->getId(), module->getName(), execLineNumber, id->name, valString); print(message); if(((WatchPtr)id->info)->breakOnStore) debugMode(); } return(ABL_NO_ERR); }
int32_t Debugger::traceDataFetch(SymTableNodePtr id, TypePtr idType, StackItemPtr data) { TypePtr idTypePtr = id->typePtr; if(id->info && ((WatchPtr)id->info)->fetch) { char valString[255]; sprintDataValue(valString, data, idType); if(idTypePtr->form == FRM_ARRAY) sprintf(message, "FETCH: (%d) %s [%d] - %s[#] = %s\n", module->getId(), module->getName(), execLineNumber, id->name, valString); //else if (idTypePtr->form == FRM_RECORD) // sprintf(message, "STORE AT LINE %d - %s.# = %s\n", id->name, valString); else sprintf(message, "FETCH: (%d) %s [%d] - %s = %s\n", module->getId(), module->getName(), execLineNumber, id->name, valString); print(message); if(((WatchPtr)id->info)->breakOnFetch) debugMode(); } return(ABL_NO_ERR); }
void Debugger::showValue (void) { getToken(); if (curToken == TKN_SEMICOLON) print("Bad Expression.\n"); else { //------------------------------------------------------------ // NOTE: Need a SOFT FATAL for parsing expressions here so the // debugger's errors don't Fatal out of the game! //------------------------------------------------------------ //--------------------------------------------------------------- // It's important that the expression parser return an error code // rather than fatal! TypePtr typePtr = expression(); if (errorCount > 0) return; char* savedCodeSegmentPtr = codeSegmentPtr; TokenCodeType savedCodeToken = codeToken; execExpression(); if (typePtr->form == FRM_ARRAY) { print("SHOW ARRAY\n"); } else { char message[255]; sprintDataValue(message, tos, typePtr); strcat(message, "\n"); print(message); } pop(); codeSegmentPtr = savedCodeSegmentPtr; codeToken = savedCodeToken; } }