2003-04-05 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Sat, 5 Apr 2003 18:54:38 +0000 (18:54 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 5 Apr 2003 18:54:38 +0000 (18:54 +0000)
* frame.c (frame_func_unwind, get_frame_func): New functions.
* frame.h (get_frame_func, frame_func_unwind): Declare.
(struct frame_info): Add field "prev_func" for caching the
previous frame's function address.
* arm-tdep.c (arm_frameless_function_invocation): Combine
get_pc_function_start and get_frame_pc into get_frame_func.
* sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto.
(sh64_nofp_frame_init_saved_regs): Ditto.
* s390-tdep.c (s390_function_start): Ditto.
* rs6000-tdep.c (rs6000_pop_frame): Ditto.
(rs6000_frameless_function_invocation): Ditto.
(rs6000_frame_saved_pc): Ditto.
* m68k-tdep.c (m68k_frame_init_saved_regs): Ditto.
* ia64-tdep.c (ia64_frame_init_saved_regs): Ditto.
* i386-tdep.c (i386_frameless_signal_p): Ditto.
(i386_frame_init_saved_regs): Ditto.
* hppa-tdep.c (hppa_frame_find_saved_regs): Ditto.
* d10v-tdep.c (d10v_frame_unwind_cache): Combine
get_pc_function_start and frame_pc_unwind into frame_func_unwind.
* cris-tdep.c (cris_frame_init_saved_regs): Ditto.
* blockframe.c (frameless_look_for_prologue): Ditto.

14 files changed:
gdb/ChangeLog
gdb/arm-tdep.c
gdb/blockframe.c
gdb/cris-tdep.c
gdb/d10v-tdep.c
gdb/frame.c
gdb/frame.h
gdb/hppa-tdep.c
gdb/i386-tdep.c
gdb/ia64-tdep.c
gdb/m68k-tdep.c
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/sh-tdep.c

index 8bb0240ff4f79f8188580c65d3bce24c5cd7e94e..b45380c792ff11ad6a26e2589d479fedfeb8da29 100644 (file)
@@ -1,3 +1,27 @@
+2003-04-05  Andrew Cagney  <cagney@redhat.com>
+
+       * frame.c (frame_func_unwind, get_frame_func): New functions.
+       * frame.h (get_frame_func, frame_func_unwind): Declare.
+       (struct frame_info): Add field "prev_func" for caching the
+       previous frame's function address.
+       * arm-tdep.c (arm_frameless_function_invocation): Combine
+       get_pc_function_start and get_frame_pc into get_frame_func.
+       * sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto.
+       (sh64_nofp_frame_init_saved_regs): Ditto.
+       * s390-tdep.c (s390_function_start): Ditto.
+       * rs6000-tdep.c (rs6000_pop_frame): Ditto.
+       (rs6000_frameless_function_invocation): Ditto.
+       (rs6000_frame_saved_pc): Ditto.
+       * m68k-tdep.c (m68k_frame_init_saved_regs): Ditto.
+       * ia64-tdep.c (ia64_frame_init_saved_regs): Ditto.
+       * i386-tdep.c (i386_frameless_signal_p): Ditto.
+       (i386_frame_init_saved_regs): Ditto.
+       * hppa-tdep.c (hppa_frame_find_saved_regs): Ditto.
+       * d10v-tdep.c (d10v_frame_unwind_cache): Combine
+       get_pc_function_start and frame_pc_unwind into frame_func_unwind.
+       * cris-tdep.c (cris_frame_init_saved_regs): Ditto.
+       * blockframe.c (frameless_look_for_prologue): Ditto.
+
 2003-04-05  Andrew Cagney  <cagney@redhat.com>
 
        * frame.c (legacy_get_prev_frame): Link prev to next at the
index 396859238ae85974edb2f8d450d7523ae7a3d195..5d8c538290e3147520074eaaa347c7dda02fe649 100644 (file)
@@ -295,7 +295,7 @@ arm_frameless_function_invocation (struct frame_info *fi)
        stmdb sp!, {}
        sub sp, ip, #4.  */
 
-  func_start = (get_pc_function_start (get_frame_pc (fi)) + FUNCTION_START_OFFSET);
+  func_start = (get_frame_func (fi)) + FUNCTION_START_OFFSET);
   after_prologue = SKIP_PROLOGUE (func_start);
 
   /* There are some frameless functions whose first two instructions
index 364be9e0ef11ef720ad4dc3959c49174e94e117d..cf691a358875a61d3da69b265fc67e41190c292e 100644 (file)
@@ -146,7 +146,7 @@ frameless_look_for_prologue (struct frame_info *frame)
 {
   CORE_ADDR func_start, after_prologue;
 
-  func_start = get_pc_function_start (get_frame_pc (frame));
+  func_start = get_frame_func (frame);
   if (func_start)
     {
       func_start += FUNCTION_START_OFFSET;
index 4f9ee9b84eba6894c41d0ed936cf3b3593938440..2258a17b7cc76d79975da609886a3c16d89266bd 100644 (file)
@@ -1178,7 +1178,7 @@ cris_frame_init_saved_regs (struct frame_info *fi)
     }
   else
     {    
-      ip = get_pc_function_start (get_frame_pc (fi));
+      ip = get_frame_func (fi);
       sal = find_pc_line (ip, 0);
 
       /* If there is no symbol information then sal.end == 0, and we end up
index 6c234cce1e81e8a10c9fad226f3b5cc7a5ae6609..5e94de4265012f14e04a517b76a7f289212fe5b5 100644 (file)
@@ -720,7 +720,7 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
   info->sp_offset = 0;
 
   info->uses_frame = 0;
-  for (pc = get_pc_function_start (frame_pc_unwind (next_frame));
+  for (pc = frame_func_unwind (next_frame);
        pc < frame_pc_unwind (next_frame);
        pc += 4)
     {
index 161ff6085e849997e40fa7ec36bb3fa561841da1..b58900b7f00c4c6a8e7c7245efb7b3ae55d03b7f 100644 (file)
@@ -190,6 +190,23 @@ frame_pc_unwind (struct frame_info *this_frame)
   return this_frame->pc_unwind_cache;
 }
 
+CORE_ADDR
+frame_func_unwind (struct frame_info *fi)
+{
+  if (!fi->prev_func.p)
+    {
+      fi->prev_func.p = 1;
+      fi->prev_func.addr = get_pc_function_start (frame_pc_unwind (fi));
+    }
+  return fi->prev_func.addr;
+}
+
+CORE_ADDR
+get_frame_func (struct frame_info *fi)
+{
+  return frame_func_unwind (fi->next);
+}
+
 static int
 do_frame_unwind_register (void *src, int regnum, void *buf)
 {
index ad81bd9bb41de2f4ddb8c7c8259cf4a21276e566..1d26209cede51d1cacf3c3368301958ddc8e5659 100644 (file)
@@ -149,6 +149,12 @@ extern struct frame_info *frame_find_by_id (struct frame_id id);
    this frame.  */
 extern CORE_ADDR get_frame_pc (struct frame_info *);
 
