$subj. Otherwise after running gdb as root there are orphaned files inside /usr/share/gdb/python/gdb: $ find /usr/share/gdb/ | xargs qfile -o /usr/share/gdb/python/gdb/command/__pycache__ /usr/share/gdb/python/gdb/command/__pycache__/__init__.cpython-36.pyc /usr/share/gdb/python/gdb/command/__pycache__/explore.cpython-36.pyc /usr/share/gdb/python/gdb/command/__pycache__/frame_filters.cpython-36.pyc /usr/share/gdb/python/gdb/command/__pycache__/pretty_printers.cpython-36.pyc /usr/share/gdb/python/gdb/command/__pycache__/prompt.cpython-36.pyc /usr/share/gdb/python/gdb/command/__pycache__/type_printers.cpython-36.pyc /usr/share/gdb/python/gdb/command/__pycache__/unwinders.cpython-36.pyc /usr/share/gdb/python/gdb/command/__pycache__/xmethods.cpython-36.pyc /usr/share/gdb/python/gdb/function/__pycache__ /usr/share/gdb/python/gdb/function/__pycache__/__init__.cpython-36.pyc /usr/share/gdb/python/gdb/function/__pycache__/caller_is.cpython-36.pyc /usr/share/gdb/python/gdb/function/__pycache__/strfns.cpython-36.pyc /usr/share/gdb/python/gdb/function/__pycache__/as_string.cpython-36.pyc /usr/share/gdb/python/gdb/printer/__pycache__ /usr/share/gdb/python/gdb/printer/__pycache__/__init__.cpython-36.pyc /usr/share/gdb/python/gdb/printer/__pycache__/bound_registers.cpython-36.pyc /usr/share/gdb/python/gdb/__pycache__ /usr/share/gdb/python/gdb/__pycache__/__init__.cpython-36.pyc /usr/share/gdb/python/gdb/__pycache__/FrameIterator.cpython-36.pyc /usr/share/gdb/python/gdb/__pycache__/FrameDecorator.cpython-36.pyc /usr/share/gdb/python/gdb/__pycache__/frames.cpython-36.pyc /usr/share/gdb/python/gdb/__pycache__/prompt.cpython-36.pyc /usr/share/gdb/python/gdb/__pycache__/printing.cpython-36.pyc /usr/share/gdb/python/gdb/__pycache__/types.cpython-36.pyc /usr/share/gdb/python/gdb/__pycache__/xmethod.cpython-36.pyc
Sounds reasonable. How about: /usr/share/gdb/system-gdbinit/elinos.py /usr/share/gdb/system-gdbinit/wrs-linux.py Would you like to write a patch yourself?
(In reply to Sergei Trofimovich from comment #1) > /usr/share/gdb/system-gdbinit/elinos.py > /usr/share/gdb/system-gdbinit/wrs-linux.py Both of these files are incompatible with Python 3. They are not used by default. A file would be used by default if GDB was configured at build time with --with-system-gdbinit=FILE option. Example: --with-system-gdbinit=/usr/share/gdb/system-gdbinit/wrs-linux.py Otherwise, --command / -x / --init-command / -ix can be used: $ gdb -x /usr/share/gdb/system-gdbinit/wrs-linux.py ... File "/usr/share/gdb/system-gdbinit/wrs-linux.py", line 24 print "warning: ENV_PREFIX environment variable missing." ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(int "warning: ENV_PREFIX environment variable missing.")? (gdb) Testing with a valid file shows that Python cache file is not created: $ echo 'print(123456)' > /tmp/aaa.py $ gdb -x /tmp/aaa.py ... 123456 (gdb) quit $ ls /tmp/__pycache__ ls: cannot access '/tmp/__pycache__': No such file or directory So python_optimize() is not needed for /usr/share/gdb/system-gdbinit.
Created attachment 603794 [details] sys-devel-gdb-call-python_optimize.patch I've bumped 8.3.1 because the patch changes installed files.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abc12b4d6fc5a276cdf82cf92066a27a9b5020a6 commit abc12b4d6fc5a276cdf82cf92066a27a9b5020a6 Author: Alexander Tsoy <alexander@tsoy.me> AuthorDate: 2020-01-20 10:48:41 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-01-20 19:38:16 +0000 sys-devel/gdb: call python_optimize, bug #705680 Closes: https://bugs.gentoo.org/705680 Signed-off-by: Alexander Tsoy <alexander@tsoy.me> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-devel/gdb/gdb-8.3.1-r1.ebuild | 264 ++++++++++++++++++++++++++++++++++++++ sys-devel/gdb/gdb-9999.ebuild | 4 + 2 files changed, 268 insertions(+)