/* MI Command Set - stack commands.
- Copyright 2000 Free Software Foundation, Inc.
+ Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
#include "value.h"
#include "mi-cmds.h"
#include "ui-out.h"
+#include "symtab.h"
+#include "block.h"
-#ifdef UI_OUT
/* FIXME: these should go in some .h file but stack.c doesn't have a
corresponding .h file. These wrappers will be obsolete anyway, once
we pull the plug on the sanitization. */
extern void select_frame_command_wrapper (char *, int);
-#endif
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
int frame_low;
int frame_high;
int i;
+ struct cleanup *cleanup_stack;
struct frame_info *fi;
if (!target_has_stack)
if (fi == NULL)
error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
- ui_out_list_begin (uiout, "stack");
+ cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "stack");
/* Now let;s print the frames up to frame_high, or until there are
frames in the stack. */
0 /* args */ );
}
- ui_out_list_end (uiout);
+ do_cleanups (cleanup_stack);
if (i < frame_high)
error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
if (argc != 1)
error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
- list_args_or_locals (1, atoi (argv[0]), selected_frame);
+ list_args_or_locals (1, atoi (argv[0]), deprecated_selected_frame);
return MI_CMD_DONE;
}
int frame_high;
int i;
struct frame_info *fi;
+ 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]");
if (fi == NULL)
error ("mi_cmd_stack_list_args: Not enough frames in stack.");
- ui_out_list_begin (uiout, "stack-args");
+ cleanup_stack_args = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
/* Now let's print the frames up to frame_high, or until there are
frames in the stack. */
fi && (i <= frame_high || frame_high == -1);
i++, fi = get_prev_frame (fi))
{
+ struct cleanup *cleanup_frame;
QUIT;
- ui_out_tuple_begin (uiout, "frame");
+ cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
ui_out_field_int (uiout, "level", i);
list_args_or_locals (0, atoi (argv[0]), fi);
- ui_out_tuple_end (uiout);
+ do_cleanups (cleanup_frame);
}
- ui_out_list_end (uiout);
+ do_cleanups (cleanup_stack_args);
if (i < frame_high)
error ("mi_cmd_stack_list_args: Not enough frames in stack.");
struct block *block;
struct symbol *sym;
int i, nsyms;
- int print_me = 0;
+ struct cleanup *cleanup_list;
static struct ui_stream *stb = NULL;
stb = ui_out_stream_new (uiout);
- block = get_frame_block (fi);
+ block = get_frame_block (fi, 0);
- ui_out_list_begin (uiout, locals ? "locals" : "args");
+ cleanup_list = make_cleanup_ui_out_list_begin_end (uiout, locals ? "locals" : "args");
while (block != 0)
{
- nsyms = BLOCK_NSYMS (block);
- for (i = 0; i < nsyms; i++)
+ ALL_BLOCK_SYMBOLS (block, i, sym)
{
- sym = BLOCK_SYM (block, i);
+ int print_me = 0;
+
switch (SYMBOL_CLASS (sym))
{
default:
case LOC_REGPARM_ADDR: /* indirect register arg */
case LOC_LOCAL_ARG: /* stack arg */
case LOC_BASEREG_ARG: /* basereg arg */
+ case LOC_COMPUTED_ARG: /* arg with computed location */
if (!locals)
print_me = 1;
break;
case LOC_BASEREG: /* basereg local */
case LOC_STATIC: /* static */
case LOC_REGISTER: /* register */
+ case LOC_COMPUTED: /* computed location */
if (locals)
print_me = 1;
break;
}
if (print_me)
{
+ struct cleanup *cleanup_tuple = NULL;
if (values)
- ui_out_tuple_begin (uiout, NULL);
- ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
+ cleanup_tuple =
+ make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+ ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
if (values)
{
struct symbol *sym2;
if (!locals)
- sym2 = lookup_symbol (SYMBOL_NAME (sym),
- block, VAR_NAMESPACE,
+ sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
+ block, VAR_DOMAIN,
(int *) NULL,
(struct symtab **) NULL);
else
sym2 = sym;
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
- ui_out_tuple_end (uiout);
+ do_cleanups (cleanup_tuple);
}
}
}
else
block = BLOCK_SUPERBLOCK (block);
}
- ui_out_list_end (uiout);
+ do_cleanups (cleanup_list);
ui_out_stream_delete (stb);
}
enum mi_cmd_result
mi_cmd_stack_select_frame (char *command, char **argv, int argc)
{
-#ifdef UI_OUT
if (!target_has_stack)
error ("mi_cmd_stack_select_frame: No stack.");
select_frame_command_wrapper (0, 1 /* not used */ );
else
select_frame_command_wrapper (argv[0], 1 /* not used */ );
-#endif
return MI_CMD_DONE;
}