+2013-06-03 Yao Qi <yao@codesourcery.com>
+
+ * mi/mi-cmd-var.c (mi_no_values, mi_simple_values): Move to
+ mi-parse.c. Make them static.
+ (mi_all_values): Likewise.
+ (mi_parse_values_option): Move to mi-parse.c. Rename it to
+ mi_parse_print_values. Make it external.
+ * mi/mi-cmds.h (mi_no_values, mi_simple_values, mi_all_values):
+ Remove the declarations.
+ * mi/mi-parse.c (mi_parse_print_values): Moved from mi-cmd-var.c.
+ * mi/mi-parse.h (mi_parse_print_values): Declare.
+ * mi/mi-cmd-stack.c: Include mi-parse.h.
+ (parse_print_values): Remove
+ (mi_cmd_stack_list_locals): Call mi_parse_print_values instead
+ of parse_print_values.
+ (mi_cmd_stack_list_args, mi_cmd_stack_list_variables): Likewise.
+
2013-05-31 Pedro Alves <pedro@codesourcery.com>
Yao Qi <yao@codesourcery.com>
#include "mi-getopt.h"
#include "python/python.h"
#include <ctype.h>
+#include "mi-parse.h"
enum what_to_list { locals, arguments, all };
ui_out_field_int (current_uiout, "depth", i);
}
-static enum print_values
-parse_print_values (char *name)
-{
- if (strcmp (name, "0") == 0
- || strcmp (name, mi_no_values) == 0)
- return PRINT_NO_VALUES;
- else if (strcmp (name, "1") == 0
- || strcmp (name, mi_all_values) == 0)
- return PRINT_ALL_VALUES;
- else if (strcmp (name, "2") == 0
- || strcmp (name, mi_simple_values) == 0)
- return PRINT_SIMPLE_VALUES;
- else
- error (_("Unknown value for PRINT_VALUES: must be: \
-0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
- mi_no_values, mi_all_values, mi_simple_values);
-}
-
/* Print a list of the locals for the current frame. With argument of
0, print only the names, with argument of 1 print also the
values. */
error (_("-stack-list-locals: Usage: [--no-frame-filters] PRINT_VALUES"));
frame = get_selected_frame (NULL);
- print_value = parse_print_values (argv[raw_arg]);
+ print_value = mi_parse_print_values (argv[raw_arg]);
if (! raw_arg && frame_filters)
{
frame_high = -1;
}
- print_values = parse_print_values (argv[raw_arg]);
+ print_values = mi_parse_print_values (argv[raw_arg]);
/* Let's position fi on the frame at which to start the
display. Could be the innermost frame if the whole stack needs
"[--no-frame-filters] PRINT_VALUES"));
frame = get_selected_frame (NULL);
- print_value = parse_print_values (argv[raw_arg]);
+ print_value = mi_parse_print_values (argv[raw_arg]);
if (! raw_arg && frame_filters)
{
#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. */
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. */
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;
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;
PRINT_SIMPLE_VALUES
};
-extern const char mi_no_values[];
-extern const char mi_simple_values[];
-extern const char mi_all_values[];
-
typedef void (mi_cmd_argv_ftype) (char *command, char **argv, int argc);
/* Declarations of the functions implementing each command. */
#include "gdb_string.h"
#include "cli/cli-utils.h"
+const static char mi_no_values[] = "--no-values";
+const static char mi_simple_values[] = "--simple-values";
+const static char mi_all_values[] = "--all-values";
+
/* Like parse_escape, but leave the results as a host char, not a
target char. */
parse->op = MI_COMMAND;
return parse;
}
+
+enum print_values
+mi_parse_print_values (const char *name)
+{
+ if (strcmp (name, "0") == 0
+ || strcmp (name, mi_no_values) == 0)
+ return PRINT_NO_VALUES;
+ else if (strcmp (name, "1") == 0
+ || strcmp (name, mi_all_values) == 0)
+ return PRINT_ALL_VALUES;
+ else if (strcmp (name, "2") == 0
+ || strcmp (name, mi_simple_values) == 0)
+ return PRINT_SIMPLE_VALUES;
+ else
+ error (_("Unknown value for PRINT_VALUES: must be: \
+0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
+ mi_no_values, mi_all_values, mi_simple_values);
+}
extern void mi_parse_free (struct mi_parse *cmd);
+/* Parse a string argument into a print_values value. */
+
+enum print_values mi_parse_print_values (const char *name);
+
#endif