示例#1
0
static UINT32 wdbBpDelete
    (
    TGT_ADDR_T *	pId
    )
    {
    dll_t *	pDll;
    dll_t *	pNextDll;
    BRKPT *	pBp;

    pBp = *(BRKPT **) pId;

    /* 
     * Breakpoint ID of -1 means remove all breakpoints. 
     * We can only remove breakpoints set by the host tools. Breakpoints
     * set from target shell can't be removed
     */

    wdbTaskLock ();	/* disable task switching */
    if ((int ) pBp == -1)
	{
	for (pDll = dll_head(&bpList);
	     pDll != dll_end(&bpList);
	     pDll = pNextDll)
	    {
	    pNextDll = dll_next(pDll);

	    if (BP_BASE(pDll)->bp_flags & BP_HOST)
		wdbDbgBpRemove (BP_BASE(pDll));
	    }

	wdbTaskUnlock ();		/* re-enable task switching */
	return (WDB_OK);
	}

    /* else just remove one breakpoint */

    for (pDll = dll_head(&bpList); pDll != dll_end(&bpList);
	    pDll = dll_next(pDll))
	{
	if (BP_BASE(pDll) == pBp)
	    {
	    wdbDbgBpRemove (pBp);
	    wdbTaskUnlock ();	/* re-enable task switching */
	    return (WDB_OK);
	    }
	}
    wdbTaskUnlock ();	/* re-enable task switching */

    return (WDB_ERR_INVALID_EVENTPOINT);
    }
示例#2
0
文件: wdbLib.c 项目: andy345/vxworks5
void wdbResumeSystem (void)
    {
    dll_t *		pThisNode;
    WDB_REG_SET_OBJ *	pRegSet;

    wdbState &= (~WDB_STATE_EXTERN_RUNNING);	/* mark extern agent done */

    /* 
     * Set driver in interrupt mode only if task mode is supported by the
     * agent. Otherwise, it is not usefull.
     */

    if (wdbRunsTasking ())
	{
	(*pWdbExternCommIf->modeSet)		/* reset communication stack */
                (pWdbExternCommIf->commId,
		    WDB_COMM_MODE_INT);
	}

    wdbOneShot = FALSE;				/* ... */
    wdbExternExitHook();			/* call extern exit hook */

    /* restore inferior context */

    for (pThisNode  = dll_head (&wdbRegSetList);
         pThisNode != dll_end  (&wdbRegSetList);
         pThisNode  = dll_next (pThisNode))
        {
        pRegSet = (WDB_REG_SET_OBJ *)pThisNode;
	(*pRegSet->load)();
	}
    WDB_CTX_LOAD (&wdbExternSystemRegs);

    /*NOTREACHED*/
    }
示例#3
0
文件: wdbLib.c 项目: andy345/vxworks5
STATUS wdbExternRegsGet
    (
    WDB_REG_SET_TYPE	type,
    char **		ppRegs
    )
    {
    dll_t *		pThisNode;
    WDB_REG_SET_OBJ *	pRegSet;

    if (type == WDB_REG_SET_IU)
	{
	*ppRegs = (char *)&wdbExternSystemRegs;
	return (OK);
	}

    for (pThisNode  = dll_head (&wdbRegSetList);
	 pThisNode != dll_end  (&wdbRegSetList);
	 pThisNode  = dll_next (pThisNode))
	{
	pRegSet = (WDB_REG_SET_OBJ *)pThisNode;
	if (pRegSet->regSetType == type)
	    {
	    (*pRegSet->get) (ppRegs);
	    return (OK);
	    }
	}

    return (ERROR);
    }
