2011-09-22 Gary Benson * infrun.c (stopped_at_solib_event_breakpoint): New function. (stopped_at_solib_event_breakpoint_helper): Likewise. (handle_inferior_event): Avoid calling skip_inline_frames when at the solib event breakpoint. diff --git a/gdb/infrun.c b/gdb/infrun.c index 225034c..2e49470 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3102,6 +3102,39 @@ fill_in_stop_func (struct gdbarch *gdbarch, } } +/* Helper for stopped_at_solib_event_breakpoint. */ + +static int +stopped_at_solib_event_breakpoint_helper (struct breakpoint *b, void *arg) +{ + struct execution_control_state *ecs + = (struct execution_control_state *) arg; + + if (b->type == bp_shlib_event) + { + CORE_ADDR prev_pc = ecs->event_thread->prev_pc; + struct bp_location *loc; + + for (loc = b->loc; loc; loc = loc->next) + { + if (loc->pspace == current_program_space + && (loc->address == stop_pc || loc->address == prev_pc)) + return 1; + } + } + + return 0; +} + +/* Nonzero if we are stopped at the solib event breakpoint. */ + +static int +stopped_at_solib_event_breakpoint (struct execution_control_state *ecs) +{ + return iterate_over_breakpoints (stopped_at_solib_event_breakpoint_helper, + ecs) != NULL; +} + /* 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. */ @@ -4010,9 +4043,14 @@ handle_inferior_event (struct execution_control_state *ecs) stopped_by_random_signal = 0; /* Hide inlined functions starting here, unless we just performed stepi or - nexti. After stepi and nexti, always show the innermost frame (not any - inline function call sites). */ - if (ecs->event_thread->control.step_range_end != 1) + nexti, or we are at the solib event breakpoint. After stepi and nexti, + always show the innermost frame (not any inline function call sites). + This call is expensive, and we avoid it if we are at the solib event + breakpoint which is defined as the address of a function (i.e., not + inline). This improves performance with inferiors that load a lot of + shared libraries. */ + if (ecs->event_thread->control.step_range_end != 1 + && !stopped_at_solib_event_breakpoint (ecs)) skip_inline_frames (ecs->ptid); if (ecs->event_thread->suspend.stop_signal == TARGET_SIGNAL_TRAP