* ppc-linux-nat.c (store_altivec_registers): Don't cast fourth
[deliverable/binutils-gdb.git] / gdb / mi / mi-cmd-stack.c
index 3cfdadbda8bddaae932ec4feafa35471d9884726..1f6a9a1aa73f0005f4093097b881156a972bb80d 100644 (file)
@@ -1,5 +1,5 @@
 /* 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);
 
@@ -46,6 +46,7 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc)
   int frame_low;
   int frame_high;
   int i;
+  struct cleanup *cleanup_stack;
   struct frame_info *fi;
 
   if (!target_has_stack)
@@ -77,7 +78,7 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc)
   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. */
@@ -96,7 +97,7 @@ mi_cmd_stack_list_frames (char *command, char **argv, int argc)
                        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.");
 
@@ -142,7 +143,7 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc)
   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;
 }
 
@@ -156,6 +157,7 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc)
   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]");
@@ -183,7 +185,7 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc)
   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. */
@@ -191,14 +193,15 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc)
        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.");
 
@@ -215,21 +218,21 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
   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:
@@ -250,6 +253,7 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
            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;
@@ -258,29 +262,32 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
            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);
                }
            }
        }
@@ -289,14 +296,13 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
       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.");
 
@@ -308,6 +314,5 @@ mi_cmd_stack_select_frame (char *command, char **argv, int argc)
     select_frame_command_wrapper (0, 1 /* not used */ );
   else
     select_frame_command_wrapper (argv[0], 1 /* not used */ );
-#endif
   return MI_CMD_DONE;
 }
This page took 0.027282 seconds and 4 git commands to generate.