示例#4
0
void wdbBpInstall (void)
    {
    dll_t *	pDll;
#if	DBG_HARDWARE_BP
    DBG_REGS	dbgRegs;
#endif	/* DBG_HARDWARE_BP */

    /* don't install system BP's if we are not in system mode */

    if (wdbIsNowTasking())
	return;

#if	DBG_HARDWARE_BP
    memset (&dbgRegs, 0, sizeof (DBG_REGS));
    wdbDbgRegsClear ();		/* clean debug registers */
#endif	/* DBG_HARDWARE_BP */

    /* if stepping, just set trace mode */

    if (wdbSysBpMode != 0)
	{
#if	DBG_NO_SINGLE_STEP
	wdbSysNpc = wdbDbgGetNpc (&wdbExternSystemRegs);
	wdbSysNpcInstr = *wdbSysNpc;
	usrBreakpointSet (wdbSysNpc, DBG_BREAK_INST);
#endif	/* DBG_NO_SINGLE_STEP */
	wdbBpData = wdbDbgTraceModeSet ((REG_SET *) &wdbExternSystemRegs);
	}
    else	/* if not stepping, insert breakpoints */
	{
	for (pDll = dll_head(&bpList); pDll != dll_end(&bpList);
		pDll = dll_next(pDll))
	    {
	    if (BP_BASE(pDll)->bp_task ==  -1)
		{
		if ((BP_BASE(pDll)->bp_flags & BRK_HARDWARE) == 0)
		    usrBreakpointSet (BP_BASE(pDll)->bp_addr, DBG_BREAK_INST);
#if	DBG_HARDWARE_BP
		else
		    wdbDbgHwBpSet (&dbgRegs, 
				   BP_BASE(pDll)->bp_flags & BRK_HARDMASK, 
				   (UINT32) BP_BASE(pDll)->bp_addr);
#endif	/* DBG_HARDWARE_BP */
		BP_BASE(pDll)->bp_flags |= BP_INSTALLED;
		}
	    }

#if	DBG_HARDWARE_BP
	wdbDbgRegsSet (&dbgRegs);	/* set debug registers. */
#endif	/* DBG_HARDWARE_BP */
	}
    }
示例#5
0
文件: FINDZIP.C 项目: wkoiking/xyzzy
BOOL   WINAPI   DllMain (HANDLE hInst, ULONG ul_reason_for_call,LPVOID lpReserved)
{
   switch( ul_reason_for_call) {
    case DLL_PROCESS_ATTACH:
		return dll_init();
		break;
    case DLL_THREAD_ATTACH:
		break;
    case DLL_PROCESS_DETACH:
		return dll_end();
		break;
    case DLL_THREAD_DETACH:
		break;
    }
    return TRUE;
}	
示例#6
0
void wdbExcGetEvent
    (
    void *	arg,
    WDB_EVT_DATA *	pEvtData
    )
    {
    wdbExcInfoNode_t *	pNode;
    wdbExcInfoNode_t *	pTmpNode;
    WDB_EXC_INFO *	pExcInfo;

    int lockKey;

    /* get a node from the exception queue */

    lockKey = intLock();
    pNode   = (wdbExcInfoNode_t *) dll_head (&wdbExcEvtList);
    dll_remove (&pNode->node);
    intUnlock (lockKey);

    /* give the node info to the host */

    pExcInfo = (WDB_EXC_INFO *)&pEvtData->eventInfo;
    pEvtData->evtType		= WDB_EVT_EXC;
    pExcInfo->numInts		= 4;
    pExcInfo->context		= pNode->context;
    pExcInfo->vec		= pNode->excVector;
    pExcInfo->pEsf		= (TGT_ADDR_T) pNode->pESF;

    /* mark the node invalid and put back in queue (after valid nodes) */

    pNode->valid = FALSE;
    lockKey = intLock();
    for (pTmpNode =  (wdbExcInfoNode_t *) dll_head (&wdbExcEvtList);
	 pTmpNode != (wdbExcInfoNode_t *) dll_end  (&wdbExcEvtList);
	 pTmpNode =  (wdbExcInfoNode_t *) dll_next (&pTmpNode->node))
	{
	if (pTmpNode->valid == FALSE)
	    break;
	}
    pTmpNode = (wdbExcInfoNode_t *) dll_prev (&pTmpNode->node);
    dll_insert (&pNode->node, &pTmpNode->node);
    intUnlock (lockKey);
    }
示例#7
0
文件: wdbLib.c 项目: andy345/vxworks5
void wdbSuspendSystem
    (
    WDB_IU_REGS * pRegs,			/* runtime context to save */
    void	  (*callBack)(),		/* callback after system is stopped */
    int		  arg			/* callback argument */
    )
    {
    dll_t *		pThisNode;
    WDB_REG_SET_OBJ *	pRegSet;

    intLock();

    wdbSuspendCallbackRtn = callBack;		/* install the callback */
    wdbSuspendCallbackArg = arg;		/* and the callback argument */
    wdbState |= WDB_STATE_EXTERN_RUNNING;	/* mark extern agent running */
    wdbExternEnterHook();			/* call extern enter hook */
    (*pWdbExternCommIf->modeSet)		/* reset communication stack */
		(pWdbExternCommIf->commId,
		WDB_COMM_MODE_POLL);
    bcopy ((caddr_t)pRegs,			/* save inferior context */
	   (caddr_t)&wdbExternSystemRegs,
	   sizeof (WDB_IU_REGS));
    for (pThisNode  = dll_head (&wdbRegSetList);
         pThisNode != dll_end  (&wdbRegSetList);
         pThisNode  = dll_next (pThisNode))
        {
        pRegSet = (WDB_REG_SET_OBJ *)pThisNode;
	(*pRegSet->save)();
	}

#if	CPU_FAMILY==MC680X0
    wdbExternAgentRegs.regSet.sr &= 0xefff;
    wdbExternAgentRegs.regSet.sr |= (wdbExternSystemRegs.regSet.sr & 0x1000);
#endif

    WDB_CTX_LOAD (&wdbExternAgentRegs); /* run external agent */

    /*NOTREACHED*/
    }