+/* Following on from the `resume' address.  Return the entry point
+   address of the function containing that resume address, or zero if
+   that function isn't known.  */
+extern CORE_ADDR frame_func_unwind (struct frame_info *fi);
+extern CORE_ADDR get_frame_func (struct frame_info *fi);
+
 /* Closely related to the resume address, various symbol table
    attributes that are determined by the PC.  Note that for a normal
    frame, the PC refers to the resume address after the return, and
@@ -410,6 +416,13 @@ struct frame_info
     int pc_unwind_cache_p;
     CORE_ADDR pc_unwind_cache;
 
+    /* Cached copy of the previous frame's function address.  */
+    struct
+    {
+      CORE_ADDR addr;
+      int p;
+    } prev_func;
+
     /* This frame's ID.  Note that the frame's ID, base and PC contain
        redundant information.  */
     int id_p;
index 2e0c192250cf2e9625442e4301db209d8fc189d9..c9826e0f9d98300d3bf44413dbf89f30dc42e606 100644 (file)
@@ -3912,7 +3912,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
 
   /* Get the starting address of the function referred to by the PC
      saved in frame.  */
-  pc = get_pc_function_start (frame_info->pc);
+  pc = get_frame_func (frame_info);
 
   /* Yow! */
   u = find_unwind_entry (pc);
