Message from discussion
Debugging Cython code
Received: by 10.66.81.170 with SMTP id b10mr7560171pay.31.1352752429372;
Mon, 12 Nov 2012 12:33:49 -0800 (PST)
X-BeenThere: sage-devel@googlegroups.com
Received: by 10.68.236.33 with SMTP id ur1ls26288420pbc.2.gmail; Mon, 12 Nov
2012 12:33:45 -0800 (PST)
MIME-Version: 1.0
Received: by 10.68.230.33 with SMTP id sv1mr5655363pbc.18.1352752425354; Mon,
12 Nov 2012 12:33:45 -0800 (PST)
Authentication-Results: ls.google.com; spf=pass (google.com: domain of
nbr...@sfu.ca designates internal as permitted sender)
smtp.mail=nbr...@sfu.ca; dkim=pass
header...@sfu.ca
Received: by qi10g2000pbb.googlegroups.com with HTTP; Mon, 12 Nov 2012
12:33:45 -0800 (PST)
Date: Mon, 12 Nov 2012 12:33:45 -0800 (PST)
In-Reply-To: <k7rkv2$vd3$1@ger.gmane.org>
References: <CANP2DtV_zXEuLokahzii9g+DhUpusA9jeqPzcyjJZnGh29KM2Q@mail.gmail.com>
<k7rkv2$vd3$1@ger.gmane.org>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0,gzip(gfe)
Message-ID: <1092d5b5-1d6c-41da-93a4-60160ba983ba@qi10g2000pbb.googlegroups.com>
Subject: Re: Debugging Cython code
From: Nils Bruin <nbr...@sfu.ca>
To: sage-devel <sage-devel@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Nov 12, 12:08=A0pm, Jason Grout <jason-s...@creativetrax.com> wrote:
> I think you can also use gdb; it seems I've done it once before, at least=
.
I have used gdb for stack examination after a segfault. For "C-like"
pieces of Cython it works quite well. For "Python-like" pieces it's
horrible, because python objects are virtually impossible to
investigate with gdb (i.e., C-level). There is the added problem that
gdb will happily give you the source context, but that will refer to
the C that cython produced, not the original ".pyx". That means you
have to deal with mangled identifier names too (which isn't too bad
for C-like cython, which allows an almost 1-1 translation to C).
A thing that would make gdb-debugging of cython immensely more useful
would be if one could set breakpoints in a sensible way. I haven't
used it, but gdb allows setting breakpoints by filename and
linenumber. Those would be ".c" filename and linenumber, though. If we
could somehow have a convenient translation tool from ".pyx" filename
+linenumber to ".c" filename+linenumber, setting breakpoints would be
much more doable. Is this something the cython people have thought
about? Does this need a "cydb" wrapper around gdb or does gdb have its
own customization options that allow something along these lines?
People tend to say that debuggers provide a more efficient
investigation tool than print-and-recompile, but I doubt this is
presently true for cython. Perhaps this can be improved?