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]

Re: [patch][python] 2 of 5 - Frame filter MI code changes.


On 13/03/13 17:48, Tom Tromey wrote:
>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
> 
>>> I think -stack-list-frames takes "-no-frame-filters" but this and others
>>> take the "--" form.  That seems confusing.
> 
> Phil> They all take the "--" notation
>  
> I think mi_getopt just looks for a single '-'.

I do apologies, I forgot to add the mi-getopt.c patch in with the
patch-set.  Here it is.

Cheers

Phil

--

diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c
index a1e2ccc..be76ac1 100644
--- a/gdb/mi/mi-getopt.c
+++ b/gdb/mi/mi-getopt.c
@@ -29,6 +29,7 @@ mi_getopt (const char *prefix,
 {
   char *arg;
   const struct mi_opt *opt;
+  int olength = 1;
 
   /* We assume that argv/argc are ok.  */
   if (*oind > argc || *oind < 0)
@@ -50,10 +51,15 @@ mi_getopt (const char *prefix,
       *oarg = NULL;
       return -1;
     }
+
+  /* Deal with --foo options.  */
+  if (arg[0] == '-' && arg[1] == '-')
+    olength++;
+
   /* Look the option up.  */
   for (opt = opts; opt->name != NULL; opt++)
     {
-      if (strcmp (opt->name, arg + 1) != 0)
+      if (strcmp (opt->name, arg + olength) != 0)
 	continue;
       if (opt->arg_p)
 	{
@@ -71,7 +77,7 @@ mi_getopt (const char *prefix,
 	  return opt->index;
 	}
     }
-  error (_("%s: Unknown option ``%s''"), prefix, arg + 1);
+  error (_("%s: Unknown option ``%s''"), prefix, arg + olength);
 }
 
 int 



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