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)
I've come up with a simpler test case on an Ubuntu 20.10 system which follows:
1) Execute 'gdb --args cat' dbgsym_ 8.32-3ubuntu1_ amd64.ddeb /tmp/dbgsym' directory /tmp/dbgsym/ usr/lib/ debug'"
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-
7) Execute "gdb --ex 'file /bin/cat' --ex 'core-file /tmp/cat.core' --ex 'set debug-file-
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: a7cee6aca864b8f 79dfaa8a2678553 33b445c1. debug
CRC value: 0x5e28a31d
The separate debug info file exists in /tmp/dbgsym:
[ 11:07AM 10857 ] [ bdmurray@ impulse: /tmp/dbgsym ] debug/. build-id/ fb/a7cee6aca864 b8f79dfaa8a2678 55333b445c1. debug
$ find . -name a7cee\*.debug
./usr/lib/
However despite setting debug-file- directory an strace reveals that /tmp/dbgsym is not searched:
$ grep a7cee /tmp/gdb- bin-cat. trace "/usr/lib/ debug/. build-id/ fb/a7cee6aca864 b8f79dfaa8a2678 55333b445c1. debug", F_OK) = -1 ENOENT (No such file or directory) 864b8f79dfaa8a2 67855333b445c1. debug", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) debug/a7cee6aca 864b8f79dfaa8a2 67855333b445c1. debug", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) debug// bin/a7cee6aca86 4b8f79dfaa8a267 855333b445c1. debug", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access(
openat(AT_FDCWD, "/bin/a7cee6aca
openat(AT_FDCWD, "/bin/.
openat(AT_FDCWD, "/usr/lib/