Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Ignore case when processing CLI commands

Hi,

GDB is case-insensitive when it comes to handling CLI commands. This means the user can type break, BREAK, bReaK, and all mean the same thing. So CDI and DSF code which processes CLI command strings (i.e. CLIProcessor, CLIEventProcessor, etc) should also be case insensitive.

Have attached a patch for the following three classes:
org.eclipse.cdt.debug.mi.core.CLIProcessor
org.eclipse.cdt.dsf.mi.service.command.CLIEventProcessor
org.eclipse.cdt.dsf.mi.service.command.CLIEventProcessor_7_0

Should I file a bug?

Thanks
Abeer Bagul.
### Eclipse Workspace Patch 1.0
#P org.eclipse.cdt.debug.mi.core
Index: mi/org/eclipse/cdt/debug/mi/core/CLIProcessor.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/CLIProcessor.java,v
retrieving revision 1.14
diff -u -r1.14 CLIProcessor.java
--- mi/org/eclipse/cdt/debug/mi/core/CLIProcessor.java	15 Jul 2010 14:35:57 -0000	1.14
+++ mi/org/eclipse/cdt/debug/mi/core/CLIProcessor.java	28 Jan 2011 10:09:58 -0000
@@ -124,6 +124,10 @@
 	}
 
 	static int getSteppingOperationKind(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type n, next, N, NEXT, NeXt, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
 		int type = -1;
 		/* execution commands: n, next, s, step, si, stepi, u, until, finish, return,
 		   c, continue, fg */
@@ -167,6 +171,10 @@
 	}
 
 	boolean isSettingBreakpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type break, BREAK, bReaK, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
 		boolean isbreak = false;
 		/* breakpoints: b, break, hbreak, tbreak, rbreak, thbreak */
 		/* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
@@ -182,6 +190,10 @@
 	}
 
 	boolean isSettingWatchpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type watch, WATCH, wATch, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
 		boolean isWatch = false;
 		/* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
 		if ((operation.startsWith("wa")  && "watch".indexOf(operation)   != -1) || //$NON-NLS-1$ //$NON-NLS-2$
@@ -193,6 +205,10 @@
 	}
 
 	boolean isDeletingBreakpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type clear, CLEAR, clEAr, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
 		boolean isDelete = false;
 		/* deleting breaks: clear, delete */
 		if ((operation.startsWith("cl")  && "clear".indexOf(operation)   != -1) || //$NON-NLS-1$ //$NON-NLS-2$
@@ -203,6 +219,10 @@
 	}
 
 	boolean isChangeBreakpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type dis, DIS, Dis, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
 		boolean isChange = false;
 		/* changing breaks: enable, disable */
 		if ((operation.equals("dis") || operation.equals("disa") || //$NON-NLS-1$ //$NON-NLS-2$
@@ -216,6 +236,10 @@
 	}
 
 	int getBreakpointHint(String command) {
+    	//gdb is case-insensitive when it comes to commands 
+    	//this means the user can type catch, CATCH, caTCH, and all mean the same thing
+    	//so we too have to be case-insensitive when processing commands
+		command = command.toLowerCase();
 		StringTokenizer st = new StringTokenizer(command);
 		// get operation
 		String op = st.nextToken();
@@ -254,6 +278,10 @@
 	}
 
 	boolean isSettingSignal(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type handle, HANDLE, haNDLe, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
 		boolean isChange = false;
 		/* changing signal: handle, signal */
 		if (operation.startsWith("ha")  && "handle".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
@@ -267,6 +295,10 @@
 	 * @return
 	 */
 	boolean isDetach(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type detach, DETACH, Detach, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
 		return (operation.startsWith("det")  && "detach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 }
#P org.eclipse.cdt.dsf.gdb
Index: src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java,v
retrieving revision 1.8
diff -u -r1.8 CLIEventProcessor.java
--- src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java	4 Oct 2010 01:59:31 -0000	1.8
+++ src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java	28 Jan 2011 10:10:01 -0000
@@ -226,7 +226,11 @@
     }
 
     private static int getSteppingOperationKind(String operation) {
-        // Get the command name.
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type n, next, N, NEXT, NeXt, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
+    	// Get the command name.
         int indx = operation.indexOf(' ');
         if (indx != -1) {
             operation = operation.substring(0, indx).trim();
@@ -284,6 +288,10 @@
      * @since 4.0
      */
     public static boolean isAttachingOperation(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type attach, ATTACH, aTtAcH, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         // Get the command name.
         int indx = operation.indexOf(' ');
         if (indx != -1) {
@@ -296,6 +304,10 @@
     }
 
     private boolean isSettingBreakpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type break, BREAK, bReaK, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isbreak = false;
         /* breakpoints: b, break, hbreak, tbreak, rbreak, thbreak */
         /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
@@ -310,6 +322,10 @@
     }
 
     private boolean isSettingWatchpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type watch, WATCH, wATch, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isWatch = false;
         /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
         if ((operation.startsWith("wa")  && "watch".indexOf(operation)   != -1) || //$NON-NLS-1$ //$NON-NLS-2$
@@ -321,6 +337,10 @@
     }
 
     private boolean isDeletingBreakpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type clear, CLEAR, clEAr, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isDelete = false;
         /* deleting breaks: clear, delete */
         if ((operation.startsWith("cl")  && "clear".indexOf(operation)   != -1) || //$NON-NLS-1$ //$NON-NLS-2$
@@ -331,6 +351,10 @@
     }
 
     private boolean isChangeBreakpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type dis, DIS, Dis, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isChange = false;
         /* changing breaks: enable, disable */
         if ((operation.equals("dis") || operation.equals("disa") || //$NON-NLS-1$ //$NON-NLS-2$
@@ -344,6 +368,10 @@
     }
 
     private boolean isSettingSignal(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type handle, HANDLE, haNDLe, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isChange = false;
         /* changing signal: handle, signal */
         if (operation.startsWith("ha")  && "handle".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
@@ -357,6 +385,10 @@
      * @return
      */
     private boolean isDetach(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type detach, DETACH, Detach, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         return (operation.startsWith("det")  && "detach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
Index: src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java,v
retrieving revision 1.2
diff -u -r1.2 CLIEventProcessor_7_0.java
--- src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java	11 Feb 2010 19:10:27 -0000	1.2
+++ src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java	28 Jan 2011 10:10:01 -0000
@@ -182,6 +182,10 @@
     }
 
     private static int getSteppingOperationKind(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type n, next, N, NEXT, NeXt, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         int type = -1;
         /* execution commands: n, next, s, step, si, stepi, u, until, finish, rerurn,
            c, continue, fg */
@@ -225,6 +229,10 @@
     }
 
     private boolean isSettingBreakpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type break, BREAK, bReaK, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isbreak = false;
         /* breakpoints: b, break, hbreak, tbreak, rbreak, thbreak */
         /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
@@ -239,6 +247,10 @@
     }
 
     private boolean isSettingWatchpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type watch, WATCH, wATch, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isWatch = false;
         /* watchpoints: watch, rwatch, awatch, tbreak, rbreak, thbreak */
         if ((operation.startsWith("wa")  && "watch".indexOf(operation)   != -1) || //$NON-NLS-1$ //$NON-NLS-2$
@@ -250,6 +262,10 @@
     }
 
     private boolean isDeletingBreakpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type clear, CLEAR, clEAr, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isDelete = false;
         /* deleting breaks: clear, delete */
         if ((operation.startsWith("cl")  && "clear".indexOf(operation)   != -1) || //$NON-NLS-1$ //$NON-NLS-2$
@@ -260,6 +276,10 @@
     }
 
     private boolean isChangeBreakpoint(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type dis, DIS, Dis, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isChange = false;
         /* changing breaks: enable, disable */
         if ((operation.equals("dis") || operation.equals("disa") || //$NON-NLS-1$ //$NON-NLS-2$
@@ -273,6 +293,10 @@
     }
 
     private boolean isSettingSignal(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type handle, HANDLE, haNDLe, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         boolean isChange = false;
         /* changing signal: handle, signal */
         if (operation.startsWith("ha")  && "handle".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$
@@ -286,6 +310,10 @@
      * @return
      */
     private boolean isDetach(String operation) {
+    	//gdb is case-insensitive when it comes to operation names 
+    	//this means the user can type detach, DETACH, Detach, and all mean the same thing
+    	//so we too have to be case-insensitive when processing operation names
+    	operation = operation.toLowerCase();
         return (operation.startsWith("det")  && "detach".indexOf(operation) != -1); //$NON-NLS-1$ //$NON-NLS-2$
     }
 

Back to the top