Comment 0 for bug 1918035

Revision history for this message
Ppluzhnikov-google (ppluzhnikov-google) wrote :

lsb_release -rd
Description: Ubuntu 20.04.2 LTS
Release: 20.04

Using gdb 9.2-0ubuntu1~20.04, libc6 and libc6-dbg 2.31-0ubuntu9.2

gdb -q /bin/date
Reading symbols from /bin/date...
(No debugging symbols found in /bin/date)
(gdb) starti
Starting program: /usr/bin/date

Program stopped.
0x00007ffff7fd0100 in ?? () from /lib64/ld-linux-x86-64.so.2

(gdb) b _dl_debug_state
Breakpoint 1 at 0x7ffff7fe11d0
(gdb) c
Continuing.

Breakpoint 1, 0x00007ffff7fe11d0 in _dl_debug_state () from /lib64/ld-linux-x86-64.so.2
(gdb) bt
#0 0x00007ffff7fe11d0 in _dl_debug_state () from /lib64/ld-linux-x86-64.so.2
#1 0x00007ffff7fd2fd1 in ?? () from /lib64/ld-linux-x86-64.so.2
#2 0x00007ffff7febc3b in ?? () from /lib64/ld-linux-x86-64.so.2
#3 0x00007ffff7fd104c in ?? () from /lib64/ld-linux-x86-64.so.2
#4 0x00007ffff7fd0108 in ?? () from /lib64/ld-linux-x86-64.so.2
#5 0x0000000000000001 in ?? ()
#6 0x00007fffffffe58c in ?? ()
#7 0x0000000000000000 in ?? ()

Note that debug info for ld-linux is missing despite libc6-dbg being installed.

(gdb) disable 1
(gdb) catch syscall exit_group
Catchpoint 2 (syscall 'exit_group' [231])

(gdb) c
Continuing.
Sat Mar 6 22:47:08 PST 2021

Catchpoint 2 (call to syscall exit_group), __GI__exit (status=status@entry=0) at ../sysdeps/unix/sysv/linux/_exit.c:31
31 ../sysdeps/unix/sysv/linux/_exit.c: No such file or directory.

Note that debug info for `libc.so.6` was loaded correctly, but debug info for ld-linux was not.

(gdb) info shared
From To Syms Read Shared Object Library
0x00007ffff7fd0100 0x00007ffff7ff2674 Yes (*) /lib64/ld-linux-x86-64.so.2
0x00007ffff7df4630 0x00007ffff7f6920d Yes /lib/x86_64-linux-gnu/libc.so.6
(*): Shared library is missing debugging information.

----
As far as I can tell, this is happening because libc6-dbg installs ld-2.31.so into the wrong place:

dpkg -L libc6-dbg | grep /ld-2.31
/usr/lib/debug/lib/libc6-prof/x86_64-linux-gnu/ld-2.31.so
/usr/lib/debug/lib/x86_64-linux-gnu/ld-2.31.so

Since ld-linux resolves to /lib64/ld-linux-x86-64.so.2, GDB looks for debug symbols in the following paths:

/lib64/.debug/ld-2.31.so
/usr/lib/debug/lib64/ld-2.31.so
/usr/lib/x86_64-linux-gnu/.debug/ld-2.31.so
/usr/lib/debug/usr/lib/x86_64-linux-gnu/ld-2.31.so
/usr/lib/x86_64-linux-gnu/.debug/ld-2.31.so
/usr/lib/debug/usr/lib/x86_64-linux-gnu/ld-2.31.so

None of these matches the actual installed path, so debug symbols are not loaded.

P.S. Manually adding symbols via add-symbol-file /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.31.so works fine, but this should be automatic.

P.P.S. After running

sudo mkdir /usr/lib/debug/lib64
sudo ln -s /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.31.so /usr/lib/debug/lib64

things start working as expected:

gdb -q /bin/date
Reading symbols from /bin/date...
(No debugging symbols found in /bin/date)
(gdb) starti
Starting program: /usr/bin/date

Program stopped.
0x00007ffff7fd0100 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) b _dl_debug_state
Breakpoint 1 at 0x7ffff7fe11d0: file dl-debug.c, line 73.
(gdb) c
Continuing.

Breakpoint 1, __GI__dl_debug_state () at dl-debug.c:73
73 dl-debug.c: No such file or directory.
(gdb) bt
#0 __GI__dl_debug_state () at dl-debug.c:73
#1 0x00007ffff7fd2fd1 in dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:1661
#2 0x00007ffff7febc3b in _dl_sysdep_start (start_argptr=start_argptr@entry=0x7fffffffe390, dl_main=dl_main@entry=0x7ffff7fd15e0 <dl_main>) at ../elf/dl-sysdep.c:252
#3 0x00007ffff7fd104c in _dl_start_final (arg=0x7fffffffe390) at rtld.c:449
#4 _dl_start (arg=0x7fffffffe390) at rtld.c:539
#5 0x00007ffff7fd0108 in _start () from /lib64/ld-linux-x86-64.so.2
#6 0x0000000000000001 in ?? ()
#7 0x00007fffffffe5c8 in ?? ()
#8 0x0000000000000000 in ?? ()

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: libc6-dbg 2.31-0ubuntu9.2
Uname: Linux 5.4.72-microsoft-standard-WSL2 x86_64
ApportVersion: 2.20.11-0ubuntu27.16
Architecture: amd64
CasperMD5CheckResult: skip
Date: Sat Mar 6 22:39:51 2021
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=C.UTF-8
 SHELL=/bin/bash
SourcePackage: glibc
UpgradeStatus: No upgrade log present (probably fresh install)