New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cpython: add separateDebugInfo, allow use of gdb libpython #93083
Conversation
used together with cpython's debugging symbols, this allows inspection of the python stack of cpython programs in gdb. this file is a little different from the rest of the python output by this package, in that it's not intended to be run by the current python being built, instead by the python being used by the gdb in question, which could be very different. therefore placed in its own, but hopefully logical & predictable location.
cd6abe7
to
ede2e00
Compare
@GrahamcOfBorg build python35 python36 python37 python38 python39 |
Python size increased after this change by ~30 MB. https://hydra.nixos.org/build/125194527#tabs-details $ nix build /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5 /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5
$ nix path-info -sh /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5 /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5
/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5 62.2M
/nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5 90.0M
$ du -hs /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/* | sort -h
4,0K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/config.c
4,0K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/config.c.in
4,0K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/python-config.py
4,0K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/python.o
4,0K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/Setup.local
8,0K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/makesetup
16K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/install-sh
16K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/__pycache__
16K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/Setup
80K /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/Makefile
6,9M /nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.a
$ du -hs /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/* | sort -h
4,0K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/config.c
4,0K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/config.c.in
4,0K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/python-config.py
4,0K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/Setup.local
8,0K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/makesetup
16K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/install-sh
16K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/__pycache__
16K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/Setup
36K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/python.o
80K /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/Makefile
35M /nix/store/wbilyi119q8my0kz2pl4chgs35xhlnhm-python3-3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.a Is |
Oh dear. Looks like I had too much faith in the magic of |
I'm putting something on my TODO list to write some tests for cpython/gdb debugging so we can safely experiment with slimming it down. |
I'm going to revert this change, because its too big this way. |
This increase the closure size by 30 MB. #93083 (comment) This reverts commit 4b340cb, reversing changes made to 47e499f.
Motivation for this change
The first thing this does is enable
separateDebugInfo
for cpython. Bit surprised we didn't already have this.It also exposes
Tools/gdb/libpython.py
in the package output. Used together with cpython's debugging symbols, this allows inspection of the python stack of cpython programs ingdb
. This file is a little different from the rest of the python output by this package, in that it's not intended to be run by the current python being built, instead by whatever python being used by thegdb
in question, which could be very different. Therefore I placed it placed in its own, but hopefully logical & predictable location:/usr/share/gdb/
/share/gdb/
. Also skipped building bytecode for it for similar reasons.This, of course, results in a massive rebuild and I'm not sure how I'd ever make a dent in it myself. I've tested
python27
throughpython39
. However I'm fairly sure we've got some custom python builds floating around, though I'm not sure how I'd find them.Tested on linux x86_64 & macos 10.14, though on macos
separateDebugInfo
does nothing leaving this slightly pointless there.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)