Gentoo doesn't currently generate build-ids by default (we tried it in the past, had some issues with file collisions, will likely try again in the future) and they're of limited use to KDE anyway because most users won't have a known build-id anyway. It will be a bit useful for our new binary packages but it'll still be the minority. Anyway, we shouldn't reject/refuse to submit GDB payloads in drkonqi because of this when we have an empty build-id (https://github.com/KDE/drkonqi/blob/015e1bc2cc4ece240de0f732078431101e57a7c0/src/data/gdb_preamble/preamble.py#L409). Given that this check *is* useful on most distros, I guess we want a way to customise it. I may just patch it out in Gentoo for now though so we can get useful reports.
Looking at https://develop.sentry.dev/sdk/data-model/event-payloads/debugmeta/#elf-images, it looks like we need to calculate our own when a build-id is missing: ``` code_id Optional. Identifier of the dynamic library or executable. If the program was compiled with a relatively recent compiler, this should be the hex representation of the NT_GNU_BUILD_ID program header (type PT_NOTE), or the value of the .note.gnu.build-id note section (type SHT_NOTE). Otherwise, leave this value empty. ``` and ``` debug_id Required. Debug identifier of the dynamic library or executable. If a code identifier is available, the debug identifier is the little-endian UUID representation of the first 16-bytes of that identifier. Spaces are inserted for readability, note the byte order of the first fields: [...] If no code id is available, the debug id should be computed by XORing the first 4096 bytes of the .text section in 16-byte chunks, and representing it as a little-endian UUID (again swapping the byte order). ```
Prompted by both this bug and the build-id part of https://mail.kde.org/pipermail/distributions/2025-April/001574.html: I've been meaning to do this for some time, but written up build-id for Gentoo and will hopefully work on that soon (https://bugs.gentoo.org/953869). That said, having some minimal functionality without build-ids would still be appreciated until we get time to deploy that, and also so that drkonqi does something useful with default GCC (and Clang) builds.