Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: gdb/mi/mi-cmd-var.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/mi/mi-cmd-target.c ('k') | gdb/mi/mi-cmds.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/mi/mi-cmd-var.c
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 1bc7144a76b1ae56e37b29ba135a9137528db341..06036794b30e2f59d5a3a6ec4e22b161d1e18892 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -1,5 +1,4 @@
/* MI Command Set - varobj commands.
-
Copyright (C) 2000, 2002, 2004-2005, 2007-2012 Free Software
Foundation, Inc.
@@ -38,8 +37,8 @@ const char mi_all_values[] = "--all-values";
extern int varobjdebug; /* defined in varobj.c. */
static void varobj_update_one (struct varobj *var,
- enum print_values print_values,
- int explicit);
+ enum print_values print_values,
+ int explicit);
static int mi_print_value_p (struct varobj *var,
enum print_values print_values);
@@ -47,6 +46,7 @@ static int mi_print_value_p (struct varobj *var,
/* Print variable object VAR. The PRINT_VALUES parameter controls
if the value should be printed. The PRINT_EXPRESSION parameter
controls if the expression should be printed. */
+
static void
print_varobj (struct varobj *var, enum print_values print_values,
int print_expression)
@@ -109,15 +109,11 @@ mi_cmd_var_create (char *command, char **argv, int argc)
enum varobj_type var_type;
if (argc != 3)
- {
- /* mi_error_message = xstrprintf ("-var-create: Usage:
- ...."); return MI_CMD_ERROR; */
- error (_("-var-create: Usage: NAME FRAME EXPRESSION."));
- }
+ error (_("-var-create: Usage: NAME FRAME EXPRESSION."));
name = xstrdup (argv[0]);
- /* Add cleanup for name. Must be free_current_contents as
- name can be reallocated */
+ /* Add cleanup for name. Must be free_current_contents as name can
+ be reallocated. */
old_cleanups = make_cleanup (free_current_contents, &name);
frame = xstrdup (argv[1]);
@@ -175,12 +171,12 @@ mi_cmd_var_delete (char *command, char **argv, int argc)
error (_("-var-delete: Usage: [-c] EXPRESSION."));
name = xstrdup (argv[0]);
- /* Add cleanup for name. Must be free_current_contents as
- name can be reallocated */
+ /* Add cleanup for name. Must be free_current_contents as name can
+ be reallocated. */
old_cleanups = make_cleanup (free_current_contents, &name);
/* If we have one single argument it cannot be '-c' or any string
- starting with '-'. */
+ starting with '-'. */
if (argc == 1)
{
if (strcmp (name, "-c") == 0)
@@ -191,7 +187,7 @@ mi_cmd_var_delete (char *command, char **argv, int argc)
}
/* If we have 2 arguments they must be '-c' followed by a string
- which would be the variable name. */
+ which would be the variable name. */
if (argc == 2)
{
if (strcmp (name, "-c") != 0)
@@ -203,7 +199,7 @@ mi_cmd_var_delete (char *command, char **argv, int argc)
}
/* If we didn't error out, now NAME contains the name of the
- variable. */
+ variable. */
var = varobj_get_handle (name);
@@ -252,18 +248,18 @@ mi_cmd_var_set_format (char *command, char **argv, int argc)
if (argc != 2)
error (_("-var-set-format: Usage: NAME FORMAT."));
- /* Get varobj handle, if a valid var obj name was specified */
+ /* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
format = mi_parse_format (argv[1]);
- /* Set the format of VAR to given format */
+ /* Set the format of VAR to the given format. */
varobj_set_display_format (var, format);
- /* Report the new current format */
+ /* Report the new current format. */
ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
- /* Report the value in the new format */
+ /* Report the value in the new format. */
val = varobj_get_value (var);
ui_out_field_string (uiout, "value", val);
xfree (val);
@@ -305,12 +301,11 @@ mi_cmd_var_set_frozen (char *command, char **argv, int argc)
varobj_set_frozen (var, frozen);
- /* We don't automatically return the new value, or what varobjs got new
- values during unfreezing. If this information is required, client
- should call -var-update explicitly. */
+ /* We don't automatically return the new value, or what varobjs got
+ new values during unfreezing. If this information is required,
+ client should call -var-update explicitly. */
}
-
void
mi_cmd_var_show_format (char *command, char **argv, int argc)
{
@@ -321,12 +316,12 @@ mi_cmd_var_show_format (char *command, char **argv, int argc)
if (argc != 1)
error (_("-var-show-format: Usage: NAME."));
- /* Get varobj handle, if a valid var obj name was specified */
+ /* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
format = varobj_get_display_format (var);
- /* Report the current format */
+ /* Report the current format. */
ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
}
@@ -339,7 +334,7 @@ mi_cmd_var_info_num_children (char *command, char **argv, int argc)
if (argc != 1)
error (_("-var-info-num-children: Usage: NAME."));
- /* Get varobj handle, if a valid var obj name was specified */
+ /* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));
@@ -413,7 +408,7 @@ mi_cmd_var_list_children (char *command, char **argv, int argc)
error (_("-var-list-children: Usage: "
"[PRINT_VALUES] NAME [FROM TO]"));
- /* Get varobj handle, if a valid var obj name was specified */
+ /* Get varobj handle, if a valid var obj name was specified. */
if (argc == 1 || argc == 3)
var = varobj_get_handle (argv[0]);
else
@@ -479,7 +474,7 @@ mi_cmd_var_info_type (char *command, char **argv, int argc)
if (argc != 1)
error (_("-var-info-type: Usage: NAME."));
- /* Get varobj handle, if a valid var obj name was specified */
+ /* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
ui_out_field_string (uiout, "type", varobj_get_type (var));
@@ -513,7 +508,7 @@ mi_cmd_var_info_expression (char *command, char **argv, int argc)
if (argc != 1)
error (_("-var-info-expression: Usage: NAME."));
- /* Get varobj handle, if a valid var obj name was specified */
+ /* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
lang = varobj_get_language (var);
@@ -554,50 +549,50 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
enum varobj_display_formats format;
int formatFound;
- int optind;
- char *optarg;
+ int oind;
+ char *oarg;
enum opt
- {
- OP_FORMAT
- };
- static const struct mi_opt opts[] =
{
- {"f", OP_FORMAT, 1},
- { 0, 0, 0 }
+ OP_FORMAT
};
+ static const struct mi_opt opts[] =
+ {
+ {"f", OP_FORMAT, 1},
+ { 0, 0, 0 }
+ };
- /* Parse arguments */
+ /* Parse arguments. */
format = FORMAT_NATURAL;
formatFound = 0;
- optind = 0;
+ oind = 0;
while (1)
{
int opt = mi_getopt ("-var-evaluate-expression", argc, argv,
- opts, &optind, &optarg);
+ opts, &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
- {
+ {
case OP_FORMAT:
if (formatFound)
error (_("Cannot specify format more than once"));
- format = mi_parse_format (optarg);
+ format = mi_parse_format (oarg);
formatFound = 1;
break;
- }
+ }
}
- if (optind >= argc)
+ if (oind >= argc)
error (_("Usage: [-f FORMAT] NAME"));
- if (optind < argc - 1)
+ if (oind < argc - 1)
error (_("Garbage at end of command"));
- /* Get varobj handle, if a valid var obj name was specified */
- var = varobj_get_handle (argv[optind]);
+ /* Get varobj handle, if a valid var obj name was specified. */
+ var = varobj_get_handle (argv[oind]);
if (formatFound)
{
@@ -625,7 +620,7 @@ mi_cmd_var_assign (char *command, char **argv, int argc)
if (argc != 2)
error (_("-var-assign: Usage: NAME EXPRESSION."));
- /* Get varobj handle, if a valid var obj name was specified */
+ /* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
if (!varobj_editable_p (var))
@@ -672,9 +667,9 @@ mi_cmd_var_update_iter (struct varobj *var, void *data_pointer)
thread_stopped = 1;
}
- if (thread_stopped)
- if (!data->only_floating || varobj_floating_p (var))
- varobj_update_one (var, data->print_values, 0 /* implicit */);
+ if (thread_stopped
+ && (!data->only_floating || varobj_floating_p (var)))
+ varobj_update_one (var, data->print_values, 0 /* implicit */);
}
void
@@ -691,7 +686,7 @@ mi_cmd_var_update (char *command, char **argv, int argc)
if (argc == 1)
name = argv[0];
else
- name = (argv[1]);
+ name = argv[1];
if (argc == 2)
print_values = mi_parse_values_option (argv[0]);
@@ -703,25 +698,25 @@ mi_cmd_var_update (char *command, char **argv, int argc)
else
cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist");
- /* Check if the parameter is a "*" which means that we want
- to update all variables */
+ /* Check if the parameter is a "*", which means that we want to
+ update all variables. */
if ((*name == '*' || *name == '@') && (*(name + 1) == '\0'))
{
struct mi_cmd_var_update data;
- data.only_floating = *name == '@';
+ data.only_floating = (*name == '@');
data.print_values = print_values;
- /* varobj_update_one automatically updates all the children of VAROBJ.
- Therefore update each VAROBJ only once by iterating only the root
- VAROBJs. */
+ /* varobj_update_one automatically updates all the children of
+ VAROBJ. Therefore update each VAROBJ only once by iterating
+ only the root VAROBJs. */
all_root_varobjs (mi_cmd_var_update_iter, &data);
}
else
{
- /* Get varobj handle, if a valid var obj name was specified */
+ /* Get varobj handle, if a valid var obj name was specified. */
struct varobj *var = varobj_get_handle (name);
varobj_update_one (var, print_values, 1 /* explicit */);
@@ -835,6 +830,7 @@ mi_cmd_enable_pretty_printing (char *command, char **argv, int argc)
{
if (argc != 0)
error (_("-enable-pretty-printing: no arguments allowed"));
+
varobj_enable_pretty_printing ();
}
« no previous file with comments | « gdb/mi/mi-cmd-target.c ('k') | gdb/mi/mi-cmds.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698