merge from gcc
[deliverable/binutils-gdb.git] / gdb / stack.c
index 2c03f42ca97b536d5e4c8b7aca7c58b67c76cbf0..e13a5a040eae44b41c76742bdac6d93567dbe921 100644 (file)
@@ -1,6 +1,6 @@
 /* Print and select stack frames for GDB, the GNU debugger.
 
-   Copyright (C) 1986-2005, 2007-2012 Free Software Foundation, Inc.
+   Copyright (C) 1986-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -46,6 +46,7 @@
 #include "disasm.h"
 #include "inline-frame.h"
 #include "linespec.h"
+#include "cli/cli-utils.h"
 
 #include "gdb_assert.h"
 #include <ctype.h>
@@ -322,7 +323,8 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
        }
     }
 
-  if (SYMBOL_CLASS (sym) == LOC_COMPUTED
+  if (SYMBOL_COMPUTED_OPS (sym) != NULL
+      && SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry != NULL
       && print_entry_values != print_entry_values_no
       && (print_entry_values != print_entry_values_if_needed
          || !val || value_optimized_out (val)))
@@ -504,8 +506,6 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
   struct ui_file *stb;
   /* True if we should print arguments, false otherwise.  */
   int print_args = strcmp (print_frame_arguments, "none");
-  /* True in "summary" mode, false otherwise.  */
-  int summary = !strcmp (print_frame_arguments, "scalars");
 
   stb = mem_fileopen ();
   old_chain = make_cleanup_ui_file_delete (stb);
