This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

[RFA] Preventing infinite loop in file-name completion


The following patch prevents GDB from entering an infinite loop when
you type e.g. "source foo<TAB>" and the first file seen by GDB happens
to be a backup file.

Okay to check in?

2000-04-05  Eli Zaretskii  <eliz@is.elta.co.il>

	* top.c (filename_completer): Set subsequent_name to 1 early on,
	to prevent an infinite loop if the first file in the directory is
	a backup file.

--- gdb/top.c~0	Sat Apr  1 19:41:12 2000
+++ gdb/top.c	Wed Apr  5 21:40:32 2000
@@ -1888,6 +1888,7 @@
 	  return_val[return_val_used++] = p;
 	  break;
 	}
+      subsequent_name = 1;
       /* Like emacs, don't complete on old versions.  Especially useful
          in the "source" command.  */
       if (p[strlen (p) - 1] == '~')
@@ -1917,7 +1918,6 @@
 	    free (p);
 	  }
       }
-      subsequent_name = 1;
     }
 #if 0
   /* There is no way to do this just long enough to affect quote inserting

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