This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH:gdb/mi] Update a specified list of variable objects
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 21 Sep 2009 16:39:05 +0400
- Subject: Re: [PATCH:gdb/mi] Update a specified list of variable objects
- References: <19127.27863.973393.962895@totara.tehura.co.nz>
Nick Roberts wrote:
> Since -var-list-children currently creates variable objects of all children
> and this may be a large number, I would like to be able to restrict
> -var-update to just update those variable objects whose expressions are
> visible in the front end. This could be done by updating them individually
> but that might result in many round trips. I would therefore like to commit
> the following patch which allows a list of variable objects to be specified in
> the argument to -var-update:
>
> -var-update [PRINT_VALUES] NAME1 NAME2 ...
>
Hi Nick,
the general idea seems good. There is a minor issue. You have made this change
- if (argc == 2)
- print_values = mi_parse_values_option (argv[0]);
- else
- print_values = PRINT_NO_VALUES;
+ while (1)
+ {
+ int opt = mi_getopt ("mi_cmd_var_update",
+ argc, argv, opts, &optind, &optarg);
mi_parse_values_option used to accept 0, 1 and 2, in addition to
string values, and your change breaks that. So, I observe this:
(gdb)
-var-create foo @ 10
^done,name="foo",numchild="0",value="10",type="int",has_more="0"
(gdb)
-var-update 0 foo
^error,msg="Variable object not found"
and it works for me with 6.8
Would it be easier to rename mi_parse_values_option to
mi_parse_values_option_nothrow and write new mi_parse_values_option that
would call mi_parse_values_option_nothrow and call error as necessary?
- Volodya