I tried the testcase from comment #12 in Focal and Hirsute and it worked just fine:
$ gdb --ex 'set debug-file-directory /tmp/dbgsym/usr/lib/debug:/usr/lib/debug' --ex 'file /bin/cat' --ex 'core-file /tmp/cat.core'
Type "apropos word" to search for commands related to "word".
Reading symbols from /bin/cat...
Reading symbols from /tmp/dbgsym/usr/lib/debug/.build-id/b3/57ed53c8c9cb1a312f83b28982304effae0135.debug...
[New LWP 2094475]
Core was generated by `/bin/cat'.
Program terminated with signal SIGTSTP, Stopped (user).
#0 0x00007ffff7eb6142 in __GI___libc_read (fd=fd@entry=0, buf=buf@entry=0x7ffff7faa000, nbytes=nbytes@entry=131072) at ../sysdeps/unix/sysv/linux/read.c:26
# hirsute
$ gdb --ex 'set debug-file-directory /tmp/dbgsym/usr/lib/debug:/usr/lib/debug' --ex 'file /bin/cat' --ex 'core-file /tmp/cat.core'
Reading symbols from /bin/cat...
Reading symbols from /tmp/dbgsym/usr/lib/debug/.build-id/fb/a7cee6aca864b8f79dfaa8a267855333b445c1.debug...
[New LWP 14651]
Core was generated by `/usr/bin/cat'.
Program terminated with signal SIGTSTP, Stopped (user).
#0 0x00007ffff7edccb2 in __GI___libc_read (fd=fd@entry=0, buf=buf@entry=0x7ffff791e000, nbytes=nbytes@entry=131072) at ../sysdeps/unix/sysv/linux/read.c:26
26 ../sysdeps/unix/sysv/linux/read.c: No such file or directory.
If the dbgsym is installed and I use (with intentional typo):
set debug-file-directory /tmp/dbgsym/usr/lib/debugnot:/usr/lib/debug
it then loads symbols correctly from /usr/lib/debug
Note, this was tested under Focal (host) and Hirsute (lxd container).
I tried the testcase from comment #12 in Focal and Hirsute and it worked just fine:
$ gdb --ex 'set debug-file- directory /tmp/dbgsym/ usr/lib/ debug:/ usr/lib/ debug' --ex 'file /bin/cat' --ex 'core-file /tmp/cat.core' usr/lib/ debug/. build-id/ b3/57ed53c8c9cb 1a312f83b289823 04effae0135. debug.. . entry=0x7ffff7f aa000, nbytes= nbytes@ entry=131072) at ../sysdeps/ unix/sysv/ linux/read. c:26
Type "apropos word" to search for commands related to "word".
Reading symbols from /bin/cat...
Reading symbols from /tmp/dbgsym/
[New LWP 2094475]
Core was generated by `/bin/cat'.
Program terminated with signal SIGTSTP, Stopped (user).
#0 0x00007ffff7eb6142 in __GI___libc_read (fd=fd@entry=0, buf=buf@
# hirsute directory /tmp/dbgsym/ usr/lib/ debug:/ usr/lib/ debug' --ex 'file /bin/cat' --ex 'core-file /tmp/cat.core' usr/lib/ debug/. build-id/ fb/a7cee6aca864 b8f79dfaa8a2678 55333b445c1. debug.. . entry=0x7ffff79 1e000, nbytes= nbytes@ entry=131072) at ../sysdeps/ unix/sysv/ linux/read. c:26 unix/sysv/ linux/read. c: No such file or directory.
$ gdb --ex 'set debug-file-
Reading symbols from /bin/cat...
Reading symbols from /tmp/dbgsym/
[New LWP 14651]
Core was generated by `/usr/bin/cat'.
Program terminated with signal SIGTSTP, Stopped (user).
#0 0x00007ffff7edccb2 in __GI___libc_read (fd=fd@entry=0, buf=buf@
26 ../sysdeps/
If the dbgsym is installed and I use (with intentional typo): directory /tmp/dbgsym/ usr/lib/ debugnot: /usr/lib/ debug
set debug-file-
it then loads symbols correctly from /usr/lib/debug
Note, this was tested under Focal (host) and Hirsute (lxd container).