示例#8
0
STATUS wdbVioChannelRegister
    (
    WDB_VIO_NODE *	pVioNode
    )
    {
    WDB_VIO_NODE *	pThisNode;
    int lockKey;

    for (pThisNode =  (WDB_VIO_NODE *)dll_head (&wdbVioDevList);
	 pThisNode != (WDB_VIO_NODE *)dll_end  (&wdbVioDevList);
	 pThisNode =  (WDB_VIO_NODE *)dll_next (&pThisNode->node)
	)
	{
	if (pThisNode->channel == pVioNode->channel)
	    return (ERROR);
	}

    lockKey = intLock();
    dll_insert (&pVioNode->node, &wdbVioDevList);
    intUnlock (lockKey);

    return (OK);
    }
示例#9
0
static UINT32 wdbVioWrite
    (
    WDB_MEM_XFER *	pMemXfer,
    UINT32 *		pBytesWritten
    )
    {
    WDB_VIO_NODE *	pThisNode;

    for (pThisNode =  (WDB_VIO_NODE *)dll_head (&wdbVioDevList);
	 pThisNode != (WDB_VIO_NODE *)dll_end  (&wdbVioDevList);
	 pThisNode =  (WDB_VIO_NODE *)dll_next (&pThisNode->node)
	)
	{
	if (pThisNode->channel == (UINT32)pMemXfer->destination)
	    {
	    *pBytesWritten = (*pThisNode->inputRtn)(pThisNode,
				    pMemXfer->source,
				    pMemXfer->numBytes);
	    return (OK);
	    }
	}

    return (WDB_ERR_INVALID_VIO_CHANNEL);
    }
