Re: frame cache

Michael Eager
2007-07-24T17:36:07Z

Thanks for the quick reply.

Daniel Jacobowitz wrote:
> On Tue, Jul 24, 2007 at 10:01:05AM -0700, Michael Eager wrote:
>> I have a couple questions about the <target>_frame_cache
>> structure and functions.
>>
>> 1) This appears to be a single-entry cache. Why not keep
>> multiple entries?
>
> No, it isn't single-entry. The common code in frame.c is responsible
> for passing a pointer to the correct place to store the cache for the
> current frame.

I don't see any links to the <target>_frame_cache in frame_info.
I don't see anything in frame.c which looks like it searches
for the correct <target>_frame_cache. Can you point me at the
right place?

>> 2) The data in the frame cache seems to be of two different
>> types:
>> a) Fixed, based on analyzing the code: register offsets,
>> stack alignment, framelessness, etc.
>> b) Variable, based on the call: return pc, frame base
>>
>> It looks to me that the object code is analyzed repeatedly
>> and this fixed information is discarded along with the
>> variable information.
>>
>> Why not keep a persistent cache of function specific fixed
>> data and only discard the call-specific data when the frame
>> cache is cleared?
>
> No good reason. I have thought about doing this before. It's not
> fundamentally different from the way the DWARF unwinder works; the
> persistent part of the cache would be approximately an FDE. It's a
> little tricky to implement, since we still need to detect stopping
> within the prologue, but not too tricky. I suppose bonus points would
> be awarded for constructing an actual FDE :-)

I don't know about creating FDEs, but keeping persistent data
like frame pointer and size should be simple.

When I put debugging code in <target>_analyze_prologue(), I see
that it is called over and over while executing a "next" command.
All those bits going back and forth over the serial line to the
target.

>> Is there any documentation about what target-specific data
>> the frame cache is supposed to contain or how the functions are
>> supposed to work?
>
> Not really, because it's completely up to the target what goes in
> them; it varies quite a bit between targets.
>
> Vlad, didn't you say a week or two ago that you'd been working on some
> frame docs?

I'd appreciate anything, naturally.

--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077