kdb: make "mdr" command repeat
authorRandy Dunlap <rdunlap@infradead.org>
Fri, 8 Dec 2017 18:19:19 +0000 (10:19 -0800)
committerJason Wessel <jason.wessel@windriver.com>
Thu, 25 Jan 2018 14:41:07 +0000 (08:41 -0600)
The "mdr" command should repeat (continue) when only Enter/Return
is pressed, so make it do so.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: kgdb-bugreport@lists.sourceforge.net
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
kernel/debug/kdb/kdb_main.c

index 69e70f4021fe5d89f6e9a684488473144886aebf..ff6047d3b73f3c67ce7faf4d87d50e2e9cb59980 100644 (file)
@@ -1566,6 +1566,7 @@ static int kdb_md(int argc, const char **argv)
        int symbolic = 0;
        int valid = 0;
        int phys = 0;
+       int raw = 0;
 
        kdbgetintenv("MDCOUNT", &mdcount);
        kdbgetintenv("RADIX", &radix);
@@ -1575,9 +1576,10 @@ static int kdb_md(int argc, const char **argv)
        repeat = mdcount * 16 / bytesperword;
 
        if (strcmp(argv[0], "mdr") == 0) {
-               if (argc != 2)
+               if (argc == 2 || (argc == 0 && last_addr != 0))
+                       valid = raw = 1;
+               else
                        return KDB_ARGCOUNT;
-               valid = 1;
        } else if (isdigit(argv[0][2])) {
                bytesperword = (int)(argv[0][2] - '0');
                if (bytesperword == 0) {
@@ -1613,7 +1615,10 @@ static int kdb_md(int argc, const char **argv)
                radix = last_radix;
                bytesperword = last_bytesperword;
                repeat = last_repeat;
-               mdcount = ((repeat * bytesperword) + 15) / 16;
+               if (raw)
+                       mdcount = repeat;
+               else
+                       mdcount = ((repeat * bytesperword) + 15) / 16;
        }
 
        if (argc) {
@@ -1630,7 +1635,10 @@ static int kdb_md(int argc, const char **argv)
                        diag = kdbgetularg(argv[nextarg], &val);
                        if (!diag) {
                                mdcount = (int) val;
-                               repeat = mdcount * 16 / bytesperword;
+                               if (raw)
+                                       repeat = mdcount;
+                               else
+                                       repeat = mdcount * 16 / bytesperword;
                        }
                }
                if (argc >= nextarg+1) {
@@ -1640,8 +1648,15 @@ static int kdb_md(int argc, const char **argv)
                }
        }
 
-       if (strcmp(argv[0], "mdr") == 0)
-               return kdb_mdr(addr, mdcount);
+       if (strcmp(argv[0], "mdr") == 0) {
+               int ret;
+               last_addr = addr;
+               ret = kdb_mdr(addr, mdcount);
+               last_addr += mdcount;
+               last_repeat = mdcount;
+               last_bytesperword = bytesperword; // to make REPEAT happy
+               return ret;
+       }
 
        switch (radix) {
        case 10: