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

Andrew Hankins andrewh at etherstack.com
Tue Jan 15 18:06:02 PST 2013


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?
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: struct2ctype.tar
Type: application/octet-stream
Size: 1949 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130116/3adfae76/attachment.obj>


More information about the cfe-dev mailing list