This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Fix to enum variables
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: Fix to enum variables
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Fri, 08 Sep 2000 15:21:58 +0000
- Organization: Red Hat Canada Ltd. - Toronto
I will be checking this in soon.
Andrew fixed this same problem for commands but I found that it also
happen with enums.
If we specify an enum value that is also a substring of another value
it is not recognized :-(
2000-09-08 Fernando Nasser <fnasser@totem.to.cygnus.com>
* command.c (do_setshow_command): Make complete matches take
precedence over incomplete ones for enum variables.
Index: command.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/command.c,v
retrieving revision 1.67
diff -c -p -r1.67 command.c
*** command.c 2000/05/01 04:46:47 1.67
--- command.c 2000/09/07 22:38:50
*************** do_setshow_command (arg, from_tty, c)
*** 1696,1706 ****
nmatches = 0;
for (i = 0; c->enums[i]; i++)
! if (strncmp (arg, c->enums[i], len) == 0)
! {
! match = c->enums[i];
! nmatches++;
! }
if (nmatches <= 0)
error ("Undefined item: \"%s\".", arg);
--- 1696,1715 ----
nmatches = 0;
for (i = 0; c->enums[i]; i++)
! {
! /* An exact match takes precedence. */
! if (strcmp (arg, c->enums[i]) == 0)
! {
! match = c->enums[i];
! nmatches = 1;
! break;
! }
! if (strncmp (arg, c->enums[i], len) == 0)
! {
! match = c->enums[i];
! nmatches++;
! }
! }
if (nmatches <= 0)
error ("Undefined item: \"%s\".", arg);
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@cygnus.com