diff options
Diffstat (limited to 'arch/mn10300/kernel/gdb-stub.c')
-rw-r--r-- | arch/mn10300/kernel/gdb-stub.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/arch/mn10300/kernel/gdb-stub.c b/arch/mn10300/kernel/gdb-stub.c index b169d99d9f20..538266b2c9bc 100644 --- a/arch/mn10300/kernel/gdb-stub.c +++ b/arch/mn10300/kernel/gdb-stub.c | |||
@@ -133,7 +133,7 @@ | |||
133 | #include <asm/system.h> | 133 | #include <asm/system.h> |
134 | #include <asm/gdb-stub.h> | 134 | #include <asm/gdb-stub.h> |
135 | #include <asm/exceptions.h> | 135 | #include <asm/exceptions.h> |
136 | #include <asm/cacheflush.h> | 136 | #include <asm/debugger.h> |
137 | #include <asm/serial-regs.h> | 137 | #include <asm/serial-regs.h> |
138 | #include <asm/busctl-regs.h> | 138 | #include <asm/busctl-regs.h> |
139 | #include <unit/leds.h> | 139 | #include <unit/leds.h> |
@@ -405,6 +405,7 @@ static int hexToInt(char **ptr, int *intValue) | |||
405 | return (numChars); | 405 | return (numChars); |
406 | } | 406 | } |
407 | 407 | ||
408 | #ifdef CONFIG_GDBSTUB_ALLOW_SINGLE_STEP | ||
408 | /* | 409 | /* |
409 | * We single-step by setting breakpoints. When an exception | 410 | * We single-step by setting breakpoints. When an exception |
410 | * is handled, we need to restore the instructions hoisted | 411 | * is handled, we need to restore the instructions hoisted |
@@ -729,6 +730,7 @@ static int gdbstub_single_step(struct pt_regs *regs) | |||
729 | __gdbstub_restore_bp(); | 730 | __gdbstub_restore_bp(); |
730 | return -EFAULT; | 731 | return -EFAULT; |
731 | } | 732 | } |
733 | #endif /* CONFIG_GDBSTUB_ALLOW_SINGLE_STEP */ | ||
732 | 734 | ||
733 | #ifdef CONFIG_GDBSTUB_CONSOLE | 735 | #ifdef CONFIG_GDBSTUB_CONSOLE |
734 | 736 | ||
@@ -1171,7 +1173,7 @@ int gdbstub_clear_breakpoint(u8 *addr, int len) | |||
1171 | 1173 | ||
1172 | /* | 1174 | /* |
1173 | * This function does all command processing for interfacing to gdb | 1175 | * This function does all command processing for interfacing to gdb |
1174 | * - returns 1 if the exception should be skipped, 0 otherwise. | 1176 | * - returns 0 if the exception should be skipped, -ERROR otherwise. |
1175 | */ | 1177 | */ |
1176 | static int gdbstub(struct pt_regs *regs, enum exception_code excep) | 1178 | static int gdbstub(struct pt_regs *regs, enum exception_code excep) |
1177 | { | 1179 | { |
@@ -1186,7 +1188,7 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep) | |||
1186 | int loop; | 1188 | int loop; |
1187 | 1189 | ||
1188 | if (excep == EXCEP_FPU_DISABLED) | 1190 | if (excep == EXCEP_FPU_DISABLED) |
1189 | return 0; | 1191 | return -ENOTSUPP; |
1190 | 1192 | ||
1191 | gdbstub_flush_caches = 0; | 1193 | gdbstub_flush_caches = 0; |
1192 | 1194 | ||
@@ -1195,7 +1197,7 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep) | |||
1195 | asm volatile("mov mdr,%0" : "=d"(mdr)); | 1197 | asm volatile("mov mdr,%0" : "=d"(mdr)); |
1196 | local_save_flags(epsw); | 1198 | local_save_flags(epsw); |
1197 | arch_local_change_intr_mask_level( | 1199 | arch_local_change_intr_mask_level( |
1198 | NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); | 1200 | NUM2EPSW_IM(CONFIG_DEBUGGER_IRQ_LEVEL + 1)); |
1199 | 1201 | ||
1200 | gdbstub_store_fpu(); | 1202 | gdbstub_store_fpu(); |
1201 | 1203 | ||
@@ -1208,11 +1210,13 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep) | |||
1208 | /* if we were single stepping, restore the opcodes hoisted for the | 1210 | /* if we were single stepping, restore the opcodes hoisted for the |
1209 | * breakpoint[s] */ | 1211 | * breakpoint[s] */ |
1210 | broke = 0; | 1212 | broke = 0; |
1213 | #ifdef CONFIG_GDBSTUB_ALLOW_SINGLE_STEP | ||
1211 | if ((step_bp[0].addr && step_bp[0].addr == (u8 *) regs->pc) || | 1214 | if ((step_bp[0].addr && step_bp[0].addr == (u8 *) regs->pc) || |
1212 | (step_bp[1].addr && step_bp[1].addr == (u8 *) regs->pc)) | 1215 | (step_bp[1].addr && step_bp[1].addr == (u8 *) regs->pc)) |
1213 | broke = 1; | 1216 | broke = 1; |
1214 | 1217 | ||
1215 | __gdbstub_restore_bp(); | 1218 | __gdbstub_restore_bp(); |
1219 | #endif | ||
1216 | 1220 | ||
1217 | if (gdbstub_rx_unget) { | 1221 | if (gdbstub_rx_unget) { |
1218 | sigval = SIGINT; | 1222 | sigval = SIGINT; |
@@ -1548,17 +1552,21 @@ packet_waiting: | |||
1548 | * Step to next instruction | 1552 | * Step to next instruction |
1549 | */ | 1553 | */ |
1550 | case 's': | 1554 | case 's': |
1551 | /* | 1555 | /* Using the T flag doesn't seem to perform single |
1552 | * using the T flag doesn't seem to perform single | ||
1553 | * stepping (it seems to wind up being caught by the | 1556 | * stepping (it seems to wind up being caught by the |
1554 | * JTAG unit), so we have to use breakpoints and | 1557 | * JTAG unit), so we have to use breakpoints and |
1555 | * continue instead. | 1558 | * continue instead. |
1556 | */ | 1559 | */ |
1560 | #ifdef CONFIG_GDBSTUB_ALLOW_SINGLE_STEP | ||
1557 | if (gdbstub_single_step(regs) < 0) | 1561 | if (gdbstub_single_step(regs) < 0) |
1558 | /* ignore any fault error for now */ | 1562 | /* ignore any fault error for now */ |
1559 | gdbstub_printk("unable to set single-step" | 1563 | gdbstub_printk("unable to set single-step" |
1560 | " bp\n"); | 1564 | " bp\n"); |
1561 | goto done; | 1565 | goto done; |
1566 | #else | ||
1567 | gdbstub_strcpy(output_buffer, "E01"); | ||
1568 | break; | ||
1569 | #endif | ||
1562 | 1570 | ||
1563 | /* | 1571 | /* |
1564 | * Set baud rate (bBB) | 1572 | * Set baud rate (bBB) |
@@ -1657,7 +1665,7 @@ done: | |||
1657 | * NB: We flush both caches, just to be sure... | 1665 | * NB: We flush both caches, just to be sure... |
1658 | */ | 1666 | */ |
1659 | if (gdbstub_flush_caches) | 1667 | if (gdbstub_flush_caches) |
1660 | gdbstub_purge_cache(); | 1668 | debugger_local_cache_flushinv(); |
1661 | 1669 | ||
1662 | gdbstub_load_fpu(); | 1670 | gdbstub_load_fpu(); |
1663 | mn10300_set_gdbleds(0); | 1671 | mn10300_set_gdbleds(0); |
@@ -1667,14 +1675,23 @@ done: | |||
1667 | touch_softlockup_watchdog(); | 1675 | touch_softlockup_watchdog(); |
1668 | 1676 | ||
1669 | local_irq_restore(epsw); | 1677 | local_irq_restore(epsw); |
1670 | return 1; | 1678 | return 0; |
1679 | } | ||
1680 | |||
1681 | /* | ||
1682 | * Determine if we hit a debugger special breakpoint that needs skipping over | ||
1683 | * automatically. | ||
1684 | */ | ||
1685 | int at_debugger_breakpoint(struct pt_regs *regs) | ||
1686 | { | ||
1687 | return 0; | ||
1671 | } | 1688 | } |
1672 | 1689 | ||
1673 | /* | 1690 | /* |
1674 | * handle event interception | 1691 | * handle event interception |
1675 | */ | 1692 | */ |
1676 | asmlinkage int gdbstub_intercept(struct pt_regs *regs, | 1693 | asmlinkage int debugger_intercept(enum exception_code excep, |
1677 | enum exception_code excep) | 1694 | int signo, int si_code, struct pt_regs *regs) |
1678 | { | 1695 | { |
1679 | static u8 notfirst = 1; | 1696 | static u8 notfirst = 1; |
1680 | int ret; | 1697 | int ret; |
@@ -1688,7 +1705,7 @@ asmlinkage int gdbstub_intercept(struct pt_regs *regs, | |||
1688 | asm("mov mdr,%0" : "=d"(mdr)); | 1705 | asm("mov mdr,%0" : "=d"(mdr)); |
1689 | 1706 | ||
1690 | gdbstub_entry( | 1707 | gdbstub_entry( |
1691 | "--> gdbstub_intercept(%p,%04x) [MDR=%lx PC=%lx]\n", | 1708 | "--> debugger_intercept(%p,%04x) [MDR=%lx PC=%lx]\n", |
1692 | regs, excep, mdr, regs->pc); | 1709 | regs, excep, mdr, regs->pc); |
1693 | 1710 | ||
1694 | gdbstub_entry( | 1711 | gdbstub_entry( |
@@ -1722,7 +1739,7 @@ asmlinkage int gdbstub_intercept(struct pt_regs *regs, | |||
1722 | 1739 | ||
1723 | ret = gdbstub(regs, excep); | 1740 | ret = gdbstub(regs, excep); |
1724 | 1741 | ||
1725 | gdbstub_entry("<-- gdbstub_intercept()\n"); | 1742 | gdbstub_entry("<-- debugger_intercept()\n"); |
1726 | gdbstub_busy = 0; | 1743 | gdbstub_busy = 0; |
1727 | return ret; | 1744 | return ret; |
1728 | } | 1745 | } |