From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20365 invoked by alias); 7 Sep 2003 15:16:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 20354 invoked from network); 7 Sep 2003 15:16:19 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 7 Sep 2003 15:16:19 -0000 Received: from drow by nevyn.them.org with local (Exim 4.22 #1 (Debian)) id 19w1Gx-0006j4-HO; Sun, 07 Sep 2003 11:16:15 -0400 Date: Sun, 07 Sep 2003 15:16:00 -0000 From: Daniel Jacobowitz To: Jafa Cc: gdb-patches@sources.redhat.com Subject: Re: [patch] missing case in epilogue stub detection Message-ID: <20030907151614.GA480@nevyn.them.org> Mail-Followup-To: Jafa , gdb-patches@sources.redhat.com References: <3F2991AA.2050400@redhat.com> <1030825211237.ZM7510@localhost.localdomain> <3F4B9A2A.6020901@redhat.com> <00f901c36c22$8fe12250$0502a8c0@scenix.com> <20030826224530.GA28636@nevyn.them.org> <010f01c36c26$09ae49c0$0502a8c0@scenix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <010f01c36c26$09ae49c0$0502a8c0@scenix.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-09/txt/msg00097.txt.bz2 On Tue, Aug 26, 2003 at 04:01:52PM -0700, Jafa wrote: > Hi Daniel, > > My appologies... > (description below) > > diff -u -6 -r1.10 infrun.c > --- infrun.c 20 Aug 2003 17:15:33 -0000 1.10 > +++ infrun.c 26 Aug 2003 23:00:59 -0000 > @@ -2443,15 +2443,15 @@ > > ecs->remove_breakpoints_on_following_step = 1; > keep_going (ecs); > return; > } > > - if (stop_pc == ecs->stop_func_start /* Quick test */ > - || (in_prologue (stop_pc, ecs->stop_func_start) && > - !IN_SOLIB_RETURN_TRAMPOLINE (stop_pc, ecs->stop_func_name)) > + if (((stop_pc == ecs->stop_func_start /* Quick test. */ > + || in_prologue (stop_pc, ecs->stop_func_start)) > + && !IN_SOLIB_RETURN_TRAMPOLINE (stop_pc, ecs->stop_func_name)) > || IN_SOLIB_CALL_TRAMPOLINE (stop_pc, ecs->stop_func_name) > || ecs->stop_func_name == 0) > { > /* It's a subroutine call. */ > > if ((step_over_calls == STEP_OVER_NONE) > > > The first thing the original code does is "if (stop_pc == > ecs->stop_func_start /* Quick test */" which means if the stop_pc is equal > to the first instrucion of a function or stub then it bypasses all of the > other checks and blindly assumes it is a function. The "in_prologue" and > "IN_SOLIB_RETURN_TRAMPOLINE" functions never get called because it has > already decided that it is a function. > > I believe the original code is valid in assuming that if the pc is at the > start of the func/stub then it can skip the prologue test, however it still > needs to check to see if it is in an epilogue stub. > > This is critical because an epilogue stub (by definition) does not return to > the caller, thus cannot be treated as a subroutine. > > BTW - Thanks for the feedback, you are probably right, the comment is still > reasonably relavant and my editor doesn't pick up lines being too long. > > If there is a better way to solve this problem then I would appreciate your > advice. Hi Nick, OK, thank you for the explanation. Presumably, for whatever target this code was originally added, the return stubs didn't show up as functions in the symbol table and so the first check never triggered. Your explanation makes sense, so I've committed this patch. [I don't believe this patch requires copyright assignment, but do you/Ubicom have one in place? I don't remember.] -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2003-09-07 Daniel Jacobowitz From Nick Kelsey : * infrun.c (handle_inferior_event): Check IN_SOLIB_RETURN_TRAMPOLINE when the stop PC is at the beginning of a function also. Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.110 diff -u -p -r1.110 infrun.c --- infrun.c 19 Jun 2003 15:04:57 -0000 1.110 +++ infrun.c 7 Sep 2003 04:34:55 -0000 @@ -2446,9 +2446,9 @@ process_event_stop_test: return; } - if (stop_pc == ecs->stop_func_start /* Quick test */ - || (in_prologue (stop_pc, ecs->stop_func_start) && - !IN_SOLIB_RETURN_TRAMPOLINE (stop_pc, ecs->stop_func_name)) + if (((stop_pc == ecs->stop_func_start /* Quick test */ + || in_prologue (stop_pc, ecs->stop_func_start)) + && !IN_SOLIB_RETURN_TRAMPOLINE (stop_pc, ecs->stop_func_name)) || IN_SOLIB_CALL_TRAMPOLINE (stop_pc, ecs->stop_func_name) || ecs->stop_func_name == 0) {