--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-10-20 Hui Zhu + + Deal with get ecs->stop_func_end fail. + + * infrun.c (reverse_need_step): New variable. Set to 1 if next + reverse execute need step. + (handle_inferior_event): If + 2008-10-19 Hui Zhu * infrun.c (handle_inferior_event): Set "stop_pc" when --- a/infrun.c +++ b/infrun.c @@ -1854,6 +1854,8 @@ ensure_not_running (void) by an event from the inferior, figure out what it means and take appropriate action. */ +static int reverse_need_step = 0; + void handle_inferior_event (struct execution_control_state *ecs) { @@ -1862,6 +1864,13 @@ handle_inferior_event (struct execution_ int stepped_after_stopped_by_watchpoint = 0; struct symtab_and_line stop_pc_sal; enum stop_kind stop_soon; + int reverse_need_step_prev; + + /* Save the reverse_need_step that is set in prev cycle to + reverse_need_step_prev. */ + reverse_need_step_prev = reverse_need_step; + /* Reset the value of reverse_need_step. */ + reverse_need_step = 0; if (ecs->ws.kind != TARGET_WAITKIND_EXITED && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED @@ -2520,6 +2529,11 @@ targets should add new threads to the th 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); + /* If find_pc_partial_function get ecs->stop_func_name and ecs->stop_func_end + are 0 and this is reverse execute, Let inferior single step. */ + if (!(ecs->stop_func_name || ecs->stop_func_end) + && execution_direction == EXEC_REVERSE) + reverse_need_step = 1; ecs->stop_func_start += gdbarch_deprecated_function_start_offset (current_gdbarch); ecs->event_thread->stepping_over_breakpoint = 0; @@ -2667,7 +2681,8 @@ targets should add new threads to the th = !(bpstat_explains_signal (ecs->event_thread->stop_bpstat) || ecs->event_thread->trap_expected || (ecs->event_thread->step_range_end - && ecs->event_thread->step_resume_breakpoint == NULL)); + && ecs->event_thread->step_resume_breakpoint == NULL) + || reverse_need_step_prev); else { ecs->random_signal = !bpstat_explains_signal (ecs->event_thread->stop_bpstat); @@ -3411,7 +3426,8 @@ currently_stepping (struct thread_info * return (((tp->step_range_end && tp->step_resume_breakpoint == NULL) || tp->trap_expected) || tp->stepping_through_solib_after_catch - || bpstat_should_step ()); + || bpstat_should_step () + || reverse_need_step); } /* Inferior has stepped into a subroutine call with source code that @@ -3539,6 +3555,9 @@ insert_step_resume_breakpoint_at_sal (st step_resume_breakpoint when one is already active. */ gdb_assert (inferior_thread ()->step_resume_breakpoint == NULL); + if (!sr_sal.pc && reverse_need_step) + return; + if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: inserting step-resume breakpoint at 0x%s\n", @@ -3633,6 +3652,10 @@ stop_stepping (struct execution_control_ /* Let callers know we don't want to wait for the inferior anymore. */ ecs->wait_some_more = 0; + + /* Reset reverse_need_step to make it not affect reverse_need_step_prev + in next execute command. */ + reverse_need_step = 0; } /* This function handles various cases where we need to continue