Record GDB 6.7 branch creation. Bump version number to 6.7.50-20070911-cvs.
[deliverable/binutils-gdb.git] / gdb / stack.c
index 2bc5036e0fb8d93798b8e2e039f7a915ebec6766..af081729a8ef839f9b233378406b678c624a1e87 100644 (file)
@@ -8,7 +8,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -17,9 +17,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 #include "value.h"
@@ -247,6 +245,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
              struct symbol *nsym;
              nsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
                                    b, VAR_DOMAIN, NULL, NULL);
+             gdb_assert (nsym != NULL);
              if (SYMBOL_CLASS (nsym) == LOC_REGISTER)
                {
                  /* There is a LOC_ARG/LOC_REGISTER pair.  This means
@@ -581,6 +580,8 @@ print_frame (struct frame_info *frame, int print_level,
                   the symbol table. That'll have parameters, but
                   that's preferable to displaying a mangled name.  */
                funname = SYMBOL_PRINT_NAME (func);
+             else
+               xfree (demangled);
            }
        }
     }
@@ -840,13 +841,14 @@ frame_info (char *addr_exp, int from_tty)
 
   /* 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
+  if (gdbarch_pc_regnum (current_gdbarch) >= 0)
+    /* OK, this is weird.  The gdbarch_pc_regnum hardware register's value can
        easily not match that of the internal value returned by
        get_frame_pc().  */
-    pc_regname = gdbarch_register_name (current_gdbarch, PC_REGNUM);
+    pc_regname = gdbarch_register_name (current_gdbarch,
+                                       gdbarch_pc_regnum (current_gdbarch));
   else
-    /* But then, this is weird to.  Even without PC_REGNUM, an
+    /* But then, this is weird to.  Even without gdbarch_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().  */
@@ -880,6 +882,8 @@ frame_info (char *addr_exp, int from_tty)
             preferable to displaying a mangled name.  */
          if (demangled == NULL)
            funname = SYMBOL_PRINT_NAME (func);
+         else
+           xfree (demangled);
        }
     }
   else
@@ -1021,22 +1025,26 @@ frame_info (char *addr_exp, int from_tty)
        at one stage the frame cached the previous frame's SP instead
        of its address, hence it was easiest to just display the cached
        value.  */
-    if (SP_REGNUM >= 0)
+    if (gdbarch_sp_regnum (current_gdbarch) >= 0)
       {
        /* Find out the location of the saved stack pointer with out
            actually evaluating it.  */
-       frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
+       frame_register_unwind (fi, gdbarch_sp_regnum (current_gdbarch),
+                              &optimized, &lval, &addr,
                               &realnum, NULL);
        if (!optimized && lval == not_lval)
          {
            gdb_byte value[MAX_REGISTER_SIZE];
            CORE_ADDR sp;
-           frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
+           frame_register_unwind (fi, gdbarch_sp_regnum (current_gdbarch),
+                                  &optimized, &lval, &addr,
                                   &realnum, value);
            /* 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_size (current_gdbarch, SP_REGNUM));
+           sp = extract_unsigned_integer (value,
+                                          register_size (current_gdbarch,
+                                          gdbarch_sp_regnum (current_gdbarch)));
            printf_filtered (" Previous frame's sp is ");
            deprecated_print_address_numeric (sp, 1, gdb_stdout);
            printf_filtered ("\n");
@@ -1062,7 +1070,7 @@ frame_info (char *addr_exp, int from_tty)
     numregs = gdbarch_num_regs (current_gdbarch)
              + gdbarch_num_pseudo_regs (current_gdbarch);
     for (i = 0; i < numregs; i++)
-      if (i != SP_REGNUM
+      if (i != gdbarch_sp_regnum (current_gdbarch)
          && gdbarch_register_reggroup_p (current_gdbarch, i, all_reggroup))
        {
          /* Find out the location of the saved register without
@@ -1787,7 +1795,7 @@ return_command (char *retval_exp, int from_tty)
                   || TYPE_CODE (return_type) == TYPE_CODE_UNION))
        {
          /* NOTE: cagney/2003-10-20: Compatibility hack for legacy
-            code.  Old architectures don't expect STORE_RETURN_VALUE
+            code.  Old architectures don't expect gdbarch_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 = "\
@@ -1850,7 +1858,7 @@ If you continue, the return value that you specified will be ignored.\n";
                                        NULL, NULL, NULL)
                  == RETURN_VALUE_REGISTER_CONVENTION);
       gdbarch_return_value (current_gdbarch, return_type,
-                           current_regcache, NULL /*read*/,
+                           get_current_regcache (), NULL /*read*/,
                            value_contents (return_value) /*write*/);
     }
 
This page took 0.024883 seconds and 4 git commands to generate.