Re: Understanding GDB frames

Daniel Jacobowitz
2007-05-22T02:29:42Z

On Mon, May 21, 2007 at 03:24:04PM -0700, Maxim Grigoriev wrote:
> Let's define that "frames A and B are the same" if
>
> frame_id_eq ( A->this_id, B->this_id ) == true
>
> The breakpoit has been set at line 18 and hit 5 times.
> Execution control has been subsequently taken by
> gdb in five frames numbered 1, 2, 3, 4, and 5.
>
> According to the definition of GDB frames,
> which statement is correct ?
>
> ANSWERS
> =======
>
> 1) All frames 1, 2, 3, 4, and 5 are the same;
> 2) All frames 1, 2, 3, 4, and 5 are different from each other;
> 3) Frames 1,2, and 4 are the same. Frames 3 and 5 are
> different from 1, 2, 4 and from each other;
> 4) It's implementation-dependent. While doing architecture ports,
> people decide how to implement frame_id-related functions
> to compare frames;
> 5) Other ( explanation would be appreciated ).

The correct answer, in my opinion, is that all of these frames are
different. It is likely that when you compare their frame IDs, all of
those representing a call of f11 from main will have the same frame
ID - you can't always compare two arbitrary frame IDs if you don't
know where they came from, and it's impossible to get this 100%
correct without slowing down the execution of the program, so some of
them may be indistinguishable.

The frame ID is supposed to indicate which one of a set of currently
running frames you're looking at. Maybe if we have varobjs for a
specified frame ID, we should insert a scope breakpoint at the exit of
that frame to mark those varobjs as invalid.

--
Daniel Jacobowitz
CodeSourcery