This is the mail archive of the gdb-patches@sources.redhat.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]
Other format: [Raw text]

Re: report valid values for all errors for enum variables...


Sure, how 'bout:

Attachment: var_enum.patch
Description: Binary data



Jim

On Oct 27, 2003, at 8:45 AM, Andrew Cagney wrote:

Jim,

Since you're looking a that code, can you please tweak it so that it uses a mem_file instead of the 1024 byte stack buffer.

Is there a test case?

Andrew

+               /* If there was an error, print an informative
+                  error message.  */
                char msg[1024];
!               if (arg == NULL)
!                 strcpy (msg, "Requires an argument.");
!               else if (nmatches <= 0)
!                 sprintf (msg, "Undefined item: \"%s\".", arg);
!               else if (nmatches > 1)
!                 sprintf  (msg, "Ambiguous item \"%s\".", arg);
!               strcat (msg, " Valid values are ");
                for (i = 0; c->enums[i]; i++)
                  {


--
Jim Ingham                                   jingham@apple.com
Developer Tools
Apple Computer


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