[LLVMdev] question about dibuilder

David Blaikie dblaikie at gmail.com
Mon Nov 24 09:37:41 PST 2014


On Sun, Nov 23, 2014 at 11:20 AM, Hui Zhang <wayne.huizhang at gmail.com>
wrote:

> Hello,
>
> 1. Can anyone share a bit experience of using DIBuilder class to add debug
> information to a certain language ?
>

Probably - though a great source is the Clang frontend (just see how it
uses the various APIs) and http://llvm.org/docs/SourceLevelDebugging.html
which does describe subscripts in at least a little detail.


>
> 2. Specifically, what does the "Subscripts" mean in the attributes of the
> function and what I need to supply for that in order to use this function:
>
>  DICompositeType <http://llvm.org/docs/doxygen/html/classllvm_1_1DICompositeType.html> DIBuilder::createArrayType <http://llvm.org/docs/doxygen/html/classllvm_1_1DIBuilder.html#a06b1c961b2ad918925e36e95415845b1>(uint64_t Size, uint64_t AlignInBits, DIType <http://llvm.org/docs/doxygen/html/classllvm_1_1DIType.html> Ty, DIArray <http://llvm.org/docs/doxygen/html/classllvm_1_1DITypedArray.html> Subscripts)
>
>
To quote the above docs:

The members of array types (tag = DW_TAG_array_type) are *subrange
descriptors*
<http://llvm.org/docs/SourceLevelDebugging.html#format-subrange>, each
representing the range of subscripts at that level of indexing.

(so that tells you the "Subscripts" DIArray in "createArrayType" should be
subrange descriptors, which are...)

[...] descriptors [that] are used to define ranges of array subscripts for
an array *composite type*
<http://llvm.org/docs/SourceLevelDebugging.html#format-composite-type>. The
low value defines the lower bounds typically zero for C/C++. The high value
is the upper bounds. Values are 64 bit. High - Low + 1 is the size of the
array. If Low > High the array bounds are not included in generated
debugging information.


>
> ​I don't find any explanation on that and I'm trying to add debug info for
> an array type....
> thanks !​
>
> --
> Best regards
>
>
> Hui Zhang
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141124/b20cee3b/attachment.html>


More information about the llvm-dev mailing list