This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] Use mi_getopt in mi_cmd_stack_list_locals and mi_cmd_stack_list_variables
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 29 Jul 2013 19:17:05 +0100
- Subject: Re: [PATCH 1/2] Use mi_getopt in mi_cmd_stack_list_locals and mi_cmd_stack_list_variables
- References: <1372816106-15942-1-git-send-email-yao at codesourcery dot com> <1372816106-15942-2-git-send-email-yao at codesourcery dot com>
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