Re: [patch/rfc] Add a sentinel frame

Andrew Cagney
2003-02-19T16:46:56Z

> On Wed, Feb 19, 2003 at 08:32:32AM -0500, Andrew Cagney wrote:
>
>> So I think it is one of these tests going awall:
>>
>> if (next_frame->level >= 0
>> && !backtrace_below_main
>> && inside_main_func (get_frame_pc (next_frame)))
>> /* Don't unwind past main(), bug always unwind the sentinel frame.
>> Note, this is done _before_ the frame has been marked as
>> previously unwound. That way if the user later decides to
>> allow unwinds past main(), that just happens. */
>> return NULL;
>>
>> /* If we're inside the entry file, it isn't valid. */
>> /* NOTE: drow/2002-12-25: should there be a way to disable this
>> check? It assumes a single small entry file, and the way some
>> debug readers (e.g. dbxread) figure out which object is the
>> entry file is somewhat hokey. */
>> /* NOTE: cagney/2003-01-10: If there is a way of disabling this test
>> then it should probably be moved to before the ->prev_p test,
>> above. */
>> if (inside_entry_file (get_frame_pc (next_frame)))
>> return NULL;
>>
>> The second looks worrying (the dummy frame breakpoint lives in the entry
>> file ...). Perhaphs something like:
>>
>> if (dummy_frame_p (get_frame_pc (next_frame) != NULL
>> && inside_entry_file (get_frame_pc (next_frame))
>> return NULL;
>
>
> Hrm, shouldn't we have already detected the dummy frame at this point?

No. GDB is trying to perform:

pop_frame (get_current_frame())

with the assumption that it has a dummy frame and get_current_frame()
will return it.

> That's what happens on i386 IIRC...

Chance has it inside_entry_file(entry-point) returns false. Knowing
that function, I'd not be suprized.

The `bug' is an unexpected interaction between get_prev_frame's
end-of-frame test and the change to unwind from the sentinel frame.
Previously the end-of-frame test wasn't applied to the current frame.

Andrew