2003-09-14 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / stack.c
index b48dec794b3756ac0ea9d87d7d240bd32b500b48..4015099e715f0a846aa2043b05a9703c35fb2e25 100644 (file)
 #include "inferior.h"
 #include "annotate.h"
 #include "ui-out.h"
+#include "block.h"
+#include "stack.h"
+#include "gdb_assert.h"
+#include "dictionary.h"
 
 /* Prototypes for exported functions. */
 
@@ -70,8 +74,6 @@ void frame_command (char *, int);
 
 static void current_frame_command (char *, int);
 
-static void select_frame_command (char *, int);
-
 static void print_frame_arg_vars (struct frame_info *, struct ui_file *);
 
 static void catch_info (char *, int);
@@ -167,6 +169,225 @@ struct print_args_args
 
 static int print_args_stub (void *);
 
+/* Print nameless args on STREAM.
+   FI is the frameinfo for this frame, START is the offset
+   of the first nameless arg, and NUM is the number of nameless args to
+   print.  FIRST is nonzero if this is the first argument (not just
+   the first nameless arg).  */
+
+static void
+print_frame_nameless_args (struct frame_info *fi, long start, int num,
+                          int first, struct ui_file *stream)
+{
+  int i;
+  CORE_ADDR argsaddr;
+  long arg_value;
+
+  for (i = 0; i < num; i++)
+    {
+      QUIT;
+      argsaddr = get_frame_args_address (fi);
+      if (!argsaddr)
+       return;
+      arg_value = read_memory_integer (argsaddr + start, sizeof (int));
+      if (!first)
+       fprintf_filtered (stream, ", ");
+      fprintf_filtered (stream, "%ld", arg_value);
+      first = 0;
+      start += sizeof (int);
+    }
+}
+
+/* Print the arguments of a stack frame, given the function FUNC
+   running in that frame (as a symbol), the info on the frame,
+   and the number of args according to the stack frame (or -1 if unknown).  */
+
+/* References here and elsewhere to "number of args according to the
+   stack frame" appear in all cases to refer to "number of ints of args
+   according to the stack frame".  At least for VAX, i386, isi.  */
+
+static void
+print_frame_args (struct symbol *func, struct frame_info *fi, int num,
+                 struct ui_file *stream)
+{
+  struct block *b = NULL;
+  int first = 1;
+  struct dict_iterator iter;
+  struct symbol *sym;
+  struct value *val;
+  /* Offset of next stack argument beyond the one we have seen that is
+     at the highest offset.
+     -1 if we haven't come to a stack argument yet.  */
+  long highest_offset = -1;
+  int arg_size;
+  /* Number of ints of arguments that we have printed so far.  */
+  int args_printed = 0;
+  struct cleanup *old_chain, *list_chain;
+  struct ui_stream *stb;
+
+  stb = ui_out_stream_new (uiout);
+  old_chain = make_cleanup_ui_out_stream_delete (stb);
+
+  if (func)
+    {
+      b = SYMBOL_BLOCK_VALUE (func);
+
+      ALL_BLOCK_SYMBOLS (b, iter, sym)
+        {
+         QUIT;
+
+         /* Keep track of the highest stack argument offset seen, and
+            skip over any kinds of symbols we don't care about.  */
+
+         switch (SYMBOL_CLASS (sym))
+           {
+           case LOC_ARG:
+           case LOC_REF_ARG:
+             {
+               long current_offset = SYMBOL_VALUE (sym);
+               arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym));
+
+               /* Compute address of next argument by adding the size of
+                  this argument and rounding to an int boundary.  */
+               current_offset =
+                 ((current_offset + arg_size + sizeof (int) - 1)
+                  & ~(sizeof (int) - 1));
+
+               /* If this is the highest offset seen yet, set highest_offset.  */
+               if (highest_offset == -1
+                   || (current_offset > highest_offset))
+                 highest_offset = current_offset;
+
+               /* Add the number of ints we're about to print to args_printed.  */
+               args_printed += (arg_size + sizeof (int) - 1) / sizeof (int);
+             }
+
+             /* We care about types of symbols, but don't need to keep track of
+                stack offsets in them.  */
+           case LOC_REGPARM:
+           case LOC_REGPARM_ADDR:
+           case LOC_LOCAL_ARG:
+           case LOC_BASEREG_ARG:
+           case LOC_COMPUTED_ARG:
+             break;
+
+           /* Other types of symbols we just skip over.  */
+           default:
+             continue;
+           }
+
+         /* We have to look up the symbol because arguments can have
+            two entries (one a parameter, one a local) and the one we
+            want is the local, which lookup_symbol will find for us.
+            This includes gcc1 (not gcc2) on the sparc when passing a
+            small structure and gcc2 when the argument type is float
+            and it is passed as a double and converted to float by
+            the prologue (in the latter case the type of the LOC_ARG
+            symbol is double and the type of the LOC_LOCAL symbol is
+            float).  */
+         /* But if the parameter name is null, don't try it.
+            Null parameter names occur on the RS/6000, for traceback tables.
+            FIXME, should we even print them?  */
+
+         if (*DEPRECATED_SYMBOL_NAME (sym))
+           {
+             struct symbol *nsym;
+             nsym = lookup_symbol
+               (DEPRECATED_SYMBOL_NAME (sym),
+                b, VAR_DOMAIN, (int *) NULL, (struct symtab **) NULL);
+             if (SYMBOL_CLASS (nsym) == LOC_REGISTER)
+               {
+                 /* There is a LOC_ARG/LOC_REGISTER pair.  This means that
+                    it was passed on the stack and loaded into a register,
+                    or passed in a register and stored in a stack slot.
+                    GDB 3.x used the LOC_ARG; GDB 4.0-4.11 used the LOC_REGISTER.
+
+                    Reasons for using the LOC_ARG:
+                    (1) because find_saved_registers may be slow for remote
+                    debugging,
+                    (2) because registers are often re-used and stack slots
+                    rarely (never?) are.  Therefore using the stack slot is
+                    much less likely to print garbage.
+
+                    Reasons why we might want to use the LOC_REGISTER:
+                    (1) So that the backtrace prints the same value as
+                    "print foo".  I see no compelling reason why this needs
+                    to be the case; having the backtrace print the value which
+                    was passed in, and "print foo" print the value as modified
+                    within the called function, makes perfect sense to me.
+
+                    Additional note:  It might be nice if "info args" displayed
+                    both values.
+                    One more note:  There is a case with sparc structure passing
+                    where we need to use the LOC_REGISTER, but this is dealt with
+                    by creating a single LOC_REGPARM in symbol reading.  */
+
+                 /* Leave sym (the LOC_ARG) alone.  */
+                 ;
+               }
+             else
+               sym = nsym;
+           }
+
+         /* Print the current arg.  */
+         if (!first)
+           ui_out_text (uiout, ", ");
+         ui_out_wrap_hint (uiout, "    ");
+
+         annotate_arg_begin ();
+
+         list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+         fprintf_symbol_filtered (stb->stream, SYMBOL_PRINT_NAME (sym),
+                                  SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI);
+         ui_out_field_stream (uiout, "name", stb);
+         annotate_arg_name_end ();
+         ui_out_text (uiout, "=");
+
+         /* Avoid value_print because it will deref ref parameters.  We just
+            want to print their addresses.  Print ??? for args whose address
+            we do not know.  We pass 2 as "recurse" to val_print because our
+            standard indentation here is 4 spaces, and val_print indents
+            2 for each recurse.  */
+         val = read_var_value (sym, fi);
+
+         annotate_arg_value (val == NULL ? NULL : VALUE_TYPE (val));
+
+         if (val)
+           {
+             val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0,
+                        VALUE_ADDRESS (val),
+                        stb->stream, 0, 0, 2, Val_no_prettyprint);
+             ui_out_field_stream (uiout, "value", stb);
+           }
+         else
+           ui_out_text (uiout, "???");
+
+         /* Invoke ui_out_tuple_end.  */
+         do_cleanups (list_chain);
+
+         annotate_arg_end ();
+
+         first = 0;
+       }
+    }
+
+  /* Don't print nameless args in situations where we don't know
+     enough about the stack to find them.  */
+  if (num != -1)
+    {
+      long start;
+
+      if (highest_offset == -1)
+       start = FRAME_ARGS_SKIP;
+      else
+       start = highest_offset;
+
+      print_frame_nameless_args (fi, start, num - args_printed,
+                                first, stream);
+    }
+  do_cleanups (old_chain);
+}
+
 /* Pass the args the way catch_errors wants them.  */
 
 static int
