<story><title>Fedora now has frame pointers</title><url>https://rwmj.wordpress.com/2023/02/02/fedora-now-has-frame-pointers/</url></story><parent_chain><item><author>jart</author><text>-fomit-frame-pointer is pretty high on the list of most destructive micro-optimizations in the history of open source. When you repurpose the backtrace pointer (RBP) for other things, it totally savages our ability to have native backtraces. All for a pointless ~1% performance boost. I&amp;#x27;ve always thought it was some kind of grand conspiracy to obfuscate the behaviors of closed source software but for some reason every single Linux distro that claims to love freedom has to do this too. I don&amp;#x27;t want to trust binaries built by strangers on the Internet if they hide their behaviors. Back when I worked at Google I used to read a lot of the company-wide core build configs, and the first thing they always did was make sure -fno-omit-frame-pointer is always passed, no matter what build flags a specific team uses. Don&amp;#x27;t tell me DWARF is an acceptable alternative. While it can be nice sugar on top with Linux perf report when it actually works, frame pointers let me produce a backtrace in just ten lines of C without any dependencies. If I wanted to do the same with DWARF I&amp;#x27;d need to link some GPL library or write 10,000 lines of byzantine code to figure out which function called the one that&amp;#x27;s crashing. Stuff like this is why everyone uses scripting languages these days, since the main value prop of high-level languages is their ability to reliably print backtraces.</text></item></parent_chain><comment><author>jandrese</author><text>&amp;gt; All for a pointless ~1% performance boost.&lt;p&gt;With 32 bit code this was absolutely not the case.  I have not looked so closely at 64 bit code, but in 32 bit land -fomit-frame-pointer was often closer to a 20-30% performance boost.  Of all of gcc&amp;#x27;s optimization options it was the only one that I ever found to make a significant difference in real code.</text></comment>
<story><title>Fedora now has frame pointers</title><url>https://rwmj.wordpress.com/2023/02/02/fedora-now-has-frame-pointers/</url></story><parent_chain><item><author>jart</author><text>-fomit-frame-pointer is pretty high on the list of most destructive micro-optimizations in the history of open source. When you repurpose the backtrace pointer (RBP) for other things, it totally savages our ability to have native backtraces. All for a pointless ~1% performance boost. I&amp;#x27;ve always thought it was some kind of grand conspiracy to obfuscate the behaviors of closed source software but for some reason every single Linux distro that claims to love freedom has to do this too. I don&amp;#x27;t want to trust binaries built by strangers on the Internet if they hide their behaviors. Back when I worked at Google I used to read a lot of the company-wide core build configs, and the first thing they always did was make sure -fno-omit-frame-pointer is always passed, no matter what build flags a specific team uses. Don&amp;#x27;t tell me DWARF is an acceptable alternative. While it can be nice sugar on top with Linux perf report when it actually works, frame pointers let me produce a backtrace in just ten lines of C without any dependencies. If I wanted to do the same with DWARF I&amp;#x27;d need to link some GPL library or write 10,000 lines of byzantine code to figure out which function called the one that&amp;#x27;s crashing. Stuff like this is why everyone uses scripting languages these days, since the main value prop of high-level languages is their ability to reliably print backtraces.</text></item></parent_chain><comment><author>catiopatio</author><text>DWARF is not just the better alternative, it’s the only correct solution.&lt;p&gt;Not only do you get more complete and correct backtraces with DWARF, you also get preservation of stack-saved registers and the ability to reconstitute a subset of local state in a given frame.&lt;p&gt;libunwind is MIT licensed, not GPL.&lt;p&gt;I’ve also written a full DWARF stack unwinder myself, including a full DWARF expression interpreter — it’s &lt;i&gt;nowhere near&lt;/i&gt; 10k lines of code.</text></comment>