<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 23, 2014 at 11:20 AM, Hui Zhang <span dir="ltr"><<a href="mailto:wayne.huizhang@gmail.com" target="_blank">wayne.huizhang@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:georgia,serif;font-size:large">Hello, </div><div style="font-family:georgia,serif;font-size:large"><br></div><div style="font-family:georgia,serif;font-size:large">1. Can anyone share a bit experience of using DIBuilder class to add debug information to a certain language ?</div></div></blockquote><div><br>Probably - though a great source is the Clang frontend (just see how it uses the various APIs) and <a href="http://llvm.org/docs/SourceLevelDebugging.html">http://llvm.org/docs/SourceLevelDebugging.html</a> which does describe subscripts in at least a little detail.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:georgia,serif;font-size:large"><br></div><div style="font-family:georgia,serif;font-size:large">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: </div><div style="font-family:georgia,serif;font-size:large"><pre style="font-family:Fixed,monospace;font-size:13px;border:1px solid rgb(204,204,204);margin:4px 8px 4px 2px;padding:4px 6px;color:rgb(0,0,0);background-color:rgb(245,245,245)"> <a href="http://llvm.org/docs/doxygen/html/classllvm_1_1DICompositeType.html" title="Types that refer to multiple other types." style="color:rgb(0,0,255);text-decoration:none" target="_blank">DICompositeType</a> <a href="http://llvm.org/docs/doxygen/html/classllvm_1_1DIBuilder.html#a06b1c961b2ad918925e36e95415845b1" style="color:rgb(0,0,255);text-decoration:none" target="_blank">DIBuilder::createArrayType</a>(uint64_t Size, uint64_t AlignInBits, <a href="http://llvm.org/docs/doxygen/html/classllvm_1_1DIType.html" style="color:rgb(0,0,255);text-decoration:none" target="_blank">DIType</a> Ty, <a href="http://llvm.org/docs/doxygen/html/classllvm_1_1DITypedArray.html" title="This descriptor holds an array of nodes with type T." style="color:rgb(0,0,255);text-decoration:none" target="_blank">DIArray</a> Subscripts) </pre></div></div></blockquote><div><br>To quote the above docs:<br><br><span style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px">The members of array types (tag = </span><tt class="" style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em;color:rgb(0,0,0);line-height:21px"><span class="">DW_TAG_array_type</span></tt><span style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px">) are </span><a class="" href="http://llvm.org/docs/SourceLevelDebugging.html#format-subrange" style="color:rgb(202,121,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"><em>subrange descriptors</em></a><span style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px">, each representing the range of subscripts at that level of indexing.<br></span><br>(so that tells you the "Subscripts" DIArray in "createArrayType" should be subrange descriptors, which are...)<br><br><span style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px">[...] descriptors [that] are used to define ranges of array subscripts for an array </span><a class="" href="http://llvm.org/docs/SourceLevelDebugging.html#format-composite-type" style="color:rgb(202,121,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"><em>composite type</em></a><span style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px">. The low value defines the lower bounds typically zero for C/C++. The high value is the upper bounds. Values are 64 bit. </span><tt class="" style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em;color:rgb(0,0,0);line-height:21px"><span class="">High</span> <span class="">-</span> <span class="">Low</span> <span class="">+</span> <span class="">1</span></tt><span style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"> is the size of the array. If </span><tt class="" style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em;color:rgb(0,0,0);line-height:21px"><span class="">Low</span> <span class="">></span> <span class="">High</span></tt><span style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"> the array bounds are not included in generated debugging information.</span><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div><div style="font-family:georgia,serif;font-size:large">​I don't find any explanation on that and I'm trying to add debug info for an array type....</div><div style="font-family:georgia,serif;font-size:large">thanks !​</div><span class=""><font color="#888888"><br></font></span></div><span class=""><font color="#888888">-- <br><div>Best regards<br><br><br>Hui Zhang<br></div>
</font></span></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div></div>