示例#10
0
static UINT32 wdbHwBpAdd
    (
    WDB_EVTPT_ADD_DESC *	pBreakPoint,	/* breakpoint to add */
    UINT32 *			pId		/* breakpoint ID */
    )
    {
    BRKPT *	pBp;
    dll_t *	pDll;
    int		status;
    DBG_REGS	dbgRegs;		/* debug registers */
    int		contextId;		/* context ID */
    UINT32	addr;			/* breakpoint address */
    UINT32	count = 0;		/* breakpoint count */
    int		type = DEFAULT_HW_BP;	/* hardware type */

    switch (pBreakPoint->numArgs)
	{
	default:
	case 3:
	    type = pBreakPoint->args[2];
	    /* FALL THROUGH */
	case 2:
	    count = pBreakPoint->args[1];
	    /* FALL THROUGH */
	case 1:
	    addr = pBreakPoint->args[0];
	    break;
	case 0:
	    return (WDB_ERR_INVALID_PARAMS);
	}

    /* check validity of hardware breakpoint address */

    if (wdbDbgHwAddrCheck (addr, type, (FUNCPTR) pWdbRtIf->memProbe) != OK)
        return (WDB_ERR_MEM_ACCES);

    /* check the agent mode */

    switch (pBreakPoint->context.contextType)
	{
	case WDB_CTX_SYSTEM:
	    if (!wdbIsNowExternal())
		return (WDB_ERR_AGENT_MODE);
	    break;

	default:
	    if (!wdbIsNowTasking())
		return (WDB_ERR_AGENT_MODE);
	}

    /* set the context ID */

    switch (pBreakPoint->context.contextType)
        {
        case WDB_CTX_SYSTEM:
            contextId = BP_SYS;
            break;
        case WDB_CTX_ANY_TASK:
            contextId = BP_ANY_TASK;
            break;
        case WDB_CTX_TASK:
        default:
            contextId = pBreakPoint->context.contextId;
        }

    /* clean dbgRegs structure */

    memset (&dbgRegs, 0, sizeof (DBG_REGS));

    /* fill dbgRegs structure with all hardware breakpoints */

    wdbTaskLock ();	/* disable task switching */
    for (pDll = dll_head(&bpList); pDll != dll_end(&bpList);
		pDll = dll_next(pDll))
	{
	pBp = BP_BASE(pDll);

	/* check if found breakpoint is applicable to new breakpoint context */

	if (((contextId == BP_SYS) && (pBp->bp_task == BP_SYS)) ||
		((contextId == BP_ANY_TASK) && (pBp->bp_task != BP_SYS)) ||
		((contextId != BP_SYS) && (pBp->bp_task == BP_ANY_TASK)))
	    {
	    if (pBp->bp_flags & BRK_HARDWARE)
		{
		if ((status = wdbDbgHwBpSet (&dbgRegs, 
				pBp->bp_flags & BRK_HARDMASK, 
				(UINT32) pBp->bp_addr)) != OK)
		    {
		    wdbTaskUnlock ();	/* re-enable task switching */
		    return (status);
		    }
		}
	    }
	}
    wdbTaskUnlock ();	/* re-enable task switching */

    if ((status = wdbDbgHwBpSet (&dbgRegs, type, addr)) != OK)
	return (status);

    if (dll_empty (&bpFreeList))
	return (WDB_ERR_EVENTPOINT_TABLE_FULL);

    wdbTaskLock ();		/* disable task switching */
    pBp = BP_BASE(dll_tail (&bpFreeList));
    dll_remove (&pBp->bp_chain);
    wdbTaskUnlock ();	/* re-enable task switching */

    pBp->bp_flags = BP_HOST | type | BRK_HARDWARE;
    pBp->bp_addr = (INSTR *)addr;
    pBp->bp_action = pBreakPoint->action.actionType;
    pBp->bp_count = count;
    pBp->bp_callRtn = (void (*)())pBreakPoint->action.callRtn;
    pBp->bp_callArg = pBreakPoint->action.callArg;
    pBp->bp_task = contextId;

    /* 
     * XXX - MS hack because host tools pass wrong info.
     * XXX - DBT This has been corrected in tornado 2.0 host tools but we
     * must keep this hack for backward compatibility.
     */

    if ((pBp->bp_action == 0) || (pBp->bp_action == WDB_ACTION_STOP))
	pBp->bp_action = WDB_ACTION_STOP | WDB_ACTION_NOTIFY;

    wdbTaskLock ();		/* disable task switching */
    dll_insert(&pBp->bp_chain, &bpList);
    wdbTaskUnlock ();		/* re-enable task switching */

    if (pBreakPoint->context.contextType != WDB_CTX_SYSTEM)
	if (_wdbTaskBpAdd != NULL)
	    _wdbTaskBpAdd (pBreakPoint);

    *pId = (UINT32)pBp;
    return (WDB_OK);
    }
示例#11
0
int main()
{
    chk_msg("dll_init");
    dll_t list;
    dll_init(&list);
    chk_dll_size(&list, 0);

    chk_msg("dll_push_back");
    dll_push_back(&list);
    chk_dll_size(&list, 1);

    chk_msg("dll_push_front");
    dll_push_front(&list);
    chk_dll_size(&list, 2);

    chk_msg("dll_destroy");
    dll_destroy(&list);
    chk_dll_size(&list, 0);

    chk_msg("dll_push_front");
    dll_push_front(&list);
    chk_dll_size(&list, 1);

    chk_msg("dll_pop_back");
    dll_pop_back(&list);
    chk_dll_size(&list, 0);

    chk_msg("dll_destroy");
    dll_destroy(&list);
    chk_dll_size(&list, 0);

    chk_msg("dll_destroy");
    dll_destroy(&list);
    chk_dll_size(&list, 0);

    chk_msg("dll_push_back");
    dll_item_t *item = dll_push_back(&list);
    chk_dll_size(&list, 1);

    chk_msg("dll_insert_before");
    item = dll_insert_before(&list, item);
    chk_dll_size(&list, 2);

    chk_msg("dll_insert_after");
    item = dll_insert_after(&list, item);
    chk_dll_size(&list, 3);

#if TRIGGER_INV_BUG
    chk_msg("dll_remove");
    dll_remove(&list, dll_next(dll_prev(dll_prev(dll_end(&list)))));
    chk_dll_size(&list, 2);
#endif

    chk_msg("dll_pop_front");
    dll_pop_front(&list);
    chk_dll_size(&list, 1);

#if TRIGGER_INV_BUG
    chk_msg("dll_remove");
    dll_remove(&list, dll_beg(&list));
    chk_dll_size(&list, 0);
#endif

    ___sl_plot(NULL);

    return 0;
}