* alpha-tdep.c (heuristic_proc_desc): Increase search limit
authorPeter Schauer <Peter.Schauer@mytum.de>
Sat, 26 Apr 1997 10:41:14 +0000 (10:41 +0000)
committerPeter Schauer <Peter.Schauer@mytum.de>
Sat, 26 Apr 1997 10:41:14 +0000 (10:41 +0000)
for return address register, handle `ret' instruction.

gdb/ChangeLog
gdb/alpha-tdep.c

index 5a27eeda07652bbc3bb7e45efbaac42e5d4f26c7..c6ff4a084e797e3b84694c08fbab9e43317b5982 100644 (file)
@@ -1,4 +1,7 @@
-Sat Apr 26 02:42:52 1997  Peter Schauer  (pes@regent.e-technik.tu-muenchen.de)
+Sat Apr 26 03:38:02 1997  Peter Schauer  (pes@regent.e-technik.tu-muenchen.de)
+
+       * alpha-tdep.c (heuristic_proc_desc):  Increase search limit
+       for return address register, handle `ret' instruction.
 
        * corelow.c (get_core_registers):  Initialize cf.
 
index b19d85feb1902963647fc3d558c393e6d88e8e51..69be20497c76623000e25b925b4cfaedbca1162a 100644 (file)
@@ -1,5 +1,5 @@
 /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
-   Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -519,14 +519,18 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
               rearrange the register saves.
               So we recognize only a few registers (t7, t9, ra) within
               the procedure prologue as valid return address registers.
+              If we encounter a return instruction, we extract the
+              the return address register from it.
 
               FIXME: Rewriting GDB to access the procedure descriptors,
               e.g. via the minimal symbol table, might obviate this hack.  */
            if (pcreg == -1
-               && cur_pc < (start_pc + 20)
+               && cur_pc < (start_pc + 80)
                && (reg == T7_REGNUM || reg == T9_REGNUM || reg == RA_REGNUM))
              pcreg = reg;
          }
+       else if ((word & 0xffe0ffff) == 0x6be08001)     /* ret zero,reg,1 */
+         pcreg = (word >> 16) & 0x1f;
        else if (word == 0x47de040f)                    /* bis sp,sp fp */
          has_frame_reg = 1;
       }
@@ -534,15 +538,13 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
       {
        /* If we haven't found a valid return address register yet,
           keep searching in the procedure prologue.  */
-       while (cur_pc < (limit_pc + 20) && cur_pc < (start_pc + 20))
+       while (cur_pc < (limit_pc + 80) && cur_pc < (start_pc + 80))
          {
            char buf[4];
            unsigned long word;
-           int status;
 
-           status = read_memory_nobpt (cur_pc, buf, 4); 
-           if (status)
-             memory_error (status, cur_pc);
+           if (read_memory_nobpt (cur_pc, buf, 4))
+             break;
            cur_pc += 4;
            word = extract_unsigned_integer (buf, 4);
 
@@ -556,6 +558,11 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
                    break;
                  }
              }
+           else if ((word & 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
+             {
+               pcreg = (word >> 16) & 0x1f;
+               break;
+             }
          }
       }
 
This page took 0.02787 seconds and 4 git commands to generate.