This is the mail archive of the
mailing list for the GCC project.
Re: Expansion of __builtin_frame_address
Richard Earnshaw wrote:
> The only chance you have for producing a backtrace() is to have
> unwinding information similar to that provided for exception unwinding.
> This would describe to the unwinder how that frames code is laid out so
> that it can unpick it.
I'd suggest we leave backtrace() aside, and just talk about
__builtin_frame_address(0), which does have well-defined semantics.
_b_f_a(0) is currently broken on ARM, and we all agree we should fix it.
I mildly disagree with David's comment that:
> It seems like a bad idea to force every port to define
> INITIAL_FRAME_ADDRESS_RTX to avoid a penalty.
in that I think the default should be working code, and Mark's change
Of course, if _b_f_a(0) can be implemented more efficiently on some
target, there should be a hook to do that. And, I think it's reasonable
to ask Mark to go through and add that optimization to ports that
already work that way, so that his patch doesn't regress any target.
(I'm not actually sure how _b_f_a(0) works on other targets, but not on
But, scrapping about the default probably isn't very productive. The
important thing is to work out how _b_f_a(0) can be made to work on ARM.
Richard, I can't tell from your comments how you think _b_f_a(0) should
be implemented on ARM. We could use Mark's logic (forcing a hard frame
pointer), but stuff it into INITIAL_FRAME_ADDRESS_RTX. We could also
try to reimplement the thing you mentioned about using a pseudo, though
I guess we'd need to work out why that was thought a bad idea before.
What option do you suggest?
(650) 331-3385 x713