I just tried to debug clang:14 itself but GDB cannot load its debug information. sys-devel/clang is compiled with use debug. MWE: ``` $ gdb clang-14 GNU gdb (Gentoo 13.2 vanilla) 13.2 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://bugs.gentoo.org/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from clang-14... Reading symbols from /usr/lib/debug//usr/lib/llvm/14/bin/clang-14.debug... (No debugging symbols found in /usr/lib/debug//usr/lib/llvm/14/bin/clang-14.debug) (gdb) ``` Inspecting the debug file itself: ``` $ objdump -g /usr/lib/debug/usr/lib/llvm/14/bin/clang-14.debug /usr/lib/debug/usr/lib/llvm/14/bin/clang-14.debug: file format elf64-x86-64 Contents of the .eh_frame section (loaded from /usr/lib/debug/usr/lib/llvm/14/bin/clang-14.debug): 00000000 ZERO terminator ``` The debug file contains symbols, though. I'm not sure, if the debug file should contain debug information but I have expected it. The clang binary itself has some debug information but also links to the external debug file: ``` Contents of the .gnu_debuglink section (loaded from /usr/lib/llvm/14/bin/clang-14): Separate debug info file: clang-14.debug CRC value: 0x7bd1d29 ```
Note that USE=debug has nothing to do with debug symbols. See https://wiki.gentoo.org/wiki/Debugging#Per-package. Anyway, if I had to guess, this is because debugedit lacks support for dwarf5. This would be a problem if you built clang with clang.
Ok, I have `splitdebug` activated and clang is compiled with the system default (should be GCC). I will try to recompile it with `-g`. Is it possible that splitdebug make Portage to split out a debug section that is more less empty since Clang was compiled without debug information? Also, I have some debug information. For example, pressing <TAB> when defining a break point give some symbols.
Actually compiling with debug information (-ggdb) fixes the problem.