From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16928 invoked by alias); 15 Jun 2009 02:45:05 -0000 Received: (qmail 16916 invoked by uid 22791); 15 Jun 2009 02:45:03 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_39 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Jun 2009 02:44:54 +0000 Received: from jupiter.vmware.com (mailhost5.vmware.com [10.16.68.131]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 2976B3B059; Sun, 14 Jun 2009 19:44:52 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by jupiter.vmware.com (Postfix) with ESMTP id 1EAD7DC39E; Sun, 14 Jun 2009 19:44:52 -0700 (PDT) Message-ID: <4A35B5CD.1030004@vmware.com> Date: Mon, 15 Jun 2009 02:45:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Hui Zhu CC: Marc Khouzam , "gdb-patches@sourceware.org" Subject: Re: [RFA] Patch to fix "reverse-next" command error References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------000108010203030809040909" 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-06/txt/msg00376.txt.bz2 This is a multi-part message in MIME format. --------------000108010203030809040909 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1886 Hui Zhu wrote: > Ping. Hui, I rewrote your patch a little bit. I think we can use gdbarch_skip_trampoline_code to detect the fact that we have stepped into a trampoline (ie. "plt"). This is more general. Mark, please tell me if this patch fixes your original problem, and Hui, please tell me if the patch is OK with you. Michael > On Mon, May 11, 2009 at 15:07, Hui Zhu wrote: >> PING >> >> On Wed, May 6, 2009 at 14:00, Hui Zhu wrote: >>> Hi Michael, >>> >>> I try this issue with cvs-head. It still affect cvs-head. >>> And I try the patch, it can fix this issue. It's time close to 7.0 >>> branch. So could you please help me review it? >>> >>> The attachment is the new patch follow cvs-head. >>> >>> 2009-05-06 Hui Zhu >>> >>> * infrun.c (handle_inferior_event): Make inferior step if it >>> stepping over a function call in reverse , and stop at the >>> start address of the function. >>> >>> Thanks, >>> Hui >>> >>> On Thu, Jan 22, 2009 at 17:00, teawater wrote: >>>> Hi guys, >>>> >>>> This patch is for bug in http://sourceware.org/ml/gdb/2009-01/msg00146.html >>>> >>>> This issue is because sometime the inferior is already in function >>>> start address (i.e. plt), set a breakpoint and continue will make >>>> "reverse-next" work error. >>>> >>>> This patch make inferior step if it reverse step and stop at the >>>> function start address. >>>> It tested OK with process record patch and testsuite gdb.twreverse in >>>> branch reverse-20081226-branch. >>>> >>>> 2009-01-22 Hui Zhu >>>> >>>> * infrun.c (handle_inferior_event): Make inferior step if it >>>> stepping over a function call in reverse , and stop at the >>>> start address of the function. >>>> >>>> OK for mainline? >>>> >>>> Thanks, >>>> Hui >>>> > --------------000108010203030809040909 Content-Type: text/plain; name="reverse-next.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="reverse-next.txt" Content-length: 2176 2009-06-14 Hui Zhu Michael Snyder * infrun.c (handle_inferior_event): Reverse-next through trampoline. Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.387 diff -u -p -r1.387 infrun.c --- infrun.c 11 Jun 2009 11:57:46 -0000 1.387 +++ infrun.c 15 Jun 2009 02:39:51 -0000 @@ -3623,9 +3623,17 @@ infrun: not switching back to stepped th Note that step_range_end is the address of the first instruction beyond the step range, and NOT the address of the last instruction - within it! */ + within it! + + Note also that during reverse execution, we may be stepping + through a function epilogue and therefore must detect when + the current-frame changes in the middle of a line. */ + if (stop_pc >= ecs->event_thread->step_range_start - && stop_pc < ecs->event_thread->step_range_end) + && stop_pc < ecs->event_thread->step_range_end + && (execution_direction != EXEC_REVERSE + || frame_id_eq (get_frame_id (get_current_frame ()), + ecs->event_thread->step_frame_id))) { if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: stepping inside range [0x%s-0x%s]\n", @@ -3762,10 +3770,21 @@ infrun: not switching back to stepped th keep_going (ecs); return; } - /* Normal (staticly linked) function call return. */ - init_sal (&sr_sal); - sr_sal.pc = ecs->stop_func_start; - insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id); + if (gdbarch_skip_trampoline_code(current_gdbarch, + get_current_frame (), + stop_pc)) + { + /* We are in a function call trampoline. + Keep stepping backward to get to the caller. */ + ecs->event_thread->stepping_over_breakpoint = 1; + } + else + { + /* Normal function call return (static or dynamic). */ + init_sal (&sr_sal); + sr_sal.pc = ecs->stop_func_start; + insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id); + } } else insert_step_resume_breakpoint_at_caller (get_current_frame ()); --------------000108010203030809040909--