gdb/
authorGary Benson <gary@redhat.com>
Tue, 19 Jul 2011 12:24:34 +0000 (12:24 +0000)
committerGary Benson <gary@redhat.com>
Tue, 19 Jul 2011 12:24:34 +0000 (12:24 +0000)
* infrun.c (struct execution_control_state): New member
stop_func_filled_in.
(clear_stop_func, fill_in_stop_func): New functions.
(handle_inferior_event): Call clear_stop_func rather than
manipulating the execution control state directly.
Call fill_in_stop_func lazily as required rather than
directly calling find_pc_partial_function in all cases.

gdb/ChangeLog
gdb/infrun.c

index 44cc9d4a7450532a89b6d617a50f589e95e24c86..4e6f35fcf2f92540c033af69ec97d4108f550e89 100644 (file)
@@ -1,3 +1,13 @@
+2011-07-19  Gary Benson  <gbenson@redhat.com>
+
+       * infrun.c (struct execution_control_state): New member
+       stop_func_filled_in.
+       (clear_stop_func, fill_in_stop_func): New functions.
+       (handle_inferior_event): Call clear_stop_func rather than
+       manipulating the execution control state directly.
+       Call fill_in_stop_func lazily as required rather than
+       directly calling find_pc_partial_function in all cases.
+
 2011-07-18  Tom Tromey  <tromey@redhat.com>
 
        * dwarf2read.c (read_subrange_type): Use attr_form_is_block when
index 2b4525e213eb91051c4c334be1c97e35095fddc0..91e0fc27e778b83f30bf3f52f7bdab2d49e2dd42 100644 (file)
@@ -2326,6 +2326,7 @@ struct execution_control_state
 
   struct target_waitstatus ws;
   int random_signal;
+  int stop_func_filled_in;
   CORE_ADDR stop_func_start;
   CORE_ADDR stop_func_end;
   char *stop_func_name;
@@ -3080,6 +3081,36 @@ handle_syscall_event (struct execution_control_state *ecs)
   return 1;
 }
 
+/* Clear the supplied execution_control_state's stop_func_* fields.  */
+
+static void
+clear_stop_func (struct execution_control_state *ecs)
+{
+  ecs->stop_func_filled_in = 0;
+  ecs->stop_func_start = 0;
+  ecs->stop_func_end = 0;
+  ecs->stop_func_name = NULL;
+}
+
+/* Lazily fill in the execution_control_state's stop_func_* fields.  */
+
+static void
+fill_in_stop_func (struct gdbarch *gdbarch,
+                  struct execution_control_state *ecs)
+{
+  if (!ecs->stop_func_filled_in)
+    {
+      /* Don't care about return value; stop_func_start and stop_func_name
+        will both be 0 if it doesn't work.  */
+      find_pc_partial_function (stop_pc, &ecs->stop_func_name,
+                               &ecs->stop_func_start, &ecs->stop_func_end);
+      ecs->stop_func_start
+       += gdbarch_deprecated_function_start_offset (gdbarch);
+
+      ecs->stop_func_filled_in = 1;
+    }
+}
+
 /* Given an execution control state that has been freshly filled in
    by an event from the inferior, figure out what it means and take
    appropriate action.  */
@@ -3925,15 +3956,7 @@ handle_inferior_event (struct execution_control_state *ecs)
       return;
     }
 
-  ecs->stop_func_start = 0;
-  ecs->stop_func_end = 0;
-  ecs->stop_func_name = 0;
-  /* Don't care about return value; stop_func_start and stop_func_name
-     will both be 0 if it doesn't work.  */
-  find_pc_partial_function (stop_pc, &ecs->stop_func_name,
-                           &ecs->stop_func_start, &ecs->stop_func_end);
-  ecs->stop_func_start
-    += gdbarch_deprecated_function_start_offset (gdbarch);
+  clear_stop_func (ecs);
   ecs->event_thread->stepping_over_breakpoint = 0;
   bpstat_clear (&ecs->event_thread->control.stop_bpstat);
   ecs->event_thread->control.stop_step = 0;
@@ -4377,6 +4400,7 @@ process_event_stop_test:
            keep_going (ecs);
            return;
          }
+       fill_in_stop_func (gdbarch, ecs);
        if (stop_pc == ecs->stop_func_start
            && execution_direction == EXEC_REVERSE)
          {
@@ -4568,6 +4592,7 @@ process_event_stop_test:
      a dangling pointer.  */
   frame = get_current_frame ();
   gdbarch = get_frame_arch (frame);
+  fill_in_stop_func (gdbarch, ecs);
 
   /* If stepping through a line, keep going if still within it.
 
@@ -5128,6 +5153,8 @@ handle_step_into_function (struct gdbarch *gdbarch,
   struct symtab *s;
   struct symtab_and_line stop_func_sal, sr_sal;
 
+  fill_in_stop_func (gdbarch, ecs);
+
   s = find_pc_symtab (stop_pc);
   if (s && s->language != language_asm)
     ecs->stop_func_start = gdbarch_skip_prologue (gdbarch,
@@ -5207,6 +5234,8 @@ handle_step_into_function_backward (struct gdbarch *gdbarch,
   struct symtab *s;
   struct symtab_and_line stop_func_sal;
 
+  fill_in_stop_func (gdbarch, ecs);
+
   s = find_pc_symtab (stop_pc);
   if (s && s->language != language_asm)
     ecs->stop_func_start = gdbarch_skip_prologue (gdbarch,
This page took 0.035163 seconds and 4 git commands to generate.