mod cmd fixes for -g -r

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



6.0.3 added -g and -r options to the mod command, but they can't be used
together.   This patch allows "-r -g" or "-rg" or "-Srg" etc.

crash-6.0.3> mod -r -g -S /usr/lib/debug/lib/modules/3.1.4-clim-3-amd64
mod: invalid option -- 'g'
Usage:
  mod -s module [objfile] | -d module | -S [directory] | -D | -r | -R | -o | -g
Enter "help mod" for details.

Still working on the flaky module symbol problem...

Bob Montgomery

--- kernel.c.orig	2012-02-06 15:53:13.000000000 -0700
+++ kernel.c	2012-02-06 17:26:16.000000000 -0700
@@ -3103,25 +3103,42 @@ cmd_mod(void)
 			continue;
 
 		if (STREQ(args[c], "-g")) {
+			int ct = c;
 			pc->curcmd_flags |= MOD_SECTIONS;
-			while (c < argcnt) {
-				args[c] = args[c+1];
-				c++;
+			while (ct < argcnt) {
+				args[ct] = args[ct+1];
+				ct++;
 			}
 			argcnt--;
+			c--;
 		} else if (STREQ(args[c], "-r")) {
+			int ct = c;
 			pc->curcmd_flags |= MOD_READNOW;
-			while (c < argcnt) {
-				args[c] = args[c+1];
-				c++;
+			while (ct < argcnt) {
+				args[ct] = args[ct+1];
+				ct++;
 			}
 			argcnt--;
-		} else if ((p = strstr(args[c], "g"))) {
-			pc->curcmd_flags |= MOD_SECTIONS;
-			shift_string_left(p, 1);
-		} else if ((p = strstr(args[c], "r"))) {
-			pc->curcmd_flags |= MOD_READNOW;
-			shift_string_left(p, 1);
+			c--;
+		} else {
+			if ((p = strstr(args[c], "g"))) {
+				pc->curcmd_flags |= MOD_SECTIONS;
+				shift_string_left(p, 1);
+			} 
+			if ((p = strstr(args[c], "r"))) {
+				pc->curcmd_flags |= MOD_READNOW;
+				shift_string_left(p, 1);
+			}
+			/* if I've removed everything but the '-', toss it */
+			if (STREQ(args[c], "-")) {
+				int ct = c;
+				while (ct < argcnt) {
+					args[ct] = args[ct+1];
+					ct++;
+				}
+				argcnt--;
+				c--;
+			}
 		}
 	}
 
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux