Can't load glib debug symbols in gdb

  • Done
  • quality assurance status badge
Details
3 participants
  • Andrew Tropin
  • Josselin Poiret
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Andrew Tropin
Severity
normal
A
A
Andrew Tropin wrote on 24 Apr 2023 09:29
(address . bug-guix@gnu.org)
871qk9spoy.fsf@trop.in
I try to run emacs in gdb with debug symbols for some libs available, I
succeed with gtk+, but it doesn't work for glib and glibc. It looks
strange to me, but maybe I am doing something wrong.

Reproducer:

guix shell gdb emacs-next-pgtk glibc:debug gtk+:debug glib:debug \
--with-debug-info=glibc --with-debug-info=glib --with-debug-info=gtk+ \
--no-grafts -- gdb .emacs-30.0.50-real

Toggle snippet (91 lines)
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from .emacs-30.0.50-real...
(No debugging symbols found in .emacs-30.0.50-real)
(gdb) run -q
Starting program: /gnu/store/g59lvzvhbai1dcrbckaw4qvf4amxyfa2-profile/bin/.emacs-30.0.50-real -q
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
[New LWP 14944]
[New LWP 14945]
[New LWP 14946]
Gdk-Message: 11:19:32.820: Unable to load sb_v_double_arrow from the cursor theme
Gdk-Message: 11:19:32.820: Unable to load sb_h_double_arrow from the cursor theme
Gdk-Message: 11:19:32.838: Unable to load hand2 from the cursor theme
Gdk-Message: 11:19:32.838: Unable to load sb_h_double_arrow from the cursor theme
Gdk-Message: 11:19:32.838: Unable to load sb_v_double_arrow from the cursor theme
[New LWP 14947]
[LWP 14947 exited]
[New LWP 14948]
[New LWP 14949]
[LWP 14948 exited]
[LWP 14949 exited]
[New LWP 14950]
[New LWP 14951]
[LWP 14950 exited]
[LWP 14951 exited]
^Z
Thread 1 ".emacs-30.0.50-" received signal SIGTSTP, Stopped (user).
0x00007ffff3def17b in pselect () from /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libc.so.6
(gdb) info dll
From To Syms Read Shared Object Library
0x00007ffff7fcf050 0x00007ffff7ff15ee Yes (*) /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/ld-linux-x86-64.so.2
0x00007ffff769c070 0x00007ffff79e9936 Yes /gnu/store/whgbkfyggc3ljkh7y9wqwvqgnsnnyf7w-gtk+-3.24.30/lib/libgtk-3.so.0
0x00007ffff7ee6190 0x00007ffff7f5efdd Yes /gnu/store/whgbkfyggc3ljkh7y9wqwvqgnsnnyf7w-gtk+-3.24.30/lib/libgdk-3.so.0
0x00007ffff7ea9b20 0x00007ffff7eaf8c0 Yes (*) /gnu/store/vk23fcm4livzrnb3kzhxs6yjds8f355c-pango-1.48.10/lib/libpangocairo-1.0.so.0
0x00007ffff7e61c80 0x00007ffff7e8711e Yes (*) /gnu/store/vk23fcm4livzrnb3kzhxs6yjds8f355c-pango-1.48.10/lib/libpango-1.0.so.0
0x00007ffff751fec0 0x00007ffff75c462e Yes (*) /gnu/store/f6ibajh7x233cvr30c2p314l2absk36h-harfbuzz-2.8.2/lib/libharfbuzz.so.0
0x00007ffff7e316b0 0x00007ffff7e3ed44 Yes (*) /gnu/store/np9pryvn0rxc00cc6g4jd7rlcxwk2mxs-atk-2.36.0/lib/libatk-1.0.so.0
0x00007ffff750d0a0 0x00007ffff750e20d Yes (*) /gnu/store/6gq2n65ixpn6drd5wai2h7g5wjm6bp2b-cairo-1.16.0/lib/libcairo-gobject.so.2
0x00007ffff73fc680 0x00007ffff74c3a97 Yes (*) /gnu/store/6gq2n65ixpn6drd5wai2h7g5wjm6bp2b-cairo-1.16.0/lib/libcairo.so.2
0x00007ffff73c9b50 0x00007ffff73dccde Yes (*) /gnu/store/xgiz9rvzvfhwx655lb6jpjx1whc4kjg8-gdk-pixbuf-2.42.4/lib/libgdk_pixbuf-2.0.so.0
0x00007ffff721e980 0x00007ffff73267e6 Yes (*) /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgio-2.0.so.0
0x00007ffff7191760 0x00007ffff71be826 Yes (*) /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libgobject-2.0.so.0
0x00007ffff706ed40 0x00007ffff70f4a7e Yes (*) /gnu/store/96srhmpmxa20wmsck95g3iq4hb3lz4a0-glib-2.70.2/lib/libglib-2.0.so.0
0x00007ffff6fd5dc0 0x00007ffff7018105 Yes (*) /gnu/store/343iqv9hvbvzp2in0hs03dvygccrcapl-libtiff-4.3.0/lib/libtiff.so.5
0x00007ffff6f39500 0x00007ffff6f8e0c5 Yes (*) /gnu/store/g5hf1zhqlcyx9vw3q1xa52bgddaqsfm5-libjpeg-turbo-2.0.5/lib/libjpeg.so.62
0x00007ffff6f05900 0x00007ffff6f2739a Yes (*) /gnu/store/p7iq81hxxyk9zy7a9dngbf16zm8d4klx-libpng-1.6.37/lib/libpng16.so.16
0x00007ffff6ee52f0 0x00007ffff6ef5cc4 Yes (*) /gnu/store/8qv5kb2fgm4c3bf70zcg9l6hkf3qzpw9-zlib-1.2.11/lib/libz.so.1
0x00007ffff6ed9390 0x00007ffff6edd58b Yes (*) /gnu/store/4d0ssibbd2glk1vc93zj738awmy22xad-giflib-5.2.1/lib/libgif.so.7
0x00007ffff6e0fcc0 0x00007ffff6e93bd6 Yes (*) /gnu/store/nfxcjvv9c2q6in9x52kkkayqv38k00ai-alsa-lib-1.2.4/lib/libasound.so.2
0x00007ffff6512070 0x00007ffff6a2df5c Yes (*) /gnu/store/0w390zkxhzhkmyp0sns8z97bfmzbr7gz-librsvg-2.50.7/lib/librsvg-2.so.2
0x00007ffff62cc200 0x00007ffff6362d11 Yes (*) /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libm.so.6
0x00007ffff6dd4370 0x00007ffff6dd8340 Yes (*) /gnu/store/a38k2v29l6l0iz6pmlk4dmzwdbvl10lq-acl-2.3.1/lib/libacl.so.1
0x00007ffff6dca3f0 0x00007ffff6dcd1b1 Yes (*) /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/librt.so.1
0x00007ffff626dd20 0x00007ffff62a636a Yes (*) /gnu/store/8zigz7afvz2rjrvrh7zq1d389qbl2684-dbus-1.12.20/lib/libdbus-1.so.3
0x00007ffff6122bd0 0x00007ffff62068ce Yes (*) /gnu/store/g3y6ifhm0751vgsxv90yipfw6mk189kj-libxml2-2.9.12/lib/libxml2.so.2
0x00007ffff6097cc0 0x00007ffff60d13e8 Yes (*) /gnu/store/9rrnm5hdjw7cy96a2a9rfgh6y08wsbmf-ncurses-6.2.20210619/lib/libncursesw.so.6
0x00007ffff6052f80 0x00007ffff6071dd1 Yes (*) /gnu/store/3hmh0srgky1a621rzaxf98qvr0p9r1dv-libselinux-3.4/lib/libselinux.so.1
0x00007ffff5fa79c0 0x00007ffff6018c0d Yes (*) /gnu/store/ak70pk2hjks17cx7zjdmdmzpcpiy9gpi-freetype-2.10.4/lib/libfreetype.so.6
0x00007ffff5f577a0 0x00007ffff5f7d05a Yes (*) /gnu/store/3r5sl1l02kjxzw3gicjpjz4kw6v4rgs9-fontconfig-minimal-2.13.94/lib/libfontconfig.so.1
0x00007ffff5f38230 0x00007ffff5f49380 Yes (*) /gnu/store/64ic06l5pd78n7blzikqzfnnp0xp5msd-libotf-0.9.16/lib/libotf.so.1
0x00007ffff5d76940 0x00007ffff5e89670 Yes (*) /gnu/store/zl9wf0zwq2ka9rpmayp53hnp2mn460xf-gnutls-3.7.2/lib/libgnutls.so.30
0x00007ffff5d22540 0x00007ffff5d2fba1 Yes (*) /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libpthread.so.0
0x00007ffff5d17200 0x00007ffff5d18301 Yes (*) /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libanl.so.1
0x00007ffff5cc3280 0x00007ffff5cf9bfa Yes (*) /gnu/store/0dhvl2lvb7gsrbjf5jq5pd7hdvznsazz-lcms-2.12/lib/liblcms2.so.2
0x00007ffff5cb2130 0x00007ffff5cb2f31 Yes (*) /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libdl.so.2
0x00007ffff5c1b830 0x00007ffff5c8537c Yes (*) /gnu/store/v3hqc5i1jqi0s04zxvi465bihrgb1sq1-elogind-246.10/lib/libelogind.so.0
0x00007ffff5bfb1f0 0x00007ffff5c02f2b Yes (*) /gnu/store/nprljhh7a86351vg6h23va3kfdnkwnd4-jansson-2.13.1/lib/libjansson.so.4
0x00007ffff5b6d440 0x00007ffff5bde0ab Yes (*) /gnu/store/fwbiihd2sbhai63y1pvvdh0f2bakfzrf-gmp-6.2.1/lib/libgmp.so.10
0x00007ffff4219c50 0x00007ffff508025e Yes (*) /gnu/store/lphzb1z0r4kbb453rsvnw7msrxxzp5r7-libgccjit-10.3.0/lib/libgccjit.so.0
0x00007ffff5b2e8c0 0x00007ffff5b51e83 Yes (*) /gnu/store/cbviswij2rbqnbsc889166wm7ri5pc2r-tree-sitter-0.20.7/lib/libtree-sitter.so.0
0x00007ffff3ed5ca0 0x00007ffff3fc4c36 Yes (*) /gnu/store/xmzx5mzv4863yw9kmr2ykndgp37p8if0-sqlite-3.36.0/lib/libsqlite3.so.0
0x00007ffff5b12310 0x00007ffff5b22b1d Yes (*) /gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib/libgcc_s.so.1
0x00007ffff3d25330 0x00007ffff3e64389 Yes (*) /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libc.so.6
0x00007ffff5b09100 0x00007ffff5b099ec Yes (*) /gnu/store/6h8skg2n4gpbi0bwfmw6qyh03phic6dm-libxinerama-1.1.4/lib/libXinerama.so.1
...
(*): Shared library is missing debugging information.

