cygdb won't stop at breakpoints

15 views
Skip to first unread message

Zachary Spector

unread,
Jul 16, 2026, 11:17:11 AM (2 days ago) Jul 16
to cython-users
I'm trying to use cygdb to diagnose an issue in Renovel, my thus-far experimental AI-free fork of the Ren'py visual novel game engine.

I think I've gotten it to start correctly. I changed run.sh so that, when the environment variable RENPY_GDB is set to "cygdb", it will run:

cygdb module/build -- --args python3-dbg -I renpy.py "$@"

When I enter cy run in the resulting gdb session, the app runs -- well, it fails to run, but it does so in the way I'm trying to debug.

However, if I set a Python breakpoint like

cy break -p main

And then I enter cy run... the same thing happens. I want it to stop execution at the first line of the renpy.py script's main() function, but that never happens. I've tried various other cy break uses, but nothing I do seems to make gdb stop anywhere useful. It only ever stops when execution stops overall, and I can't really get any useful information at that point.

How can I get cygdb to really stop at a breakpoint, like the documentation says it should?

I'm on Linux Mint 22.3, running Python 3.12.3 in a virtualenv, with Cython 3.2.8 installed from PyPI, and gdb 17.1 compiled --with-python. (Not with Python 2. cygdb doesn't really support that, despite what the documentation says.)

Zachary Spector

unread,
Jul 17, 2026, 1:02:19 PM (13 hours ago) Jul 17
to cython-users
Alright, I've made a minimal example.

File runthis.py contains:

from main import main as cymain


def main():
    print("Now presenting")
    cymain()


if __name__ == "__main__":
    main()

File main.pyx contains:

cpdef main():
   print("Hello, world!")
   print("Goodbye, world!")


File setup.py contains:

from setuptools import Extension, setup
from Cython.Build import cythonize

extensions = [Extension("main", ["main.pyx"])]
setup(name="Minimal cygdb test", ext_modules=cythonize(extensions, gdb_debug=True))



How to reproduce:

First, make sure you've got a version of Python configured --with-pydebug. Then make a venv, activate it, and install dependencies in it:

$ virtualenv -p /usr/local/bin/python3.14 venv
$ source venv/bin/activate
(venv) python -m pip install Cython setuptools

Build the Cython extension:

(venv) python setup.py build_ext --inplace

Start cygdb:

cygdb --build-dir . -- --args /usr/local/bin/python3.14 runthis.py
GNU gdb (Ubuntu 15.1-1ubuntu1~24.04.1) 15.1
Copyright (C) 2024 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-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 /usr/local/bin/python3.14...
gdb command file: Activating virtualenv: /home/sanotehu/src/cythontest/venv; path_to_activate_this_py: /home/sanotehu/src/cythontest/venv/bin/activate_this.py
warning: .cygdbinit: No such file or directory
(gdb)

Set a breakpoint in the Python code:

(gdb) cy break -p main
Breakpoint 1 at 0x2831e9: file Python/ceval.c, line 1000.

Now run the program. It runs correctly, but gdb doesn't stop in the Python main() function like we just told it to:

(gdb) cy run
Warning: 'set logging on', an alias for the command 'set logging enabled', is deprecated.
Use 'set logging enabled on'.

Now presenting
Hello, world!
Goodbye, world!
[Inferior 1 (process 854665) exited normally]


(gdb)



Reply all
Reply to author
Forward
0 new messages