getting segmentation fault

114 views
Skip to first unread message

Carles Fernàndez Julià

unread,
Aug 23, 2012, 11:40:41 AM8/23/12
to pytho...@googlegroups.com
Hi!

I was testing cffi in Cpython trying to bind to OpenGL functions to have a minimal OpenGL example.

So far I cdef() and verify() correctly, but I get a segmentation fault (not handled by python), probably by something I am doing wrong (may be in in callback code?).

So the noob question:
As I am not getting any stack trace, how can I debug this?

The file for reference: http://pastebin.com/xgLwV2kK

Armin Rigo

unread,
Aug 24, 2012, 12:56:02 PM8/24/12
to pytho...@googlegroups.com
Hi Carles,

On Thu, Aug 23, 2012 at 5:40 PM, Carles Fernàndez Julià
<chao...@gmail.com> wrote:
> So the noob question:
> As I am not getting any stack trace, how can I debug this?

There are two ways I can think of:

- add prints a bit everywhere in the Python source. At least you
should be able to pinpoint where the problem is.

- or, pretend it's a C program and debug it the same way: with gdb (or
Microsoft's debuggers on Windows). Start python with "gdb python" and
run until the segfault, and see if gdb has a useful C traceback (e.g.
if you're passing by mistake a NULL pointer to a C function that
doesn't expect it, it's likely to segfault).


A bientôt,

Armin.
Reply all
Reply to author
Forward
0 new messages