bombela / backward-cpp

A beautiful stack trace pretty printer for C++
MIT License
3.68k stars 467 forks source link

Add note on Clang -gdwarf-aranges option to README #249

Open csw opened 2 years ago

csw commented 2 years ago

I encountered a problem when using libdw with Clang 13 on Linux, where backward was not printing source location information for code compiled with Clang (it was visible for gcc-compiled libraries, however). I saw the comment on line 1845 about Clang not emitting a .debug_aranges section and having to use a fallback method to try to find source locations, and found that Clang has a -gdwarf-aranges option. Enabling this fixed the problem.

I'm almost positive I had this working in the past, so it's possible that an update to Clang, libdw, or backward broke something here. It worked using gcc, as well as Clang with libbfd.

I may be missing a better way to solve this, but it's probably worth documenting whatever the best answer is.

csw commented 2 years ago

~Marking this as a draft for now; some part of this combination appears to be buggy.~ (edit: apparently libdw just uses a lot of stack space)

bombela commented 2 years ago

Yeah I am also certain it worked fine before. In fact I think I used clang for the screenshot in the readme, years ago.