- use build in data types
git-svn-id: http://moon:8086/svn/mips@35 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
+218
-218
@@ -37,8 +37,8 @@ static char *g_state_names[STATE_NUM_ENTRIES] = {"Init", "Run", "Single step", "
|
||||
|
||||
typedef struct _sbp_t
|
||||
{
|
||||
UINT32 *pAddr;
|
||||
UINT32 instr;
|
||||
uint32_t *pAddr;
|
||||
uint32_t instr;
|
||||
} bp_t;
|
||||
|
||||
static EXCEPTION_CONTEXT xcp_last;
|
||||
@@ -48,17 +48,17 @@ static bp_t mgmt_bp_ru[2];
|
||||
static int g_is_ss;
|
||||
static int g_bp_count;
|
||||
|
||||
int IsBreak(UINT32 instr)
|
||||
int IsBreak(uint32_t instr)
|
||||
{
|
||||
return ((instr & 0xFC00003F) == 0x0000000D);
|
||||
}
|
||||
|
||||
UINT32 BreakGetType(UINT32 instr)
|
||||
uint32_t BreakGetType(uint32_t instr)
|
||||
{
|
||||
return (instr >> 6) & BP_MASK_TYPE;
|
||||
}
|
||||
|
||||
char* reg_changed(UINT32 reg1, UINT32 reg2)
|
||||
char* reg_changed(uint32_t reg1, uint32_t reg2)
|
||||
{
|
||||
static char chg_str[2] = {0};
|
||||
|
||||
@@ -69,80 +69,80 @@ char* reg_changed(UINT32 reg1, UINT32 reg2)
|
||||
|
||||
return chg_str;
|
||||
}
|
||||
|
||||
void set_mgmt_break(UINT32 *pAddr_break)
|
||||
{
|
||||
mgmt_bp_ss[0].pAddr = NULL;
|
||||
mgmt_bp_ss[0].pAddr = 0;
|
||||
|
||||
// Don't overwrite user breaks
|
||||
if (IsBreak(*pAddr_break) && (BreakGetType(*pAddr_break) == BP_USER_BASE))
|
||||
{
|
||||
// sputs("Instruction at address ");print_word((long)pAddr_break);sputs(" is user break\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save original instruction
|
||||
mgmt_bp_ss[0].pAddr = pAddr_break;
|
||||
mgmt_bp_ss[0].instr = *(mgmt_bp_ss[0].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ss[0].pAddr) = BP_MGMT_SS(1);
|
||||
ICACHE_invalidate_at(mgmt_bp_ss[0].pAddr);
|
||||
}
|
||||
}
|
||||
|
||||
void singlestep(struct xcptcontext * xcp, UINT32 *pAddr_curr, UINT32 is_branch_shadow)
|
||||
{
|
||||
|
||||
int junk;
|
||||
UINT32 branch_addr, reg, result, bp_type;
|
||||
UINT32 *pInstr, *pAddr_prev, *pAddr_next;
|
||||
|
||||
pAddr_prev = pAddr_curr - 1;
|
||||
pAddr_next = pAddr_curr + 1;
|
||||
|
||||
set_mgmt_break(pAddr_next);
|
||||
|
||||
mgmt_bp_ss[1].pAddr = NULL;
|
||||
mgmt_bp_ss[1].pAddr = 0;
|
||||
|
||||
// We have two possible management breaks, if previous instruction was branch or jump
|
||||
if (is_branch_shadow)
|
||||
{
|
||||
result = tdisasm(g_buf, (long)pAddr_prev, *pAddr_prev, 0, &junk, &branch_addr, ®);
|
||||
// Is jump target stored in register
|
||||
if (result == 3)
|
||||
{
|
||||
branch_addr = xcp->regs[reg&0x1F];
|
||||
}
|
||||
|
||||
// Don't overwrite user breaks
|
||||
if (IsBreak(branch_addr) && (BreakGetType(branch_addr) == BP_USER_BASE))
|
||||
{
|
||||
// sputs("Instruction at branch address ");print_word((long)branch_addr);sputs(" is user break\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save original instruction
|
||||
mgmt_bp_ss[1].pAddr = (UINT32*)branch_addr;
|
||||
mgmt_bp_ss[1].instr = *(mgmt_bp_ss[1].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ss[1].pAddr) = BP_MGMT_SS(2);
|
||||
ICACHE_invalidate_at(mgmt_bp_ss[1].pAddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void set_mgmt_break(uint32_t *pAddr_break)
|
||||
{
|
||||
mgmt_bp_ss[0].pAddr = NULL;
|
||||
mgmt_bp_ss[0].pAddr = 0;
|
||||
|
||||
// Don't overwrite user breaks
|
||||
if (IsBreak(*pAddr_break) && (BreakGetType(*pAddr_break) == BP_USER_BASE))
|
||||
{
|
||||
// sputs("Instruction at address ");print_word((long)pAddr_break);sputs(" is user break\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save original instruction
|
||||
mgmt_bp_ss[0].pAddr = pAddr_break;
|
||||
mgmt_bp_ss[0].instr = *(mgmt_bp_ss[0].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ss[0].pAddr) = BP_MGMT_SS(1);
|
||||
ICACHE_invalidate_at(mgmt_bp_ss[0].pAddr);
|
||||
}
|
||||
}
|
||||
|
||||
void singlestep(struct xcptcontext * xcp, uint32_t *pAddr_curr, uint32_t is_branch_shadow)
|
||||
{
|
||||
|
||||
int junk;
|
||||
uint32_t branch_addr, reg, result, bp_type;
|
||||
uint32_t *pInstr, *pAddr_prev, *pAddr_next;
|
||||
|
||||
pAddr_prev = pAddr_curr - 1;
|
||||
pAddr_next = pAddr_curr + 1;
|
||||
|
||||
set_mgmt_break(pAddr_next);
|
||||
|
||||
mgmt_bp_ss[1].pAddr = NULL;
|
||||
mgmt_bp_ss[1].pAddr = 0;
|
||||
|
||||
// We have two possible management breaks, if previous instruction was branch or jump
|
||||
if (is_branch_shadow)
|
||||
{
|
||||
result = tdisasm(g_buf, (long)pAddr_prev, *pAddr_prev, 0, &junk, &branch_addr, ®);
|
||||
// Is jump target stored in register
|
||||
if (result == 3)
|
||||
{
|
||||
branch_addr = xcp->regs[reg&0x1F];
|
||||
}
|
||||
|
||||
// Don't overwrite user breaks
|
||||
if (IsBreak(branch_addr) && (BreakGetType(branch_addr) == BP_USER_BASE))
|
||||
{
|
||||
// sputs("Instruction at branch address ");print_word((long)branch_addr);sputs(" is user break\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save original instruction
|
||||
mgmt_bp_ss[1].pAddr = (uint32_t*)branch_addr;
|
||||
mgmt_bp_ss[1].instr = *(mgmt_bp_ss[1].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ss[1].pAddr) = BP_MGMT_SS(2);
|
||||
ICACHE_invalidate_at(mgmt_bp_ss[1].pAddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_handler(struct xcptcontext * xcp)
|
||||
{
|
||||
|
||||
UINT32 bp_addr, bp_index = 0, branch_addr, reg, result, bp_type;
|
||||
uint32_t bp_addr, bp_index = 0, branch_addr, reg, result, bp_type;
|
||||
int junk, i, leave_isr, is_branch_shadow, is_user_bp;
|
||||
UINT32 *pInstr, *pAddr_curr, *pAddr_prev, *pAddr_next;
|
||||
uint32_t *pInstr, *pAddr_curr, *pAddr_prev, *pAddr_next;
|
||||
instr_info_t info;
|
||||
|
||||
|
||||
is_user_bp = 0;
|
||||
pAddr_curr = (UINT32*)xcp->epc;
|
||||
pAddr_curr = (uint32_t*)xcp->epc;
|
||||
is_branch_shadow = ((xcp->cr & 0x80000000) == 0x80000000);
|
||||
if (is_branch_shadow)
|
||||
pAddr_curr++;
|
||||
@@ -209,92 +209,92 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
}
|
||||
}
|
||||
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" Status : ", xcp->sr, reg_changed(xcp->sr, xcp_last.sr));
|
||||
PRINT_REG_CHG(" Cause : ", xcp->cr, reg_changed(xcp->cr, xcp_last.cr));
|
||||
PRINT_REG_CHG(" EPC : ", xcp->epc, reg_changed(xcp->epc, xcp_last.epc));
|
||||
PRINT_REG_CHG("BadAddr : ", xcp->baddr, reg_changed(xcp->baddr, xcp_last.baddr));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" MDLO : ", xcp->mdlo, reg_changed(xcp->mdlo, xcp_last.mdlo));
|
||||
PRINT_REG_CHG(" MDHI : ", xcp->mdhi, reg_changed(xcp->mdhi, xcp_last.mdhi));
|
||||
|
||||
sputs("\n");
|
||||
|
||||
sputs("Registers:\n");
|
||||
PRINT_REG_CHG(" 0 (ze) : ", xcp->regs[0], reg_changed(xcp->regs[0], xcp_last.regs[0]));
|
||||
PRINT_REG_CHG(" 1 (at) : ", xcp->regs[1], reg_changed(xcp->regs[1], xcp_last.regs[1]));
|
||||
PRINT_REG_CHG(" 2 (v0) : ", xcp->regs[2], reg_changed(xcp->regs[2], xcp_last.regs[2]));
|
||||
PRINT_REG_CHG(" 3 (v1) : ", xcp->regs[3], reg_changed(xcp->regs[3], xcp_last.regs[3]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" 4 (a0) : ", xcp->regs[4], reg_changed(xcp->regs[4], xcp_last.regs[4]));
|
||||
PRINT_REG_CHG(" 5 (a1) : ", xcp->regs[5], reg_changed(xcp->regs[5], xcp_last.regs[5]));
|
||||
PRINT_REG_CHG(" 6 (a2) : ", xcp->regs[6], reg_changed(xcp->regs[6], xcp_last.regs[6]));
|
||||
PRINT_REG_CHG(" 7 (a3) : ", xcp->regs[7], reg_changed(xcp->regs[7], xcp_last.regs[7]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" 8 (t0) : ", xcp->regs[8], reg_changed(xcp->regs[8], xcp_last.regs[8]));
|
||||
PRINT_REG_CHG(" 9 (t1) : ", xcp->regs[9], reg_changed(xcp->regs[9], xcp_last.regs[9]));
|
||||
PRINT_REG_CHG("10 (t2) : ", xcp->regs[10], reg_changed(xcp->regs[10], xcp_last.regs[10]));
|
||||
PRINT_REG_CHG("11 (t3) : ", xcp->regs[11], reg_changed(xcp->regs[11], xcp_last.regs[11]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("12 (t4) : ", xcp->regs[12], reg_changed(xcp->regs[12], xcp_last.regs[12]));
|
||||
PRINT_REG_CHG("13 (t5) : ", xcp->regs[13], reg_changed(xcp->regs[13], xcp_last.regs[13]));
|
||||
PRINT_REG_CHG("14 (t6) : ", xcp->regs[14], reg_changed(xcp->regs[14], xcp_last.regs[14]));
|
||||
PRINT_REG_CHG("15 (t7) : ", xcp->regs[15], reg_changed(xcp->regs[15], xcp_last.regs[15]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("16 (s0) : ", xcp->regs[16], reg_changed(xcp->regs[16], xcp_last.regs[16]));
|
||||
PRINT_REG_CHG("17 (s1) : ", xcp->regs[17], reg_changed(xcp->regs[17], xcp_last.regs[17]));
|
||||
PRINT_REG_CHG("18 (s2) : ", xcp->regs[18], reg_changed(xcp->regs[18], xcp_last.regs[18]));
|
||||
PRINT_REG_CHG("19 (s3) : ", xcp->regs[19], reg_changed(xcp->regs[19], xcp_last.regs[19]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("20 (s4) : ", xcp->regs[20], reg_changed(xcp->regs[20], xcp_last.regs[20]));
|
||||
PRINT_REG_CHG("21 (s5) : ", xcp->regs[21], reg_changed(xcp->regs[21], xcp_last.regs[21]));
|
||||
PRINT_REG_CHG("22 (s6) : ", xcp->regs[22], reg_changed(xcp->regs[22], xcp_last.regs[22]));
|
||||
PRINT_REG_CHG("23 (s7) : ", xcp->regs[23], reg_changed(xcp->regs[23], xcp_last.regs[23]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("24 (s8) : ", xcp->regs[24], reg_changed(xcp->regs[24], xcp_last.regs[24]));
|
||||
PRINT_REG_CHG("25 (s9) : ", xcp->regs[25], reg_changed(xcp->regs[25], xcp_last.regs[25]));
|
||||
PRINT_REG_CHG("26 (k0) : ", xcp->regs[26], reg_changed(xcp->regs[26], xcp_last.regs[26]));
|
||||
PRINT_REG_CHG("27 (k1) : ", xcp->regs[27], reg_changed(xcp->regs[27], xcp_last.regs[27]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("28 (gp) : ", xcp->regs[28], reg_changed(xcp->regs[28], xcp_last.regs[28]));
|
||||
PRINT_REG_CHG("29 (sp) : ", xcp->regs[29], reg_changed(xcp->regs[29], xcp_last.regs[29]));
|
||||
PRINT_REG_CHG("30 (fp) : ", xcp->regs[30], reg_changed(xcp->regs[30], xcp_last.regs[30]));
|
||||
PRINT_REG_CHG("31 (ra) : ", xcp->regs[31], reg_changed(xcp->regs[31], xcp_last.regs[31]));
|
||||
sputs("\n");
|
||||
sputs("\n");
|
||||
|
||||
// sputs(g_state_names[g_state]);sputs("\n");
|
||||
// sputs("\n");
|
||||
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" Status : ", xcp->sr, reg_changed(xcp->sr, xcp_last.sr));
|
||||
PRINT_REG_CHG(" Cause : ", xcp->cr, reg_changed(xcp->cr, xcp_last.cr));
|
||||
PRINT_REG_CHG(" EPC : ", xcp->epc, reg_changed(xcp->epc, xcp_last.epc));
|
||||
PRINT_REG_CHG("BadAddr : ", xcp->baddr, reg_changed(xcp->baddr, xcp_last.baddr));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" MDLO : ", xcp->mdlo, reg_changed(xcp->mdlo, xcp_last.mdlo));
|
||||
PRINT_REG_CHG(" MDHI : ", xcp->mdhi, reg_changed(xcp->mdhi, xcp_last.mdhi));
|
||||
|
||||
sputs("\n");
|
||||
|
||||
sputs("Registers:\n");
|
||||
PRINT_REG_CHG(" 0 (ze) : ", xcp->regs[0], reg_changed(xcp->regs[0], xcp_last.regs[0]));
|
||||
PRINT_REG_CHG(" 1 (at) : ", xcp->regs[1], reg_changed(xcp->regs[1], xcp_last.regs[1]));
|
||||
PRINT_REG_CHG(" 2 (v0) : ", xcp->regs[2], reg_changed(xcp->regs[2], xcp_last.regs[2]));
|
||||
PRINT_REG_CHG(" 3 (v1) : ", xcp->regs[3], reg_changed(xcp->regs[3], xcp_last.regs[3]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" 4 (a0) : ", xcp->regs[4], reg_changed(xcp->regs[4], xcp_last.regs[4]));
|
||||
PRINT_REG_CHG(" 5 (a1) : ", xcp->regs[5], reg_changed(xcp->regs[5], xcp_last.regs[5]));
|
||||
PRINT_REG_CHG(" 6 (a2) : ", xcp->regs[6], reg_changed(xcp->regs[6], xcp_last.regs[6]));
|
||||
PRINT_REG_CHG(" 7 (a3) : ", xcp->regs[7], reg_changed(xcp->regs[7], xcp_last.regs[7]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" 8 (t0) : ", xcp->regs[8], reg_changed(xcp->regs[8], xcp_last.regs[8]));
|
||||
PRINT_REG_CHG(" 9 (t1) : ", xcp->regs[9], reg_changed(xcp->regs[9], xcp_last.regs[9]));
|
||||
PRINT_REG_CHG("10 (t2) : ", xcp->regs[10], reg_changed(xcp->regs[10], xcp_last.regs[10]));
|
||||
PRINT_REG_CHG("11 (t3) : ", xcp->regs[11], reg_changed(xcp->regs[11], xcp_last.regs[11]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("12 (t4) : ", xcp->regs[12], reg_changed(xcp->regs[12], xcp_last.regs[12]));
|
||||
PRINT_REG_CHG("13 (t5) : ", xcp->regs[13], reg_changed(xcp->regs[13], xcp_last.regs[13]));
|
||||
PRINT_REG_CHG("14 (t6) : ", xcp->regs[14], reg_changed(xcp->regs[14], xcp_last.regs[14]));
|
||||
PRINT_REG_CHG("15 (t7) : ", xcp->regs[15], reg_changed(xcp->regs[15], xcp_last.regs[15]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("16 (s0) : ", xcp->regs[16], reg_changed(xcp->regs[16], xcp_last.regs[16]));
|
||||
PRINT_REG_CHG("17 (s1) : ", xcp->regs[17], reg_changed(xcp->regs[17], xcp_last.regs[17]));
|
||||
PRINT_REG_CHG("18 (s2) : ", xcp->regs[18], reg_changed(xcp->regs[18], xcp_last.regs[18]));
|
||||
PRINT_REG_CHG("19 (s3) : ", xcp->regs[19], reg_changed(xcp->regs[19], xcp_last.regs[19]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("20 (s4) : ", xcp->regs[20], reg_changed(xcp->regs[20], xcp_last.regs[20]));
|
||||
PRINT_REG_CHG("21 (s5) : ", xcp->regs[21], reg_changed(xcp->regs[21], xcp_last.regs[21]));
|
||||
PRINT_REG_CHG("22 (s6) : ", xcp->regs[22], reg_changed(xcp->regs[22], xcp_last.regs[22]));
|
||||
PRINT_REG_CHG("23 (s7) : ", xcp->regs[23], reg_changed(xcp->regs[23], xcp_last.regs[23]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("24 (s8) : ", xcp->regs[24], reg_changed(xcp->regs[24], xcp_last.regs[24]));
|
||||
PRINT_REG_CHG("25 (s9) : ", xcp->regs[25], reg_changed(xcp->regs[25], xcp_last.regs[25]));
|
||||
PRINT_REG_CHG("26 (k0) : ", xcp->regs[26], reg_changed(xcp->regs[26], xcp_last.regs[26]));
|
||||
PRINT_REG_CHG("27 (k1) : ", xcp->regs[27], reg_changed(xcp->regs[27], xcp_last.regs[27]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("28 (gp) : ", xcp->regs[28], reg_changed(xcp->regs[28], xcp_last.regs[28]));
|
||||
PRINT_REG_CHG("29 (sp) : ", xcp->regs[29], reg_changed(xcp->regs[29], xcp_last.regs[29]));
|
||||
PRINT_REG_CHG("30 (fp) : ", xcp->regs[30], reg_changed(xcp->regs[30], xcp_last.regs[30]));
|
||||
PRINT_REG_CHG("31 (ra) : ", xcp->regs[31], reg_changed(xcp->regs[31], xcp_last.regs[31]));
|
||||
sputs("\n");
|
||||
sputs("\n");
|
||||
|
||||
// sputs(g_state_names[g_state]);sputs("\n");
|
||||
// sputs("\n");
|
||||
|
||||
pInstr = pAddr_prev;
|
||||
// Disassemble instructions
|
||||
for (i=0; i < 3; i++)
|
||||
{
|
||||
print_word((long)pInstr);
|
||||
if (pInstr != pAddr_curr)
|
||||
{
|
||||
if (pInstr != pAddr_curr)
|
||||
{
|
||||
if (IsBreak(*pInstr) && (BreakGetType(*pInstr) == BP_USER_BASE))
|
||||
{
|
||||
tdisasm(g_buf, (long)user_bp[BP_GET_ID(*pInstr)].pAddr, user_bp[BP_GET_ID(*pInstr)].instr, 0, &junk, &junk, &junk);
|
||||
sputs(": b("); print_byte((char)BP_GET_ID(*pInstr)); sputs(") ");
|
||||
}
|
||||
else
|
||||
{
|
||||
tdisasm(g_buf, (long)pInstr, *pInstr, 0, &junk, &junk, &junk);
|
||||
sputs(": ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tdisasm(g_buf, (long)pInstr, *pInstr, 0, &junk, &junk, &junk);
|
||||
sputs(": ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tdisasm(g_buf, (long)pInstr, *pInstr, 0, &junk, &junk, &junk);
|
||||
if (is_user_bp)
|
||||
{
|
||||
sputs(": b("); print_byte((char)bp_index); sputs(")-> ");
|
||||
}
|
||||
{
|
||||
sputs(": b("); print_byte((char)bp_index); sputs(")-> ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sputs(": -> ");
|
||||
}
|
||||
{
|
||||
sputs(": -> ");
|
||||
}
|
||||
}
|
||||
sputs(g_buf);
|
||||
sputs("\n");
|
||||
@@ -323,7 +323,7 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
branch_addr = xcp->regs[reg&0x1F];
|
||||
}
|
||||
// Save original instruction
|
||||
mgmt_bp_ru[1].pAddr = (UINT32*)branch_addr;
|
||||
mgmt_bp_ru[1].pAddr = (uint32_t*)branch_addr;
|
||||
mgmt_bp_ru[1].instr = *(mgmt_bp_ru[1].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ru[1].pAddr) = BP_MGMT_RU(bp_index);
|
||||
@@ -354,8 +354,8 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
printf("Enter breakpoint: ");
|
||||
scanf("%x", &bp_addr);
|
||||
printf("Insert breakpoint at %.8X\n", bp_addr);
|
||||
|
||||
user_bp[g_bp_count].pAddr = (UINT32*)bp_addr;
|
||||
|
||||
user_bp[g_bp_count].pAddr = (uint32_t*)bp_addr;
|
||||
user_bp[g_bp_count].instr = *(user_bp[g_bp_count].pAddr);
|
||||
*(user_bp[g_bp_count].pAddr) = BP_USER(g_bp_count);
|
||||
|
||||
@@ -384,82 +384,82 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
singlestep(xcp, pAddr_curr, is_branch_shadow);
|
||||
|
||||
singlestep(xcp, pAddr_curr, is_branch_shadow);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
g_state = STATE_STEP_SINGLE;
|
||||
g_is_ss = 1;
|
||||
leave_isr = 1;
|
||||
|
||||
if (is_user_bp)
|
||||
break;
|
||||
|
||||
if (IsBreak(*pAddr_curr))
|
||||
{
|
||||
if (BreakGetType(*pAddr_curr) == BP_USER_BASE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
pInstr = pAddr_curr;
|
||||
|
||||
do
|
||||
{
|
||||
result = instr_info(*pInstr, &info);
|
||||
if (result == INSTR_TYPE_JUMP)
|
||||
{
|
||||
if (info.rs == 0x1F)
|
||||
break;
|
||||
}
|
||||
else if (result == INSTR_TYPE_LOAD)
|
||||
{
|
||||
if (info.rs == 0x1F)
|
||||
break;
|
||||
}
|
||||
pInstr++;
|
||||
} while(1);
|
||||
|
||||
// sputs("Return found at "); print_word((long)pInstr);sputs("\n");
|
||||
set_mgmt_break(pInstr);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
g_state = STATE_STEP_SINGLE;
|
||||
g_is_ss = 1;
|
||||
leave_isr = 1;
|
||||
|
||||
if (is_user_bp)
|
||||
break;
|
||||
|
||||
if (IsBreak(*pAddr_curr))
|
||||
{
|
||||
if (BreakGetType(*pAddr_curr) == BP_USER_BASE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
pInstr = pAddr_curr;
|
||||
|
||||
do
|
||||
{
|
||||
result = instr_info(*pInstr, &info);
|
||||
if (result == INSTR_TYPE_JUMP)
|
||||
{
|
||||
if (info.rs == 0x1F)
|
||||
break;
|
||||
}
|
||||
else if (result == INSTR_TYPE_LOAD)
|
||||
{
|
||||
if (info.rs == 0x1F)
|
||||
break;
|
||||
}
|
||||
pInstr++;
|
||||
} while(1);
|
||||
|
||||
// sputs("Return found at "); print_word((long)pInstr);sputs("\n");
|
||||
set_mgmt_break(pInstr);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
g_state = STATE_STEP_PROC;
|
||||
g_is_ss = 1;
|
||||
leave_isr = 1;
|
||||
|
||||
if (is_user_bp)
|
||||
break;
|
||||
|
||||
if (IsBreak(*pAddr_curr))
|
||||
{
|
||||
if (BreakGetType(*pAddr_curr) == BP_USER_BASE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
result = instr_info(*pAddr_curr, &info);
|
||||
if ((result == INSTR_TYPE_JUMP) && (info.flags & INSTR_FLAGS_JUMP_LINK))
|
||||
{
|
||||
singlestep(xcp, pAddr_next, 0);
|
||||
// sputs("Skip sub-routine\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
singlestep(xcp, pAddr_curr, is_branch_shadow);
|
||||
}
|
||||
|
||||
if (is_user_bp)
|
||||
break;
|
||||
|
||||
if (IsBreak(*pAddr_curr))
|
||||
{
|
||||
if (BreakGetType(*pAddr_curr) == BP_USER_BASE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
result = instr_info(*pAddr_curr, &info);
|
||||
if ((result == INSTR_TYPE_JUMP) && (info.flags & INSTR_FLAGS_JUMP_LINK))
|
||||
{
|
||||
singlestep(xcp, pAddr_next, 0);
|
||||
// sputs("Skip sub-routine\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
singlestep(xcp, pAddr_curr, is_branch_shadow);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -467,7 +467,7 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
}
|
||||
} while (!leave_isr);
|
||||
|
||||
memcpy(&xcp_last, xcp, sizeof(EXCEPTION_CONTEXT));
|
||||
memcpy(&xcp_last, xcp, sizeof(EXCEPTION_CONTEXT));
|
||||
}
|
||||
|
||||
void debug_int(struct xcptcontext * xcp)
|
||||
|
||||
Reference in New Issue
Block a user