I want to use gdb to debug Cython code, and am running into an early roadblock: gdb can’t find python’s symbols, even when compiled so that they should be present.
The definition of the python I’m debugging is
pythonOverlay = self: super: {
python38 = ((enableDebugging super.python38).override {
packageOverrides = myPackageOverrides;
}).overrideAttrs (oldAttrs: {
keepDebugInfo = true;
disallowedReferences = [];
});
};
Yet, when I run "gdb " I get
[henry@bollum:~/Projects/eyeserver/dserver/src]$ ./debugPython2.sh
GNU gdb (GDB) 10.1
Copyright (C) 2020 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 /nix/store/wkw6fsjasr7jbbrlakxxpbiapa8hws42-python3-3.8.7/bin/python...
(No debugging symbols found in /nix/store/wkw6fsjasr7jbbrlakxxpbiapa8hws42-python3-3.8.7/bin/python)
Starting program: /nix/store/wkw6fsjasr7jbbrlakxxpbiapa8hws42-python3-3.8.7/bin/python
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/gafigwfaimlziam6qhw1m8dz4h952g1n-glibc-2.32-35/lib/libthread_db.so.1".
Python 3.8.7 (default, Dec 21 2020, 17:18:55)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[Inferior 1 (process 23057) exited normally]
(gdb) (gdb)
quit
the contents of my debug script are as follows
#! /nix/store/can00lfiynqkbsdkkmgp6qg8p8w92cxa-bash-4.4-p23/bin/bash -e
export PYTHONHOME='/nix/store/2c5hpk7i7s87vqd6q743a6lqccz52342-python3-3.8.7-env'
export PYTHONNOUSERSITE='true'
gdb -ex=r --args "/nix/store/wkw6fsjasr7jbbrlakxxpbiapa8hws42-python3-3.8.7/bin/python" "${extraFlagsArray[@]}" "$@"
while the wrapper that (/home/henry/.nix-profile/bin/python) runs python (forcing the script) is
#! /nix/store/cwnwyy82wrq53820z6yg7869z8dl5s7g-bash-4.4-p23/bin/bash -e
export NIX_PYTHONPREFIX='/nix/store/2c5hpk7i7s87vqd6q743a6lqccz52342-python3-3.8.7-env'
export NIX_PYTHONEXECUTABLE='/nix/store/2c5hpk7i7s87vqd6q743a6lqccz52342-python3-3.8.7-env/bin/python3.8'
export NIX_PYTHONPATH='/nix/store/2c5hpk7i7s87vqd6q743a6lqccz52342-python3-3.8.7-env/lib/python3.8/site-packages'
export PYTHONNOUSERSITE='true'
exec "/nix/store/wkw6fsjasr7jbbrlakxxpbiapa8hws42-python3-3.8.7/bin/python" "$@"