/* MI Command Set - stack commands.
- Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008
+ Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "target.h"
struct cleanup *cleanup_stack;
struct frame_info *fi;
- if (!target_has_stack)
- error ("mi_cmd_stack_list_frames: No stack.");
-
if (argc > 2 || argc == 1)
- error ("mi_cmd_stack_list_frames: Usage: [FRAME_LOW FRAME_HIGH]");
+ error (_("mi_cmd_stack_list_frames: Usage: [FRAME_LOW FRAME_HIGH]"));
if (argc == 2)
{
i++, fi = get_prev_frame (fi));
if (fi == NULL)
- error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
+ error (_("mi_cmd_stack_list_frames: Not enough frames in stack."));
cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "stack");
i++, fi = get_prev_frame (fi))
{
QUIT;
- /* level == i: always print the level 'i'
- source == LOC_AND_ADDRESS: print the location and the address
- always, even for level 0.
+ /* Print the location and the address always, even for level 0.
args == 0: don't print the arguments. */
- print_frame_info (fi /* frame info */ ,
- i /* level */ ,
- LOC_AND_ADDRESS /* source */ ,
- 0 /* args */ );
+ print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ );
}
do_cleanups (cleanup_stack);
- if (i < frame_high)
- error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
return MI_CMD_DONE;
}
int i;
struct frame_info *fi;
- if (!target_has_stack)
- error ("mi_cmd_stack_info_depth: No stack.");
-
if (argc > 1)
- error ("mi_cmd_stack_info_depth: Usage: [MAX_DEPTH]");
+ error (_("mi_cmd_stack_info_depth: Usage: [MAX_DEPTH]"));
if (argc == 1)
frame_high = atoi (argv[0]);
enum print_values print_values;
if (argc != 1)
- error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
+ error (_("mi_cmd_stack_list_locals: Usage: PRINT_VALUES"));
- frame = get_selected_frame ();
+ frame = get_selected_frame (NULL);
if (strcmp (argv[0], "0") == 0
- || strcmp (argv[0], "--no-values") == 0)
+ || strcmp (argv[0], mi_no_values) == 0)
print_values = PRINT_NO_VALUES;
else if (strcmp (argv[0], "1") == 0
- || strcmp (argv[0], "--all-values") == 0)
+ || strcmp (argv[0], mi_all_values) == 0)
print_values = PRINT_ALL_VALUES;
else if (strcmp (argv[0], "2") == 0
- || strcmp (argv[0], "--simple-values") == 0)
+ || strcmp (argv[0], mi_simple_values) == 0)
print_values = PRINT_SIMPLE_VALUES;
else
- error ("Unknown value for PRINT_VALUES: must be: 0 or \"--no-values\", 1 or \"--all-values\", 2 or \"--simple-values\"");
+ 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);
list_args_or_locals (1, print_values, frame);
return MI_CMD_DONE;
}
struct cleanup *cleanup_stack_args;
if (argc < 1 || argc > 3 || argc == 2)
- error ("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]");
+ error (_("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]"));
if (argc == 3)
{
i++, fi = get_prev_frame (fi));
if (fi == NULL)
- error ("mi_cmd_stack_list_args: Not enough frames in stack.");
+ error (_("mi_cmd_stack_list_args: Not enough frames in stack."));
cleanup_stack_args = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
}
do_cleanups (cleanup_stack_args);
- if (i < frame_high)
- error ("mi_cmd_stack_list_args: Not enough frames in stack.");
return MI_CMD_DONE;
}
if (print_me)
{
struct cleanup *cleanup_tuple = NULL;
+ struct symbol *sym2;
+ struct value *val;
if (values != PRINT_NO_VALUES)
cleanup_tuple =
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", SYMBOL_PRINT_NAME (sym));
- struct symbol *sym2;
if (!locals)
sym2 = lookup_symbol (SYMBOL_NATURAL_NAME (sym),
block, VAR_DOMAIN,
&& TYPE_CODE (type) != TYPE_CODE_STRUCT
&& TYPE_CODE (type) != TYPE_CODE_UNION)
{
- print_variable_value (sym2, fi, stb->stream);
+ val = read_var_value (sym2, fi);
+ common_val_print
+ (val, stb->stream, 0, 1, 0, Val_no_prettyprint);
ui_out_field_stream (uiout, "value", stb);
}
do_cleanups (cleanup_tuple);
break;
case PRINT_ALL_VALUES:
- print_variable_value (sym2, fi, stb->stream);
+ val = read_var_value (sym2, fi);
+ common_val_print
+ (val, stb->stream, 0, 1, 0, Val_no_prettyprint);
ui_out_field_stream (uiout, "value", stb);
do_cleanups (cleanup_tuple);
break;
enum mi_cmd_result
mi_cmd_stack_select_frame (char *command, char **argv, int argc)
{
- if (!target_has_stack)
- error ("mi_cmd_stack_select_frame: No stack.");
+ if (argc == 0 || argc > 1)
+ error (_("mi_cmd_stack_select_frame: Usage: FRAME_SPEC"));
- if (argc > 1)
- error ("mi_cmd_stack_select_frame: Usage: [FRAME_SPEC]");
+ select_frame_command (argv[0], 1 /* not used */ );
+ return MI_CMD_DONE;
+}
- /* with no args, don't change frame */
- if (argc == 0)
- select_frame_command (0, 1 /* not used */ );
- else
- select_frame_command (argv[0], 1 /* not used */ );
+enum mi_cmd_result
+mi_cmd_stack_info_frame (char *command, char **argv, int argc)
+{
+ if (argc > 0)
+ error (_("mi_cmd_stack_info_frame: No arguments required"));
+
+ print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0);
return MI_CMD_DONE;
}