This is the mail archive of the gdb-patches@sourceware.org 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 v8 05/24] frame: artificial frame id's


On Fri, 13 Dec 2013 09:04:11 +0100, Metzger, Markus T wrote:
> Would it be OK to have no frame be equal to null_frame_id?
> 
> diff --git a/gdb/frame.c b/gdb/frame.c
> index 37d780e..efda1cc 100644
> --- a/gdb/frame.c
> +++ b/gdb/frame.c
> @@ -577,16 +577,17 @@ frame_id_eq (struct frame_id l, struct frame_id r)
>  {
>    int eq;
>  
> -  if (memcmp (&l, &r, sizeof (l)) == 0)
> -    /* Every frame is equal to itself.
> +  if (memcmp (&l, &null_frame_id, sizeof (l)) == 0
> +      || memcmp (&r, &null_frame_id, sizeof (r)) == 0)
> +    /* Like a NaN, if either ID is invalid, the result is false.
> +       Note that a frame ID is invalid iff it is the null frame ID.  */
> +    eq = 0;
> +  else if (memcmp (&l, &r, sizeof (l)) == 0)
> +    /* Every valid frame is equal to itself.
>         This is the dodgy thing about outer_frame_id, since between execution
>         steps we might step into another function - from which we can't unwind
>         either.  More thought required to get rid of outer_frame_id.  */
>      eq = 1;
> -  else if (!l.stack_addr_p || !r.stack_addr_p)
> -    /* Like a NaN, if either ID is invalid, the result is false.
> -       Note that a frame ID is invalid iff it is the null frame ID.  */
> -    eq = 0;
>    else if (l.stack_addr != r.stack_addr)
>      /* If .stack addresses are different, the frames are different.  */
>      eq = 0;

It looks OK to me.  I have filed:
	py-finishbreakpoint.c incorrect frame_id_eq
	https://sourceware.org/bugzilla/show_bug.cgi?id=16324

I have found in create_sentinel_frame:
  /* Make the sentinel frame's ID valid, but invalid.  That way all
     comparisons with it should fail.  */
  frame->this_id.p = 1;
  frame->this_id.value = null_frame_id;

Although I haven't found any code (besides the python above) to depend on it.


Jan


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