How do you debug sage's cython code.

73 views
Skip to first unread message

Volker Weißmann

unread,
Mar 27, 2020, 1:47:10 PM3/27/20
to sage-devel
Hello,

let's say you are trying to figure out how sage's diff-function work. Maybe you write something like
#!/usr/bin/env sage
from sage.all import *
u
= var('u')
breakpoint
()
diff
(sin(u), u)

and run it with ./filename.py . Once the breakpoint is encountered, you can use step to step into the diff function and place breakpoints with break filename:linenumber in sage's python code. I'm using this a lot and it works fine. Problems arise, once you try to debug cython code. Neither stepping nor placing breakpoints in the *.pyx file works.
I also tried https://trac.sagemath.org/ticket/13881, but this also works rather poorly.

How do you guys usually debug sage's cython code?

Vincent Delecroix

unread,
Mar 27, 2020, 4:25:31 PM3/27/20
to sage-...@googlegroups.com

Vincent Delecroix

unread,
Mar 27, 2020, 4:34:26 PM3/27/20
to sage-...@googlegroups.com
Actually, what I use from time to time is

https://wiki.python.org/moin/DebuggingWithGdb

It works reasonably well (but a bit painful since the
C stack of a Python program is huge).

Volker Weißmann

unread,
Apr 1, 2020, 6:12:01 PM4/1/20
to sage-devel

Update: I found a solution and documented it here:

https://gitlab.com/volkerweissmann/cygdb_installation

--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/urbT-SzNkuQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/c7d0c707-60ab-4970-8f27-1c31a868501b%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages