[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
debugging gnulib-tool.py
From: |
Bruno Haible |
Subject: |
debugging gnulib-tool.py |
Date: |
Sat, 16 Mar 2024 01:27:05 +0100 |
Hi,
In order to debug Simon's report
<https://lists.gnu.org/archive/html/bug-gnulib/2024-03/msg00152.html>,
I decided to use a GUI debugger, rather than the primitive print(...)-based
debugging.
* Choice: It seems that PyCharm, VSCode, Spyder, Eclipse with PyDev are the
most prominent candidates.
VSCode is "modern", but
- the builds by Microsoft contain proprietary software,
- you have to explicitly opt-out from telemetry collection if you want
your privacy to be preserved,
- last time I used it (two years ago), it had bugs related to caches,
with the effect that syntax errors were shown that I already had
corrected.
So, I chose Eclipse with PyDev.
Eclipse has a long learning curve (2 weeks from the ground), therefore here
is how I configure it.
* Download and configuration:
- Eclipse IDE from https://www.eclipse.org/downloads/packages/
(either the build for Java or for C/C++ should work fine).
- PyDev from https://www.pydev.org/download.html
section "Install as Plugin".
(Don't use LiClipse, since the license costs money.)
- Follow https://www.pydev.org/manual_101_install.html,
replacing http://www.pydev.org/updates
with https://www.pydev.org/updates
- Once installed, restart the IDE.
- Window > Preferences > PyDev > Interpreters > Python Interpreter:
New > path: /usr/bin/python3
* Create a project:
Let GNULIB_DIR be my gnulib checkout.
- File > New > Project... > PyDev > PyDev Project. Call it 'gnulib'.
Note that this is a project inside the Eclipse workspace, so far
unrelated to the GNULIB_DIR.
- Popup menu > New > Link to Existing Source
Name: pygnulib
Path: <GNULIB_DIR>/pygnulib
* Create a run configuration:
- Run > Run Configurations... > Python Run
Popup menu > New configuration
Name: gnulib-tool.py
Main > Project: gnulib
Environment > Add
Variable: PYTHONPATH
Value: <GNULIB_DIR>
(This is the same hack as in <GNULIB_DIR>/gnulib-tool.py.)
Arguments > Program arguments: --help
- Test it: Run this configuration.
* Create a debug configuration:
- Run > Debug Configurations... > gnulib-tool.py
Popup menu > Duplicate
- In the duplicate, set
Arguments > Working directory: /tmp/oath-toolkit/lib
Arguments > Program arguments: --add-import
* Debug it:
- Open GLImport.py.
- On the left-hand border of this editor, do "Add breakpoint".
- Run > Debug Configurations... > pick the duplicate. Press Debug.
- debugging gnulib-tool.py,
Bruno Haible <=