@@ -175,7 +396,13 @@ print_args_stub (void *args)
   int numargs;
   struct print_args_args *p = (struct print_args_args *) args;
 
-  numargs = FRAME_NUM_ARGS (p->fi);
+  if (FRAME_NUM_ARGS_P ())
+    {
+      numargs = FRAME_NUM_ARGS (p->fi);
+      gdb_assert (numargs >= 0);
+    }
+  else
+    numargs = -1;
   print_frame_args (p->func, p->fi, numargs, p->stream);
   return 0;
 }
@@ -197,8 +424,12 @@ print_frame_info (struct frame_info *fi, int level, int source, int args)
   int source_print;
   int location_print;
 
-  if (get_frame_type (fi) == DUMMY_FRAME)
+  if (get_frame_type (fi) == DUMMY_FRAME
+      || get_frame_type (fi) == SIGTRAMP_FRAME)
     {
+      struct cleanup *uiout_cleanup
+       = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
+
       annotate_frame_begin (level == -1 ? 0 : level, get_frame_pc (fi));
 
       /* Do this regardless of SOURCE because we don't have any source
@@ -208,25 +439,27 @@ print_frame_info (struct frame_info *fi, int level, int source, int args)
           ui_out_text (uiout, "#");
           ui_out_field_fmt_int (uiout, 2, ui_left, "level", level);
         }
-      annotate_function_call ();
-      printf_filtered ("<function called from gdb>\n");
-      annotate_frame_end ();
-      return;
-    }
-  if ((get_frame_type (fi) == SIGTRAMP_FRAME))
-    {
-      annotate_frame_begin (level == -1 ? 0 : level, get_frame_pc (fi));
+      if (ui_out_is_mi_like_p (uiout))
+        {
+          annotate_frame_address ();
+          ui_out_field_core_addr (uiout, "addr", get_frame_pc (fi));
+          annotate_frame_address_end ();
+        }
 
-      /* Do this regardless of SOURCE because we don't have any source
-         to list for this frame.  */
-      if (level >= 0)
+      if (get_frame_type (fi) == DUMMY_FRAME)
         {
-          ui_out_text (uiout, "#");
-          ui_out_field_fmt_int (uiout, 2, ui_left, "level", level);
+          annotate_function_call ();
+          ui_out_field_string (uiout, "func", "<function called from gdb>");
+       }
+      else if (get_frame_type (fi) == SIGTRAMP_FRAME)
+        {
+         annotate_signal_handler_caller ();
+          ui_out_field_string (uiout, "func", "<signal handler called>");
         }
-      annotate_signal_handler_caller ();
-      printf_filtered ("<signal handler called>\n");
+      ui_out_text (uiout, "\n");
       annotate_frame_end ();
+
+      do_cleanups (uiout_cleanup);
       return;
     }
 
