This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix 'Undefined command' error message


Hi,

The following demonstrates the problem:

  (gdb) abc_def
  Undefined command: "abc".  Try "help".

Non-alphanumeric characters, such as underscore, are permitted in command names (including user defined commands), but are not understood when giving error messages.

The attached patch fixes the problem.

OK?

Andrew Stubbs
2005-11-15  Andrew Stubbs  <andrew.stubbs@st.com>

	* cli-decode.c (lookup_cmd): Allow all the same characters in
	command names that lookup_cmd_composition() does.

Index: src/gdb/cli/cli-decode.c
===================================================================
--- src.orig/gdb/cli/cli-decode.c	2005-05-26 21:49:02.000000000 +0100
+++ src/gdb/cli/cli-decode.c	2005-11-09 11:39:52.000000000 +0000
@@ -1196,7 +1196,12 @@ lookup_cmd (char **line, struct cmd_list
 	    {
 	      char *p = *line, *q;
 
-	      while (isalnum (*p) || *p == '-')
+	      while (*p && (isalnum (*p) || *p == '-' || *p == '_' ||
+#if defined(TUI)
+			    (tui_active &&
+			     (*p == '+' || *p == '<' || *p == '>' || *p == '$')) ||
+#endif
+			    (xdb_commands && (*p == '!' || *p == '/' || *p == '?'))))
 		p++;
 
 	      q = (char *) alloca (p - *line + 1);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]