Example #1
0
CELL * p_debug(CELL * params)
{
CELL * result;

openTrace();
traceFlag |= TRACE_IN_DEBUG;
result = copyCell(evaluateExpression(params));
closeTrace();

return(result);
}
Example #2
0
	Proc::~Proc() {
		if (inited_) {
			closeTrace();
		}

		assert(hasValidObjects());

		delete act_;
		delete prg_;
		delete data_;
		delete inp_;
		delete outp_;
	}
Example #3
0
void QemuSescReader::readInst() { 

  if (fread(qst, sizeof(QemuSescTrace), 1, trace) !=1){
    MSG("Size of each structure is %lu", sizeof(qst));
    if (feof(trace))
      tracEof = true;
    else {
      MSG("QemuSescReader: Error while reading TraceFile");
      exit(1);
    }
  } 

  PC = qst->pc;

  MSG("PC 0x%x r%d <- r%d %u r%d",PC, qst->dest, qst->src1, qst->opc, qst->src2);

  if (feof(trace)) {
    tracEof = true; 
    closeTrace();
  }
      
}
Example #4
0
CELL * p_trace(CELL * params)
{
if(params != nilCell)
    {
    params = evaluateExpression(params);
    if(isNumber(params->type))
        {
        traceFlag |= TRACE_PRINT_EVAL;
        getIntegerExt(params, &tracePrintDevice, FALSE);
        return(stuffInteger(tracePrintDevice));
        }
    if(!isNil(params))
        {
        openTrace();
        traceFlag |= TRACE_IN_DEBUG;
        }
    else
        closeTrace();
    }

if(traceFlag & TRACE_IN_DEBUG) return(trueCell);
if(traceFlag & TRACE_PRINT_EVAL) return(stuffInteger(tracePrintDevice));
return(nilCell);
}
Example #5
0
void getDebuggerInput(char * msg)
{
char command[MAX_LINE];
char * context;
jmp_buf errorJumpSave;
UINT * resultStackIdxSave;
SYMBOL * contextSave;

while(TRUE)
    {

    if(currentContext != mainContext)
        context = currentContext->name;
    else context = "";


    if(!evalSilent)
        varPrintf(OUT_CONSOLE, "\n[%s %d %s]%s", msg, recursionCount, context, footerStr);
    else evalSilent = FALSE;

    if(fgets(command, MAX_LINE - 1, IOchannel) == NULL)
        fatalError(ERR_IO_ERROR, 0, 0);

    /* client and server could have different line-termination */
    if(*(command + 1) == '\n' || *(command + 1) == '\r')
        {
        if(*command == 'n')
            {
            traceFlag |= TRACE_DEBUG_NEXT;
            currentLevel = recursionCount;
            break;
            }
        if(*command == 's')
            {
            traceFlag &= ~TRACE_DEBUG_NEXT;
            break;
            }
        if(*command == 'q')
            {
            closeTrace();
            longjmp(errorJump, ERR_USER_RESET);
            }
        if(*command == 'c')
            {
            closeTrace();
            break;
            }
        }

    resultStackIdxSave = resultStackIdx;
    memcpy(errorJumpSave, errorJump, sizeof(jmp_buf));
    contextSave = currentContext;
    currentContext = currentFunc->context;
    if(setjmp(errorJump))
        {
        cleanupResults(resultStackIdxSave);
        goto DEBUG_EVAL_END;
        }

    executeCommandLine(command, OUT_CONSOLE, NULL); 

    DEBUG_EVAL_END:
    currentContext = contextSave;
    memcpy(errorJump, errorJumpSave, sizeof(jmp_buf));
    }
}