From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20811 invoked by alias); 15 Jul 2009 08:33:43 -0000 Received: (qmail 20801 invoked by uid 22791); 15 Jul 2009 08:33:42 -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 wf-out-1314.google.com (HELO wf-out-1314.google.com) (209.85.200.170) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Jul 2009 08:33:36 +0000 Received: by wf-out-1314.google.com with SMTP id 23so1237619wfg.24 for ; Wed, 15 Jul 2009 01:33:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.204.11 with SMTP id b11mr1980298wfg.71.1247646814069; Wed, 15 Jul 2009 01:33:34 -0700 (PDT) In-Reply-To: <4A5D2C02.7090201@vmware.com> References: <4A4EA339.90109@vmware.com> <4A5A20F1.5080208@vmware.com> <4A5D2C02.7090201@vmware.com> From: Hui Zhu Date: Wed, 15 Jul 2009 12:53:00 -0000 Message-ID: Subject: Re: [RFA] improved handling of shared lib calls (reverse 2/2) To: Michael Snyder , "drow@false.org" 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-07/txt/msg00391.txt.bz2 I try this patch with cvs-head and program: void foo() { return; } int main() { foo(); // 1 foo(); // 2 foo(); // 3 return 0; } in ubuntu i386. And test with reverse testsuite. Everything is OK. Thanks, Hui On Wed, Jul 15, 2009 at 09:08, Michael Snyder wrote: > And now this one? > > Michael Snyder wrote: >> >> Now how about this one? >> >> 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_= direction >>> =A0 =A0 =A0 =A0check in the "check for subroutine calls" test, and add = some >>> =A0additional handling for reverse-stepping through shared libraries. >>> >>> 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_fr= ame_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_st= ack_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= _frame_id)) >>> =A0 =A0 { >>> =A0 =A0 =A0 CORE_ADDR real_stop_pc; >>> =A0@@ -3806,6 +3805,7 @@ infrun: not switching back to stepped th >>> =A0 =A0 =A0 /* Reverse stepping through solib trampolines. =A0*/ >>> =A0 =A0 =A0 =A0 if (execution_direction =3D=3D EXEC_REVERSE >>> + =A0 =A0 =A0 =A0 && ecs->event_thread->step_over_calls !=3D STEP_OVER_= NONE >>> =A0 =A0 =A0 =A0 =A0&& (gdbarch_skip_trampoline_code (gdbarch, frame, st= op_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 (sto= p_pc)))) >>> @@ -3923,6 +3923,38 @@ infrun: not switching back to stepped th >>> =A0 =A0 =A0 return; >>> =A0 =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 hav= e already >>> + =A0 =A0 =A0 =A0 =A0 =A0executed the solib function (backwards), and a= few + >>> =A0 =A0steps will take us back through the trampoline to 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, th= en >>> + =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 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, >> >> > >