It was a bit of a struggle to get this reproduced. Installing debuginfo (dbgsym) packages is not the simplest thing. But once you finally manage then you can indeed replicate it simply with: valgrind/vg-in-place -v /usr/bin/gio ~
--3475-- Reading syms from /usr/bin/gio
--3475-- Considering /usr/lib/debug/.build-id/50/d6f5b1c2450bf79554ee66724c911a73f1f635.debug ..
--3475-- .. build-id is valid
--3475-- WARNING: Serious error when reading debug info
--3475-- When reading debug info from /usr/bin/gio:
--3475-- debuginfo section duplicates a section in the main ELF file
And indeed /usr/bin/gio has both a .gnu_debugaltlink and .gnu_debuglink section.
The .gnu_debugaltlink points to /usr/lib/debug/.dwz/x86_64-linux-gnu/libglib2.0-bin.debug
The .gnu_debuglink points to "d6f5b1c2450bf79554ee66724c911a73f1f635.debug" (odd imho that is named after part of the build-id), luckily we look it up through the build-id and end up at /usr/lib/debug/.build-id/50/d6f5b1c2450bf79554ee66724c911a73f1f635.debug (which turns out to be a real file, not a symlink?)
That .debug file also has a .debug_gnualtlink section which points to the same /usr/lib/debug/.dwz/x86_64-linux-gnu/libglib2.0-bin.debug (side-note, given that this is an absolute path instead of a relative path, this makes things even harder to resolve unless everything is installed in the correct place, or you resolve everything through ids).
Since they are the same we can indeed just pick one. I believe this is a really odd thing to do, but we shouldn't really crash and burn.
The proposed patch seems to be a simplest way to do that.
It was a bit of a struggle to get this reproduced. Installing debuginfo (dbgsym) packages is not the simplest thing. But once you finally manage then you can indeed replicate it simply with: valgrind/ vg-in-place -v /usr/bin/gio ~
--3475-- Reading syms from /usr/bin/gio debug/. build-id/ 50/d6f5b1c2450b f79554ee66724c9 11a73f1f635. debug ..
--3475-- Considering /usr/lib/
--3475-- .. build-id is valid
--3475-- WARNING: Serious error when reading debug info
--3475-- When reading debug info from /usr/bin/gio:
--3475-- debuginfo section duplicates a section in the main ELF file
And indeed /usr/bin/gio has both a .gnu_debugaltlink and .gnu_debuglink section.
The .gnu_debugaltlink points to /usr/lib/ debug/. dwz/x86_ 64-linux- gnu/libglib2. 0-bin.debug
The .gnu_debuglink points to "d6f5b1c2450bf7 9554ee66724c911 a73f1f635. debug" (odd imho that is named after part of the build-id), luckily we look it up through the build-id and end up at /usr/lib/ debug/. build-id/ 50/d6f5b1c2450b f79554ee66724c9 11a73f1f635. debug (which turns out to be a real file, not a symlink?)
That .debug file also has a .debug_gnualtlink section which points to the same /usr/lib/ debug/. dwz/x86_ 64-linux- gnu/libglib2. 0-bin.debug (side-note, given that this is an absolute path instead of a relative path, this makes things even harder to resolve unless everything is installed in the correct place, or you resolve everything through ids).
Since they are the same we can indeed just pick one. I believe this is a really odd thing to do, but we shouldn't really crash and burn.
The proposed patch seems to be a simplest way to do that.