aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/xmon/xmon.c
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2018-05-23 20:00:54 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2018-05-25 00:08:26 +1000
commit7daf59300999693b85233762b847f1b2313cccbd (patch)
tree3fc1422e3f23cb96b956141ddc4b825a607b92d4 /arch/powerpc/xmon/xmon.c
parentpowerpc/8xx: fix invalid register expression in head_8xx.S (diff)
downloadlinux-dev-7daf59300999693b85233762b847f1b2313cccbd.tar.xz
linux-dev-7daf59300999693b85233762b847f1b2313cccbd.zip
powerpc/xmon: Also setup debugger hooks when single-stepping
When single-stepping kernel code from xmon without a debug hook enabled the kernel crashes. This can happen when kernel starts with xmon on crash disabled but xmon is entered using sysrq. Call force_enable_xmon when single-stepping in xmon to install the xmon debug hooks. Fixes: e1368d0c9edb ("powerpc/xmon: Setup debugger hooks when first break-point is set") Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Vaibhav Jain <vaibhav@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/xmon/xmon.c')
-rw-r--r--arch/powerpc/xmon/xmon.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index a0842f1ff72c..252df9741d20 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -778,6 +778,16 @@ static int xmon_fault_handler(struct pt_regs *regs)
return 0;
}
+/* Force enable xmon if not already enabled */
+static inline void force_enable_xmon(void)
+{
+ /* Enable xmon hooks if needed */
+ if (!xmon_on) {
+ printf("xmon: Enabling debugger hooks\n");
+ xmon_on = 1;
+ }
+}
+
static struct bpt *at_breakpoint(unsigned long pc)
{
int i;
@@ -1094,6 +1104,7 @@ static int do_step(struct pt_regs *regs)
unsigned int instr;
int stepped;
+ force_enable_xmon();
/* check we are in 64-bit kernel mode, translation enabled */
if ((regs->msr & (MSR_64BIT|MSR_PR|MSR_IR)) == (MSR_64BIT|MSR_IR)) {
if (mread(regs->nip, &instr, 4) == 4) {
@@ -1268,16 +1279,6 @@ static long check_bp_loc(unsigned long addr)
return 1;
}
-/* Force enable xmon if not already enabled */
-static inline void force_enable_xmon(void)
-{
- /* Enable xmon hooks if needed */
- if (!xmon_on) {
- printf("xmon: Enabling debugger hooks\n");
- xmon_on = 1;
- }
-}
-
static char *breakpoint_help_string =
"Breakpoint command usage:\n"
"b show breakpoints\n"