This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] missing case in epilogue stub detection


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" <drow@mvista.com>
To: "Jafa" <jafa@silicondust.com>
Cc: <gdb-patches@sources.redhat.com>
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  <nickk@ubicom.com>
> >
> >  * 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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]