[RFA] inside_entry_func() related changes

Andrew Cagney cagney@gnu.org
Sat Nov 22 13:47:00 GMT 2003


> This patch changes the implementation of inside_entry_func() so that
> the entry_func_{low,high}pc fields are not used.
> 
> It also enables the inside_entry_func() test within frame.c because
> I need this to work for FR-V.  (Note that a previous patch removed
> the inside_entry_func() call from frv-tdep.c.)

Kevin,

Re my comment:

> -  /* NOTE: cagney/2003-02-25: Don't enable until someone has found
> -     hard evidence that this is needed.  */

The revised patch I posted:
http://sources.redhat.com/ml/gdb-patches/2003-11/msg00441.html
contains the test:

-      && inside_entry_func (get_frame_pc (this_frame)))
+#if 0
+      && get_frame_func (this_frame) == entry_point_address ()
+#endif

(be it in a one line function or inline, what ever) while the patch 
you've proposed also introduces the additional checks:

>   if (pc == 0)
>     return 1;

and:

>   if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
>     {
>       /* Do not stop backtracing if the pc is in the call dummy
>          at the entry point.  */
>       /* FIXME: Won't always work with zeros for the last two arguments */
>       if (DEPRECATED_PC_IN_CALL_DUMMY (pc, 0, 0))
>         return 0;
>     }

Rather than doing this (I assume that your frv test doesn't provide 
evidence supporting their introduction and this was unintentional), why 
not add a one-line function containing just the minimal test and then 
call that from get_prev_frame?

Note that, per MarkK's comment:
   /* Make sure we pass an address within THIS_FRAME's code block to
      inside_main_func.  Otherwise, we might stop unwinding at a
      function which has a call instruction as its last instruction if
      that function immediately precedes main().  */
so a test based on get_frame_pc won't work.  Also a call to 
entry_point_address() is preferable to to a reference to the global 
variable.

Daniel mentioned the doco, what about a testcase for just this?
>    (gdb) bt
>     #0  factorial (value=5)
> 	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:96
>     #1  0x00010574 in factorial (value=6)
> 	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:97
>     #2  0x000104c0 in main (argc=0, argv=0x0, envp=0x0)
> 	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:79
>     (gdb) set backtrace past-main 
>     (gdb) bt
>     #0  factorial (value=5)
> 	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:96
>     #1  0x00010574 in factorial (value=6)
> 	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:97
>     #2  0x000104c0 in main (argc=0, argv=0x0, envp=0x0)
> 	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:79
>     #3  0x00010118 in _start ()

Andrew




More information about the Gdb-patches mailing list