[gdal-dev] Hints for debugging gdal vector drivers ?

Andrew C Aitchison andrew at aitchison.me.uk
Wed May 20 14:25:44 PDT 2020


Those two hints were just what I needed.

On Wed, 20 May 2020, Even Rouault wrote:
> On mercredi 20 mai 2020 17:02:12 CEST Andrew C Aitchison wrote:
>> I'm writing a gdal vector driver for a file-based data format.
>> I'm getting a SIGSEGV in OGRLayer::GetExtentInternal called from
>> ogrinfo code when I run
>>     /usr/local/gdal3.1.0/bin/ogrinfo /home/maps/MemoryMap/Norway-1m.qct
>> "outline" on my datafiles.
>> The stack trace below suggests that the feature has no valid extent (see
>> m_sFilterEnvelope) - which is reasonable as the driver never sets a filter,
>> envelope or extent.
>> I believe I've followed what was https://gdal.org/ogr_drivertut.html
>> (IIRC http://manpages.org/ogr_drivertut is a reasonable mirror).
>> How should the driver ensure that it gives OGR the necessary
>> filter/envolope.extent information ?
>> From the crash at line 267 of ogrlyaer.cpp, I'd say your driver returns a geometry object that
> has been destroyed
> Random guess: you might do something like:
> {
> 	OGRPoint p;
> 	poFeature->SetGeometryDirectly(&p);
> 	// p is destroy now, and poFeature has just kept the pointer on it.
> }
> ==> Run Valgrind. Or run valgrind. Or perhaps run valgrind :-)

Andrew C. Aitchison					Kendal, UK
 			andrew at aitchison.me.uk

More information about the gdal-dev mailing list