[LLVMdev] DW_TAG_lexical_block structure in debug information
Devang Patel
dpatel at apple.com
Tue Mar 8 08:30:12 PST 2011
On Mar 7, 2011, at 4:16 AM, Eli Bendersky wrote:
> Hello,
>
> The documentation for debug information
> (http://llvm.org/docs/SourceLevelDebugging.html) says the structure of
> block descriptors metadata is:
>
> !3 = metadata !{
> i32, ;; Tag = 11 + LLVMDebugVersion (DW_TAG_lexical_block)
> metadata,;; Reference to context descriptor
> i32, ;; Line number
> i32 ;; Column number
> }
>
> However, looking at the generated metadata, there are 2 extra fields
> not documented here. From the source code it appears to be a link to
> the function holding the block, and a unique integer ID:
>
> DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
> unsigned Line, unsigned Col) {
> // Defeat MDNode uniqing for lexical blocks by using unique id.
> static unsigned int unique_id = 0;
> Value *Elts[] = {
> GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block),
> Scope,
> ConstantInt::get(Type::getInt32Ty(VMContext), Line),
> ConstantInt::get(Type::getInt32Ty(VMContext), Col),
> File,
> ConstantInt::get(Type::getInt32Ty(VMContext), unique_id++)
> };
> return DILexicalBlock(MDNode::get(VMContext, &Elts[0], array_lengthof(Elts)));
> }
>
> Is this an error in the documentation?
>
These two fields were added to support scopes inside template functions (r107919).
I updated the docs today in r127249.
Thanks!
-
Devang
More information about the llvm-dev
mailing list