Comment 12 for bug 1818918

Revision history for this message
Brian Murray (brian-murray) wrote :

I've come up with a simpler test case on an Ubuntu 20.10 system which follows:

1) Execute 'gdb --args cat'
2) in gdb type 'run'
3) press Ctrl-Z
4) in gdb type 'generate-core-file /tmp/cat.core'
5) download the dbgsym for coreutils
6) Extract them 'dbg-deb -x coreutils-dbgsym_8.32-3ubuntu1_amd64.ddeb /tmp/dbgsym'
7) Execute "gdb --ex 'file /bin/cat' --ex 'core-file /tmp/cat.core' --ex 'set debug-file-directory /tmp/dbgsym/usr/lib/debug'"

In gdb you'll see the following error message:

Reading symbols from /bin/cat...
(No debugging symbols found in /bin/cat)

Running "objdump -g /bin/cat" we can see the location for the separate debug info:

Contents of the .gnu_debugaltlink section (loaded from /bin/cat):

  Separate debug info file: /usr/lib/debug/.dwz/x86_64-linux-gnu/coreutils.debug
  Build-ID (0x14 bytes):
 cb 5b e4 8a 6d b2 52 6e 9c 80 8d 64 ec 4b 1f b7 7f 0c ca 9e

Contents of the .gnu_debuglink section (loaded from /bin/cat):

  Separate debug info file: a7cee6aca864b8f79dfaa8a267855333b445c1.debug
  CRC value: 0x5e28a31d

The separate debug info file exists in /tmp/dbgsym:

[ 11:07AM 10857 ] [ bdmurray@impulse:/tmp/dbgsym ]
 $ find . -name a7cee\*.debug
./usr/lib/debug/.build-id/fb/a7cee6aca864b8f79dfaa8a267855333b445c1.debug

However despite setting debug-file-directory an strace reveals that /tmp/dbgsym is not searched:

 $ grep a7cee /tmp/gdb-bin-cat.trace
access("/usr/lib/debug/.build-id/fb/a7cee6aca864b8f79dfaa8a267855333b445c1.debug", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/bin/a7cee6aca864b8f79dfaa8a267855333b445c1.debug", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/bin/.debug/a7cee6aca864b8f79dfaa8a267855333b445c1.debug", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/debug//bin/a7cee6aca864b8f79dfaa8a267855333b445c1.debug", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)