diff --git a/gdb/infrun.c b/gdb/infrun.c index 3b779de..c4b737e 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2299,6 +2299,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; @@ -3049,6 +3050,35 @@ 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. */ @@ -3889,15 +3919,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; @@ -4359,6 +4381,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) { @@ -4511,6 +4534,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. @@ -5071,6 +5095,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, @@ -5150,6 +5176,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,