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

Andrew C Aitchison andrew at aitchison.me.uk
Wed May 20 09:02:12 PDT 2020


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 ?

Thanks,

(gdb) where
#0  0x00007ffff65e1cf0 in main_arena () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7809d0f in OGRLayer::GetExtentInternal 
(this=0x555555620710,
     iGeomField=0, psExtent=0x7fffffffd600, bForce=<optimised out>)
     at ogrlayer.cpp:267
#2  0x0000555555558de0 in ReportOnLayer (poLayer=0x555555620710,
     pszWHERE=<optimised out>, pszGeomField=<optimised out>,
     poSpatialFilter=<optimised out>, bListMDD=<optimised out>,
     bShowMetadata=<optimised out>, papszExtraMDDomains=0x0,
     bFeatureCount=true, bExtent=true, bGeomType=true,
     pszWKTFormat=0x55555555a6c0 "WKT2") at ogrinfo.cpp:293
#3  0x00005555555576ef in main (nArgc=<optimised out>,
     papszArgv=<optimised out>) at ogrinfo.cpp:1038
(gdb) up
#1  0x00007ffff7809d0f in OGRLayer::GetExtentInternal 
(this=0x555555620710,
     iGeomField=0, psExtent=0x7fffffffd600, bForce=<optimised out>)
     at ogrlayer.cpp:267
267             if (poGeom == nullptr || poGeom->IsEmpty())
(gdb) print *this
$3 = {<GDALMajorObject> = {
     _vptr.GDALMajorObject = 0x7ffff08f9c08 <vtable for OGRQCTLayer+16>,
     nFlags = 1,
     sDescription = {<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >> = "outline", <No data fields>}, oMDMD = {
       papszDomainList = 0x0, papoMetadataLists = 0x0}},
   m_poPrivate = std::unique_ptr<OGRLayer::Private> = {get() = 0x555555620800},
   m_bFilterIsEnvelope = 0, m_poFilterGeom = 0x0, m_pPreparedFilterGeom = 0x0,
   m_sFilterEnvelope = {MinX = inf, MaxX = -inf, MinY = inf, MaxY = -inf},
   m_iGeomFieldFilter = 0, m_poStyleTable = 0x0, m_poAttrQuery = 0x0,
   m_pszAttrQueryString = 0x0, m_poAttrIndex = 0x0, m_nRefCount = 0,
   m_nFeaturesRead = 0}

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


More information about the gdal-dev mailing list