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

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

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 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 06036794b30e2f59d5a3a6ec4e22b161d1e18892..84cdc1562767384cfd26a7dc76782b019ba90c5a 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -1,6 +1,5 @@
/* MI Command Set - varobj commands.
- Copyright (C) 2000, 2002, 2004-2005, 2007-2012 Free Software
- Foundation, Inc.
+ Copyright (C) 2000-2013 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
@@ -21,20 +20,19 @@
#include "defs.h"
#include "mi-cmds.h"
+#include "mi-main.h"
#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 <string.h>
#include "mi-getopt.h"
#include "gdbthread.h"
+#include "mi-parse.h"
-const char mi_no_values[] = "--no-values";
-const char mi_simple_values[] = "--simple-values";
-const char mi_all_values[] = "--all-values";
-
-extern int varobjdebug; /* defined in varobj.c. */
+extern unsigned int varobjdebug; /* defined in varobj.c. */
static void varobj_update_one (struct varobj *var,
enum print_values print_values,
@@ -340,26 +338,6 @@ mi_cmd_var_info_num_children (char *command, char **argv, int argc)
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. */
@@ -428,7 +406,7 @@ mi_cmd_var_list_children (char *command, char **argv, int argc)
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;
@@ -502,7 +480,7 @@ void
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)
@@ -513,7 +491,7 @@ mi_cmd_var_info_expression (char *command, char **argv, int argc)
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));
}
@@ -616,6 +594,7 @@ mi_cmd_var_assign (char *command, char **argv, int argc)
struct ui_out *uiout = current_uiout;
struct varobj *var;
char *expression, *val;
+ struct cleanup *cleanup;
if (argc != 2)
error (_("-var-assign: Usage: NAME EXPRESSION."));
@@ -628,6 +607,12 @@ mi_cmd_var_assign (char *command, char **argv, int argc)
expression = xstrdup (argv[1]);
+ /* MI command '-var-assign' may write memory, so suppress memory
+ changed notification if it does. */
+ cleanup
+ = make_cleanup_restore_integer (&mi_suppress_notification.memory);
+ mi_suppress_notification.memory = 1;
+
if (!varobj_set_value (var, expression))
error (_("-var-assign: Could not assign "
"expression to variable object"));
@@ -635,6 +620,8 @@ mi_cmd_var_assign (char *command, char **argv, int argc)
val = varobj_get_value (var);
ui_out_field_string (uiout, "value", val);
xfree (val);
+
+ do_cleanups (cleanup);
}
/* Type used for parameters passing to mi_cmd_var_update_iter. */
@@ -689,7 +676,7 @@ mi_cmd_var_update (char *command, char **argv, int argc)
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;
@@ -732,7 +719,6 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
int explicit)
{
struct ui_out *uiout = current_uiout;
- struct cleanup *cleanup = NULL;
VEC (varobj_update_result) *changes;
varobj_update_result *r;
int i;
@@ -743,9 +729,10 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
{
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)
@@ -783,14 +770,14 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
ui_out_field_int (uiout, "new_num_children",
varobj_get_num_children (r->varobj));
- display_hint = varobj_get_display_hint (var);
+ display_hint = varobj_get_display_hint (r->varobj);
if (display_hint)
{
ui_out_field_string (uiout, "displayhint", display_hint);
xfree (display_hint);
}
- if (varobj_pretty_printed_p (var))
+ if (varobj_pretty_printed_p (r->varobj))
ui_out_field_int (uiout, "dynamic", 1);
varobj_get_child_range (r->varobj, &from, &to);
@@ -819,8 +806,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
r->new = NULL; /* Paranoia. */
}
- if (mi_version (uiout) > 1)
- do_cleanups (cleanup);
+ do_cleanups (cleanup);
}
VEC_free (varobj_update_result, changes);
}
« 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