[Numpy-discussion] PyArray_Check problem.

Konrad Hinsen hinsen at cnrs-orleans.fr
Fri Oct 20 08:08:40 CDT 2000


> > A look at the value of "spam" with a debugger should tell you what's
> > going on.
> 
> I have not yet figured out how to use a de-bugger with a python
> extension. Does anyone know of any nifty tutorial for how to do this
> (with gdb, preferably)? note that I'm a newby to C too, so I need a
> really basic run through.

I used gdb with gcc under Linux, and I just use it as I would on
any other program:

   gdb /usr/bin/python
   run spam.py

and wait for the crash. Of course your module should have been compiled
with -g if you want symbolic debugging.

The only difficulty with debugging extension modules built as dynamic
libraries is setting breakpoints. You can't do it right away because
the module isn't loaded yet, so its symbols are unknown to gdb. My
solution is to start my script with the import, followed immediately
by "time.sleep(5)". That gives me five seconds to press Control-C to
reenter the debugger, and from then on everything works as advertised.
If someone knows a more elegant solution, please let me know!

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------



More information about the Numpy-discussion mailing list