aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Roberts <nickrob@snap.net.nz>2004-01-20 00:46:36 +0000
committerNick Roberts <nickrob@snap.net.nz>2004-01-20 00:46:36 +0000
commitc9e1f0fc1fcb1b3c000852cd83f1850c9869db79 (patch)
treea7fd16aa946ff8532eccc8e6322ac5385ac62a68
parentf5ec20424bc5ff4377f715e5130e29e0506d9a1c (diff)
downloadgdb-c9e1f0fc1fcb1b3c000852cd83f1850c9869db79.zip
gdb-c9e1f0fc1fcb1b3c000852cd83f1850c9869db79.tar.gz
gdb-c9e1f0fc1fcb1b3c000852cd83f1850c9869db79.tar.bz2
(mi_cmd_var_list_children): Print the values of the
children, if required.
-rw-r--r--gdb/mi/mi-cmd-var.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 114531c..3641187 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -257,17 +257,29 @@ mi_cmd_var_list_children (char *command, char **argv, int argc)
struct cleanup *cleanup_children;
int numchild;
char *type;
+ enum print_values print_values;
- if (argc != 1)
- error ("mi_cmd_var_list_children: Usage: NAME.");
+ if (argc != 1 && argc != 2)
+ error ("mi_cmd_var_list_children: Usage: [PRINT_VALUES] NAME");
/* Get varobj handle, if a valid var obj name was specified */
- var = varobj_get_handle (argv[0]);
+ if (argc == 1) var = varobj_get_handle (argv[0]);
+ else var = varobj_get_handle (argv[1]);
if (var == NULL)
- error ("mi_cmd_var_list_children: Variable object not found");
+ error ("Variable object not found");
numchild = varobj_list_children (var, &childlist);
ui_out_field_int (uiout, "numchild", numchild);
+ if (argc == 2)
+ if (strcmp (argv[0], "0") == 0
+ || strcmp (argv[0], "--no-values") == 0)
+ print_values = PRINT_NO_VALUES;
+ else if (strcmp (argv[0], "1") == 0
+ || strcmp (argv[0], "--all-values") == 0)
+ print_values = PRINT_ALL_VALUES;
+ else
+ error ("Unknown value for PRINT_VALUES: must be: 0 or \"--no-values\", 1 or \"--all-values\"");
+ else print_values = PRINT_NO_VALUES;
if (numchild <= 0)
return MI_CMD_DONE;
@@ -284,6 +296,8 @@ mi_cmd_var_list_children (char *command, char **argv, int argc)
ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
+ if (print_values)
+ ui_out_field_string (uiout, "value", varobj_get_value (*cc));
type = varobj_get_type (*cc);
/* C++ pseudo-variables (public, private, protected) do not have a type */
if (type)