2024-09-06T10:10:36.067Z | <Alex Ainscow> I have observed that for recent ceph builds, built with GCC, that OSDs cannot be debugged with LLDB in debug builds.
The reason is that GCC emits a the “DW_FORM_data16” format, which lldb does not understand (although there is an llvm [PR](https://github.com/llvm/llvm-project/pull/106799)).
We have choices of how to deal with this:
1. Make ceph+gcc debug builds emit dwarf-4 (-gdwarf-4)
2. Tell developers they just need to deal with this… (either build with llvm, or use gdb).
I would be interested in thoughts from others about whether a PR for option 1 is a good idea. |
2024-09-06T11:32:23.337Z | <Casey Bodley> as a workaround, you can add that `-gdwarf-4` to `CMAKE_C_FLAGS_DEBUG`/`CMAKE_CXX_FLAGS_DEBUG` options in your CMakeCache.txt |
2024-09-06T12:00:42.903Z | <Alex Ainscow> Yes, I can confirm this works. Do you think its worth submitting a PR to do this generally? |
2024-09-06T12:09:55.518Z | <Casey Bodley> personally, i don't think so. lldb will eventually support that, but it's unlikely that anyone will remember to remove the `-gdwarf-4` default in the future |
2024-09-06T12:14:55.207Z | <Alex Ainscow> Thanks. Its a good point that nobody will remember! |
2024-09-06T12:17:07.391Z | <Casey Bodley> i tend to think devs should have control over their toolchains. but cmake does support toolchain files that ceph hasn't made use of. i could see us adding a toolchain file like gcc-with-lldb.cmake that adds those flags, and people could opt in with
```-DCMAKE_TOOLCHAIN_FILE=gcc-with-lldb.cmake``` |
2024-09-06T12:18:04.653Z | <Casey Bodley> that could go in the ceph repo under ceph/cmake/, or you could manage your own locally |
2024-09-06T12:20:20.860Z | <Alex Ainscow> For our squad use-case, we have some containers we use for building ceph. Currently these will default to building in GCC, but our experience is that LLDB does a better job of debugging C++.
I will look into updating the container images to default to a llvm based toolchain and see what people think. |