[rfa/cli] Accept ambiguious enum when an exact match

Fernando Nasser fnasser@cygnus.com
Tue Jun 6 04:47:00 GMT 2000


Andrew,

You just removed an item from my TODO list.  I discovered this 2 weeks ago
and I was going to fix it after the 12th.

Please check it in.

Thank you.

Fernando


Andrew Cagney wrote:
> 
> Hello,
> 
> Was trying out enums with the d10v architecture but found that:
> 
>   (gdb) set architecture d10v
> 
> failed. Turned out that an ambiguous enum that exactly matched was
> ignored.
> 
> The attatched fixes this by checking for an exact match.
> 
> Ok?
> 
>         Andrew
> 
>   ----------------------------------------------------------------------------------------------------
> Tue Jun  6 21:14:47 2000  Andrew Cagney  <cagney@b1.cygnus.com>
> 
>         * command.c (do_setshow_command): Accept an enum option immediatly
>         when it is an exact match.
> 
> Index: command.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/command.c,v
> retrieving revision 1.11
> diff -p -r1.11 command.c
> *** command.c   2000/06/04 00:41:09     1.11
> --- command.c   2000/06/06 11:16:47
> *************** do_setshow_command (arg, from_tty, c)
> *** 1696,1703 ****
>             for (i = 0; c->enums[i]; i++)
>               if (strncmp (arg, c->enums[i], len) == 0)
>                 {
> !                 match = c->enums[i];
> !                 nmatches++;
>                 }
> 
>             if (nmatches <= 0)
> --- 1696,1712 ----
>             for (i = 0; c->enums[i]; i++)
>               if (strncmp (arg, c->enums[i], len) == 0)
>                 {
> !                 if (c->enums[i][len] == '\0')
> !                   {
> !                     match = c->enums[i];
> !                     nmatches = 1;
> !                     break; /* exact match. */
> !                   }
> !                 else
> !                   {
> !                     match = c->enums[i];
> !                     nmatches++;
> !                   }
>                 }
> 
>             if (nmatches <= 0)

-- 
Fernando Nasser
Cygnus Solutions (a Red Hat company)    E-Mail:  fnasser@cygnus.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299


More information about the Gdb-patches mailing list