From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1996 invoked by alias); 12 Jul 2009 17:48:50 -0000 Received: (qmail 1985 invoked by uid 22791); 12 Jul 2009 17:48:48 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 12 Jul 2009 17:48:41 +0000 Received: from mailhost4.vmware.com (mailhost4.vmware.com [10.16.67.124]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 2483758006; Sun, 12 Jul 2009 10:48:40 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost4.vmware.com (Postfix) with ESMTP id EC557C9B7B; Sun, 12 Jul 2009 10:48:39 -0700 (PDT) Message-ID: <4A5A20F1.5080208@vmware.com> Date: Sun, 12 Jul 2009 18:10:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Michael Snyder CC: "gdb-patches@sourceware.org" , "drow@false.org" Subject: Re: [RFA] improved handling of shared lib calls (reverse 2/2) References: <4A4EA339.90109@vmware.com> In-Reply-To: <4A4EA339.90109@vmware.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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/msg00347.txt.bz2 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 Michael Snyder > > * infrun.c (handle_inferior_event): Remove an execution_direction > check in the "check for subroutine calls" test, and add some > additional handling for reverse-stepping through shared libraries. > > Index: infrun.c > =================================================================== > RCS file: /cvs/src/src/gdb/infrun.c,v > retrieving revision 1.400 > diff -u -p -r1.400 infrun.c > --- infrun.c 2 Jul 2009 17:21:06 -0000 1.400 > +++ infrun.c 4 Jul 2009 00:27:53 -0000 > @@ -3776,9 +3776,8 @@ infrun: not switching back to stepped th > previous frame must have valid frame IDs. */ > if (!frame_id_eq (get_stack_frame_id (frame), > 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)) > + && frame_id_eq (frame_unwind_caller_id (frame), > + ecs->event_thread->step_stack_frame_id)) > { > CORE_ADDR real_stop_pc; > > @@ -3806,6 +3805,7 @@ infrun: not switching back to stepped th > /* Reverse stepping through solib trampolines. */ > > if (execution_direction == EXEC_REVERSE > + && ecs->event_thread->step_over_calls != STEP_OVER_NONE > && (gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc) > || (ecs->stop_func_start == 0 > && in_solib_dynsym_resolve_code (stop_pc)))) > @@ -3923,6 +3923,38 @@ infrun: not switching back to stepped th > return; > } > > + /* Reverse stepping through solib trampolines. */ > + > + if (execution_direction == EXEC_REVERSE > + && ecs->event_thread->step_over_calls != STEP_OVER_NONE) > + { > + if (gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc) > + || (ecs->stop_func_start == 0 > + && in_solib_dynsym_resolve_code (stop_pc))) > + { > + /* Any solib trampoline code can be handled in reverse > + by simply continuing to single-step. We have already > + executed the solib function (backwards), and a few > + steps will take us back through the trampoline to the > + caller. */ > + keep_going (ecs); > + return; > + } > + else if (in_solib_dynsym_resolve_code (stop_pc)) > + { > + /* Stepped backward into the solib dynsym resolver. > + Set a breakpoint at its start and continue, then > + one more step will take us out. */ > + struct symtab_and_line sr_sal; > + init_sal (&sr_sal); > + sr_sal.pc = ecs->stop_func_start; > + insert_step_resume_breakpoint_at_sal (gdbarch, > + sr_sal, null_frame_id); > + keep_going (ecs); > + return; > + } > + } > + > /* If we're in the return path from a shared library trampoline, > we want to proceed through the trampoline when stepping. */ > if (gdbarch_in_solib_return_trampoline (gdbarch,