]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Revert "kdb: Get rid of confusing diag msg from "rd" if current task has no regs"
authorDaniel Thompson <daniel.thompson@linaro.org>
Thu, 6 Feb 2020 11:40:09 +0000 (11:40 +0000)
committerDaniel Thompson <daniel.thompson@linaro.org>
Thu, 6 Feb 2020 11:40:09 +0000 (11:40 +0000)
This reverts commit bbfceba15f8d1260c328a254efc2b3f2deae4904.

When DBG_MAX_REG_NUM is zero then a number of symbols are conditionally
defined. It is therefore not possible to check it using C expressions.

Reported-by: Anatoly Pugachev <matorola@gmail.com>
Acked-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
kernel/debug/kdb/kdb_main.c

index b22292b649c419dfa269f848c6a8a7fac05f238e..ba12e9f4661ec5a8bcba4e1ec81c15df12ccef58 100644 (file)
@@ -543,8 +543,9 @@ int kdbgetaddrarg(int argc, const char **argv, int *nextarg,
                if (diag)
                        return diag;
        } else if (symname[0] == '%') {
-               if (kdb_check_regs())
-                       return 0;
+               diag = kdb_check_regs();
+               if (diag)
+                       return diag;
                /* Implement register values with % at a later time as it is
                 * arch optional.
                 */
@@ -1835,7 +1836,8 @@ static int kdb_go(int argc, const char **argv)
  */
 static int kdb_rd(int argc, const char **argv)
 {
-       int len = 0;
+       int len = kdb_check_regs();
+#if DBG_MAX_REG_NUM > 0
        int i;
        char *rname;
        int rsize;
@@ -1844,14 +1846,8 @@ static int kdb_rd(int argc, const char **argv)
        u16 reg16;
        u8 reg8;
 
-       if (kdb_check_regs())
-               return 0;
-
-       /* Fallback to Linux showregs() if we don't have DBG_MAX_REG_NUM */
-       if (DBG_MAX_REG_NUM <= 0) {
-               kdb_dumpregs(kdb_current_regs);
-               return 0;
-       }
+       if (len)
+               return len;
 
        for (i = 0; i < DBG_MAX_REG_NUM; i++) {
                rsize = dbg_reg_def[i].size * 2;
@@ -1893,7 +1889,12 @@ static int kdb_rd(int argc, const char **argv)
                }
        }
        kdb_printf("\n");
+#else
+       if (len)
+               return len;
 
+       kdb_dumpregs(kdb_current_regs);
+#endif
        return 0;
 }
 
@@ -1927,8 +1928,9 @@ static int kdb_rm(int argc, const char **argv)
        if (diag)
                return diag;
 
-       if (kdb_check_regs())
-               return 0;
+       diag = kdb_check_regs();
+       if (diag)
+               return diag;
 
        diag = KDB_BADREG;
        for (i = 0; i < DBG_MAX_REG_NUM; i++) {