[llvm-dev] DWARF gotchas moving from 3.7.1 to 3.9.0

David Jones via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 18 09:32:19 PST 2016


That was it, thanks.

BTW, I'm likely to be filing a couple of bugs against the Debug Info
Verifier. Once I added setSubprogram() in, I got asserts from the verifier
for other issues. Once I cleaned those up, I got an assert from the DWARF
generator that I traced back to a trivial issue that the verifier could
have caught. So:

- The verifier fails to flag the absence of a DISubprogram metadata on a
function, even when the DISubprogram metadata is present in the module, and
reachable by other means.
- The verifier fails to flag a DIArray instance whose element type was NULL.


On Fri, Nov 18, 2016 at 11:50 AM, Adrian Prantl <aprantl at apple.com> wrote:

> Are you perhaps not calling
>
>  void Function::setSubprogram (DISubprogram * SP)
>
> http://llvm.org/doxygen/classllvm_1_1Function.html#
> a05a19abc8ee11d5909275d980efa1670
> ?
>
> -- adrian
>
> > On Nov 18, 2016, at 8:46 AM, David Blaikie <dblaikie at gmail.com> wrote:
> >
> > (+Adrian who might have some more context here)
> >
> > Generally I'd suggest looking at Clang's code to see how it's
> constructing the correct IR - I'm not aware of any particular changes in
> the timeline after we switched the subprogram edges (which it looks like we
> had already done in 3.7, judging by the IR  you quoted)... don't have great
> guesses here.
> >
> > On Thu, Nov 17, 2016 at 6:46 PM David Jones via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> > I recently upgraded a codebase to use LLVM 3.9.0, up from 3.7.1.
> >
> > All seems to work well, except that I am unable to generate debug
> information.
> >
> > However, if I run objdump -g on the generated object file, it reports
> that the compile unit has no children:
> >
> > Contents of the .debug_abbrev section:
> >
> >   Number TAG (0x0)
> >    1      DW_TAG_compile_unit    [no children]
> >     DW_AT_producer     DW_FORM_strp
> >     DW_AT_language     DW_FORM_data2
> >     DW_AT_name         DW_FORM_strp
> >     DW_AT_stmt_list    DW_FORM_sec_offset
> >     DW_AT value: 0     DW_FORM value: 0
> >
> > The IR generated for 3.9.0 passes the IR verifier without complaint
> (including the debug into verifier). I can run llc manually on my IR
> without complaint. However, I am not able to ascertain whether llc runs the
> debug info verifier by default.
> >
> > One of the changes I had to make to get my code to compile was to remove
> the function argument (of Function* type) from the call to
> DIBuilder::createFunction(). This appears to be my problem, as my functions
> do not appear to have debug info:
> >
> > From my 3.7.1 code:
> >
> > define void @func(%artype*) #4 !dbg !5 {
> > !5 = distinct !DISubprogram(n...)
> >
> > From 3.9.0:
> >
> > define void @func(%artype*) #4 {
> >
> > What must I do to attach the DISubprogram metadata node to my Function,
> assuming this is the problem?
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161118/a0874168/attachment.html>


More information about the llvm-dev mailing list