示例#1
0
文件: debug.c 项目: fmccabe/cafe
static DebugWaitFor dbgShowLocal(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  integer lclNo = cmdCount(line, 0);
  methodPo mtd = p->prog;
  framePo fp = p->fp;
  ptrPo sp = p->sp;

  if (lclNo == 0)
    showAllLocals(debugOutChnnl, mtd, p->pc, fp);
  else if (lclNo > 0 && lclNo <= lclCount(mtd))
    showLcl(debugOutChnnl, cmdCount(line, 0), mtd, fp, sp);
  else
    outMsg(debugOutChnnl, "invalid local number: %d", lclNo);

  resetDeflt("n");
  return moreDebug;
}
示例#2
0
文件: debug.c 项目: fmccabe/cafe
static DebugWaitFor dbgDropFrame(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  integer count = cmdCount(line, 0);

  // First we check that there are enough frames
  methodPo mtd = p->prog;
  framePo fp = p->fp;
  ptrPo sp = p->sp;

  integer frameNo = 0;

  while (frameNo < count && fp < (framePo) p->stackLimit) {
    mtd = fp->prog;
    sp = (ptrPo) (fp + 1);
    fp = fp->fp;
    frameNo++;
  }

  if (fp < (framePo) p->stackLimit) {
    p->prog = mtd;
    p->pc = entryPoint(mtd);

    integer lclCnt = lclCount(mtd);  /* How many locals do we have */
    p->sp = sp = ((ptrPo) fp) - lclCnt;
    p->fp = fp;

#ifdef TRACEEXEC
    for (integer ix = 0; ix < lclCnt; ix++)
      sp[ix] = voidEnum;
#endif
  } else
    outMsg(debugOutChnnl, "Could not drop %d stack frame\n%_", count);

  resetDeflt("n");
  return moreDebug;
}
示例#3
0
文件: debug.c 项目: fmccabe/cafe
static DebugWaitFor dbgUntilRet(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  p->traceCount = cmdCount(line, 0);
  p->tracing = False;
  resetDeflt("n");

  switch (ins) {
    case Ret: {
      p->traceDepth = 1;
      return stepOver;
    }
    case Call:
    case OCall: {
      p->traceDepth = 2;
      return stepOver;
    }
    case Tail:
    case OTail: {
      p->traceDepth = 1;
      return stepOver;
    }

    default:
      p->traceDepth = 1;
      return stepOver;
  }
}
示例#4
0
文件: debug.c 项目: fmccabe/cafe
static DebugWaitFor dbgShowStack(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  methodPo mtd = p->prog;
  framePo fp = p->fp;
  ptrPo sp = p->sp;

  if (line[0] == '\n') {
    showAllStack(debugOutChnnl, p, mtd, fp, sp);
  } else
    showStack(debugOutChnnl, p, mtd, cmdCount(line, 1), fp, sp);

  resetDeflt("n");
  return moreDebug;
}
示例#5
0
文件: debug.c 项目: fmccabe/cafe
static DebugWaitFor dbgShowArg(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  integer argNo = cmdCount(line, 0);
  methodPo mtd = p->prog;
  framePo fp = p->fp;
  ptrPo sp = p->sp;

  if (argNo == 0)
    showAllArgs(debugOutChnnl, p, mtd, fp, sp);
  else if (argNo > 0 && argNo < argCount(mtd))
    showArg(debugOutChnnl, argNo, mtd, fp, sp);
  else
    outMsg(debugOutChnnl, "invalid argument number: %d", argNo);

  resetDeflt("n");
  return moreDebug;
}
示例#6
0
文件: debug.c 项目: fmccabe/cafe
static DebugWaitFor dbgShowCode(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  integer count = maximum(1, cmdCount(line, 1));
  methodPo mtd = p->prog;
  insPo pc = p->pc;

  insPo last = entryPoint(mtd) + insCount(mtd);

  for (integer ix = 0; ix < count && pc < last; ix++) {
    pc = disass(debugOutChnnl, p, mtd, pc, Null, Null);
    outStr(debugOutChnnl, "\n");
  }

  flushFile(debugOutChnnl);
  resetDeflt("n");

  return moreDebug;
}
// ---------------------------------------------------------------------------
// Destructor
// ---------------------------------------------------------------------------
//
CNATFWStunConnectionHandler::~CNATFWStunConnectionHandler()
    {
    __STUNPLUGIN(
        "CNATFWStunConnectionHandler::~CNATFWStunConnectionHandler start" )

    iServerList.ResetAndDestroy();
    CTimer::DoCancel();

    delete iDomain;
    delete iNatSettings;
    iStunSettings = NULL;
    delete iStunRefreshTimer;

    TInt cmdCount( iCallBackCmds.Count() );
    for ( TInt i = 0; i < cmdCount; ++i )
        {
        delete reinterpret_cast<CBase*>( iCallBackCmds[i].iDataPtr );
        }

    TInt count( iStreamArray.Count() );
    for ( TInt index = count - 1; index >= 0; index-- )
        {
        DeleteStream( index, ETrue );
        }

    iCallBackCmds.Close();
    iStreamArray.Close();
    delete iStunClient;
    delete iTimerServ;
    iConnection.Close();
    iConnMux = NULL;
    delete iAsyncCallback;

    __STUNPLUGIN(
        "CNATFWStunConnectionHandler::~CNATFWStunConnectionHandler end" )
    }
示例#8
0
文件: debug.c 项目: fmccabe/cafe
static DebugWaitFor dbgSetDepth(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  displayDepth = cmdCount(line, 0);

  resetDeflt("n");
  return moreDebug;
}
示例#9
0
文件: debug.c 项目: fmccabe/cafe
static DebugWaitFor dbgSingle(char *line, processPo p, termPo loc, insWord ins, void *cl) {
  p->traceCount = cmdCount(line, 0);
  p->traceDepth = 0;
  p->tracing = (logical) (p->traceCount == 0);
  return stepInto;
}