Frame pointers – an important update

A few days ago I posted about Fedora 38’s frame pointer change. I stated there that perf using only DWARF information produced inaccurate stack traces. But this isn’t true at all. After working on trying to reproduce those results (with the binutils developers who offered to help) I realised that I made a mistake on the DWARF (Fedora 37, pre-frame-pointer change) results, using:

perf record -a -g -- <cmd>

instead of:

perf record -a -g --call-graph=dwarf -- <cmd>

The difference is the first command still tries to use frame pointers, which entirely explains the inaccurate stack traces. With the correct parameters, perf record does do the right thing, collecting accurate stack traces even on Fedora 37, and the flame graphs generated look fine.

That caused a lot of noise, and it was wrong.

There are some issues around DWARF vs frame pointers, but they’re not about the accuracy of the stack traces, but about the size of the collected data and the speed of processing it. Using DWARF CFI means that much more data has to be collected (typical perf.data files grow by more than x10 — on my laptop perf.data grows to 8 GB for a single trace).

Advertisement

1 Comment

Filed under Uncategorized

One response to “Frame pointers – an important update

  1. Pingback: Frame pointers vs DWARF – my verdict | Richard WM Jones

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.