How to debug dynamic lib accessed with swig

View: New views
3 Messages — Rating Filter:   Alert me  

How to debug dynamic lib accessed with swig

by grossetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everyone,

I have written a dynamic lib/shared lib that I access with python using
swig. I get segfaults sometimes and I was wondering if anyone has some
tips on how to debug this. When I tested the C code using a C main it
works, and even in python, but in the real app (python) it sometimes dies.

Thank you,
Gabriel

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: How to debug dynamic lib accessed with swig

by Jani Kajala-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try re-building Python yourself and include some debug information (defaults are ok if you're using Visual Studio). Probably takes some time to get everything built, but I'm sure you'll benefit from it in the long run in terms of easier time with debugging.

Possible ideas for Release/Debug crashing differences:
* Memory management problems
* Mismatched C-runtime libraries / memory allocation functions
* Corrupted data (might not show itself in the other build)

All of those could work in some case and some case don't. Best shot is to just try to pinpoint where exactly it crashes, for example, with "printf debugging" if nothing else works.


Good luck,
Jani

On Wed, Sep 23, 2009 at 2:21 PM, Gabriel Rossetti <gabriel.rossetti@...> wrote:
Hello everyone,

I have written a dynamic lib/shared lib that I access with python using
swig. I get segfaults sometimes and I was wondering if anyone has some
tips on how to debug this. When I tested the C code using a C main it
works, and even in python, but in the real app (python) it sometimes dies.

Thank you,
Gabriel

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: How to debug dynamic lib accessed with swig

by grossetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Jani, I'll give that a try. I tried printf's but I was looking
for something where I don't have to stop, add a printf, and re-run
everything every time that I want to see something new, but yes, in the
worst case-scenario I'll do that :-)

Cheers,
Gabriel


Jani Kajala wrote:

> Try re-building Python yourself and include some debug information
> (defaults are ok if you're using Visual Studio). Probably takes some
> time to get everything built, but I'm sure you'll benefit from it in
> the long run in terms of easier time with debugging.
>
> Possible ideas for Release/Debug crashing differences:
> * Memory management problems
> * Mismatched C-runtime libraries / memory allocation functions
> * Corrupted data (might not show itself in the other build)
>
> All of those could work in some case and some case don't. Best shot is
> to just try to pinpoint where exactly it crashes, for example, with
> "printf debugging" if nothing else works.
>
>
> Good luck,
> Jani
>
> On Wed, Sep 23, 2009 at 2:21 PM, Gabriel Rossetti
> <gabriel.rossetti@... <mailto:gabriel.rossetti@...>> wrote:
>
>     Hello everyone,
>
>     I have written a dynamic lib/shared lib that I access with python
>     using
>     swig. I get segfaults sometimes and I was wondering if anyone has some
>     tips on how to debug this. When I tested the C code using a C main it
>     works, and even in python, but in the real app (python) it
>     sometimes dies.
>
>     Thank you,
>     Gabriel
>
>     ------------------------------------------------------------------------------
>     Come build with us! The BlackBerry® Developer Conference in SF, CA
>     is the only developer event you need to attend this year.
>     Jumpstart your
>     developing skills, take BlackBerry mobile applications to market
>     and stay
>     ahead of the curve. Join us from November 9-12, 2009. Register
>     now!
>     http://p.sf.net/sfu/devconf
>     _______________________________________________
>     Swig-user mailing list
>     Swig-user@...
>     <mailto:Swig-user@...>
>     https://lists.sourceforge.net/lists/listinfo/swig-user
>
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user