@@ -305,7 +538,7 @@ print_frame (struct frame_info *fi,
             struct symtab_and_line sal)
 {
   struct symbol *func;
-  register char *funname = 0;
+  char *funname = 0;
   enum language funlang = language_unknown;
   struct ui_stream *stb;
   struct cleanup *old_chain;
@@ -314,7 +547,7 @@ print_frame (struct frame_info *fi,
   stb = ui_out_stream_new (uiout);
   old_chain = make_cleanup_ui_out_stream_delete (stb);
 
-  func = find_pc_function (frame_address_in_block (fi));
+  func = find_pc_function (get_frame_address_in_block (fi));
   if (func)
     {
       /* In certain pathological cases, the symtabs give the wrong
@@ -333,7 +566,7 @@ print_frame (struct frame_info *fi,
          ever changed many parts of GDB will need to be changed (and we'll
          create a find_pc_minimal_function or some such).  */
 
-      struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (frame_address_in_block (fi));
+      struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (get_frame_address_in_block (fi));
       if (msymbol != NULL
          && (SYMBOL_VALUE_ADDRESS (msymbol)
              > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
@@ -349,12 +582,12 @@ print_frame (struct frame_info *fi,
          /* We also don't know anything about the function besides
             its address and name.  */
          func = 0;
-         funname = SYMBOL_NAME (msymbol);
+         funname = DEPRECATED_SYMBOL_NAME (msymbol);
          funlang = SYMBOL_LANGUAGE (msymbol);
        }
       else
        {
-         /* I'd like to use SYMBOL_SOURCE_NAME() here, to display the
+         /* I'd like to use SYMBOL_PRINT_NAME() here, to display the
             demangled name that we already have stored in the symbol
             table, but we stored a version with DMGL_PARAMS turned
             on, and here we don't want to display parameters. So call
@@ -366,7 +599,7 @@ print_frame (struct frame_info *fi,
             here, while we still have our hands on the function
             symbol.) */
          char *demangled;
-         funname = SYMBOL_NAME (func);
+         funname = DEPRECATED_SYMBOL_NAME (func);
          funlang = SYMBOL_LANGUAGE (func);
          if (funlang == language_cplus)
            {
@@ -375,16 +608,16 @@ print_frame (struct frame_info *fi,
                /* If the demangler fails, try the demangled name from
                   the symbol table. This'll have parameters, but
                   that's preferable to diplaying a mangled name. */
-               funname = SYMBOL_SOURCE_NAME (func);
+               funname = SYMBOL_PRINT_NAME (func);
            }
        }
     }
   else
     {
-      struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (frame_address_in_block (fi));
+      struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (get_frame_address_in_block (fi));
       if (msymbol != NULL)
        {
-         funname = SYMBOL_NAME (msymbol);
+         funname = DEPRECATED_SYMBOL_NAME (msymbol);
          funlang = SYMBOL_LANGUAGE (msymbol);
        }
     }
@@ -593,16 +826,6 @@ parse_frame_specification (char *frame_exp)
   /* NOTREACHED */
 }
 
-/* FRAME_ARGS_ADDRESS_CORRECT is just like FRAME_ARGS_ADDRESS except
-   that if it is unsure about the answer, it returns 0
-   instead of guessing (this happens on the VAX and i960, for example).
-
-   On most machines, we never have to guess about the args address,
-   so FRAME_ARGS_ADDRESS{,_CORRECT} are the same.  */
-#if !defined (FRAME_ARGS_ADDRESS_CORRECT)
-#define FRAME_ARGS_ADDRESS_CORRECT FRAME_ARGS_ADDRESS
-#endif
-
 /* Print verbosely the selected frame or the frame at address ADDR.
    This means absolutely all information in the frame is printed.  */
 
@@ -617,10 +840,25 @@ frame_info (char *addr_exp, int from_tty)
   int i, count, numregs;
   char *funname = 0;
   enum language funlang = language_unknown;
+  const char *pc_regname;
 
   if (!target_has_stack)
     error ("No stack.");
 
+  /* Name of the value returned by get_frame_pc().  Per comments, "pc"
+     is not a good name.  */
+  if (PC_REGNUM >= 0)
+    /* OK, this is weird.  The PC_REGNUM hardware register's value can
+       easily not match that of the internal value returned by
+       get_frame_pc().  */
+    pc_regname = REGISTER_NAME (PC_REGNUM);
+  else
+    /* But then, this is weird to.  Even without PC_REGNUM, an
+       architectures will often have a hardware register called "pc",
+       and that register's value, again, can easily not match
+       get_frame_pc().  */
+    pc_regname = "pc";
+
   fi = parse_frame_specification (addr_exp);
   if (fi == NULL)
     error ("Invalid frame specified.");
@@ -632,7 +870,7 @@ frame_info (char *addr_exp, int from_tty)
   s = find_pc_symtab (get_frame_pc (fi));
   if (func)
     {
-      /* I'd like to use SYMBOL_SOURCE_NAME() here, to display
+      /* I'd like to use SYMBOL_PRINT_NAME() here, to display
        * the demangled name that we already have stored in
        * the symbol table, but we stored a version with
        * DMGL_PARAMS turned on, and here we don't want
@@ -646,7 +884,7 @@ frame_info (char *addr_exp, int from_tty)
        * have our hands on the function symbol.)
        */
       char *demangled;
-      funname = SYMBOL_NAME (func);
+      funname = DEPRECATED_SYMBOL_NAME (func);
       funlang = SYMBOL_LANGUAGE (func);
       if (funlang == language_cplus)
        {
@@ -656,7 +894,7 @@ frame_info (char *addr_exp, int from_tty)
           * but that's preferable to diplaying a mangled name.
           */
          if (demangled == NULL)
-           funname = SYMBOL_SOURCE_NAME (func);
+           funname = SYMBOL_PRINT_NAME (func);
        }
     }
   else
@@ -664,7 +902,7 @@ frame_info (char *addr_exp, int from_tty)
       register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (get_frame_pc (fi));
       if (msymbol != NULL)
        {
-         funname = SYMBOL_NAME (msymbol);
+         funname = DEPRECATED_SYMBOL_NAME (msymbol);
          funlang = SYMBOL_LANGUAGE (msymbol);
        }
     }
@@ -683,7 +921,7 @@ frame_info (char *addr_exp, int from_tty)
       print_address_numeric (get_frame_base (fi), 1, gdb_stdout);
       printf_filtered (":\n");
     }
-  printf_filtered (" %s = ", REGISTER_NAME (PC_REGNUM));
+  printf_filtered (" %s = ", pc_regname);
   print_address_numeric (get_frame_pc (fi), 1, gdb_stdout);
 
   wrap_here ("   ");
@@ -698,7 +936,7 @@ frame_info (char *addr_exp, int from_tty)
     printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line);
   puts_filtered ("; ");
   wrap_here ("    ");
-  printf_filtered ("saved %s ", REGISTER_NAME (PC_REGNUM));
+  printf_filtered ("saved %s ", pc_regname);
   print_address_numeric (frame_pc_unwind (fi), 1, gdb_stdout);
   printf_filtered ("\n");
 
@@ -736,7 +974,7 @@ frame_info (char *addr_exp, int from_tty)
 
   {
     /* Address of the argument list for this frame, or 0.  */
-    CORE_ADDR arg_list = FRAME_ARGS_ADDRESS_CORRECT (fi);
+    CORE_ADDR arg_list = get_frame_args_address (fi);
     /* Number of args for this frame, or -1 if unknown.  */
     int numargs;
 
@@ -748,22 +986,29 @@ frame_info (char *addr_exp, int from_tty)
        print_address_numeric (arg_list, 1, gdb_stdout);
        printf_filtered (",");
 
-       numargs = FRAME_NUM_ARGS (fi);
-       if (numargs < 0)
-         puts_filtered (" args: ");
-       else if (numargs == 0)
-         puts_filtered (" no args.");
-       else if (numargs == 1)
-         puts_filtered (" 1 arg: ");
+       if (!FRAME_NUM_ARGS_P ())
+         {
+           numargs = -1;
+           puts_filtered (" args: ");
+         }
        else
-         printf_filtered (" %d args: ", numargs);
+         {
+           numargs = FRAME_NUM_ARGS (fi);
+           gdb_assert (numargs >= 0);
+           if (numargs == 0)
+             puts_filtered (" no args.");
+           else if (numargs == 1)
+             puts_filtered (" 1 arg: ");
+           else
+             printf_filtered (" %d args: ", numargs);
+         }
        print_frame_args (func, fi, numargs, gdb_stdout);
        puts_filtered ("\n");
       }
   }
   {
     /* Address of the local variables for this frame, or 0.  */
-    CORE_ADDR arg_list = FRAME_LOCALS_ADDRESS (fi);
+    CORE_ADDR arg_list = get_frame_locals_address (fi);
 
     if (arg_list == 0)
       printf_filtered (" Locals at unknown address,");
@@ -775,9 +1020,9 @@ frame_info (char *addr_exp, int from_tty)
       }
   }
 
