-fno-omit-frame-pointer does not work as advertised

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

to those who are pushing the -fno-omit-frame-pointer change: Are you aware 
that neither that flag nor even -mno-omit-leaf-frame-pointer actually 
guarantee that every leaf function is going to carry a frame pointer, as 
required for your backtraces?

See for yourself:
https://godbolt.org/z/TjzTsWoWT

The only way to get GCC to generate a frame pointer for this function is to 
not use any optimization at all (-O0, or just leave the flags empty, which 
unfortunately defaults to -O0 in GCC).

I have tried:
* just -O2
* -O2 -fno-omit-frame-pointer
* -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
and all of them produce just imul+mov+ret, which means that an unwinder 
based purely on frame pointers will NOT be able to locate the caller of this 
function if the profiler snapshots it in the middle.

Another issue is that even if the function does have a frame pointer, it 
takes time to set up the frame pointer (push rbp; mov rbp, rsp), and it also 
needs to be popped at the end (pop rbp) before returning (ret), so a 
randomly sampled snapshot can always happen to be taken in the short time 
window where the frame pointer is not ready, which will also lead to the 
caller being unable to be located. This inherently makes purely frame-
pointer-based unwinding unreliable.

Frame pointers sound like a simple solution to unwinding, but they are not. 
They are no complete replacement for unwinding information.

        Kevin Kofler
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux