From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31024 invoked by alias); 7 Jul 2009 09:30:09 -0000 Received: (qmail 30959 invoked by uid 22791); 7 Jul 2009 09:30:06 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-px0-f195.google.com (HELO mail-px0-f195.google.com) (209.85.216.195) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Jul 2009 09:30:00 +0000 Received: by pxi33 with SMTP id 33so4061638pxi.12 for ; Tue, 07 Jul 2009 02:29:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.204.11 with SMTP id b11mr1739915wfg.186.1246958998718; Tue, 07 Jul 2009 02:29:58 -0700 (PDT) Date: Tue, 07 Jul 2009 09:30:00 -0000 Message-ID: Subject: [RFC] Add step_stack_prev_frame_id From: Hui Zhu To: gdb-patches ml , Michael Snyder , Daniel Jacobowitz , Pedro Alves , Marc Khouzam Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00182.txt.bz2 Hi, Now, reverse debug have a problem about infrun doesn't know the frame_id of prev function. So it will not know inferior stepped into subroutine or stepped out from subroutine. http://sourceware.org/ml/gdb/2009-06/msg00089.html This mail talk about this issue. Daniel suggest us to use "frame_unwind_caller_id" and Michael make some patch for it. Looks it's depend on arch code support and new version gcc support. I have other idea about it. http://sourceware.org/ml/gdb-patches/2009-06/msg00793.html Save this prev_frame_id when we save step_stack_prev_frame_id in reverse mode. I made a patch for it. I think it will not depend on arch code support and new version gcc support. I try it with precord AMD64 patch. Thanks, Hui 2009-07-07 Hui Zhu * gdbthread.h (thread_info): Add step_stack_prev_frame_id to save the prev_frame_id when we can get the prev_frame. * infrun.c (inferior_status): Ditto. (save_inferior_status): Ditto. (restore_inferior_status): Ditto. (set_step_info): Get the step_stack_prev_frame_id. (handle_inferior_event): Use the step_stack_prev_frame_id make sure inferior stepped into subroutine or not. --- gdbthread.h | 3 +++ infrun.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) --- a/gdbthread.h +++ b/gdbthread.h @@ -88,6 +88,9 @@ struct thread_info any inlined frames). */ struct frame_id step_stack_frame_id; + /* The prev frame id of step_stack_frame_id. */ + struct frame_id step_stack_prev_frame_id; + int current_line; struct symtab *current_symtab; --- a/infrun.c +++ b/infrun.c @@ -2153,10 +2153,17 @@ void set_step_info (struct frame_info *frame, struct symtab_and_line sal) { struct thread_info *tp = inferior_thread (); + struct frame_info *prev_frame; tp->step_frame_id = get_frame_id (frame); tp->step_stack_frame_id = get_stack_frame_id (frame); + prev_frame = get_prev_frame (frame); + if (prev_frame) + tp->step_stack_prev_frame_id = get_stack_frame_id (prev_frame); + else + tp->step_stack_prev_frame_id = null_frame_id; + tp->current_symtab = sal.symtab; tp->current_line = sal.line; } @@ -3778,7 +3785,9 @@ infrun: not switching back to stepped th ecs->event_thread->step_stack_frame_id) && (frame_id_eq (frame_unwind_caller_id (frame), ecs->event_thread->step_stack_frame_id) - || execution_direction == EXEC_REVERSE)) + || (execution_direction == EXEC_REVERSE + && !frame_id_eq (get_stack_frame_id (frame), + ecs->event_thread->step_stack_prev_frame_id)))) { CORE_ADDR real_stop_pc; @@ -5388,6 +5397,7 @@ struct inferior_status CORE_ADDR step_range_end; struct frame_id step_frame_id; struct frame_id step_stack_frame_id; + struct frame_id step_stack_prev_frame_id; enum step_over_calls_kind step_over_calls; CORE_ADDR step_resume_break_address; int stop_after_trap; @@ -5418,6 +5428,7 @@ save_inferior_status (void) inf_status->step_range_end = tp->step_range_end; inf_status->step_frame_id = tp->step_frame_id; inf_status->step_stack_frame_id = tp->step_stack_frame_id; + inf_status->step_stack_prev_frame_id = tp->step_stack_prev_frame_id; inf_status->step_over_calls = tp->step_over_calls; inf_status->stop_after_trap = stop_after_trap; inf_status->stop_soon = inf->stop_soon; @@ -5472,6 +5483,7 @@ restore_inferior_status (struct inferior tp->step_range_end = inf_status->step_range_end; tp->step_frame_id = inf_status->step_frame_id; tp->step_stack_frame_id = inf_status->step_stack_frame_id; + tp->step_stack_prev_frame_id = inf_status->step_stack_prev_frame_id; tp->step_over_calls = inf_status->step_over_calls; stop_after_trap = inf_status->stop_after_trap; inf->stop_soon = inf_status->stop_soon;