⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbgarchlib.c

📁 vxworks的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
** NOMANUAL** INTERNAL* This routine checks the instruction pointed to by the input argument to* determine if it is an instruction that is used to implement a function call.* If so, the function returns TRUE, otherwise the return value is FALSE.* Note the use of the INST_CMP macro defined in dbgLib.h. [Arch port kit]** NOTE* This routine is called from so() only.*/BOOL _dbgFuncCallCheck    (    INSTR * addr    )    {    /* SH JSR and BSR instructions:     *      * JSR	@Rn		0100nnnn00001011	itAtOneReg  - 2/3     * BSRF	Rn		0000nnnn00000011	itBraDispRn - 2/2     * BSR	disp		1011dddddddddddd	itBraDisp12 - 2/2     */    return (INST_CMP (addr, 0x400b, 0xf0ff)	/* JSR  */	||  INST_CMP (addr, 0x0003, 0xf0ff)	/* BSRF */	||  INST_CMP (addr, 0xb000, 0xf000)	/* BSR  */ );    }/********************************************************************************* _dbgInfoPCGet - get pc from stack** RETURNS: value of pc saved on stack** NOMANUAL** INTERNAL* This routine returns a pointer to the instruction addressed by the program* counter. The input argument is a pointer to the breakpoint stack frame. The* return value is the program counter element of that structure, whose type* should be an INSTR*. [Arch port kit]** NOTE* This routine is called from dbgBreakpoint() only.*/INSTR * _dbgInfoPCGet    (    BREAK_ESF * pInfo    )    {    return (pInfo->pc);    }/********************************************************************************* _dbgTaskPCSet - set task's pc** NOMANUAL** INTERNAL* The task identification and the program counter(s) are passed to this* function which will set new program counter(s) for the specified task.* A local copy of REG_SET is filled by the call to taskRegsGet(), the program* counter(s) set, and then copied back to the task's TCB by taskRegsSet().* This routine is similar for all architectures. [Arch port kit]** NOTE* This routine is called from c() and s().*/void _dbgTaskPCSet    (    int     tid,    INSTR * pc,		/* task's pc                        */    INSTR * npc		/* task's npc (not supported by SH) */    )    {    REG_SET regSet;    if (taskRegsGet (tid, &regSet) != OK)	return;    regSet.pc = pc;    taskRegsSet (tid, &regSet);    }/********************************************************************************* _dbgTaskPCGet - get task's pc** RETURNS: specified task's program counter** NOMANUAL** INTERNAL* This routine returns a pointer to the instruction addressed by the program* counter. The input argument is the task identifier used with taskRegsGet().* The return value is the program counter element of that structure, whose* type should be an INSTR*. [Arch port kit]** NOTE* This routine is called from c(), so(), dbgTlSnglStep(), and dbgTaskSwitch().*/INSTR * _dbgTaskPCGet    (    int     tid    )    {    REG_SET regSet;    (void) taskRegsGet (tid, &regSet);    return ((INSTR *) regSet.pc);    }/********************************************************************************* getOneReg - return the contents of one register** Given a task's ID, this routine returns the contents of the register* specified by the register code.  This routine is used by r0, sr, etc.* The register codes are defined in regsSh.h.** NOMANUAL** RETURNS: register contents, or ERROR.** INTERNAL* This routine gets the contents of a specific register in the REG_SET based on* the task identifier and the register index. A call is made to taskIdFigure(),* and the return value checked for an ERROR. taskIdDefault() and taskRegsGer()* are called to fill a local copy of REG_SET. The index is used to return the* contents of the register. [Arch port kit]**/LOCAL int getOneReg    (    int     taskId,			/* task ID, 0 means default task */    int     regCode			/* code for specifying register */    )    {    REG_SET regSet;			/* get task's regs into here */    taskId = taskIdFigure (taskId);	/* translate super name to ID */    if (taskId == ERROR)		/* couldn't figure out super name */	return (ERROR);    taskId = taskIdDefault (taskId);	/* set the default ID */    if (taskRegsGet (taskId, &regSet) != OK)	return (ERROR);    return (*(int *)((int)&regSet + regCode));    }/********************************************************************************* r0 - return the contents of general register r0 (also r1-r15) (SH)** This command extracts the contents of register r0 from the TCB of a specified* task.  If <taskId> is omitted or zero, the last task referenced is assumed.** Similar routines are provided for all general registers (r1 - r15):* r1() - r15().** RETURNS: The contents of register r0 (or the requested register).** SEE ALSO:* .pG "Debugging"** INTERNAL* Although this routine is hereby marked NOMANUAL, it actually gets* published, but from arch/doc/dbgArchLib.c.** INTERNAL* Each control and general-purpose register should have a routine to display* its contents in the REG_SET structure in the TCB. The task identifier and* a register index is passed to the hidden (local) function getOneReg() which* returns the contents. [Arch port kit]*/int r0    (    int taskId		/* task ID, 0 means default task */    )    {    return (getOneReg (taskId, REG_SET_R0  ));    }int r1  (int taskId) { return (getOneReg (taskId, REG_SET_R1  )); }int r2  (int taskId) { return (getOneReg (taskId, REG_SET_R2  )); }int r3  (int taskId) { return (getOneReg (taskId, REG_SET_R3  )); }int r4  (int taskId) { return (getOneReg (taskId, REG_SET_R4  )); }int r5  (int taskId) { return (getOneReg (taskId, REG_SET_R5  )); }int r6  (int taskId) { return (getOneReg (taskId, REG_SET_R6  )); }int r7  (int taskId) { return (getOneReg (taskId, REG_SET_R7  )); }int r8  (int taskId) { return (getOneReg (taskId, REG_SET_R8  )); }int r9  (int taskId) { return (getOneReg (taskId, REG_SET_R9  )); }int r10 (int taskId) { return (getOneReg (taskId, REG_SET_R10 )); }int r11 (int taskId) { return (getOneReg (taskId, REG_SET_R11 )); }int r12 (int taskId) { return (getOneReg (taskId, REG_SET_R12 )); }int r13 (int taskId) { return (getOneReg (taskId, REG_SET_R13 )); }int r14 (int taskId) { return (getOneReg (taskId, REG_SET_R14 )); }int r15 (int taskId) { return (getOneReg (taskId, REG_SET_R15 )); }/********************************************************************************* sr - return the contents of control register sr (also gbr, vbr) (SH)** This command extracts the contents of register sr from the TCB of a specified* task.  If <taskId> is omitted or zero, the last task referenced is assumed.** Similar routines are provided for all control registers (gbr, vbr):* gbr(), vbr().** RETURNS: The contents of register sr (or the requested control register).** SEE ALSO:* .pG "Debugging"** INTERNAL* Although this routine is hereby marked NOMANUAL, it actually gets* published, but from arch/doc/dbgArchLib.c.** INTERNAL* Each control and general-purpose register should have a routine to display* its contents in the REG_SET structure in the TCB. The task identifier and* a register index is passed to the hidden (local) function getOneReg() which* returns the contents. [Arch port kit]*/int sr    (    int taskId		/* task ID, 0 means default task */    )    {    return (getOneReg (taskId, REG_SET_SR  ));    }int gbr (int taskId) { return (getOneReg (taskId, REG_SET_GBR )); }int vbr (int taskId) { return (getOneReg (taskId, REG_SET_VBR )); }/********************************************************************************* mach - return the contents of system register mach (also macl, pr) (SH)** This command extracts the contents of register mach from the TCB of* a specified task.  If <taskId> is omitted or zero, the last task referenced* is assumed.** Similar routines are provided for other system registers (macl, pr):* macl(), pr().  Note that pc() is provided by usrLib.c.** RETURNS: The contents of register mach (or the requested system register).** SEE ALSO:* .pG "Debugging"** INTERNAL* Although this routine is hereby marked NOMANUAL, it actually gets* published, but from arch/doc/dbgArchLib.c.** INTERNAL* Each control and general-purpose register should have a routine to display* its contents in the REG_SET structure in the TCB. The task identifier and* a register index is passed to the hidden (local) function getOneReg() which* returns the contents. [Arch port kit]*/int mach    (    int taskId		/* task ID, 0 means default task */    )    {    return (getOneReg (taskId, REG_SET_MACH));    }int macl(int taskId) { return (getOneReg (taskId, REG_SET_MACL)); }int pr  (int taskId) { return (getOneReg (taskId, REG_SET_PR  )); }#if	FALSEint pc  (int taskId) { return (getOneReg (taskId, REG_SET_PC  )); }#endif	/* FALSE, usrLib provides this. */#if	DBG_HARDWARE_BP  	/* TO THE END OF THIS FILE *//******************************************************************************** _dbgBrkDisplayHard - display a hardware breakpoint** NOMANUAL** NOTE* This routine is called from dbgBrkDisplay() only.*/void _dbgBrkDisplayHard    (    BRKPT *	pBp            /* breakpoint table entry */    )    {    int type;    if ((pBp->bp_flags & BRK_HARDWARE) == 0)         return;    type = pBp->bp_flags & BRK_HARDMASK;    printf ("\n            UBC");    switch (type & BH_BREAK_MASK)	{	/* HW breakpoint on bus... */	case BH_BREAK_INSN:  printf(" INST");	break;	/* istruction access */	case BH_BREAK_DATA:  printf(" DATA");	break;	/* data access */	default:             printf(" I/D");	break;	/* any */	}    switch (type & BH_CYCLE_MASK)	{        /* HW breakpoint on bus cycle... */	case BH_CYCLE_READ:  printf(" READ");	break;	/* read  */	case BH_CYCLE_WRITE: printf(" WRITE");	break;	/* write */	default:             printf(" R/W");	break;  /* any */	}    switch (type & BH_SIZE_MASK)	{	/* HW breakpoint on operand size */	case BH_8:           printf(" BYTE");	break;	/*  8 bit */	case BH_16:          printf(" WORD");	break;	/* 16 bit */	case BH_32:          printf(" LONG");	break;	/* 32 bit */	}    switch (type & BH_CPU_MASK)	{        /* HW breakpoint on bus cycle... */	case BH_CPU:	     printf(" CPU");	break;	/* CPU */	case BH_DMAC:	     printf(" DMA");	break;	/* DMA ctrl */	case BH_DMAC_CPU:    printf(" DMA/CPU");break;	/* DMA/CPU */	}    switch (type & BH_BUS_MASK)	{        /* HW breakpoint on bus cycle... */	case BH_XBUS:        printf(" XBUS");	break;	/* XBUS, DSP only */	case BH_YBUS:        printf(" YBUS");	break;	/* YBUS, DSP only */	}    }#endif	/* DBG_HARDWARE_BP */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -