* minsyms.h (struct bound_minimal_symbol): New.
[deliverable/binutils-gdb.git] / gdb / stack.c
index a9dabb5871d376af7ea9c833ce1f76b5ca352acb..c072a2ef4cc503a3932101d56063746fe0ee867e 100644 (file)
@@ -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);
        }
     }
 }
@@ -1180,11 +1182,14 @@ print_frame (struct frame_info *frame, int print_level,
   ui_out_text (uiout, ")");
   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);
@@ -1248,8 +1253,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;
 
@@ -1422,13 +1426,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);
@@ -1459,7 +1463,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);
@@ -2276,6 +2281,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;
@@ -2329,6 +2336,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
@@ -2336,14 +2344,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;
+           }
        }
     }
 
@@ -2373,9 +2385,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.028732 seconds and 4 git commands to generate.