[RFC] Provide minimal debugging to crash

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

 



Hi
Sachin and myself have worked on this patch. In case the memory dump is corrupted crash tool exits from execution and we don't have any means to debug the problem. This feature provides minimalistic features to crash and help in debugging even if dump is corrupted.

Description of the patch:
This patch will provide the minimal functionality in crash tool. This patch has been generated against crash-4.0.6.2. This feature will read the dump, even if it is corrupted. It provides minimal debugging features, as provided by lcrash tool earlier. It provides access to dmesg, symbol information, disassembly and memory read features. You can get into minimal mode by providing "--minimal" option while starting crash
    eg: crash --minimal <vmlinux> <dump>
========================================================================
Testing:
This patch has been tested on the corrupted dump images on z-series machine. 'help' command in the minimal mode gives out put in a line, not like the way out put is generated in the normal mode of operation.

Please go through the features and let us know your thoughts
========================================================================
	
Thanks
Yeehaw


diff -Naurp crash-old/cmdline.c crash-new/cmdline.c
--- crash-old/cmdline.c	2008-03-31 22:58:31.000000000 +0530
+++ crash-new/cmdline.c	2008-08-01 16:36:44.000000000 +0530
@@ -2137,3 +2137,11 @@ wait_for_children(ulong waitflag)
 		stall(1000);
 	}
 }
+
+int minimal_functions(char *name)
+{
+	return  STREQ("log", name) || STREQ("help",name) || \
+		STREQ("dis", name) || STREQ("q", name)   || \
+		STREQ("sym", name) || STREQ("exit", name)|| \
+		STREQ("rd", name); 
+}
diff -Naurp crash-old/defs.h crash-new/defs.h
--- crash-old/defs.h	2008-03-31 22:58:31.000000000 +0530
+++ crash-new/defs.h	2008-08-04 13:36:23.000000000 +0530
@@ -183,6 +183,7 @@ struct number_option {
 #define PLEASE_WAIT   (0x200000000000000ULL)
 #define IFILE_ERROR   (0x400000000000000ULL)
 #define KERNTYPES     (0x800000000000000ULL)
+#define MINIMAL_MODE (0x1000000000000000ULL)
 
 #define ACTIVE()            (pc->flags & LIVE_SYSTEM)
 #define DUMPFILE()          (!(pc->flags & LIVE_SYSTEM))
@@ -3129,6 +3130,7 @@ int received_SIGINT(void);
 void debug_redirect(char *);
 int CRASHPAGER_valid(void);
 char *setup_scroll_command(void);
+int minimal_functions(char *);
 
 /*
  *  tools.c
diff -Naurp crash-old/help.c crash-new/help.c
--- crash-old/help.c	2008-08-01 16:49:16.000000000 +0530
+++ crash-new/help.c	2008-08-01 16:52:28.000000000 +0530
@@ -420,12 +420,14 @@ display_help_screen(char *indent)
         for (i = 0; i < rows; i++) {
                 namep = &pc->cmdlist[i];
                 for (j = 0; j < HELP_COLUMNS; j++) {
-                        fprintf(fp,"%-15s", *namep);
+			if(!((pc->flags & MINIMAL_MODE)&&!(minimal_functions(*namep))))
+                        	fprintf(fp,"%-15s", *namep);
                         namep += rows;
                         if ((namep - pc->cmdlist) >= pc->ncmds)
                                 break;
                 }
-                fprintf(fp,"\n%s", indent);
+		if(!(pc->flags & MINIMAL_MODE))
+	                fprintf(fp,"\n%s", indent);
         }
 
         fprintf(fp, "\n%s%s version: %-6s   gdb version: %s\n", indent,
diff -Naurp crash-old/main.c crash-new/main.c
--- crash-old/main.c	2008-03-31 22:58:31.000000000 +0530
+++ crash-new/main.c	2008-08-04 13:38:33.000000000 +0530
@@ -56,6 +56,7 @@ static struct option long_options[] = {
         {"no_scroll", 0, 0, 0},
         {"reloc", required_argument, 0, 0},
 	{"active", 0, 0, 0},
+	{"minimal", 0, 0, 0},
         {0, 0, 0, 0}
 };
 
@@ -197,6 +198,9 @@ main(int argc, char **argv)
 				kt->flags |= RELOC_SET;
 			}
 
+			else if (STREQ(long_options[option_index].name, "minimal")) 
+				pc->flags |= MINIMAL_MODE;
+
 			else {
 				error(INFO, "internal error: option %s unhandled\n",
 					long_options[option_index].name);
@@ -492,7 +496,7 @@ main_loop(void)
 #else
         		error(FATAL, XEN_HYPERVISOR_NOT_SUPPORTED);
 #endif
-		} else {
+		} else if(!(pc->flags & MINIMAL_MODE)){
 			read_in_kernel_config(IKCFG_INIT);
 			kernel_init();
 			machdep_init(POST_GDB);
@@ -520,7 +524,7 @@ main_loop(void)
 #else
         		error(FATAL, XEN_HYPERVISOR_NOT_SUPPORTED);
 #endif
-		} else {
+		} else if(!(pc->flags & MINIMAL_MODE)){
 			display_sys_stats();
 			show_context(CURRENT_CONTEXT());
 		}
@@ -610,7 +614,10 @@ reattempt:
 		return;
 
 	pc->curcmd = pc->program_name;
-	error(INFO, "command not found: %s\n", args[0]);
+	if (!(pc->flags & MINIMAL_MODE)) 
+		error(INFO, "command not found: %s\n", args[0]);
+	else
+		error(INFO, "command: %s not available in minimal mode\n", args[0]);
 
 	if (pc->curcmd_flags & REPEAT)
 		pc->curcmd_flags &= ~REPEAT;
@@ -625,6 +632,9 @@ get_command_table_entry(char *name)
 {       
         struct command_table_entry *cp;
         struct extension_table *ext;
+	
+	if ((pc->flags & MINIMAL_MODE) && !minimal_functions(name)) 
+		return NULL;
   
 	for (cp = pc->cmd_table; cp->name; cp++) {
                 if (STREQ(cp->name, name))
--
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