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

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 
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

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

 $ grep a7cee /tmp/gdb-bin-cat.trace
 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)
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to apport in Ubuntu.

  gdb doesn't search in debug-file-directory for .gnu_debugaltlink

Status in Apport:
  Fix Released
Status in apport package in Ubuntu:
Status in gdb package in Ubuntu:

Bug description:
  As far as I can tell gdb version 8.2.90 isn't searching the debug-
  file-directory, which I set, for the '.gnu_debugaltlink' which is in
  the debug symbols. Here's the error I'm seeing:

  Type "apropos word" to search for commands related to "word".
  Reading symbols from /srv/vms/apport-sandbox-dir/Ubuntu 
  Reading symbols from /srv/vms/apport-sandbox-dir/Ubuntu 
  could not find '.gnu_debugaltlink' file for 
  (No debugging symbols found in /srv/vms/apport-sandbox-dir/Ubuntu 

  Here's part of an strace of what's going on behind the scenes:

 {st_mode=S_IFREG|0644, st_size=839744, ...}) = 0 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

  This is the only time "/usr/lib/debug" is searched, generally
  "/srv/vms/apport-sandbox-dir/Ubuntu 19.04/amd64/report-
  sandbox/usr/lib/debug/" is used. I'll attach the full strace though.

  For completeness here's the gdb command I'm using:

  Calling gdb command: '/srv/vms/apport-sandbox-dir/Ubuntu 19.04/amd64
  /report-sandbox/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2' '/srv/vms
  /apport-sandbox-dir/Ubuntu 19.04/amd64/report-sandbox/usr/bin/gdb'
  --ex 'set debug-file-directory /srv/vms/apport-sandbox-dir/Ubuntu
  19.04/amd64/report-sandbox/usr/lib/debug' --ex 'set solib-absolute-
  prefix /srv/vms/apport-sandbox-dir/Ubuntu 19.04/amd64/report-sandbox'
  --ex 'add-auto-load-safe-path /srv/vms/apport-sandbox-dir/Ubuntu
  19.04/amd64/report-sandbox' --ex 'set solib-search-path /srv/vms
  /apport-sandbox-dir/Ubuntu 19.04/amd64/report-sandbox/lib/x86_64
  -linux-gnu' --ex 'set data-directory /srv/vms/apport-sandbox-
  dir/Ubuntu 19.04/amd64/report-sandbox/usr/share/gdb' --ex 'file
  "/srv/vms/apport-sandbox-dir/Ubuntu 19.04/amd64/report-
  sandbox//usr/bin/gnome-calculator"' --ex 'core-file

To manage notifications about this bug go to:

Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to