From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31527 invoked by alias); 15 Jun 2009 06:47:16 -0000 Received: (qmail 31517 invoked by uid 22791); 15 Jun 2009 06:47:15 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_39,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from wf-out-1314.google.com (HELO wf-out-1314.google.com) (209.85.200.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Jun 2009 06:47:05 +0000 Received: by wf-out-1314.google.com with SMTP id 23so1197209wfg.24 for ; Sun, 14 Jun 2009 23:47:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.212.21 with SMTP id k21mr2667414wfg.250.1245048423933; Sun, 14 Jun 2009 23:47:03 -0700 (PDT) In-Reply-To: <4A35B5CD.1030004@vmware.com> References: <4A35B5CD.1030004@vmware.com> Date: Mon, 15 Jun 2009 06:47:00 -0000 Message-ID: Subject: Re: [RFA] Patch to fix "reverse-next" command error From: Hui Zhu To: Michael Snyder , Marc Khouzam Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00378.txt.bz2 On Mon, Jun 15, 2009 at 10:45, Michael Snyder wrote: > Hui Zhu wrote: >> >> Ping. > > Hui, I rewrote your patch a little bit. =A0I think we can use > gdbarch_skip_trampoline_code to detect the fact that we have > stepped into a trampoline (ie. "plt"). =A0This 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. > This patch is OK with me. BTW, the patch that you sent include the prev one. Thanks, Hui >> 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. =A0It still affect cvs-head. >>>> And I try the patch, it can fix this issue. =A0It's time close to 7.0 >>>> branch. =A0So could you please help me review it? >>>> >>>> The attachment is the new patch follow cvs-head. >>>> >>>> 2009-05-06 =A0Hui Zhu =A0 >>>> >>>> =A0 =A0 =A0* infrun.c (handle_inferior_event): Make inferior step if it >>>> =A0 =A0 =A0stepping over a function call in reverse , and stop at the >>>> =A0 =A0 =A0start 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 =A0Hui Zhu =A0 >>>>> >>>>> =A0 =A0 =A0 * infrun.c (handle_inferior_event): Make inferior step if= it >>>>> =A0 =A0 =A0 stepping over a function call in reverse , and stop at the >>>>> =A0 =A0 =A0 start address of the function. >>>>> >>>>> OK for mainline? >>>>> >>>>> Thanks, >>>>> Hui >>>>> >> > > > 2009-06-14 =A0Hui Zhu =A0 > =A0 =A0 =A0 =A0 =A0 =A0Michael Snyder =A0 > > =A0 =A0 =A0 =A0* infrun.c (handle_inferior_event): Reverse-next through t= rampoline. > > Index: infrun.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/infrun.c,v > retrieving revision 1.387 > diff -u -p -r1.387 infrun.c > --- infrun.c =A0 =A011 Jun 2009 11:57:46 -0000 =A0 =A0 =A01.387 > +++ infrun.c =A0 =A015 Jun 2009 02:39:51 -0000 > @@ -3623,9 +3623,17 @@ infrun: not switching back to stepped th > > =A0 =A0 =A0Note that step_range_end is the address of the first instructi= on > =A0 =A0 =A0beyond the step range, and NOT the address of the last instruc= tion > - =A0 =A0 within it! */ > + =A0 =A0 within it! > + > + =A0 =A0 Note also that during reverse execution, we may be stepping > + =A0 =A0 through a function epilogue and therefore must detect when > + =A0 =A0 the current-frame changes in the middle of a line. =A0*/ > + > =A0 if (stop_pc >=3D ecs->event_thread->step_range_start > - =A0 =A0 =A0&& stop_pc < ecs->event_thread->step_range_end) > + =A0 =A0 =A0&& stop_pc < ecs->event_thread->step_range_end > + =A0 =A0 =A0&& (execution_direction !=3D EXEC_REVERSE > + =A0 =A0 =A0 =A0 || frame_id_eq (get_frame_id (get_current_frame ()), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ecs->event_thread->step= _frame_id))) > =A0 =A0 { > =A0 =A0 =A0 if (debug_infrun) > =A0 =A0 =A0 =A0fprintf_unfiltered (gdb_stdlog, "infrun: stepping inside r= ange > [0x%s-0x%s]\n", > @@ -3762,10 +3770,21 @@ infrun: not switching back to stepped th > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0keep_going (ecs); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0 =A0 =A0 /* Normal (staticly linked) function call retur= n. =A0*/ > - =A0 =A0 =A0 =A0 =A0 =A0 init_sal (&sr_sal); > - =A0 =A0 =A0 =A0 =A0 =A0 sr_sal.pc =3D ecs->stop_func_start; > - =A0 =A0 =A0 =A0 =A0 =A0 insert_step_resume_breakpoint_at_sal (sr_sal, n= ull_frame_id); > + =A0 =A0 =A0 =A0 =A0 =A0 if (gdbarch_skip_trampoline_code(current_gdbarc= h, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0get_current_frame (), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0stop_pc)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* We are in a function call trampoline. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Keep stepping backward to get to= the caller. =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ecs->event_thread->stepping_over_breakp= oint =3D 1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Normal function call return (static = or dynamic). =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 init_sal (&sr_sal); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sr_sal.pc =3D ecs->stop_func_start; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 insert_step_resume_breakpoint_at_sal (s= r_sal, > null_frame_id); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0else > =A0 =A0 =A0 =A0 =A0 =A0insert_step_resume_breakpoint_at_caller (get_curre= nt_frame ()); > >