OSDN Git Service

2004-04-02 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Fri, 2 Apr 2004 22:38:43 +0000 (22:38 +0000)
committerAndrew Cagney <cagney@redhat.com>
Fri, 2 Apr 2004 22:38:43 +0000 (22:38 +0000)
* infrun.c (pc_in_sigtramp): Delete function.
(check_sigtramp2): Inline call to pc_in_sigtramp, use
get_frame_type.

gdb/ChangeLog
gdb/infrun.c

index c7c084d..b6d211c 100644 (file)
@@ -1,5 +1,11 @@
 2004-04-02  Andrew Cagney  <cagney@redhat.com>
 
+       * infrun.c (pc_in_sigtramp): Delete function.
+       (check_sigtramp2): Inline call to pc_in_sigtramp, use
+       get_frame_type.
+
+2004-04-02  Andrew Cagney  <cagney@redhat.com>
+
        * infrun.c (handle_step_into_function): Delete code conditional on
        legacy_frame_p.
        (handle_inferior_event, step_over_function): Ditto.
index 66a8adf..b64325a 100644 (file)
@@ -1203,39 +1203,6 @@ context_switch (struct execution_control_state *ecs)
   inferior_ptid = ecs->ptid;
 }
 
-/* Wrapper for DEPRECATED_PC_IN_SIGTRAMP that takes care of the need
-   to find the function's name.
-
-   In a classic example of "left hand VS right hand", "infrun.c" was
-   trying to improve GDB's performance by caching the result of calls
-   to calls to find_pc_partial_funtion, while at the same time
-   find_pc_partial_function was also trying to ramp up performance by
-   caching its most recent return value.  The below makes the the
-   function find_pc_partial_function solely responsibile for
-   performance issues (the local cache that relied on a global
-   variable - arrrggg - deleted).
-
-   Using the testsuite and gcov, it was found that dropping the local
-   "infrun.c" cache and instead relying on find_pc_partial_function
-   increased the number of calls to 12000 (from 10000), but the number
-   of times find_pc_partial_function's cache missed (this is what
-   matters) was only increased by only 4 (to 3569).  (A quick back of
-   envelope caculation suggests that the extra 2000 function calls
-   @1000 extra instructions per call make the 1 MIP VAX testsuite run
-   take two extra seconds, oops :-)
-
-   Long term, this function can be eliminated, replaced by the code:
-   get_frame_type(current_frame()) == SIGTRAMP_FRAME (for new
-   architectures this is very cheap).  */
-
-static int
-pc_in_sigtramp (CORE_ADDR pc)
-{
-  char *name;
-  find_pc_partial_function (pc, &name, NULL, NULL);
-  return DEPRECATED_PC_IN_SIGTRAMP (pc, name);
-}
-
 /* Handle the inferior event in the cases when we just stepped
    into a function.  */
 
@@ -2727,37 +2694,45 @@ currently_stepping (struct execution_control_state *ecs)
 static void
 check_sigtramp2 (struct execution_control_state *ecs)
 {
-  if (trap_expected
-      && pc_in_sigtramp (stop_pc)
-      && !pc_in_sigtramp (prev_pc)
-      && INNER_THAN (read_sp (), step_sp))
-    {
-      /* What has happened here is that we have just stepped the
-         inferior with a signal (because it is a signal which
-         shouldn't make us stop), thus stepping into sigtramp.
+  char *name;
+  struct symtab_and_line sr_sal;
 
-         So we need to set a step_resume_break_address breakpoint and
-         continue until we hit it, and then step.  FIXME: This should
-         be more enduring than a step_resume breakpoint; we should
-         know that we will later need to keep going rather than
-         re-hitting the breakpoint here (see the testsuite,
-         gdb.base/signals.exp where it says "exceedingly difficult").  */
+  /* Check that what has happened here is that we have just stepped
+     the inferior with a signal (because it is a signal which
+     shouldn't make us stop), thus stepping into sigtramp.  */
+
+  if (!trap_expected)
+    return;
+  if (get_frame_type (get_current_frame ()) != SIGTRAMP_FRAME)
+    return;
+  /* Long term, this function can be eliminated, replaced by the code:
+     get_frame_type(current_frame()) == SIGTRAMP_FRAME (for new
+     architectures this is very cheap).  */
+  find_pc_partial_function (prev_pc, &name, NULL, NULL);
+  if (DEPRECATED_PC_IN_SIGTRAMP (prev_pc, name))
+    return;
+  if (!INNER_THAN (read_sp (), step_sp))
+    return;
 
-      struct symtab_and_line sr_sal;
+  /* So we need to set a step_resume_break_address breakpoint and
+     continue until we hit it, and then step.  FIXME: This should be
+     more enduring than a step_resume breakpoint; we should know that
+     we will later need to keep going rather than re-hitting the
+     breakpoint here (see the testsuite, gdb.base/signals.exp where it
+     says "exceedingly difficult").  */
 
-      init_sal (&sr_sal);      /* initialize to zeroes */
-      sr_sal.pc = prev_pc;
-      sr_sal.section = find_pc_overlay (sr_sal.pc);
-      /* We perhaps could set the frame if we kept track of what the
-         frame corresponding to prev_pc was.  But we don't, so don't.  */
-      through_sigtramp_breakpoint =
-       set_momentary_breakpoint (sr_sal, null_frame_id, bp_through_sigtramp);
-      if (breakpoints_inserted)
-       insert_breakpoints ();
+  init_sal (&sr_sal);  /* initialize to zeroes */
+  sr_sal.pc = prev_pc;
+  sr_sal.section = find_pc_overlay (sr_sal.pc);
+  /* We perhaps could set the frame if we kept track of what the frame
+     corresponding to prev_pc was.  But we don't, so don't.  */
+  through_sigtramp_breakpoint =
+    set_momentary_breakpoint (sr_sal, null_frame_id, bp_through_sigtramp);
+  if (breakpoints_inserted)
+    insert_breakpoints ();
 
-      ecs->remove_breakpoints_on_following_step = 1;
-      ecs->another_trap = 1;
-    }
+  ecs->remove_breakpoints_on_following_step = 1;
+  ecs->another_trap = 1;
 }
 
 /* Subroutine call with source code we should not step over.  Do step