From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22483 invoked by alias); 5 Jul 2009 10:54:08 -0000 Received: (qmail 22473 invoked by uid 22791); 5 Jul 2009 10:54:08 -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-pz0-f203.google.com (HELO mail-pz0-f203.google.com) (209.85.222.203) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 05 Jul 2009 10:54:01 +0000 Received: by pzk41 with SMTP id 41so3017755pzk.12 for ; Sun, 05 Jul 2009 03:53:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.14.6 with SMTP id r6mr1031858wfi.24.1246791239478; Sun, 05 Jul 2009 03:53:59 -0700 (PDT) In-Reply-To: <4A4EA339.90109@vmware.com> References: <4A4EA339.90109@vmware.com> Date: Sun, 05 Jul 2009 10:54:00 -0000 Message-ID: Subject: Re: [RFA] improved handling of shared lib calls (reverse 2/2) From: Hui Zhu To: Michael Snyder Cc: gdb-patches@sourceware.org, drow@false.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-07/txt/msg00108.txt.bz2 I tried this patch with ubuntu i386. Everything is OK. Thanks, Hui On Sat, Jul 4, 2009 at 08:32, Michael Snyder wrote: > This change depends on the previous one (epilogue unwinder for i386, > http://sourceware.org/ml/gdb-patches/2009-07/msg00099.html). > > With the frame unwinder working properly, we can remove the > special case code in the test for "check for subroutine call" > in handle_inferior_event. > > Of course that reveals some hidden problems with shared library > calls, so this patch also addresses those. > > Michael > > > 2009-07-03 =A0Michael Snyder =A0 > > =A0 =A0 =A0 =A0* infrun.c (handle_inferior_event): Remove an execution_di= rection > =A0 =A0 =A0 =A0check in the "check for subroutine calls" test, and add so= me > =A0 =A0 =A0 =A0additional handling for reverse-stepping through shared li= braries. > > 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.400 > diff -u -p -r1.400 infrun.c > --- infrun.c =A0 =A02 Jul 2009 17:21:06 -0000 =A0 =A0 =A0 1.400 > +++ infrun.c =A0 =A04 Jul 2009 00:27:53 -0000 > @@ -3776,9 +3776,8 @@ infrun: not switching back to stepped th > =A0 =A0 =A0previous frame must have valid frame IDs. =A0*/ > =A0 if (!frame_id_eq (get_stack_frame_id (frame), > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ecs->event_thread->step_stack_fram= e_id) > - =A0 =A0 =A0&& (frame_id_eq (frame_unwind_caller_id (frame), > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ecs->event_thread->step_stac= k_frame_id) > - =A0 =A0 =A0 =A0 || execution_direction =3D=3D EXEC_REVERSE)) > + =A0 =A0 =A0&& frame_id_eq (frame_unwind_caller_id (frame), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ecs->event_thread->step_stack_f= rame_id)) > =A0 =A0 { > =A0 =A0 =A0 CORE_ADDR real_stop_pc; > > @@ -3806,6 +3805,7 @@ infrun: not switching back to stepped th > =A0 =A0 =A0 /* Reverse stepping through solib trampolines. =A0*/ > > =A0 =A0 =A0 if (execution_direction =3D=3D EXEC_REVERSE > + =A0 =A0 =A0 =A0 && ecs->event_thread->step_over_calls !=3D STEP_OVER_NO= NE > =A0 =A0 =A0 =A0 =A0&& (gdbarch_skip_trampoline_code (gdbarch, frame, stop= _pc) > =A0 =A0 =A0 =A0 =A0 =A0 =A0|| (ecs->stop_func_start =3D=3D 0 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&& in_solib_dynsym_resolve_code (stop_= pc)))) > @@ -3923,6 +3923,38 @@ infrun: not switching back to stepped th > =A0 =A0 =A0 return; > =A0 =A0 } > > + =A0/* Reverse stepping through solib trampolines. =A0*/ > + > + =A0if (execution_direction =3D=3D EXEC_REVERSE > + =A0 =A0 =A0&& ecs->event_thread->step_over_calls !=3D STEP_OVER_NONE) > + =A0 =A0{ > + =A0 =A0 =A0if (gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc) > + =A0 =A0 =A0 =A0 || (ecs->stop_func_start =3D=3D 0 > + =A0 =A0 =A0 =A0 =A0 =A0 && in_solib_dynsym_resolve_code (stop_pc))) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 /* Any solib trampoline code can be handled in reverse > + =A0 =A0 =A0 =A0 =A0 =A0by simply continuing to single-step. =A0We have = already > + =A0 =A0 =A0 =A0 =A0 =A0executed the solib function (backwards), and a f= ew > + =A0 =A0 =A0 =A0 =A0 =A0steps will take us back through the trampoline t= o the > + =A0 =A0 =A0 =A0 =A0 =A0caller. =A0*/ > + =A0 =A0 =A0 =A0 keep_going (ecs); > + =A0 =A0 =A0 =A0 return; > + =A0 =A0 =A0 } > + =A0 =A0 =A0else if (in_solib_dynsym_resolve_code (stop_pc)) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 /* Stepped backward into the solib dynsym resolver. > + =A0 =A0 =A0 =A0 =A0 =A0Set a breakpoint at its start and continue, then > + =A0 =A0 =A0 =A0 =A0 =A0one more step will take us out. =A0*/ > + =A0 =A0 =A0 =A0 struct symtab_and_line sr_sal; > + =A0 =A0 =A0 =A0 init_sal (&sr_sal); > + =A0 =A0 =A0 =A0 sr_sal.pc =3D ecs->stop_func_start; > + =A0 =A0 =A0 =A0 insert_step_resume_breakpoint_at_sal (gdbarch, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 sr_sal, null_frame_id); > + =A0 =A0 =A0 =A0 keep_going (ecs); > + =A0 =A0 =A0 =A0 return; > + =A0 =A0 =A0 } > + =A0 =A0} > + > =A0 /* If we're in the return path from a shared library trampoline, > =A0 =A0 =A0we want to proceed through the trampoline when stepping. =A0*/ > =A0 if (gdbarch_in_solib_return_trampoline (gdbarch, > >