My .gdbinit:
Toggle snippet (19 lines)
# Tell GDB where to look for separate debugging files.
guile
(use-modules (gdb))
(execute (string-append "set debug-file-directory "
(string-join
(if (getenv "GDB_DEBUG_FILE_DIRECTORY")
(list (getenv "GDB_DEBUG_FILE_DIRECTORY"))
'())
":")))
end

# Authorize extensions found in the store, such as the
# pretty-printers of libstdc++.
set auto-load safe-path /
# /gnu/store/*/lib
set history filename ~/.cache/gdb_history
set history save on

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmRGL+0ACgkQIgjSCVjB
3rCRdQ/8DkPRIYywyCN3h2IKTyOmkE5DbQ6KXY5lDEBWg1awdDiglRDEnFfk4XJd
TxK5TQfyThtwayahULxv4YkZRIbi4y0FU6brWgslfVBTdMHmCeeD+wyEuBuUKgAU
0RXCk07dx1H2NNSuCz4HkEHDyIhCUOzfm3IwDcCDqF3Lt5wqCk79WbtwCMRXkk1n
3gZZ7YFi9/lTcZLCslbrtOZFRTBl4fPmvH/s4Cs7REyGjloO+RuAGtS77oD4lBKG
43bN5H2Ec7WGJXY6eElIpdGBJnCwv7qc9+L8wkmcKmi/76KtRDk3GlMWSCAIyfKu
f2t4+PHfe+k7WU/MvaVRRqkC9awiGLEOWDB6tedf5ft6e9JKQq9XO7m1N9Bj7MVh
nQ7GhnUcaZqLD2DpgXvx30gdSMczrs7aVNIDy2K5isLdTOU2muUt8LrrBlgMXO3N
v6KDwswGJH5IBqbJO9xfZLgvMFuVEjiNPZrZ3WZjPrWAKoZ/LgRHPQL2NRFX53qE
beoC7G8WRGRNguoGX/19eS1weWHyuTv3/CkPh7xdih/bfB5Zx5xW3G8Kxa5wRjFA
XTA4z7KpLiD3CAD7Mhyo4OYUUxDcFSTCNSVOsu6AxURBBuZQVUE1pjer1kQeU2nJ
4ja0vNNRckLPEUn/5aW2478Ld7IXCU4fYlH9DyeEDgKugPJoB0k=
=i5y2
-----END PGP SIGNATURE-----

J
J
Josselin Poiret wrote on 24 Apr 2023 09:54
87ttx5vhoq.fsf@jpoiret.xyz
Hi Andrew,

Andrew Tropin <andrew@trop.in> writes:

Toggle quote (10 lines)
> I try to run emacs in gdb with debug symbols for some libs available, I
> succeed with gtk+, but it doesn't work for glib and glibc. It looks
> strange to me, but maybe I am doing something wrong.
>
> Reproducer:
>
> guix shell gdb emacs-next-pgtk glibc:debug gtk+:debug glib:debug \
> --with-debug-info=glibc --with-debug-info=glib --with-debug-info=gtk+ \
> --no-grafts -- gdb .emacs-30.0.50-real

At least for glibc, the glibc that is linked against is the one in (gnu
packages commencement), which is hidden from the user. The one in (gnu
packages base), which you can refer to with "glibc" is different. You
can try to find the proper debug output by looking at `guix size` of
your store path, then finding out the deriver for glibc with `guix gc
--derivers` and finally looking at the .drv to find out what the debug
output should be.

For glib, it might be similar, make sure that you're using exactly the
right store path for it.

Best,
--
Josselin Poiret
-----BEGIN PGP SIGNATURE-----

iQHEBAEBCAAuFiEEOSSM2EHGPMM23K8vUF5AuRYXGooFAmRGNbUQHGRldkBqcG9p
cmV0Lnh5egAKCRBQXkC5FhcailDLDACCv808ZnXddNomzJ4zdz1nBKR/tv5L8wz3
7ffY6Tt0fBixqSjH25vYH4wrYDDganSxFdRDHUGcaDXH5FV7h/vm/IsNL8glojLh
1HwrWgXWC3KicYBlU2Af8mgMwGkhmCXa1zfk5Otlv2q6djpa5Z6HwUnW5aHY6/z2
7hdPgycA0NMuCnhyfdRiPhdh+grPvxt7cHMD9nRc197OCJpyn5qt2Ac3y/dsA447
L0nZbyWo/Qxr2wBl0ciDNeDbSyYxLCWQjU3qDi51dRAoQmJpZZMWwiAZxi8Dy/GH
xwYFaUaAkFIzMgY+JKlYmF4OT483690kG6HUQZCxo5wyIFfED145EVxowVczw4jH
3gtPu/zaaLCeozBQGYVDth1Khz3SjJd4sTAk270jSXZWqLA/EWbR9OXTqPcwjgxG
HBIZxn4HuezPbbZmfSbb4XuVuTJ/yoNDuyU0ZPm1mVTEG9d0QlDQB+c71wrdlghq
ARL+PKRyP3lz1HUYLYa4vDUkpheuz50=
=59A5
-----END PGP SIGNATURE-----

M
M
Maxim Cournoyer wrote on 25 Apr 2023 14:38
(name . Josselin Poiret via Bug reports for GNU Guix)(address . bug-guix@gnu.org)
87edo8qgq3.fsf@gmail.com
Hi Andrew,

Josselin Poiret via Bug reports for GNU Guix <bug-guix@gnu.org> writes:

Toggle quote (25 lines)
> Hi Andrew,
>
> Andrew Tropin <andrew@trop.in> writes:
>
>> I try to run emacs in gdb with debug symbols for some libs available, I
>> succeed with gtk+, but it doesn't work for glib and glibc. It looks
>> strange to me, but maybe I am doing something wrong.
>>
>> Reproducer:
>>
>> guix shell gdb emacs-next-pgtk glibc:debug gtk+:debug glib:debug \
>> --with-debug-info=glibc --with-debug-info=glib --with-debug-info=gtk+ \
>> --no-grafts -- gdb .emacs-30.0.50-real
>
> At least for glibc, the glibc that is linked against is the one in (gnu
> packages commencement), which is hidden from the user. The one in (gnu
> packages base), which you can refer to with "glibc" is different. You
> can try to find the proper debug output by looking at `guix size` of
> your store path, then finding out the deriver for glibc with `guix gc
> --derivers` and finally looking at the .drv to find out what the debug
> output should be.
>
> For glib, it might be similar, make sure that you're using exactly the
> right store path for it.

Perhaps try on the core-updates branch, where glibc no longer has its
symbols stripped. Another thing that can cause the debug symbols to not
be found is grafts, as described in #48907, so when debugging I'd
recommend using --no-grafts for now.

--
Thanks,
Maxim
A
A
Andrew Tropin wrote on 13 Sep 2023 09:54
87zg1qy0db.fsf@trop.in
On 2023-04-25 08:38, Maxim Cournoyer wrote:

Toggle quote (34 lines)
> Hi Andrew,
>
> Josselin Poiret via Bug reports for GNU Guix <bug-guix@gnu.org> writes:
>
>> Hi Andrew,
>>
>> Andrew Tropin <andrew@trop.in> writes:
>>
>>> I try to run emacs in gdb with debug symbols for some libs available, I
>>> succeed with gtk+, but it doesn't work for glib and glibc. It looks
>>> strange to me, but maybe I am doing something wrong.
>>>
>>> Reproducer:
>>>
>>> guix shell gdb emacs-next-pgtk glibc:debug gtk+:debug glib:debug \
>>> --with-debug-info=glibc --with-debug-info=glib --with-debug-info=gtk+ \
>>> --no-grafts -- gdb .emacs-30.0.50-real
>>
>> At least for glibc, the glibc that is linked against is the one in (gnu
>> packages commencement), which is hidden from the user. The one in (gnu
>> packages base), which you can refer to with "glibc" is different. You
>> can try to find the proper debug output by looking at `guix size` of
>> your store path, then finding out the deriver for glibc with `guix gc
>> --derivers` and finally looking at the .drv to find out what the debug
>> output should be.
>>
>> For glib, it might be similar, make sure that you're using exactly the
>> right store path for it.
>
> Perhaps try on the core-updates branch, where glibc no longer has its
> symbols stripped. Another thing that can cause the debug symbols to not
> be found is grafts, as described in #48907, so when debugging I'd
> recommend using --no-grafts for now.

Thank you for the tips.

For future readers: the core-updates merged, it should be fixed, however,
I didn't check if it works now.

Closing the issue, but feel free to reopen.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmUBaqAACgkQIgjSCVjB
3rBjzw//ezAAeqU8TbMm2CQZS62OHDbePSGqCCaYy3N7aga71ssnjxnaCQrYrRzC
tNDWmXy3UioY4qN/87A1FqoNSJhZRAkm5jUUQOzRYlaXJnvbHNy+TTsYUbyQnY1o
12Jfq9f5aQ3JmyWIwOz7Ra+KmJdAL2S5g1pdj76D/epq6wkaZpDmaIvdLt9EAzyz
4JdgyAXoj36shM+yLI3VVAduV2/g6xBwgJ4/IKD9KWfgVNpfmprBW5ivqRXD7if8
ZECcH4vpDC1UAAKmWSxJAC8EFxXvJvhY85PDCMQTkuD6GZsh+d+hvQxRpUcwAKpr
4H4bH6PJ8D5eDcYhZsLfO40ZWVoJzMQlv2Nbx5fbCwmtenQactqfO0jZJNdBoGap
hq1jI8ab275Pb/x0RsCm+q4L0enaD6A0kwEMhIOehCu1tBLvmENK6WSLNtVzbgNa
r3F2xgSw9ce0PRlL6Z6LHiaYFZjhL9TI5iPct4q3V7ebI+kwUXJFy5puBCVzNbko
EzVpvNKAOVq1gPYuLYH0hRm7+DJU81wqg3q4jz4CW/Ii6eN7IQuyzJTVGB6iBCET
umgSgZR7PoJgBe2okl5O1N1tSRD2U1aP8b02hnM1DxpT+S03fdK3rUf58E1qim2/
gZUGX5RIGFvQQPT8pou6WPbb/bUQ4mZ/MyeEIeHZTibyeg9B/U4=
=JfX3
-----END PGP SIGNATURE-----

?