/* MI Command Set - varobj commands.
- Copyright (C) 2000-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2014 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
#include "ui-out.h"
#include "mi-out.h"
#include "varobj.h"
+#include "language.h"
#include "value.h"
#include <ctype.h>
-#include "gdb_string.h"
#include "mi-getopt.h"
#include "gdbthread.h"
-
-const char mi_no_values[] = "--no-values";
-const char mi_simple_values[] = "--simple-values";
-const char mi_all_values[] = "--all-values";
+#include "mi-parse.h"
extern unsigned int varobjdebug; /* defined in varobj.c. */
xfree (display_hint);
}
- if (varobj_pretty_printed_p (var))
+ if (varobj_is_dynamic_p (var))
ui_out_field_int (uiout, "dynamic", 1);
}
ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));
}
-/* Parse a string argument into a print_values value. */
-
-static enum print_values
-mi_parse_values_option (const char *arg)
-{
- if (strcmp (arg, "0") == 0
- || strcmp (arg, mi_no_values) == 0)
- return PRINT_NO_VALUES;
- else if (strcmp (arg, "1") == 0
- || strcmp (arg, mi_all_values) == 0)
- return PRINT_ALL_VALUES;
- else if (strcmp (arg, "2") == 0
- || strcmp (arg, mi_simple_values) == 0)
- return PRINT_SIMPLE_VALUES;
- else
- error (_("Unknown value for PRINT_VALUES\n\
-Must be: 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
- mi_no_values, mi_simple_values, mi_all_values);
-}
-
/* Return 1 if given the argument PRINT_VALUES we should display
the varobj VAR. */
if (print_values == PRINT_ALL_VALUES)
return 1;
- if (varobj_pretty_printed_p (var))
+ if (varobj_is_dynamic_p (var))
return 1;
type = varobj_get_gdb_type (var);
children = varobj_list_children (var, &from, &to);
ui_out_field_int (uiout, "numchild", to - from);
if (argc == 2 || argc == 4)
- print_values = mi_parse_values_option (argv[0]);
+ print_values = mi_parse_print_values (argv[0]);
else
print_values = PRINT_NO_VALUES;
mi_cmd_var_info_expression (char *command, char **argv, int argc)
{
struct ui_out *uiout = current_uiout;
- enum varobj_languages lang;
+ const struct language_defn *lang;
struct varobj *var;
if (argc != 1)
lang = varobj_get_language (var);
- ui_out_field_string (uiout, "lang", varobj_language_string[(int) lang]);
+ ui_out_field_string (uiout, "lang", lang->la_natural_name);
ui_out_field_string (uiout, "exp", varobj_get_expression (var));
}
thread_id = varobj_get_thread_id (var);
- if (thread_id == -1 && is_stopped (inferior_ptid))
+ if (thread_id == -1
+ && (ptid_equal (inferior_ptid, null_ptid)
+ || is_stopped (inferior_ptid)))
thread_stopped = 1;
else
{
name = argv[1];
if (argc == 2)
- print_values = mi_parse_values_option (argv[0]);
+ print_values = mi_parse_print_values (argv[0]);
else
print_values = PRINT_NO_VALUES;
int explicit)
{
struct ui_out *uiout = current_uiout;
- struct cleanup *cleanup = NULL;
VEC (varobj_update_result) *changes;
varobj_update_result *r;
int i;
{
char *display_hint;
int from, to;
+ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
if (mi_version (uiout) > 1)
- cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+ make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", varobj_get_objname (r->varobj));
switch (r->status)
xfree (display_hint);
}
- if (varobj_pretty_printed_p (r->varobj))
+ if (varobj_is_dynamic_p (r->varobj))
ui_out_field_int (uiout, "dynamic", 1);
varobj_get_child_range (r->varobj, &from, &to);
r->new = NULL; /* Paranoia. */
}
- if (mi_version (uiout) > 1)
- do_cleanups (cleanup);
+ do_cleanups (cleanup);
}
VEC_free (varobj_update_result, changes);
}