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 1/2] Use mi_getopt in mi_cmd_stack_list_locals and mi_cmd_stack_list_variables


On 07/03/2013 02:48 AM, Yao Qi wrote:
> Hi,
> During the review of frame filter MI patch, Tom pointed that it is better
> to use mi_getopt to simplify option parsing.  Unfortunately, the code
> doesn't do it.  Since I am trying to add another option to commands
> '-stack-list-XXXX', I'd like to have a try to use mi_getopt.
> 
> For command '-stack-list-locals' and '-stack-list-variables',
> the PRINT_VALUES may confuse option parsing by mi_getopt, 

[to clarify,] because it throws error on unknown options, and
PRINT_VALUES may look like an option (--no-values, --simple-values,
etc.), or not (0, 1, etc.).

> so in this
> patch, we copy the argv except PRINT_VALUES to a new vector, and parse
> the new vector by mi_getopt.

Please help me understand the patch.  Why do we need to copy
the arg vector?  Isn't it the same to do:

	  /* Don't parse 'print-values' as an option.  */
	  int opt = mi_getopt ("-stack-list-locals", argc - 1, argv,
			       opts, &oind, &oarg);

?

-- 
Pedro Alves


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