Profiling BLAS-heavy code on Mac OS X: workaround for libunwind bug?

I’m on Mac OS X Sonoma (14.7), julia 1.10.5, trying to profile some linear-algebra-heavy code. I’m running into behavior very similar to that described in a previous thread (flamegraph-profileview-not-showing-matrix-operations/100359: sorry for not including a link; this account is new)—I see similar flamegraphs when I use Profile View.

When I do Profile.print(), the lines I see don’t come anywhere close to adding up to the reported “total snapshots”. But when I add ‘C = true’, I see a bunch of dgemm/zgemm calls with huge numbers of counts, at the top level.

That previous thread says this is an upstream libunwind bug.

Is there a workaround? How are folks that do lots of linear algebra on Mac OS X profiling their code?

So one not very satisfying option is to use Instruments. Which is the xcode profiler. I’ve seen good results with it, but it doesn’t support symbolizing the JIT traces, so if that becomes an issue a workaround is to put your code in a package.

Related issue: Known profiling issues where unwinding fails · Issue #56332 · JuliaLang/julia · GitHub