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

Gregory Szorc gregory.szorc at gmail.com
Sun Jan 20 12:45:38 PST 2013


AFAIK every valid cursor should have a TU.

I tried running your code and could not trigger a segfault. I'm using 
Python 2.7.3 and an LLVM build from yesterday on OS X. Although, it 
sounds like you may have stumbled across a legit bug in libclang for the 
null TU. My realm of expertise is only Python. Hopefully someone else on 
this list will jump in... You should also consider filing a bug on this.

On 1/16/13 12:55 AM, andrewh at etherstack.com wrote:
> Hi Gregory,
>
> I've tried with the a version I checked out from svn a week or so ago 
> and still experience the segfault
>
> LLVM
> URL: http://llvm.org/svn/llvm-project/llvm/trunk
> Repository Root: http://llvm.org/svn/llvm-project
> Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
> Revision: 171351
> Node Kind: directory
> Schedule: normal
> Last Changed Author: ctopper
> Last Changed Rev: 171351
> Last Changed Date: 2013-01-02 07:53:20 +1100 (Wed, 02 Jan 2013)
>
> Clang
> URL: http://llvm.org/svn/llvm-project/cfe/trunk
> Repository Root: http://llvm.org/svn/llvm-project
> Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
> Revision: 171351
> Node Kind: directory
> Schedule: normal
> Last Changed Author: d0k
> Last Changed Rev: 171350
> Last Changed Date: 2013-01-02 07:08:10 +1100 (Wed, 02 Jan 2013)
>
> Cheers,
> Andrew
>
>
> Quoting Gregory Szorc <gregory.szorc at gmail.com>:
>
>> Could you please try reproducing this with Clang 3.2 or the latest SVN
>> version (http://clang.llvm.org/get_started.html)?
>>
>> On 1/15/2013 6:06 PM, Andrew Hankins 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?
>>> 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
>>>
>>>
>>> _______________________________________________
>>> 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