Comment 21 for bug 1818918

Revision history for this message
Tiago Stürmer Daitx (tdaitx) wrote :

So the issue is: if there is a .gnu_debugaltlink GDB will try to load that file and throw an error if it can't. That path is absolute and GDB does _not_ look for that path/file anywhere else, not even inside 'debug-file-directory'.

GDB seems to only look at section .gnu_debugaltlink in debug/.build-id/nn/nnnnnn.debug, it does not seem to use that section from the binary at all.

Due to that, another workaround is to modify that section to point to the 'right' place:

1) use objcopy to dump .gnu_debugaltlink from debug/.build-id/nn/nnnnnn.debug into a file
2) use sed to modify the path in the dump file
3) use objcopy to update .gnu_debugaltlink section in debug/.build-id/nn/nnnnnn.debug

As in:
$ objcopy --dump-section .gnu_debugaltlink=altlink /tmp/dbgsym/usr/lib/debug/.build-id/76/e9f820204912084fd156c593b2c92f1a4b51f1.debug
$ sed -i 's:^:/tmp/dbgsym:' altlink
$ objcopy --update-section .gnu_debugaltlink=altlink /tmp/dbgsym/usr/lib/debug/.build-id/76/e9f820204912084fd156c593b2c92f1a4b51f1.debug