[cfe-dev] clang segfault - CXTypes.cpp:134

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Jan 16 09:06:11 PST 2013


On Jan 15, 2013, at 6:06 PM, Andrew Hankins <andrewh at etherstack.com> wrote:

> Hi all,
> 
> Using libclang with the python bindings to parse some header files and hopefully generate the equivalent Python ctypes definition for the structures requested.
> After parse as I'm walking through the tree I am hitting a segfault in CXIndex.cpp:134 from struct2ctype.py:87
> Looks like in CXTypes.cpp getCursorTU(C) returns null and freaks out on the next line where its dereferenced - Every valid cursor should have a valid TU right?

Except on null/invalid cursors. I added a check in r172625 to make sure we don't crash if TU is null.

> I've attach two files that can be used to reproduce the issue. Invoke with the following command
> 
> python2.7 struct2ctypes.py -d . StructName
> 
> I've had some mixed results reproducing the issue. With library I built from head I hit the issue having only parsed the single file but library shipped with ubuntu I need to place the file in a directory structure with plenty of other files.
> 
> My machine details
> - Linux 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
> - Python 2.7.3 (default, Aug  1 2012, 05:14:39)
> - clang version 3.0
> 
> Happy to work further on this - just need some direction
> 
> Cheers,
> Andrew
> <struct2ctype.tar>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list