* sparc64-tdep.h (stryct_frame_info, struct trad_frame_saved_reg):
[deliverable/binutils-gdb.git] / gdb / stack.c
index 723f1e57d0e85cf2a55c2fa76cafd0ef638fe414..73a6ec52e33234932decb5d013e2a31aecfdede4 100644 (file)
@@ -1,8 +1,8 @@
 /* Print and select stack frames for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
-   Foundation, Inc.
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
+   Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -968,10 +968,6 @@ frame_info (char *addr_exp, int from_tty)
     printf_filtered (" source language %s.\n",
                     language_str (s->language));
 
-#ifdef DEPRECATED_PRINT_EXTRA_FRAME_INFO
-  DEPRECATED_PRINT_EXTRA_FRAME_INFO (fi);
-#endif
-
   {
     /* Address of the argument list for this frame, or 0.  */
     CORE_ADDR arg_list = get_frame_args_address (fi);
@@ -1356,7 +1352,7 @@ print_block_frame_labels (struct block *b, int *have_default,
 
   ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
-      if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default"))
+      if (DEPRECATED_STREQ (DEPRECATED_SYMBOL_NAME (sym), "default"))
        {
          if (*have_default)
            continue;
@@ -1854,33 +1850,33 @@ return_command (char *retval_exp, int from_tty)
       if (VALUE_LAZY (return_value))
        value_fetch_lazy (return_value);
 
-      /* Check that this architecture can handle the function's return
-         type.  In the case of "struct convention", still do the
-         "return", just also warn the user.  */
-      if (gdbarch_return_value_p (current_gdbarch))
+      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
+           return expression so that, even when the expression result
+           is discarded, side effects such as "return i++" still
+           occure.  */
+       return_value = NULL;
+      else if (!gdbarch_return_value_p (current_gdbarch)
+              && (TYPE_CODE (return_type) == TYPE_CODE_STRUCT
+                  || TYPE_CODE (return_type) == TYPE_CODE_UNION))
        {
-         if (gdbarch_return_value (current_gdbarch, return_type,
-                                   NULL, NULL, NULL)
-             == RETURN_VALUE_STRUCT_CONVENTION)
-           return_value = NULL;
+         /* NOTE: cagney/2003-10-20: Compatibility hack for legacy
+            code.  Old architectures don't expect STORE_RETURN_VALUE
+            to be called with with a small struct that needs to be
+            stored in registers.  Don't start doing it now.  */
+         query_prefix = "\
+A structure or union return type is not supported by this architecture.\n\
+If you continue, the return value that you specified will be ignored.\n";
+         return_value = NULL;
        }
-      else
+      else if (using_struct_return (return_type, 0))
        {
-         /* NOTE: cagney/2003-10-20: The double check is to ensure
-            that the STORE_RETURN_VALUE call, further down, is not
-            applied to a struct or union return-value.  It wasn't
-            allowed previously, so don't start allowing it now.  An
-            ABI that uses "register convention" to return small
-            structures and should implement the "return_value"
-            architecture method.  */
-         if (using_struct_return (return_type, 0)
-             || TYPE_CODE (return_type) == TYPE_CODE_STRUCT
-             || TYPE_CODE (return_type) == TYPE_CODE_UNION)
-           return_value = 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;
        }
-      if (return_value == NULL)
-       query_prefix = "\
-The location at which to store the function's return value is unknown.\n";
     }
 
   /* Does an interactive user really want to do this?  Include
@@ -1935,8 +1931,9 @@ The location at which to store the function's return value is unknown.\n";
          gdb_assert (gdbarch_return_value (current_gdbarch, return_type,
                                            NULL, NULL, NULL)
                      == RETURN_VALUE_REGISTER_CONVENTION);
-         gdbarch_return_value (current_gdbarch, return_type, current_regcache,
-                               VALUE_CONTENTS (return_value), NULL);
+         gdbarch_return_value (current_gdbarch, return_type,
+                               current_regcache, NULL /*read*/,
+                               VALUE_CONTENTS (return_value) /*write*/);
        }
     }
 
@@ -2035,7 +2032,14 @@ get_frame_language (void)
 
   if (deprecated_selected_frame)
     {
-      s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+      /* We determine the current frame language by looking up its
+         associated symtab.  To retrieve this symtab, we use the frame PC.
+         However we cannot use the frame pc as is, because it usually points
+         to the instruction following the "call", which is sometimes the first
+         instruction of another function.  So we rely on
+         get_frame_address_in_block(), it provides us with a PC which is
+         guaranteed to be inside the frame's code block.  */
+      s = find_pc_symtab (get_frame_address_in_block (deprecated_selected_frame));
       if (s)
        flang = s->language;
       else
This page took 0.026792 seconds and 4 git commands to generate.