powerpc/xmon: Allow listing and clearing breakpoints in read-only mode
authorChristopher M. Riedl <cmr@informatik.wtf>
Sat, 7 Sep 2019 06:11:23 +0000 (01:11 -0500)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 28 Oct 2019 10:54:15 +0000 (21:54 +1100)
Read-only mode should not prevent listing and clearing any active
breakpoints.

Tested-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Christopher M. Riedl <cmr@informatik.wtf>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190907061124.1947-2-cmr@informatik.wtf
arch/powerpc/xmon/xmon.c

index d83364ebc5c5ad17f4a3730c081a910495dcd5a3..0a0d84261678d8cda0ac385611e1121152d3fd75 100644 (file)
@@ -1047,10 +1047,6 @@ cmds(struct pt_regs *excp)
                        set_lpp_cmd();
                        break;
                case 'b':
-                       if (xmon_is_ro) {
-                               printf(xmon_ro_msg);
-                               break;
-                       }
                        bpt_cmds();
                        break;
                case 'C':
@@ -1319,11 +1315,16 @@ bpt_cmds(void)
        struct bpt *bp;
 
        cmd = inchar();
+
        switch (cmd) {
 #ifndef CONFIG_PPC_8xx
        static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n";
        int mode;
        case 'd':       /* bd - hardware data breakpoint */
+               if (xmon_is_ro) {
+                       printf(xmon_ro_msg);
+                       break;
+               }
                if (!ppc_breakpoint_available()) {
                        printf("Hardware data breakpoint not supported on this cpu\n");
                        break;
@@ -1351,6 +1352,10 @@ bpt_cmds(void)
                break;
 
        case 'i':       /* bi - hardware instr breakpoint */
+               if (xmon_is_ro) {
+                       printf(xmon_ro_msg);
+                       break;
+               }
                if (!cpu_has_feature(CPU_FTR_ARCH_207S)) {
                        printf("Hardware instruction breakpoint "
                               "not supported on this cpu\n");
@@ -1409,7 +1414,8 @@ bpt_cmds(void)
                        break;
                }
                termch = cmd;
-               if (!scanhex(&a)) {
+
+               if (xmon_is_ro || !scanhex(&a)) {
                        /* print all breakpoints */
                        printf("   type            address\n");
                        if (dabr.enabled) {