From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18722 invoked by alias); 26 Aug 2003 23:01:58 -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 18709 invoked from network); 26 Aug 2003 23:01:54 -0000 Received: from unknown (HELO hydra.ubicom.com) (4.20.168.98) by sources.redhat.com with SMTP; 26 Aug 2003 23:01:54 -0000 Received: FROM fenway.scenix.com BY hydra.ubicom.com ; Tue Aug 26 16:01:52 2003 -0700 Received: from nkelseyxp2 (NKELSEY-XP2 [192.168.1.187]) by fenway.scenix.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2656.59) id RTV1W3G2; Tue, 26 Aug 2003 16:01:52 -0700 Message-ID: <010f01c36c26$09ae49c0$0502a8c0@scenix.com> From: "Jafa" To: "Daniel Jacobowitz" Cc: References: <3F2991AA.2050400@redhat.com> <1030825211237.ZM7510@localhost.localdomain> <3F4B9A2A.6020901@redhat.com> <00f901c36c22$8fe12250$0502a8c0@scenix.com> <20030826224530.GA28636@nevyn.them.org> Subject: Re: [patch] missing case in epilogue stub detection Date: Tue, 26 Aug 2003 23:01:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-SW-Source: 2003-08/txt/msg00464.txt.bz2 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. Thanks Nick ----- Original Message ----- From: "Daniel Jacobowitz" To: "Jafa" Cc: Sent: Tuesday, August 26, 2003 3:45 PM Subject: Re: [patch] missing case in epilogue stub detection > *This message was transferred with a trial version of CommuniGate(tm) Pro* > On Tue, Aug 26, 2003 at 03:36:59PM -0700, Jafa wrote: > > The following patch fixes a bug where an epilogue stub isn't detected and is > > erroneously treated as a subroutine. > > > > Fixes step and next errors when at the end of a function for the ip2k. Mips > > may have suffered from the same problem but the occurrence of the code would > > have been rare. > > > > 2003-08-26 Nick Kelsey > > > > * infrun.c (handle_inferior_event): Bug fix in subroutine detection > > code regarding dealing with an epilogue stub. The previous code correctly > > detected the stub in all cases except where the pc is equal to the stub > > entry point. > > > First of all, please use context or (my preference) unified diff. > > Second of all, please obey the coding standards; you removed a comment > and made a line too long. > > And the actual problem, please explain what the bug is and why this > change is correct. From the patch I'll make a wild guess: stop_pc == > ecs->stop_func_start but in_prologue returns false. That looks like a > bug in your target's prologue code. > > -- > Daniel Jacobowitz > MontaVista Software Debian GNU/Linux Developer >