@@ -1037,23 +1037,25 @@ find_frame_funname (struct frame_info *frame, const char **funname,
          changed (and we'll create a find_pc_minimal_function or some
          such).  */
 
-      struct minimal_symbol *msymbol = NULL;
+      struct bound_minimal_symbol msymbol;
 
       /* Don't attempt to do this for inlined functions, which do not
         have a corresponding minimal symbol.  */
       if (!block_inlined_p (SYMBOL_BLOCK_VALUE (func)))
        msymbol
          = lookup_minimal_symbol_by_pc (get_frame_address_in_block (frame));
+      else
+       memset (&msymbol, 0, sizeof (msymbol));
 
-      if (msymbol != NULL
-         && (SYMBOL_VALUE_ADDRESS (msymbol)
+      if (msymbol.minsym != NULL
+         && (SYMBOL_VALUE_ADDRESS (msymbol.minsym)
              > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
        {
          /* We also don't know anything about the function besides
             its address and name.  */
          func = 0;
-         *funname = SYMBOL_PRINT_NAME (msymbol);
-         *funlang = SYMBOL_LANGUAGE (msymbol);
+         *funname = SYMBOL_PRINT_NAME (msymbol.minsym);
+         *funlang = SYMBOL_LANGUAGE (msymbol.minsym);
        }
       else
        {
@@ -1080,17 +1082,17 @@ find_frame_funname (struct frame_info *frame, const char **funname,
     }
   else
     {
-      struct minimal_symbol *msymbol;
+      struct bound_minimal_symbol msymbol;
       CORE_ADDR pc;
 
       if (!get_frame_address_in_block_if_available (frame, &pc))
        return;
 
       msymbol = lookup_minimal_symbol_by_pc (pc);
-      if (msymbol != NULL)
+      if (msymbol.minsym != NULL)
        {
-         *funname = SYMBOL_PRINT_NAME (msymbol);
-         *funlang = SYMBOL_LANGUAGE (msymbol);
+         *funname = SYMBOL_PRINT_NAME (msymbol.minsym);
+         *funlang = SYMBOL_LANGUAGE (msymbol.minsym);
        }
     }
 }
@@ -1178,19 +1180,21 @@ print_frame (struct frame_info *frame, int print_level,
       QUIT;
     }
   ui_out_text (uiout, ")");
-  if (sal.symtab && sal.symtab->filename)
+  if (sal.symtab)
     {
+      const char *filename_display;
+      
+      filename_display = symtab_to_filename_for_display (sal.symtab);
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      ui_out_field_string (uiout, "file", filename_display);
       if (ui_out_is_mi_like_p (uiout))
        {
          const char *fullname = symtab_to_fullname (sal.symtab);
 
-         if (fullname != NULL)
-           ui_out_field_string (uiout, "fullname", fullname);
+         ui_out_field_string (uiout, "fullname", fullname);
        }
       annotate_frame_source_file_end ();
       ui_out_text (uiout, ":");
@@ -1199,14 +1203,11 @@ print_frame (struct frame_info *frame, int print_level,
       annotate_frame_source_end ();
     }
 
-  if (pc_p && (!funname || (!sal.symtab || !sal.symtab->filename)))
+  if (pc_p && (funname == NULL || sal.symtab == NULL))
     {
-#ifdef PC_SOLIB
-      char *lib = PC_SOLIB (get_frame_pc (frame));
-#else
       char *lib = solib_name_from_address (get_frame_program_space (frame),
                                           get_frame_pc (frame));
-#endif
+
       if (lib)
        {
          annotate_frame_where ();
@@ -1249,8 +1250,7 @@ parse_frame_specification_1 (const char *frame_exp, const char *message,
          const char *p;
 
          /* Skip leading white space, bail of EOL.  */
-         while (isspace (*frame_exp))
-           frame_exp++;
+         frame_exp = skip_spaces_const (frame_exp);
          if (!*frame_exp)
            break;
 
@@ -1423,13 +1423,13 @@ frame_info (char *addr_exp, int from_tty)
     }
   else if (frame_pc_p)
     {
-      struct minimal_symbol *msymbol;
+      struct bound_minimal_symbol msymbol;
 
       msymbol = lookup_minimal_symbol_by_pc (frame_pc);
-      if (msymbol != NULL)
+      if (msymbol.minsym != NULL)
        {
-         funname = SYMBOL_PRINT_NAME (msymbol);
-         funlang = SYMBOL_LANGUAGE (msymbol);
+         funname = SYMBOL_PRINT_NAME (msymbol.minsym);
+         funlang = SYMBOL_LANGUAGE (msymbol.minsym);
        }
     }
   calling_frame_info = get_prev_frame (fi);
@@ -1460,7 +1460,8 @@ frame_info (char *addr_exp, int from_tty)
     }
   wrap_here ("   ");
   if (sal.symtab)
-    printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line);
+    printf_filtered (" (%s:%d)", symtab_to_filename_for_display (sal.symtab),
+                    sal.line);
   puts_filtered ("; ");
   wrap_here ("    ");
   printf_filtered ("saved %s ", pc_regname);
@@ -1848,6 +1849,8 @@ iterate_over_block_locals (struct block *b,
        case LOC_COMPUTED:
          if (SYMBOL_IS_ARGUMENT (sym))
            break;
+         if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN)
+           break;
          (*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
          break;
 
@@ -2275,6 +2278,8 @@ down_command (char *count_exp, int from_tty)
 void
 return_command (char *retval_exp, int from_tty)
 {
+  /* Initialize it just to avoid a GCC false warning.  */
+  enum return_value_convention rv_conv = RETURN_VALUE_STRUCT_CONVENTION;
   struct frame_info *thisframe;
   struct gdbarch *gdbarch;
   struct symbol *thisfun;
@@ -2328,6 +2333,7 @@ return_command (char *retval_exp, int from_tty)
       if (thisfun != NULL)
        function = read_var_value (thisfun, thisframe);
 
+      rv_conv = RETURN_VALUE_REGISTER_CONVENTION;
       if (TYPE_CODE (return_type) == TYPE_CODE_VOID)
        /* If the return-type is "void", don't try to find the
            return-value's location.  However, do still evaluate the
@@ -2335,14 +2341,18 @@ return_command (char *retval_exp, int from_tty)
            is discarded, side effects such as "return i++" still
            occur.  */
        return_value = NULL;
-      else if (thisfun != NULL
-              && using_struct_return (gdbarch, function, return_type))
+      else if (thisfun != NULL)
        {
-         query_prefix = "The location at which to store the "
-           "function's return value is unknown.\n"
-           "If you continue, the return value "
-           "that you specified will be ignored.\n";
-         return_value = NULL;
+         rv_conv = struct_return_convention (gdbarch, function, return_type);
+         if (rv_conv == RETURN_VALUE_STRUCT_CONVENTION
+             || rv_conv == RETURN_VALUE_ABI_RETURNS_ADDRESS)
+           {
+             query_prefix = "The location at which to store the "
+               "function's return value is unknown.\n"
+               "If you continue, the return value "
+               "that you specified will be ignored.\n";
+             return_value = NULL;
+           }
        }
     }
 
@@ -2372,9 +2382,8 @@ return_command (char *retval_exp, int from_tty)
       struct type *return_type = value_type (return_value);
       struct gdbarch *gdbarch = get_regcache_arch (get_current_regcache ());
 
-      gdb_assert (gdbarch_return_value (gdbarch, function, return_type, NULL,
-                                       NULL, NULL)
-                 == RETURN_VALUE_REGISTER_CONVENTION);
+      gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION
+                 && rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
       gdbarch_return_value (gdbarch, function, return_type,
                            get_current_regcache (), NULL /*read*/,
                            value_contents (return_value) /*write*/);
This page took 0.026689 seconds and 4 git commands to generate.