index 7ef1f6e80e04d55c19735ad7590c7199bedd3302..317d7261e79fcf50734e6a64513b53eb76756c85 100644 (file)
@@ -502,7 +502,7 @@ i386_frameless_signal_p (struct frame_info *frame)
   return (get_next_frame (frame)
          && get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME
          && (frameless_look_for_prologue (frame)
-             || get_frame_pc (frame) == get_pc_function_start (get_frame_pc (frame))));
+             || get_frame_pc (frame) == get_frame_func (frame)));
 }
 
 /* Return the chain-pointer for FRAME.  In the case of the i386, the
@@ -714,7 +714,7 @@ i386_frame_init_saved_regs (struct frame_info *fip)
 
   frame_saved_regs_zalloc (fip);
 
-  pc = get_pc_function_start (get_frame_pc (fip));
+  pc = get_frame_func (fip);
   if (pc != 0)
     locals = i386_get_frame_setup (pc);
 
index ecb49197291738d495343a37779e7ad5f22b4adb..5e46d6b8f408c5c0157e13e8d0d98e6880e142cb 100644 (file)
@@ -1205,7 +1205,7 @@ ia64_frame_init_saved_regs (struct frame_info *frame)
     {
       CORE_ADDR func_start;
 
-      func_start = get_pc_function_start (get_frame_pc (frame));
+      func_start = get_frame_func (frame);
       examine_prologue (func_start, get_frame_pc (frame), frame);
     }
 }
index 7a9886b50760e33509ae3e010ffcafeb55c6a66f..a93a156080e32150faf624c23c07b8c26c470d61 100644 (file)
@@ -614,7 +614,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info)
     }
   else
     {
-      pc = get_pc_function_start (get_frame_pc (frame_info));
+      pc = get_frame_func (frame_info);
 
       nextinsn = read_memory_unsigned_integer (pc, 2);
       if (P_PEA_FP == nextinsn
index 5b48846bd9af33e6336d486e866a3ad36d1130cc..08394dee1d54fbea56e068850b361e6882eb9e3a 100644 (file)
@@ -990,7 +990,7 @@ rs6000_pop_frame (void)
      still in the link register, otherwise walk the frames and retrieve the
      saved %pc value in the previous frame.  */
 
-  addr = get_pc_function_start (get_frame_pc (frame));
+  addr = get_frame_func (frame);
   (void) skip_prologue (addr, get_frame_pc (frame), &fdata);
 
   wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
@@ -1499,7 +1499,7 @@ rs6000_frameless_function_invocation (struct frame_info *fi)
       && !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
     return 0;
 
-  func_start = get_pc_function_start (get_frame_pc (fi));
+  func_start = get_frame_func (fi);
 
   /* If we failed to find the start of the function, it is a mistake
      to inspect the instructions.  */
@@ -1540,7 +1540,7 @@ rs6000_frame_saved_pc (struct frame_info *fi)
     return deprecated_read_register_dummy (get_frame_pc (fi),
                                           get_frame_base (fi), PC_REGNUM);
 
-  func_start = get_pc_function_start (get_frame_pc (fi));
+  func_start = get_frame_func (fi);
 
   /* If we failed to find the start of the function, it is a mistake
      to inspect the instructions.  */
@@ -1596,8 +1596,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap)
   if (fdatap == NULL)
     {
       fdatap = &work_fdata;
-      (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
-                           get_frame_pc (fi), fdatap);
+      (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), fdatap);
     }
 
   frame_saved_regs_zalloc (fi);
@@ -1720,8 +1719,7 @@ frame_initial_stack_address (struct frame_info *fi)
 
   /* Find out if this function is using an alloca register.  */
 
-  (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
-                       get_frame_pc (fi), &fdata);
+  (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), &fdata);
 
   /* If saved registers of this frame are not known yet, read and
      cache them.  */
index deff25d4f2d6d8cad45fdc1d099f503a18aaacad..2f8f4ff971b77c2dd63ef5b44b8034a666c5689b 100644 (file)
@@ -775,7 +775,7 @@ s390_function_start (struct frame_info *fi)
   if (get_frame_extra_info (fi) && get_frame_extra_info (fi)->initialised)
     function_start = get_frame_extra_info (fi)->function_start;
   else if (get_frame_pc (fi))
-    function_start = get_pc_function_start (get_frame_pc (fi));
+    function_start = get_frame_func (fi);
   return function_start;
 }
 
index 804b34a5de5b40992f483855fa2f182fbfc8d372..d30586c75206d06793c92ddf8f192f387c552996 100644 (file)
@@ -1116,7 +1116,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi)
      that does not appear to be part of the prologue.  But give up
      after 20 of them, since we're getting silly then. */
 
-  pc = get_pc_function_start (get_frame_pc (fi));
+  pc = get_frame_func (fi);
   if (!pc)
     {
       deprecated_update_frame_pc_hack (fi, 0);
@@ -1456,7 +1456,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi)
      that does not appear to be part of the prologue.  But give up
      after 20 of them, since we're getting silly then. */
 
-  pc = get_pc_function_start (get_frame_pc (fi));
+  pc = get_frame_func (fi);
   if (!pc)
     {
       deprecated_update_frame_pc_hack (fi, 0);
@@ -1657,7 +1657,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi)
      that does not appear to be part of the prologue.  But give up
      after 20 of them, since we're getting silly then. */
 
-  pc = get_pc_function_start (get_frame_pc (fi));
+  pc = get_frame_func (fi);
   if (!pc)
     {
       deprecated_update_frame_pc_hack (fi, 0);
This page took 0.035961 seconds and 4 git commands to generate.