[gdal-dev] ogr.BuildPolygonFromEdges as called from python segfaults

Even Rouault even.rouault at mines-paris.org
Sun May 18 04:46:05 EDT 2008


Dave,

thanks for the reporting ! 
Ouch, it seems that the OGRBuildPolygonFromEdges() function has not been 
mapped into SWIG, as far as I can see. So, I guess that you use now the new 
generation python bindings that are the default from GDAL 1.5.0... That 
explains why it works in GDAL 1.4.X and not in GDAL 1.5.0

I've filed a ticket for that : http://trac.osgeo.org/gdal/ticket/2380

I don't understand the segfault however. On my machine, I just get a python 
exception.

You can debug the GDAL code called from a python script with DDD/GDB.
Run 'ddd python'. Then in DDD : 'set args my_script.py'. Then 'run'.
On your test case, if it segfaults in GDAL code, you should be able to see the 
stack trace, 'bt' or the GUI command.
Once the first run has occured, you can also add breakpoints in GDAL code, for 
example 'b CPLMalloc' and rerun again. 

You can also run Valgrind on a python script calling GDAL code :
valgrind --trace-children=yes ./my_script.py

Best regards,

Even

Le Sunday 18 May 2008 05:01:02 David Fuhry, vous avez écrit :
> The script works fine in 1.4.4, so the problem was introduced somewhere
> between there and 1.5.1.
>
> -Dave
>
> David Fuhry wrote:
> > ogr.BuildPolygonFromEdges as called from python is always throwing an
> > exception for me, and perhaps always segfaulting:
> >
> > $ ./test_build_poly.py
> > BuildPolygonFromEdges failed.
> > Segmentation fault
> >
> > I first experienced the error running swig/python/samples/tigerpoly.py
> > on some TIGER data.  I duplicated some of tigerpoly.pl into a reduced
> > python testcase (attached).
> >
> > Tested with both svn head and 1.5.1, on both RHEL4 x86_64 and Debian
> > x86_64.  I don't know the debugging procedure for tracing python calls
> > into C++.  Suggestions on that or how to fix the bug welcome.
> >
> > Thanks,
> >
> > Dave
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev




More information about the gdal-dev mailing list