-  if (FRAME_INIT_SAVED_REGS_P ()
+  if (DEPRECATED_FRAME_INIT_SAVED_REGS_P ()
       && get_frame_saved_regs (fi) == NULL)
-    FRAME_INIT_SAVED_REGS (fi);
+    DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
   /* Print as much information as possible on the location of all the
      registers.  */
   {
@@ -802,11 +1047,14 @@ frame_info (char *addr_exp, int from_tty)
                               &realnum, NULL);
        if (!optimized && lval == not_lval)
          {
-           void *value = alloca (MAX_REGISTER_RAW_SIZE);
+           char value[MAX_REGISTER_SIZE];
            CORE_ADDR sp;
            frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
                                   &realnum, value);
-           sp = extract_address (value, REGISTER_RAW_SIZE (SP_REGNUM));
+           /* NOTE: cagney/2003-05-22: This is assuming that the
+               stack pointer was packed as an unsigned integer.  That
+               may or may not be valid.  */
+           sp = extract_unsigned_integer (value, REGISTER_RAW_SIZE (SP_REGNUM));
            printf_filtered (" Previous frame's sp is ");
            print_address_numeric (sp, 1, gdb_stdout);
            printf_filtered ("\n");
@@ -891,10 +1139,10 @@ static void
 backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
 {
   struct frame_info *fi;
-  register int count;
-  register int i;
-  register struct frame_info *trailing;
-  register int trailing_level;
+  int count;
+  int i;
+  struct frame_info *trailing;
+  int trailing_level;
 
   if (!target_has_stack)
     error ("No stack.");
@@ -958,7 +1206,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
           fi = get_prev_frame (fi))
        {
          QUIT;
-         ps = find_pc_psymtab (frame_address_in_block (fi));
+         ps = find_pc_psymtab (get_frame_address_in_block (fi));
          if (ps)
            PSYMTAB_TO_SYMTAB (ps);     /* Force syms to come in */
        }
@@ -1061,14 +1309,15 @@ backtrace_full_command (char *arg, int from_tty)
    Return 1 if any variables were printed; 0 otherwise.  */
 
 static int
-print_block_frame_locals (struct block *b, register struct frame_info *fi,
-                         int num_tabs, register struct ui_file *stream)
+print_block_frame_locals (struct block *b, struct frame_info *fi,
+                         int num_tabs, struct ui_file *stream)
 {
-  register int i, j;
-  register struct symbol *sym;
-  register int values_printed = 0;
+  struct dict_iterator iter;
+  int j;
+  struct symbol *sym;
+  int values_printed = 0;
 
-  ALL_BLOCK_SYMBOLS (b, i, sym)
+  ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
       switch (SYMBOL_CLASS (sym))
        {
@@ -1076,10 +1325,11 @@ print_block_frame_locals (struct block *b, register struct frame_info *fi,
        case LOC_REGISTER:
        case LOC_STATIC:
        case LOC_BASEREG:
+       case LOC_COMPUTED:
          values_printed = 1;
          for (j = 0; j < num_tabs; j++)
            fputs_filtered ("\t", stream);
-         fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
+         fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
          fputs_filtered (" = ", stream);
          print_variable_value (sym, fi, stream);
          fprintf_filtered (stream, "\n");
@@ -1099,13 +1349,13 @@ static int
 print_block_frame_labels (struct block *b, int *have_default,
                          register struct ui_file *stream)
 {
-  register int i;
-  register struct symbol *sym;
-  register int values_printed = 0;
+  struct dict_iterator iter;
+  struct symbol *sym;
+  int values_printed = 0;
 
-  ALL_BLOCK_SYMBOLS (b, i, sym)
+  ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
-      if (STREQ (SYMBOL_NAME (sym), "default"))
+      if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default"))
        {
          if (*have_default)
            continue;
@@ -1116,7 +1366,7 @@ print_block_frame_labels (struct block *b, int *have_default,
          struct symtab_and_line sal;
          sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 0);
          values_printed = 1;
-         fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
+         fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
          if (addressprint)
            {
              fprintf_filtered (stream, " ");
@@ -1141,8 +1391,8 @@ static void
 print_frame_local_vars (register struct frame_info *fi, register int num_tabs,
                        register struct ui_file *stream)
 {
-  register struct block *block = get_frame_block (fi, 0);
-  register int values_printed = 0;
+  struct block *block = get_frame_block (fi, 0);
+  int values_printed = 0;
 
   if (block == 0)
     {
@@ -1174,9 +1424,9 @@ static void
 print_frame_label_vars (register struct frame_info *fi, int this_level_only,
                        register struct ui_file *stream)
 {
-  register struct blockvector *bl;
-  register struct block *block = get_frame_block (fi, 0);
-  register int values_printed = 0;
+  struct blockvector *bl;
+  struct block *block = get_frame_block (fi, 0);
+  int values_printed = 0;
   int index, have_default = 0;
   char *blocks_printed;
   CORE_ADDR pc = get_frame_pc (fi);
@@ -1280,10 +1530,10 @@ print_frame_arg_vars (register struct frame_info *fi,
                      register struct ui_file *stream)
 {
   struct symbol *func = get_frame_function (fi);
-  register struct block *b;
-  register int i;
-  register struct symbol *sym, *sym2;
-  register int values_printed = 0;
+  struct block *b;
+  struct dict_iterator iter;
+  struct symbol *sym, *sym2;
+  int values_printed = 0;
 
   if (func == 0)
     {
@@ -1292,7 +1542,7 @@ print_frame_arg_vars (register struct frame_info *fi,
     }
 
   b = SYMBOL_BLOCK_VALUE (func);
-  ALL_BLOCK_SYMBOLS (b, i, sym)
+  ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
       switch (SYMBOL_CLASS (sym))
        {
@@ -1302,8 +1552,9 @@ print_frame_arg_vars (register struct frame_info *fi,
        case LOC_REGPARM:
        case LOC_REGPARM_ADDR:
        case LOC_BASEREG_ARG:
+       case LOC_COMPUTED_ARG:
          values_printed = 1;
-         fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
+         fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
          fputs_filtered (" = ", stream);
 
          /* We have to look up the symbol because arguments can have
@@ -1317,8 +1568,8 @@ print_frame_arg_vars (register struct frame_info *fi,
             float).  There are also LOC_ARG/LOC_REGISTER pairs which
             are not combined in symbol-reading.  */
 
-         sym2 = lookup_symbol (SYMBOL_NAME (sym),
-                  b, VAR_NAMESPACE, (int *) NULL, (struct symtab **) NULL);
+         sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
+                  b, VAR_DOMAIN, (int *) NULL, (struct symtab **) NULL);
          print_variable_value (sym2, fi, stream);
          fprintf_filtered (stream, "\n");
          break;
@@ -1409,8 +1660,8 @@ struct frame_info *
 find_relative_frame (register struct frame_info *frame,
                     register int *level_offset_ptr)
 {
-  register struct frame_info *prev;
-  register struct frame_info *frame1;
+  struct frame_info *prev;
+  struct frame_info *frame1;
 
   /* Going up is simple: just do get_prev_frame enough times
      or until initial frame is reached.  */
@@ -1443,14 +1694,7 @@ find_relative_frame (register struct frame_info *frame,
    and select it.  See parse_frame_specification for more info on proper
    frame expressions. */
 
-/* ARGSUSED */
 void
-select_frame_command_wrapper (char *level_exp, int from_tty)
-{
-  select_frame_command (level_exp, from_tty);
-}
-
-static void
 select_frame_command (char *level_exp, int from_tty)
 {
   struct frame_info *frame;
@@ -1496,7 +1740,7 @@ current_frame_command (char *level_exp, int from_tty)
 static void
 up_silently_base (char *count_exp)
 {
-  register struct frame_info *fi;
+  struct frame_info *fi;
   int count = 1, count1;
   if (count_exp)
     count = parse_and_eval_long (count_exp);
@@ -1533,7 +1777,7 @@ up_command (char *count_exp, int from_tty)
 static void
 down_silently_base (char *count_exp)
 {
-  register struct frame_info *frame;
+  struct frame_info *frame;
   int count = -1, count1;
   if (count_exp)
     count = -parse_and_eval_long (count_exp);
@@ -1615,7 +1859,7 @@ return_command (char *retval_exp, int from_tty)
     {
       if (thisfun != 0)
        {
-         if (!query ("Make %s return now? ", SYMBOL_SOURCE_NAME (thisfun)))
+         if (!query ("Make %s return now? ", SYMBOL_PRINT_NAME (thisfun)))
            {
              error ("Not confirmed.");
              /* NOTREACHED */
@@ -1625,18 +1869,26 @@ return_command (char *retval_exp, int from_tty)
        error ("Not confirmed.");
     }
 
+  /* FIXME: cagney/2003-01-18: Rather than pop each frame in turn,
+     this code should just go straight to the relevant frame and pop
+     that.  */
+
   /* Do the real work.  Pop until the specified frame is current.  We
-     use this method because the deprecated_selected_frame is not valid after
-     a POP_FRAME.  The pc comparison makes this work even if the
-     selected frame shares its fp with another frame.  */
+     use this method because the deprecated_selected_frame is not
+     valid after a frame_pop().  The pc comparison makes this work
+     even if the selected frame shares its fp with another frame.  */
+
+  /* FIXME: cagney/32003-03-12: This code should use frame_id_eq().
+     Unfortunatly, that function doesn't yet include the PC in any
+     frame ID comparison.  */
 
   while (selected_frame_addr != get_frame_base (frame = get_current_frame ())
         || selected_frame_pc != get_frame_pc (frame))
-    POP_FRAME;
+    frame_pop (get_current_frame ());
 
   /* Then pop that frame.  */
 
-  POP_FRAME;
+  frame_pop (get_current_frame ());
 
   /* Compute the return value (if any) and store in the place
      for return values.  */
@@ -1646,9 +1898,14 @@ return_command (char *retval_exp, int from_tty)
 
   /* If we are at the end of a call dummy now, pop the dummy frame too.  */
 
+  /* FIXME: cagney/2003-01-18: This is silly.  Instead of popping all
+     the frames except the dummy, and then, as an afterthought,
+     popping the dummy frame, this code should just pop through to the
+     dummy frame.  */
+  
   if (CALL_DUMMY_HAS_COMPLETED (read_pc(), read_sp (),
                                get_frame_base (get_current_frame ())))
-    POP_FRAME;
+    frame_pop (get_current_frame ());
 
   /* If interactive, print the frame that is now current.  */
 
@@ -1724,7 +1981,7 @@ func_command (char *arg, int from_tty)
 enum language
 get_frame_language (void)
 {
-  register struct symtab *s;
+  struct symtab *s;
   enum language flang;         /* The language of the current frame */
 
   if (deprecated_selected_frame)
This page took 0.035471 seconds and 4 git commands to generate.