From: nickrob@snap.net.nz (Nick Roberts)
To: Vladimir Prus <vladimir@codesourcery.com>,
gdb-patches@sources.redhat.com
Subject: Re: [PATCH:gdb/mi] Update a specified list of variable objects
Date: Tue, 22 Sep 2009 00:04:00 -0000 [thread overview]
Message-ID: <19128.5244.844945.680565@totara.tehura.co.nz> (raw)
In-Reply-To: <19128.3154.796642.554720@totara.tehura.co.nz>
> I've tried to address this point below. It's even in unified diff format!
Actually it's probably better to use isdigit like below
--
Nick http://www.inet.net.nz/~nickrob
--- mi-cmd-var.c.~1.61~ 2009-09-16 18:30:24.000000000 +1200
+++ mi-cmd-var.c 2009-09-22 11:59:40.000000000 +1200
@@ -660,19 +660,57 @@ mi_cmd_var_update (char *command, char *
struct cleanup *cleanup;
char *name;
enum print_values print_values;
+ int optind = 0;
+ char *optarg;
+ struct varobj *var;
+
+ enum opt
+ {
+ NO_VALUES, SIMPLE_VALUES, ALL_VALUES
+ };
- if (argc != 1 && argc != 2)
- error (_("mi_cmd_var_update: Usage: [PRINT_VALUES] NAME."));
+ static struct mi_opt opts[] =
+ {
+ { "-no-values", NO_VALUES, 0 },
+ { "-simple-values", SIMPLE_VALUES, 0 },
+ { "-all-values", ALL_VALUES, 0 },
+ { 0, 0, 0 }
+ };
if (argc == 1)
- name = argv[0];
+ print_values = PRINT_NO_VALUES;
+ else if (argc == 2 && isdigit (*argv[0]))
+ {
+ optind = 1;
+ print_values = mi_parse_values_option (argv[0]);
+ }
else
- name = (argv[1]);
+ {
+ while (1)
+ {
+ int opt = mi_getopt ("mi_cmd_var_update",
+ argc, argv, opts, &optind, &optarg);
+ if (opt < 0)
+ break;
+ switch ((enum opt) opt)
+ {
+ case NO_VALUES:
+ print_values = PRINT_NO_VALUES;
+ break;
+ case SIMPLE_VALUES:
+ print_values = PRINT_SIMPLE_VALUES;
+ break;
+ case ALL_VALUES:
+ print_values = PRINT_ALL_VALUES;
+ break;
+ }
+ }
- if (argc == 2)
- print_values = mi_parse_values_option (argv[0]);
- else
- print_values = PRINT_NO_VALUES;
+ if (optind >= argc)
+ error (_("mi_cmd_var_update: Usage: [PRINT_VALUES] NAME1 NAME2 ..."));
+ }
+
+ name = argv[optind];
if (mi_version (uiout) <= 1)
cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
@@ -697,10 +735,15 @@ mi_cmd_var_update (char *command, char *
}
else
{
- /* Get varobj handle, if a valid var obj name was specified */
- struct varobj *var = varobj_get_handle (name);
+ int index = optind;
+ while (argv[index])
+ {
+ /* Get varobj handle, if a valid var obj name was specified */
+ var = varobj_get_handle (argv[index]);
- varobj_update_one (var, print_values, 1 /* explicit */);
+ varobj_update_one (var, print_values, 1 /* explicit */);
+ index++;
+ }
}
do_cleanups (cleanup);
next prev parent reply other threads:[~2009-09-22 0:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-21 12:09 Nick Roberts
2009-09-21 12:39 ` Vladimir Prus
2009-09-21 23:39 ` Nick Roberts
2009-09-22 0:04 ` Nick Roberts [this message]
2009-09-28 16:33 ` Vladimir Prus
2009-09-29 23:36 ` Nick Roberts
2009-09-21 16:58 ` Tom Tromey
2009-09-21 23:39 ` Nick Roberts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19128.5244.844945.680565@totara.tehura.co.nz \
--to=nickrob@snap.net.nz \
--cc=gdb-patches@sources.redhat.com \
--cc=vladimir@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox