diff options
author | Stan Shebs <shebs@codesourcery.com> | 2012-03-06 22:48:53 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 2012-03-06 22:48:53 +0000 |
commit | 2b03b41d6ac4781c8aac2baa37e9ec282dd0d2b0 (patch) | |
tree | 132fc8ce2c9fd9b998bc772902d0368cd81d8193 /gdb/mi/mi-cmd-var.c | |
parent | 3ce231f8e2a12502728fbebf0ddfaa690e986154 (diff) | |
download | gdb-2b03b41d6ac4781c8aac2baa37e9ec282dd0d2b0.zip gdb-2b03b41d6ac4781c8aac2baa37e9ec282dd0d2b0.tar.gz gdb-2b03b41d6ac4781c8aac2baa37e9ec282dd0d2b0.tar.bz2 |
* mi/mi-cmd-break.c: Enforce coding standards, fix comments.
* mi/mi-cmd-disas.c: Ditto.
* mi/mi-cmd-env.c: Ditto.
* mi/mi-cmd-file.c: Ditto.
* mi/mi-cmd-stack.c: Ditto.
* mi/mi-cmd-target.c: Ditto.
* mi/mi-cmd-var.c: Ditto.
* mi/mi-cmds.c: Ditto.
* mi/mi-cmds.h: Ditto.
* mi/mi-console.c: Ditto.
* mi/mi-getopt.c: Ditto.
* mi/mi-getopt.h: Ditto.
* mi/mi-interp.c: Ditto.
* mi/mi-main.c: Ditto.
* mi/mi-out.c: Ditto.
* mi/mi-parse.c: Ditto.
* mi/mi-parse.h: Ditto.
* mi/mi-symbol-cmds.c: Ditto.
* mi/mi-getopt.h: Move mi_opt struct up.
* mi/mi-main.c (captured_mi_execute_command): Remove redundant
return.
* mi/mi-out.c (_initialize_mi_out): Remove empty initialize.
Diffstat (limited to 'gdb/mi/mi-cmd-var.c')
-rw-r--r-- | gdb/mi/mi-cmd-var.c | 98 |
1 files changed, 47 insertions, 51 deletions
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index 4de7392..0603679 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); @@ -558,16 +553,16 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) 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; oind = 0; @@ -579,7 +574,7 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) if (opt < 0) break; switch ((enum opt) opt) - { + { case OP_FORMAT: if (formatFound) error (_("Cannot specify format more than once")); @@ -587,7 +582,7 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) format = mi_parse_format (oarg); formatFound = 1; break; - } + } } if (oind >= argc) @@ -596,7 +591,7 @@ mi_cmd_var_evaluate_expression (char *command, char **argv, int argc) if (oind < argc - 1) error (_("Garbage at end of command")); - /* 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[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 (); } |