Esempio n. 1
0
void fpuStoreIntegerQword(int *StackPos, void *Variable, uint32_t pop)
{
    if (pop) {
	*StackPos = (*StackPos + 1) & 7;
    }
    BreakPoint();
    PUTDST16(RecompPos, (pop == 0) ? 0x35DF : 0x3DDF);
    PUTDST32(RecompPos, Variable);
    if (!pop) {
	BreakPoint();
    }
}
Esempio n. 2
0
void fpuLoadIntegerQword(int *StackPos, void *Variable)
{
    *StackPos = (*StackPos - 1) & 7;
    BreakPoint();
    PUTDST16(RecompPos, 0x2DDF);
    PUTDST32(RecompPos, Variable);
}
Esempio n. 3
0
void fpuLoadQword(int *StackPos, void *Variable)
{
    *StackPos = (*StackPos - 1) & 7;
    BreakPoint();
    PUTDST16(RecompPos, 0x05DD);
    PUTDST32(RecompPos, Variable);
}
Esempio n. 4
0
void ADSLoop()
{
    short scode = RSRSLT;             /* Normal result code (default) */
    int stat;

    for ( ;; ) {                      /* Request/Result loop */
//                                                                        _DBG0(("ADS Loop"));

        if ((stat = ads_link(scode)) < 0) {
            cputs( "ADSHELP: bad status from ads_link()\r\n");
            exit(1);
        }

        scode = RSRSLT;               /* Reset result code */

        switch (stat) {

        case RQSUBR:                  /* Handle external function requests */
            scode = RSERR;
            break;

        case RQXUNLD:                 /* Handle external function requests */
            DoneAutoCAD = TRUE;
            AtEnd = TRUE;
            BreakPoint();             /* you figure it out */
            break;
        }
    }
}
Esempio n. 5
0
void fpuStoreIntegerDword(int *StackPos, void *Variable, uint32_t pop)
{
    if (pop) {
	*StackPos = (*StackPos + 1) & 7;
    }
    BreakPoint();
    PUTDST16(RecompPos, (pop == 0) ? 0x15DB : 0x1DDB);
    PUTDST32(RecompPos, Variable);
}
Esempio n. 6
0
void
GetXferSegment (const ADAPTER_PTR HA, IO_REQ_PTR Req, SegmentDescr *SGDescr,
    U32 Offset, BOOLEAN DemandPhysicalAddr)
{

  TRACE(4, ("GetXferSegment(): Offset = %d\n", Offset));
  TRACE(4, ("GetXferSegment(): Non-S/G request, ReqDataCount = %d\n", ReqDataCount(Req)));

  if (Offset < ReqDataCount(Req)) {              // Make sure we don't over run

    SGDescr->SegmentLength = ReqDataCount(Req) - Offset;
    SGDescr->SegmentPtr = (U32)ReqDataPtr(Req) + Offset;

  } else {

    SGDescr->SegmentLength = 0;               // No data left
    SGDescr->SegmentPtr = 0;
    BreakPoint(HA);

  }
  TRACE(4, ("GetXferSegment(): %d bytes remain in segment at %08x (offset %d)\n",
      SGDescr->SegmentLength, SGDescr->SegmentPtr, Offset));

  SGDescr->Flags.IsPhysical = FALSE;

  if (DemandPhysicalAddr) {

    if (ReqState(Req).InternalRequest) {

      TRACE(5, ("GetXferSegment(): Mapping internal request\n"));
      MapToPhysical(HA, SGDescr);

    } else {

      ULONG Size = SGDescr->SegmentLength;

      SGDescr->SegmentPtr = (U32)ScsiPortConvertPhysicalAddressToUlong(
	  ScsiPortGetPhysicalAddress(HA, Req,
	  (PVOID)((U32)ReqDataPtr(Req) + Offset) /*(SGDescr->SegmentPtr)*/,
	  &Size));

      if (Size < SGDescr->SegmentLength)
	SGDescr->SegmentLength = Size;

      DEBUG(5, {
	if (SGDescr->SegmentLength < (ReqDataCount(Req) - Offset))
	  DPrintf("Segment length is %d out of %d\n",
	      SGDescr->SegmentLength, ReqDataCount(Req) - Offset);});
	
      SGDescr->Flags.IsPhysical = TRUE;

      TRACE(5, ("GetXferSegment(): Mapped to 0x%lx for %lu bytes\n",
	  SGDescr->SegmentPtr, Size));

    }
  }
Esempio n. 7
0
bool gmDebugSession::AddBreakPoint(const void * a_bp, int a_threadId)
{
  BreakPoint * bp = m_breaks.Find((void *const&)a_bp);
  if(bp) return false;
  bp = GM_NEW( BreakPoint() );
  bp->m_bp = a_bp;
  bp->m_threadId = a_threadId;
  m_breaks.Insert(bp);
  return true;
}
Esempio n. 8
0
File: main.c Progetto: hl1itj/Team3
void
InitDebug(void)
{
#ifdef DEBUG
	irqInit();
	initSpi();
	initDebug();
	BreakPoint();
#endif
}
Esempio n. 9
0
void fpuStoreIntegerQwordFromX86Reg(int *StackPos, int x86reg,
				    uint32_t pop)
{
    if (pop) {
	*StackPos = (*StackPos + 1) & 7;
    }

    BreakPoint();
    if (pop) {
	OPCODE_REG_MREG(8, 0xDF, OP_D5, x86reg);
    } else {
	OPCODE_REG_MREG(8, 0xDF, OP_D4, x86reg);
    }

}
Esempio n. 10
0
void fpuSubDwordReverse(void *Variable)
{
    BreakPoint();
    PUTDST16(RecompPos, 0x2DD8);
    PUTDST32(RecompPos, Variable);
}
void SQDbgServer::Hook(int type,int line,const SQChar *src,const SQChar *func)
{
	switch(_state){
	case eDBG_Running:
		if(type==_SC('l') && _breakpoints.size()) {
			BreakPointSetItor itr = _breakpoints.find(BreakPoint(line,src));
			if(itr != _breakpoints.end()) {
				Break(line,src,_SC("breakpoint"));
				BreakExecution();
			}
		}
		break;
	case eDBG_Suspended:
		_nestedcalls=0;
	case eDBG_StepOver:
		switch(type){
		case _SC('l'):
			if(_nestedcalls==0) {
				Break(line,src,_SC("step"));
				BreakExecution();
			}
			break;
		case _SC('c'):
			_nestedcalls++;
			break;
		case _SC('r'):
			if(_nestedcalls==0){
				_nestedcalls=0;
				
			}else{
				_nestedcalls--;
			}
			break;
		}
		break;
	case eDBG_StepInto:
		switch(type){
		case _SC('l'):
			_nestedcalls=0;
			Break(line,src,_SC("step"));
			BreakExecution();
			break;
		
		}
		break;
	case eDBG_StepReturn:
		switch(type){
		case _SC('l'):
			break;
		case _SC('c'):
			_nestedcalls++;
			break;
		case _SC('r'):
			if(_nestedcalls==0){
				_nestedcalls=0;
				_state=eDBG_StepOver;
			}else{
				_nestedcalls--;
			}
			
			break;
		}
		break;
	case eDBG_Disabled:
		break;
	}
}
bool Compiler::ParseIfNil(const TEXTRANGE& messageRange, int exprStartPos)
{
	if (!ThisTokenIsBinary('['))
	{
		Warning(CWarnExpectNiladicBlockArg, (Oop)InternSymbol("ifNil:"));
		return false;
	}

	int dupMark = GenDup();

	BreakPoint();
	const int sendIsNil = GenInstruction(SpecialSendIsNil);
	const int mapEntry = AddTextMap(sendIsNil, exprStartPos, LastTokenRange().m_stop);

	// We're going to add a pop and jump on condition instruction here
	// Its a forward jump, so we need to patch up the target later
	const int popAndJumpMark = GenJumpInstruction(LongJumpIfFalse);

	ParseIfNilBlock(false);
	
	int ifNotNilMark;

	if (strcmp(ThisTokenText(), "ifNotNil:") == 0)
	{
		POTE oteSelector = AddSymbolToFrame("ifNil:ifNotNil:", messageRange);

		// Generate the jump out instruction (forward jump, so target not yet known)
		int jumpOutMark = GenJumpInstruction(LongJump);

		// Mark first instruction of the "else" branch
		ifNotNilMark = m_codePointer;

		// #ifNil:ifNotNil: form
		NextToken();

		int argc = ParseIfNotNilBlock();

		// Be careful, may not actually be a literal block there
		if (m_ok)
		{
			// If the ifNotNil: block does not need an argument, we can patch out the Dup
			// and corresponding pop
			if (!argc)
			{
				UngenInstruction(dupMark);
				_ASSERTE(m_bytecodes[popAndJumpMark + lengthOfByteCode(LongJumpIfFalse)].byte == PopStackTop);
				UngenInstruction(popAndJumpMark + lengthOfByteCode(LongJumpIfFalse));
				_ASSERTE(m_bytecodes[ifNotNilMark].byte == PopStackTop);
				UngenInstruction(ifNotNilMark);
			}

			// Set unconditional jump at the end of the ifNil to jump over the "else" branch to a Nop
			SetJumpTarget(jumpOutMark, GenNop());
		}
	}
	else
	{
		POTE oteSelector = AddSymbolToFrame("ifNil:", messageRange);

		// No "else" branch, but we still need an instruction to jump to
		ifNotNilMark = GenNop();
	}

	if (m_ok)
	{
		// Conditional jump to the "else" branch (or the Nop if no else branch)
		SetJumpTarget(popAndJumpMark, ifNotNilMark);

		if (mapEntry >= 0)
			m_textMaps[mapEntry].stop = LastTokenRange().m_stop;
	}

	return true;
}
Esempio n. 13
0
void fpuMulQword(void *Variable)
{
    BreakPoint();
    PUTDST16(RecompPos, 0x0DDC);
    PUTDST32(RecompPos, Variable);
}
bool Compiler::ParseIfNotNil(const TEXTRANGE& messageRange, int exprStartPos)
{
	if (!ThisTokenIsBinary('['))
	{
		Warning(CWarnExpectMonadicOrNiladicBlockArg, (Oop)InternSymbol("ifNotNil:"));
		return false;
	}

	int dupMark = GenDup();
	BreakPoint();
	const int sendIsNil = GenInstruction(SpecialSendIsNil);
	AddTextMap(sendIsNil, exprStartPos, LastTokenRange().m_stop);

	// We're going to add a pop and jump on condition instruction here
	// Its a forward jump, so we need to patch up the target later
	const int popAndJumpMark = GenJumpInstruction(LongJumpIfTrue);
	int argc = ParseIfNotNilBlock();

	// If the ifNotNil: block did not have any arguments, then we do not need the Dup, and we also
	// need to patch out the corresponding pop.
	if (!argc)
	{
		UngenInstruction(dupMark);
		UngenInstruction(popAndJumpMark + lengthOfByteCode(LongJumpIfTrue));
	}

	int ifNilMark;

	// Has an #ifNil: branch?
	if (strcmp(ThisTokenText(), "ifNil:") == 0)
	{
		POTE oteSelector = AddSymbolToFrame("ifNotNil:ifNil:", messageRange);

		// Generate the jump out instruction (forward jump, so target not yet known)
		int jumpOutMark = GenJumpInstruction(LongJump);

		// Mark first instruction of the "else" branch
		ifNilMark = m_codePointer;

		// ifNotNil:ifNil: form
		NextToken();

		ParseIfNilBlock(!argc);

		SetJumpTarget(jumpOutMark, GenNop());
	}
	else
	{
		// No "ifNil:" branch 

		POTE oteSelector = AddSymbolToFrame("ifNotNil:", messageRange);

		if (!argc)
		{
			// Since we've removed the Dup if the ifNotNil: block had no args, we need to ensure there is nil atop the stack
			// This should normally get optimized away later if the expression value is not used.

			// Generate the jump out instruction
			int jumpOutMark = GenJumpInstruction(LongJump);

			ifNilMark = GenInstruction(ShortPushNil);

			SetJumpTarget(jumpOutMark, GenNop());
		}
		else
		{
			ifNilMark = GenNop();
		}
	}
	
	SetJumpTarget(popAndJumpMark, ifNilMark);
	
	return true;
}
Esempio n. 15
0
void DoOpen( char far *name, int mode, int flags )
{
    BreakPoint( OpenFile( name, mode, flags ) );
}
Esempio n. 16
0
int      __init_environment(void *  reserved){

#ifdef DEBUG_ME
    char    *cmdLineP = Command;
    if( cmdLineP[0] == '?' || ( cmdLineP[0] == '-' && cmdLineP[1] == 'h' ) ) {
        OutputToScreen( systemConsoleScreen, "Use -d[options]\r\n" );
        OutputToScreen( systemConsoleScreen, "  options are:\r\n" );
        OutputToScreen( systemConsoleScreen, "      b = initial break\r\n" );
        OutputToScreen( systemConsoleScreen, "      a = all\r\n" );
        OutputToScreen( systemConsoleScreen, "      t = threads\r\n" );
        OutputToScreen( systemConsoleScreen, "      d = debug regs\r\n" );
        OutputToScreen( systemConsoleScreen, "      e = events\r\n" );
        OutputToScreen( systemConsoleScreen, "      i = IO\r\n" );
        OutputToScreen( systemConsoleScreen, "      x = network events\r\n" );
        OutputToScreen( systemConsoleScreen, "      m = misc\r\n" );
        OutputToScreen( systemConsoleScreen, "      r = requests\r\n" );
        OutputToScreen( systemConsoleScreen, "      o = errors\r\n" );
        return( -1 );
    }
    if( cmdLineP[0] == '-' && lower( cmdLineP[1] ) == 'd' ) {
        DebugMode = 1;
        cmdLineP += 2;
        while( isalpha( *cmdLineP ) ) {
            switch( lower( *cmdLineP ) ) {
            case 'b':
                BreakPoint();
                break;
            case 'a':
                DebugClasses = -1;
                break;
            case 'r':
                DebugClasses |= D_REQ;
                break;
            case 'o':
                DebugClasses |= D_ERROR;
                break;
            case 't':
                DebugClasses |= D_THREAD;
                break;
            case 'd':
                DebugClasses |= D_DR;
                break;
            case 'e':
                DebugClasses |= D_EVENT;
                break;
            case 'i':
                DebugClasses |= D_IO;
                break;
            case 'x':
                DebugClasses |= D_NET;
                break;
            case 'm':
                DebugClasses |= D_MISC;
                break;
            }
            ++cmdLineP;
        }
        while( *cmdLineP == ' ' ) ++cmdLineP;
    }
#endif

    ScreenTag = AllocateResourceTag(
        MyNLMHandle,
        (BYTE *)"Debug server screens",
        ScreenSignature );
    AllocTag = AllocateResourceTag(
        MyNLMHandle,
        (BYTE *)"Debug server work area",
        AllocSignature );
    SemaphoreTag = AllocateResourceTag(
        MyNLMHandle,
        (BYTE *)"Debug server semaphores",
        SemaphoreSignature );
    ProcessTag = AllocateResourceTag(
        MyNLMHandle,
        (BYTE *)"Debug server processes",
        ProcessSignature );
    TimerTag = AllocateResourceTag(
        MyNLMHandle,
        (BYTE *)"Debugger time out",
        TimerSignature );
    InterruptTag = AllocateResourceTag(
        MyNLMHandle,
        (BYTE *)"Debugger interrupts",
        InterruptSignature );
    DebugTag = AllocateResourceTag(
        MyNLMHandle,
        (BYTE *)"WVIDEO Debugger",
        DebuggerSignature );
    BreakTag = AllocateResourceTag(
        MyNLMHandle,
        (BYTE *)"WVIDEO Break Points",
        BreakpointSignature );

    if( OpenScreen( TRP_The_WATCOM_Debugger, ScreenTag, &screenID ) != 0 ) {
        screenID = 0;
    }
    debugScreen = 0;

#ifdef DEBUG_ME
    if( DebugMode ) {
        if( OpenScreen( TRP_The_WATCOM_Debugger, ScreenTag, &debugScreen ) != 0 ) {
            debugScreen = 0;
        }
    }
#endif
    if( screenID == 0 || ( DebugMode && ( debugScreen == 0 ) ) ) {
        OutputToScreen( systemConsoleScreen, TRP_NLM_no_screen );
        OutputToScreen( systemConsoleScreen, "\r\n" );
    } else {
        EnableInputCursor( screenID );
    }
    return 0;
}
Esempio n. 17
0
static void doClose( HFILE hdl )
{
    BreakPoint( DosClose( hdl ) );
}
Esempio n. 18
0
void fpuSubQword(void *Variable)
{
    BreakPoint();
    PUTDST16(RecompPos, 0x25DC);
    PUTDST32(RecompPos, Variable);
}
Esempio n. 19
0
  bool AlignmentFragment::parseIndelBreak(BreakPoint &bp) {
    
     // make sure we have a non-zero cigar
    if (m_cigar.size() == 0) {
      std::cerr << "CIGAR of length 0 on " << this->print() << std::endl;
      return false;
    }
 
    // reject if too many mismatches
    //size_t di_count = 0;
    for (auto& i : m_cigar)
      if (i.RawType() == BAM_CDEL || i.RawType() == BAM_CINS)
    	++di_count;
    if (di_count > 2 && m_align.Qname().substr(0,2) == "c_") // only trim for snowman assembled contigs
      return false;

    // reject if it has small matches, could get confused. Fix later
    //for (auto& i : m_cigar) 
    //  if (i.RawType() == BAM_CMATCH && i.Length() < 5)
    //    return false;
    
     // reject if first alignment is I or D or start with too few M
    if (m_cigar.begin()->RawType() == BAM_CINS || m_cigar.begin()->RawType() == BAM_CDEL || m_cigar.back().RawType() == BAM_CDEL || m_cigar.back().RawType() == BAM_CINS) {
      //std::cerr << "rejecting cigar for starting in I or D or < 5 M" << std::endl;
      return false;
    }
    
    // use next available D / I by looping until can increment idx
    size_t loc = 0; // keep track of which cigar field
    for (auto& i : m_cigar) {
      ++loc;
      if (i.RawType() == BAM_CDEL || i.RawType() == BAM_CINS) {
	assert (loc != 1 && loc != m_cigar.size()); // shuldn't start with I or D
	if (loc > idx) {
	  idx = loc;
	  break;
	}
      }
    }
    

    // we made it to the end, no more indels to report
    if (loc == m_cigar.size())
      return false;

    // clear out the old bp just in case
    bp = BreakPoint();
    bp.num_align = 1;
    
    int curr = 0;
    int gcurrlen = 0; 
    
    // make break ends with dummy positions
    bp.b1 = BreakEnd(m_align);
    bp.b2 = BreakEnd(m_align);

    // assign the contig-wide properties
    bp.cname = m_align.Qname();
    bp.seq = m_align.Sequence();
    assert(bp.cname.length());
    
    size_t count = 0; // count to make sure we are reporting the right indel
    for (auto& i : m_cigar) { // want breaks in CONTIG coordinates, so use oriented cigar
      count++;
      
      // set the contig breakpoint
      if (i.RawType() == BAM_CMATCH || i.RawType() == BAM_CINS || i.RawType() == BAM_CSOFT_CLIP) 
	curr += i.Length();
      if (i.RawType() == BAM_CDEL && bp.b1.cpos == -1 && count == idx) {
	
	bp.b1.cpos = curr-1;
	bp.b2.cpos = curr;
      } 
      if (i.RawType() == BAM_CINS && bp.b1.cpos == -1 && count == idx) {
	bp.b1.cpos = curr - i.Length() - 1; // -1 because cpos is last MATCH
	bp.b2.cpos = curr/* - 1*/; 
	bp.insertion = m_align.Sequence().substr(bp.b1.cpos+1, i.Length()); // +1 because cpos is last MATCH.
      }
      
      // set the genome breakpoint
      if (bp.b1.cpos > 0) {
	if (i.RawType() == BAM_CDEL) {
	  if (!m_align.ReverseFlag()) {
	    bp.b1.gr.pos1 =  m_align.Position() + gcurrlen; // dont count this one//bp.b1.cpos + align.Position; //gcurrlen + align.Position;
	    bp.b2.gr.pos1 = bp.b1.gr.pos1 + i.Length() + 1;
	  } else {
	    bp.b2.gr.pos1 =  (m_align.PositionEnd()-1) - gcurrlen; //bp.b1.cpos + align.Position; //gcurrlen + align.Position;
	    bp.b1.gr.pos1 =  bp.b2.gr.pos1 - i.Length() - 1;
	  }
	} else if (i.RawType() == BAM_CINS) {
	  if (!m_align.ReverseFlag()) {
	    bp.b1.gr.pos1 = m_align.Position() + gcurrlen; //gcurrlen + align.Position;
	    bp.b2.gr.pos1 = bp.b1.gr.pos1 + 1;	
	  } else {
	    // GetEndPosition is 1 too high
	    bp.b2.gr.pos1 = (m_align.PositionEnd()-1) - gcurrlen; //gcurrlen + align.Position;
	    bp.b1.gr.pos1 = bp.b2.gr.pos1 - 1;	
	  }
	}
	break; // already got it, so quit cigar loop
      }
      
      // update the position on the genome
      if (i.RawType() == BAM_CMATCH || i.RawType() == BAM_CDEL) {
	gcurrlen += i.Length();
      } 
      
      
    } // end cigar loop
    
    // set the dummy other end
    bp.b1.gr.pos2 = bp.b1.gr.pos1; 
    bp.b2.gr.pos2 = bp.b2.gr.pos1;
   
    // should have been explicitly ordered in the creation above
    if (!(bp.b1.gr < bp.b2.gr)) {
      //std::cerr << "Warning: something went wrong in indelParseBreaks. Can't order breaks" << std::endl;
      //std::cerr << bp.b1.gr << " " << bp.b2.gr << std::endl;
      //std::cerr << (*this) << std::endl;
      return false;
    }
    //bp.order();

    bp.b1.gr.strand = '+';
    bp.b2.gr.strand = '-';

    // find if it has repeat seq near break
    int rstart = std::max(0, bp.b1.cpos - 7);
    int rlen = std::min(rstart + 7,(int)bp.seq.length() - rstart);
    std::string rr;
    try {
      rr = bp.seq.substr(rstart, rlen);
    } catch (...) { 
      std::cerr << "Caught substring error for string: " << bp.seq << " start " << rstart << " len " << rlen << std::endl;
    }
    assert(bp.valid());
    return true;
  }
Esempio n. 20
0
void fpuDivQwordReverse(void *Variable)
{
    BreakPoint();
    PUTDST16(RecompPos, 0x3DDC);
    PUTDST32(RecompPos, Variable);
}
Esempio n. 21
0
void fpuComQword(void *Variable, uint32_t Pop)
{
    BreakPoint();
    PUTDST16(RecompPos, (Pop == 1) ? 0x1DDC : 0x15DC);
    PUTDST32(RecompPos, Variable);
}
Esempio n. 22
0
void fpuAddDword(void *Variable)
{
    BreakPoint();
    PUTDST16(RecompPos, 0x05D8);
    PUTDST32(RecompPos, Variable);
}
Esempio n. 23
0
void SQDbgServer::Hook(HSQUIRRELVM v, SQInteger type, SQInteger line, const SQChar *src, const SQChar *func)
{

    VMState *vs = GetVMState(v);
    switch (_state) {
        case eDBG_Running:
            if (type == _SC('l') && _breakpoints.size()) {
                BreakPointSetItor itr = _breakpoints.find(BreakPoint(line, src));
                if (itr != _breakpoints.end()) {
                    Break(v, line, src, _SC("breakpoint"));
                    BreakExecution();
                }
            }
            break;
        case eDBG_Suspended:
            vs->_nestedcalls = 0;
        case eDBG_StepOver:
            switch (type) {
                case _SC('l'):
                    if (vs->_nestedcalls == 0) {
                        Break(v, line, src, _SC("step"));
                        BreakExecution();
                    }
                    break;
                case _SC('c'):
                    vs->_nestedcalls++;
                    break;
                case _SC('r'):
                    if (vs->_nestedcalls == 0) {
                        vs->_nestedcalls = 0;

                    }
                    else {
                        vs->_nestedcalls--;
                    }
                    break;
            }
            break;
        case eDBG_StepInto:
            switch (type) {
                case _SC('l'):
                    vs->_nestedcalls = 0;
                    Break(v, line, src, _SC("step"));
                    BreakExecution();
                    break;

            }
            break;
        case eDBG_StepReturn:
            switch (type) {
                case _SC('l'):
                    break;
                case _SC('c'):
                    vs->_nestedcalls++;
                    break;
                case _SC('r'):
                    if (vs->_nestedcalls == 0) {
                        vs->_nestedcalls = 0;
                        _state = eDBG_StepOver;
                    }
                    else {
                        vs->_nestedcalls--;
                    }

                    break;
            }
            break;
        case eDBG_Disabled:
            break;
    }
}