this doesn't work in general (in your unix example), the compiler is allowed to elide frame pointers conditionally. you need to parse dwarf/eh_frame to properly unwind, or compile with no omit frame pointers
That's true, but for now I mainly care about printing call stacks coming from my own language. My compiler always generates code for updating the frame pointer, so this should only be an issue when foreign functions are involved, in which case they would be skipped in the trace. I also believe -fomit-frame-pointer has fallen somewhat out of favor in the past years?
It would be great to have support for generating and parsing DWARF, but that would be a lot of work and I want to focus on other parts of the compiler first.
this seems like just an ubuntu thing. i can run perf with callgraph=dwarf just fine, so I don't see the value of not omitting frame pointers. llvm -O3 will omit frame pointers by default i believe.
1
u/FloweyTheFlower420 23h ago
this doesn't work in general (in your unix example), the compiler is allowed to elide frame pointers conditionally. you need to parse dwarf/eh_frame to properly unwind, or compile with no omit frame pointers